<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6101788</id><updated>2011-04-22T05:38:59.835+01:00</updated><title type='text'>hello world</title><subtitle type='html'>j2ee related snippets</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://analogueboy.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://analogueboy.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>graham</name><uri>http://www.blogger.com/profile/16125820926169399605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6101788.post-107964345455806643</id><published>2004-03-18T20:57:00.000Z</published><updated>2004-07-29T21:18:50.006+01:00</updated><title type='text'>Moving home</title><content type='html'>I'm now working for &lt;a href="http://www.ellisonbrookes.com"&gt;Ellison Brookes&lt;/a&gt;&lt;br /&gt; &lt;br /&gt; After a pleasant few months here on blogspot I'm moving to &lt;a href="http://www.jroller.com/page/grahamoregan/"&gt;JRoller&lt;/a&gt; so I won't be publishing any more content here. I'll leave this page in place, hopefully it will still be of some use to some people.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6101788-107964345455806643?l=analogueboy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default/107964345455806643'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default/107964345455806643'/><link rel='alternate' type='text/html' href='http://analogueboy.blogspot.com/index.html#107964345455806643' title='Moving home'/><author><name>graham</name><uri>http://www.blogger.com/profile/16125820926169399605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-6101788.post-107762007510199546</id><published>2004-02-24T10:54:00.000Z</published><updated>2004-02-24T11:00:18.623Z</updated><title type='text'>Aspectwerkz and Jamon</title><content type='html'>Here is an the same example using Aspectwerkz instead of DynAOP&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import com.jamonapi.Monitor;&lt;br /&gt;import com.jamonapi.MonitorFactory;&lt;br /&gt;import org.codehaus.aspectwerkz.advice.AroundAdvice;&lt;br /&gt;import org.codehaus.aspectwerkz.joinpoint.JoinPoint;&lt;br /&gt;import org.codehaus.aspectwerkz.joinpoint.MethodJoinPoint;&lt;br /&gt;public class TraceAdvice extends AroundAdvice {&lt;br /&gt;    public TraceAdvice() {&lt;br /&gt;        super();&lt;br /&gt;    }&lt;br /&gt;    public Object execute(final JoinPoint joinPoint) throws Throwable {&lt;br /&gt;        MethodJoinPoint jp = (MethodJoinPoint) joinPoint;&lt;br /&gt;        StringBuffer buffer = new StringBuffer();&lt;br /&gt;        buffer.append(jp.getMethod().getDeclaringClass().getName());&lt;br /&gt;        buffer.append(".");&lt;br /&gt;        buffer.append(jp.getMethod().getName());&lt;br /&gt;        Monitor mon = MonitorFactory.start(buffer.toString());&lt;br /&gt;        Object result = joinPoint.proceed();&lt;br /&gt;        mon.stop();&lt;br /&gt;        System.out.println(mon.toString());&lt;br /&gt;        return result;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;And the aspectwerkz.xml&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;!DOCTYPE aspectwerkz PUBLIC "-//AspectWerkz//DTD 0.8//EN" "http://aspectwerkz.codehaus.org/dtd/aspectwerkz_0_8.dtd"&amp;gt;&lt;br /&gt;&amp;lt;aspectwerkz id="samples"&amp;gt;&lt;br /&gt;	&amp;lt;advice-def name="trace" class="TraceAdvice" deployment-model="perJVM"/&amp;gt;&lt;br /&gt;	&amp;lt;aspect name="jamon"&amp;gt;&lt;br /&gt;		&amp;lt;pointcut-def name="all" type="method" pattern="* mypackage.MyClass.setName(..)"/&amp;gt;&lt;br /&gt;		&amp;lt;bind-advice pointcut="all"&amp;gt;&lt;br /&gt;			&amp;lt;advice-ref name="trace"/&amp;gt;&lt;br /&gt;		&amp;lt;/bind-advice&amp;gt;&lt;br /&gt;	&amp;lt;/aspect&amp;gt;&lt;br /&gt;&amp;lt;/aspectwerkz&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note that this is for XML definitions using Aspectwerkz 0.8, to port to 0.9 then move around advice to the org.codehaus.aspectwerkz.xml.advice package.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6101788-107762007510199546?l=analogueboy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default/107762007510199546'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default/107762007510199546'/><link rel='alternate' type='text/html' href='http://analogueboy.blogspot.com/index.html#107762007510199546' title='Aspectwerkz and Jamon'/><author><name>graham</name><uri>http://www.blogger.com/profile/16125820926169399605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-6101788.post-107670462719778365</id><published>2004-02-13T20:37:00.000Z</published><updated>2004-02-13T20:47:51.903Z</updated><title type='text'>DynAOP &amp; Jamon</title><content type='html'>Heres a more interesting example of using AOP to monitor an application. This Interceptor will start monitoring before the method is called and stop straight after and log the results. &lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import com.jamonapi.Monitor;&lt;br /&gt;import com.jamonapi.MonitorFactory;&lt;br /&gt;import dynaop.Interceptor;&lt;br /&gt;import dynaop.Invocation;&lt;br /&gt;public class TraceInterceptor implements Interceptor {&lt;br /&gt;    public Object intercept(Invocation invocation) throws Throwable {&lt;br /&gt;        StringBuffer buffer = new StringBuffer();&lt;br /&gt;        buffer.append(invocation.getMethod().getDeclaringClass().getName());&lt;br /&gt;        buffer.append(".");&lt;br /&gt;        buffer.append(invocation.getMethod().getName());&lt;br /&gt;        // Start the monitor&lt;br /&gt;        Monitor mon = MonitorFactory.start(buffer.toString());&lt;br /&gt;        // Invoke the method&lt;br /&gt;        Object result = invocation.proceed();&lt;br /&gt;        // Stop the monitor&lt;br /&gt;        mon.stop();&lt;br /&gt;        // Print results to stdout&lt;br /&gt;        System.out.println(mon.toString());&lt;br /&gt;        return result;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now register the Interceptor in the &lt;code&gt;dynaop.bsh&lt;/code&gt; file&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;interceptor(&lt;br /&gt;	mypackage.MyClass.class,&lt;br /&gt;	signature("setName"),&lt;br /&gt;	new TraceInterceptor()&lt;br /&gt;);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You can find out more about Jamon here &lt;a href="http://www.javaperformancetuning.com/tools/jamon/index.shtml"&gt;http://www.javaperformancetuning.com/tools/jamon/index.shtml&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6101788-107670462719778365?l=analogueboy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default/107670462719778365'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default/107670462719778365'/><link rel='alternate' type='text/html' href='http://analogueboy.blogspot.com/index.html#107670462719778365' title='DynAOP &amp; Jamon'/><author><name>graham</name><uri>http://www.blogger.com/profile/16125820926169399605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-6101788.post-107669796229118025</id><published>2004-02-13T18:46:00.000Z</published><updated>2004-02-15T15:53:26.996Z</updated><title type='text'>DynAOP - NKOTB</title><content type='html'>I've been looking at Bob Lee's excellent new DynAOP framework over the past couple of days and I've got to say, it can't get much simpler than this. Whilst it may not have same power as Aspectwerkz (AW) (AW in online mode is an incredibly useful tool), it makes it so simple to start using AOP in your applications with very little effort.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Another strong aspect of the AW is the list of very simple examples that Jonas and Alex provide which highlight the features that they are describing and nothing else. Bob's examples contain a little bit too much code which distracted me from the meat of framework. I've posted some samples here that people might find a little easier to digest.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here is the interface we are going to use&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package mypackage;&lt;br /&gt;public interface MyClass {&lt;br /&gt;    public void setName(String name);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt; and here is the implementation&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package mypackage;&lt;br /&gt;public class MyClassImpl implements MyClass {&lt;br /&gt;    private String name;&lt;br /&gt;    public MyClassImpl() {&lt;br /&gt;    }&lt;br /&gt;    public String getName() {&lt;br /&gt;        return name;&lt;br /&gt;    }&lt;br /&gt;    public void setName(String string) {&lt;br /&gt;    	System.out.println("Inside MyClassImpl.setName()");&lt;br /&gt;        name = string;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here is the dynaop.bsh configuration file (hurrah, no XML :-))&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;mixin(&lt;br /&gt;	mypackage.MyClass.class,&lt;br /&gt;	MixinImpl.class&lt;br /&gt;);&lt;br /&gt;interceptor(&lt;br /&gt;	mypackage.MyClass.class,&lt;br /&gt;	signature("setName"),&lt;br /&gt;	new LoggingInterceptor()&lt;br /&gt;);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This is the mixin interface&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public interface Mixin {&lt;br /&gt;    public String getMessage();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;and heres the mixin implementation&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import dynaop.Proxy;&lt;br /&gt;import dynaop.ProxyAware;&lt;br /&gt;public class MixinImpl implements Mixin, ProxyAware {&lt;br /&gt;    public String getMessage() {&lt;br /&gt;        return "Hello World";&lt;br /&gt;    }&lt;br /&gt;    // this is called by dynaop.&lt;br /&gt;   public void setProxy(Proxy proxy) {&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt; heres the LoggingInterceptor class&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import dynaop.Interceptor;&lt;br /&gt;import dynaop.Invocation;&lt;br /&gt;public class LoggingInterceptor implements Interceptor {&lt;br /&gt;    public Object intercept(Invocation invocation) throws Throwable {&lt;br /&gt;        System.out.println("This is from the logging interceptor : before");&lt;br /&gt;        Object result = invocation.proceed();&lt;br /&gt;        System.out.println("This is from the logging interceptor : after");&lt;br /&gt;        return result;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now lets create a class that shows the LogginInterceptor in action&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import mypackage.MyClass;&lt;br /&gt;import dynaop.ProxyFactory;&lt;br /&gt;public class InterceptorExample {&lt;br /&gt;    public static void main(String[] args) {&lt;br /&gt;        MyClass myClass = (MyClass) ProxyFactory.getInstance().extend(mypackage.MyClassImpl.class);&lt;br /&gt;	// An interceptor has been registered in the dynaop.bsh file for this method&lt;br /&gt;        myClass.setName("graham");&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;When you run this class you will see the following printed to stdout&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;This is from the logging interceptor : before&lt;br /&gt;Inside MyClassImpl.setName()&lt;br /&gt;This is from the logging interceptor : after&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now lets look at an example of our mixin in action. &lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import mypackage.MyClass;&lt;br /&gt;import dynaop.ProxyFactory;&lt;br /&gt;public class MixinExample {&lt;br /&gt;    public static void main(String[] args) {&lt;br /&gt;        MyClass myClass = (MyClass) ProxyFactory.getInstance().extend(mypackage.MyClassImpl.class);&lt;br /&gt;        System.out.println(((Mixin) myClass).getMessage());&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;When you run this example you'll see the flollowing printed to stdout&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Hello World&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Simple. The &lt;code&gt;getMethod()&lt;/code&gt; method has been mixed-in to the MyClass interface and called by the executing thread. Heres a link to this project including an ANT build script (just type 'ant' and the application will compile and run) and Eclipse projects files so you can import it and have a look &lt;a href="http://www.mycgiserver.com/~grahamoregan/dynaop_example.zip"&gt;http://www.mycgiserver.com/~grahamoregan/dynaop_example.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Hopefully you'll find this little easier to play with so you can start to benefit from DynAOP as soon as possible. &lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6101788-107669796229118025?l=analogueboy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default/107669796229118025'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default/107669796229118025'/><link rel='alternate' type='text/html' href='http://analogueboy.blogspot.com/index.html#107669796229118025' title='DynAOP - NKOTB'/><author><name>graham</name><uri>http://www.blogger.com/profile/16125820926169399605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-6101788.post-107109086316007557</id><published>2003-12-10T21:14:00.000Z</published><updated>2003-12-10T21:15:54.590Z</updated><title type='text'>Beanshell</title><content type='html'>&lt;p&gt;&lt;br /&gt;In the latest version of &lt;a href="http://www.beanshell.org"&gt;Beanshell&lt;/a&gt;, developers can now use existing Java classes in a dynamic environment. Heres an example of a Java class called TestScript being called by a class called TestBS.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;TestScript.java&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import java.util.Date;&lt;br /&gt;public class TestScript {&lt;br /&gt;	public String getVersion(Date date) {&lt;br /&gt;	 String ver = "Hello World";&lt;br /&gt;	 return "BeanShell version: " + ver +" "+ date.getTime();&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;TestBS&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import java.io.FileInputStream;&lt;br /&gt;import java.io.FileNotFoundException;&lt;br /&gt;import java.io.InputStreamReader;&lt;br /&gt;import java.util.Date;&lt;br /&gt;import bsh.EvalError;&lt;br /&gt;import bsh.Interpreter;&lt;br /&gt;&lt;br /&gt;public class TestBS {&lt;br /&gt;    public static void main(String[] args) {&lt;br /&gt;        Interpreter interpreter = new Interpreter();&lt;br /&gt;        try {&lt;br /&gt;            interpreter.eval(new InputStreamReader(new FileInputStream("C:/src/bs/src/TestScript.java")));&lt;br /&gt;            Date d = new Date();&lt;br /&gt;            interpreter.set("date", d);&lt;br /&gt;            interpreter.eval("TestScript script = new TestScript()");&lt;br /&gt;            System.out.println((String) interpreter.eval("script.getVersion(date)"));&lt;br /&gt;            System.exit(0);&lt;br /&gt;        } catch (FileNotFoundException e) {&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;        } catch (EvalError e) {&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;This is a pretty complete example as it shows how to call an existing class, pass parameters to it and accept returned values. Now imagine calling dynamic classes from servlets/struts actions, you wouldn't have to recompile your code and restart your server, just edit the dynamic file and view the page again. Best of all, because the dynamic classes are proper Java files, you still benefit from being able to use your existing development/debugging tools.&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6101788-107109086316007557?l=analogueboy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default/107109086316007557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default/107109086316007557'/><link rel='alternate' type='text/html' href='http://analogueboy.blogspot.com/index.html#107109086316007557' title='Beanshell'/><author><name>graham</name><uri>http://www.blogger.com/profile/16125820926169399605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-6101788.post-106961662131486614</id><published>2003-11-23T19:43:00.000Z</published><updated>2003-11-24T09:20:05.633Z</updated><title type='text'>Jakarta James FetchPOP</title><content type='html'>As the battle between Apache's Jakarta group and JBoss heats up, it seems that mail servers are the next target. Whilst JBoss are clearly ahead of Apache in terms of application servers, Apache have offered James, their mail server for several years now. However, the JBoss group seems to be developing a M$-based approach and devouring existing products to bolster their own product line. Eric Daugherty, who developed one of the leading Java mail servers &lt;a href="http://www.ericdaugherty.com/java/mailserver/index.html"&gt;JES (Java Email Server)&lt;/a&gt; is currently working with JBoss on their offering, but a full release still seems to be some time away.&lt;br /&gt;&lt;br /&gt;In the mean time, I have been looking at James to solve some of the problems that I have being having with Spam. I wanted to set up a mail server that will poll my existing email accounts, remove spam and virii, and consolidate the results into a single POP3 account that I can use. At this stage, the Spam filtering is in place, but I'm investigating how to integrate ClamAV too to complete the solution.&lt;br /&gt;&lt;br /&gt;Most aspects of James are quite mature at this stage, but one of the central componets that I required, FetchPOP, still suffers from a lack of clear documentation. Hopefully this blog can serve as a guide to people starting off on a similar quest.&lt;br /&gt;&lt;br /&gt;Firstly, you will have a to acquire and unpack a copy of &lt;a href="http://james.apache.org"&gt;James&lt;/a&gt;, and create a user to test with. This aspect of James is well documented so I won't repeat the procedure. To collect all the mail from an existing account, try this&lt;br /&gt;&lt;br /&gt;1. Open ${JAMES_HOME}/apps/james/SAR-INF/config.xml for edit and look for the FetchPOP section.&lt;br /&gt;2. By default FetchPOP will be disabled, change &lt;code&gt;&amp;lt;fetchpop enabled="false"&amp;gt;&lt;/code&gt; to &lt;code&gt;&amp;lt;fetchpop enabled="true"&amp;gt;&lt;/code&gt; to enable it.&lt;br /&gt;3.  Create an new "fetch" entry in the FetchPOP section like this&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;     &amp;lt;fetchpop enabled="true"&amp;gt;&lt;br /&gt;        &amp;lt;fetch name="account_name"&amp;gt;&lt;br /&gt;            &amp;lt;host&amp;gt;pop3.myisp.com&amp;lt;/host&amp;gt;&lt;br /&gt;            &amp;lt;user&amp;gt;username&amp;lt;/user&gt;&lt;br /&gt;            &amp;lt;password&amp;gt;password&amp;lt;/password&amp;gt;&lt;br /&gt;            &amp;lt;interval&amp;gt;600000&amp;lt;/interval&amp;gt;&lt;br /&gt;        &amp;lt;/fetch&amp;gt;&lt;br /&gt;    &amp;lt;/fetchpop&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;4. Now you have to tell the root processor what to do with messages from this account. Add this to the root processor's config section&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; &amp;lt;mailet match="FetchedFrom=account_name" class="ToProcessor"&amp;gt;&lt;br /&gt;	&amp;lt;processor&amp;gt;fetchprocessor&amp;lt;/processor&amp;gt;&lt;br /&gt;&amp;lt;/mailet&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This tells the root procesor to forward messages from account_name to another processor called "fetchprocessor".&lt;br /&gt;5. Create a new process to deal with this messages&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;processor name="fetchprocessor"&amp;gt;&lt;br /&gt;	&amp;lt;mailet match="RecipientIs=me@isp.com" class="Forward"&amp;gt;&lt;br /&gt;		&amp;lt;forwardto&gt;me@localhost&amp;lt;/forwardto&amp;gt;&lt;br /&gt;	&amp;lt;/mailet&amp;gt;&lt;br /&gt;&amp;lt;/processor&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This processor tries to match the email address of the account  that the message has been fetched from and will then forward it to the specified,local account.&lt;br /&gt;&lt;br /&gt;Simple as that, you can add as many accounts as you want to the FetchPOP section, and James will try to filter the accounts for Spam. Next on the list? AV.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6101788-106961662131486614?l=analogueboy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default/106961662131486614'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default/106961662131486614'/><link rel='alternate' type='text/html' href='http://analogueboy.blogspot.com/index.html#106961662131486614' title='Jakarta James FetchPOP'/><author><name>graham</name><uri>http://www.blogger.com/profile/16125820926169399605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-6101788.post-106961301580443460</id><published>2003-11-23T18:43:00.000Z</published><updated>2003-12-23T11:23:17.090Z</updated><title type='text'>Aspectwerkz</title><content type='html'>Here is simple example of using &lt;a href="http://aspectwerkx.codehaus.org"&gt;Aspectwerkz&lt;/a&gt; to apply AOP to your code. I have downloaded and unpacked the Aspectwerkz (AW) code to c:\java\aspectwerkz. Note that this example is very similar to the example code on the AW site and Jonas' blog, I hope this doesn't upset anyone too much.&lt;br /&gt;&lt;br /&gt;1.  Create a simple bean to test with, here a very simple example POJO&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package aspectz;&lt;br /&gt;&lt;br /&gt;public class TestBean {&lt;br /&gt;	&lt;br /&gt;	private String name;&lt;br /&gt;&lt;br /&gt;	public TestBean() {&lt;br /&gt;		&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	public String getName() {&lt;br /&gt;		return name;&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	public void setName(String string) {&lt;br /&gt;		name = string;&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;2. Next, we need a class with a main() method to create an object of our bean class&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package aspectz;&lt;br /&gt;&lt;br /&gt;public class Runner {&lt;br /&gt;&lt;br /&gt;	public static void main(String[] args) {&lt;br /&gt;		&lt;br /&gt;		TestBean bean = new TestBean();&lt;br /&gt;		&lt;br /&gt;		bean.setName("te5t");&lt;br /&gt;		&lt;br /&gt;		System.out.println(bean.getName());&lt;br /&gt;	}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;3. Now we need to create the apectwerkz.xml file that is used to declare our aspects/pointcuts etc.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;!DOCTYPE aspectwerkz PUBLIC "-//AspectWerkz//DTD 0.8//EN" "http://aspectwerkz.codehaus.org/dtd/aspectwerkz_0_8.dtd"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;aspectwerkz id="samples"&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;advice-def name="log" class="aspectz.LoggingAdvice" deployment-model="perJVM"/&amp;gt;&lt;br /&gt;	&lt;br /&gt;    &amp;lt;aspect name="test"&amp;gt;&lt;br /&gt;&lt;br /&gt;        &amp;lt;pointcut-def name="all" type="method" pattern="* aspectz..*+.*(..)"/&amp;gt;&lt;br /&gt; &lt;br /&gt;        &amp;lt;bind-advice pointcut="all"&amp;gt;&lt;br /&gt;&lt;br /&gt;            &amp;lt;advice-ref name="log"/&amp;gt;&lt;br /&gt;&lt;br /&gt;        &amp;lt;/bind-advice&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;/aspect&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/aspectwerkz&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;4.  We now need to create our advice&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;package aspectz;&lt;br /&gt;&lt;br /&gt;import org.codehaus.aspectwerkz.advice.AroundAdvice;&lt;br /&gt;import org.codehaus.aspectwerkz.joinpoint.JoinPoint;&lt;br /&gt;import org.codehaus.aspectwerkz.joinpoint.MethodJoinPoint;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class LoggingAdvice extends AroundAdvice {&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;    public LoggingAdvice() {&lt;br /&gt;        super();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public Object execute(final JoinPoint joinPoint) throws Throwable {&lt;br /&gt;&lt;br /&gt;	MethodJoinPoint jp = (MethodJoinPoint) joinPoint;&lt;br /&gt;        &lt;br /&gt;        System.out.println("execute() called by "+ jp.getMethodName());&lt;br /&gt;&lt;br /&gt;        return joinPoint.proceed();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;   &lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;5. Now all we need to do is run the example. AW expects that you have defined JAVA_HOME and ASPECTWERKZ_HOME before running. Now you can run the example by typing c:\java\aspectwerkz-0.8.1\bin\aspectwerkz -Daspectwerkz.definition.file=C:\src\test\aspectwerkz.xml aspectz.Runner (Obviously your path names would/could be different. When you run this you will see the output of the AW wrapper and then the output of the program which will resemble something like this&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;execute() called by main&lt;br /&gt;execute() called by setName&lt;br /&gt;execute() called by getName&lt;br /&gt;te5t&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6101788-106961301580443460?l=analogueboy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://aspectwerkx.codehaus.org' title='Aspectwerkz'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default/106961301580443460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default/106961301580443460'/><link rel='alternate' type='text/html' href='http://analogueboy.blogspot.com/index.html#106961301580443460' title='Aspectwerkz'/><author><name>graham</name><uri>http://www.blogger.com/profile/16125820926169399605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-6101788.post-106959689637832829</id><published>2003-11-23T14:14:00.000Z</published><updated>2003-11-23T18:53:47.626Z</updated><title type='text'>PHP and Tomcat - Perfect bed-fellows?</title><content type='html'>After installing Perl on Tomcat, I started getting a bit carried away so I had a quick look around to see if PHP had been integrated too.  It turns out that a servlet wrapper is part of the core download of PHP, and with after a few minutes tinkering, I had it up and running too. These guildelines are for the windows version, but seeing as the PHP setup is well documented, you shouldn't hvae much trouble getting it set up. The only changes that I had t o make were to reflect the refactoring in Tomcat 4.1.&lt;br /&gt;&lt;br /&gt;1. setup Tomcat - look at the docs at http://jakarta.apache.org, I'll refer to location where Tomcat is installed as %TOMCAT_HOME%&lt;br /&gt;2. Download PHP, I'll refer to the location where you install it to as %PHP_HOME% &lt;br /&gt;3. Add %PHP_Home%\ and %PHP_Home%\sapi to your %PATH% environment variable&lt;br /&gt;4. Add the following to the %TOMCAT_HOME%\conf\web.xml&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;servlet&amp;gt;&lt;br /&gt;		&amp;lt;servlet-name&amp;gt;php&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;		&amp;lt;servlet-class&amp;gt;net.php.servlet&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;	&amp;lt;/servlet&amp;gt;&lt;br /&gt;&lt;br /&gt;	&amp;lt;servlet&amp;gt;&lt;br /&gt;		&amp;lt;servlet-name&amp;gt;php-formatter&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;		&amp;lt;servlet-class&amp;gt;net.php.formatter&amp;lt;/servlet-class&amp;gt;&lt;br /&gt;	&amp;lt;/servlet&amp;gt;&lt;br /&gt;&lt;br /&gt;	&amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;		&amp;lt;servlet-name&amp;gt;php&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;		&amp;lt;url-pattern&amp;gt;*.php&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;	&amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;&lt;br /&gt;	&amp;lt;servlet-mapping&amp;gt;&lt;br /&gt;		&amp;lt;servlet-name&amp;gt;php-formatter&amp;lt;/servlet-name&amp;gt;&lt;br /&gt;		&amp;lt;url-pattern&amp;gt;*.phps&amp;lt;/url-pattern&amp;gt;&lt;br /&gt;	&amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;5. Add phpsrvlt.jar to %TOMCAT_HOME%\common\lib&lt;br /&gt;&lt;br /&gt;6. Uncomment the following line in your php.ini (you can copy php.ini-dist and rename to php.ini)  &lt;code&gt;;extension=php_java.dll&lt;/code&gt; so it becomes &lt;code&gt;extension=php_java.dll&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;7. Change the lines in the [Java] setion of php.ini to reflect your environment&lt;br /&gt;&lt;br /&gt;Now create a test php file and add the following to it&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;?php phpinfo(); ?&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now try and view the file in a browser and you should see a page listing all the info of the php environment.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6101788-106959689637832829?l=analogueboy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default/106959689637832829'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default/106959689637832829'/><link rel='alternate' type='text/html' href='http://analogueboy.blogspot.com/index.html#106959689637832829' title='PHP and Tomcat - Perfect bed-fellows?'/><author><name>graham</name><uri>http://www.blogger.com/profile/16125820926169399605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-6101788.post-106958773082488724</id><published>2003-11-23T11:42:00.000Z</published><updated>2003-11-23T18:54:25.436Z</updated><title type='text'>Running Perl CGI's on Tomcat</title><content type='html'>This is essentially a rehash of a Java Pro article, I've just included it here in case the original article disappears. Here is a link to the original&lt;br /&gt;&lt;br /&gt;http://www.fawcette.com/javapro/2003_03/online/perl_teden_03_18_03/&lt;br /&gt;&lt;br /&gt;In short, Tomcat has a cgi servlet, to enable it rename the ${TOMCAT_HOME}/server/lib/servlets-cgi.renametojar to ${TOMCAT_HOME}/server/lib/servlets-cgi.jar and the same with the SSI jar (not sure if this is really required - didn't test). Then uncomment the mapping for the servlet so cgi-bin is mapped to the cgi servlet. You'll also have to create a WEB-INF/cgi folder in your web application ti hold the perl scripts.&lt;br /&gt;&lt;br /&gt;When you have this set up, copy this script into the folder and view it in your browser (http://localhost:8080/${app_name}/cgi-bin/test.cgi for example)&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#!C:\cygwin\bin\perl.exe&lt;br /&gt;print "Hello World!";&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You'll have to change the value after #! to be the correct location, but then, if you're reading an article on enabling Perl CGI you'll know that already ;-)&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6101788-106958773082488724?l=analogueboy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default/106958773082488724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default/106958773082488724'/><link rel='alternate' type='text/html' href='http://analogueboy.blogspot.com/index.html#106958773082488724' title='Running Perl CGI&apos;s on Tomcat'/><author><name>graham</name><uri>http://www.blogger.com/profile/16125820926169399605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-6101788.post-106926189508775721</id><published>2003-11-19T17:11:00.000Z</published><updated>2003-11-23T18:56:45.170Z</updated><title type='text'>Load balanced workers2.properties</title><content type='html'>Here is a sample workers2.properties for load balancing between two jboss instances with Apache using mod_jk2. The example on the Apache site doesn't seemed to include load balancing...&lt;br /&gt;&lt;br /&gt;[logger.apache2]&lt;br /&gt;level=ERROR&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[shm]&lt;br /&gt;file=/opt/apache/logs/shm.file&lt;br /&gt;size=8388608&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[lb:jboss]&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# Example socket channel, override port and host.&lt;br /&gt;[channel.socket:channel1]&lt;br /&gt;port=8009&lt;br /&gt;host=192.168.0.1&lt;br /&gt;&lt;br /&gt;#Example socket channel, override port and host.&lt;br /&gt;[channel.socket:channel2]&lt;br /&gt;port=8009&lt;br /&gt;host=192.168.0.2&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# define the worker&lt;br /&gt;[ajp13:channel1]&lt;br /&gt;group=jboss&lt;br /&gt;lbfactor=1&lt;br /&gt;tomcatId=server1:8009&lt;br /&gt;&lt;br /&gt;# define the worker&lt;br /&gt;[ajp13:channel2]&lt;br /&gt;group=jboss&lt;br /&gt;lbfactor=1&lt;br /&gt;tomcatId=server2:8009&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6101788-106926189508775721?l=analogueboy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default/106926189508775721'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6101788/posts/default/106926189508775721'/><link rel='alternate' type='text/html' href='http://analogueboy.blogspot.com/index.html#106926189508775721' title='Load balanced workers2.properties'/><author><name>graham</name><uri>http://www.blogger.com/profile/16125820926169399605</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry></feed>
