Hi,Sreeni,
You hope me to make a proposal for GlassFish ?
Chris Liao
----- Original Message -----
From: Sreenivas Munnangi
To: obframework_at_21cn.com
Cc: dev_at_glassfish.dev.java.net
Sent: Saturday, August 04, 2007 1:18 AM
Subject: Re: Sample from Jmservice
Liao,
Thanks for thinking about GlassFish Samples.
Your intent seems to be adding a sample on JMS to glassfish-samples project, if not please correct me.
The code you attached seems to be just fragments. To proceed, please send us a proposal, briefly describing the sample and if available, the complete code.
thanks
sreeni
liao wrote:
Hi,
I am sorry to bother you. The following samples from Jmin are feasibility ? It can simplify our workload ?
Would you help me at this? Thanks!
Jmservice的服务器端的Sample
第一步:编写服务类文件:
/*
*Copyright (c) jmin Organization. All rights reserved.
*/
package first;
import org.jmin.kernel.framework.ext.J2eeAbstractService;
/**
* service sample.
*
* @author Chris liao
* @version 1.0
*/
public class FirstService extends J2eeAbstractService{
/**
* Here, you need't put down anything.
* It is simple ?
*/
}
第二步:编写服务方面类(以下方面类为可选的)
1:编写RPC的sample类:
/*
*Copyright (c) jmin Organization. All rights reserved.
*/
package first;
import org.jmin.kernel.aspect.msg.rpc.InvocationAssistant;
/**
* RPC sample
*
* @author Chris liao
* @version 1.0
*/
public class HelloRPCAssistant implements InvocationAssistant{
/**
* RPC method
* @RPC
*/
public void hello(){
System.out.println("Hello World!");
}
/**
* RPC method
* @RPC
*/
public void hello(String name){
System.out.println("Hello," + name);
}
}
2: 编写JOB处理器Sample
/*
*Copyright (c) jmin Organization. All rights reserved.
*/
package first;
import org.jmin.kernel.aspect.msg.job.JobAssistant;
/**
* Job sample.
*
* @author Chris liao
* @version 1.0
*/
public class HelloJobAssisant implements JobAssistant{
/**
* handle content from job
*/
public void handle(Object content){
System.out.println("Job content: " + content);
}
}
3:编写JMS的topic的Sample:
/*
*Copyright (c) jmin Organization. All rights reserved.
*/
package first;
import org.jmin.kernel.aspect.msg.jms.topic.Topic;
/**
* Topic sample.
*
* @author Chris liao
* @version 1.0
*/
public class HelloTopic extends Topic{
/**
* Here,you need't write anything
*/
}
4:编写Jms队列的Sample
/*
*Copyright (c) jmin Organization. All rights reserved.
*/
package first;
import org.jmin.kernel.aspect.msg.jms.queue.Queue;
/**
* Queue sample, just support one customer
*
* @author Chris liao
* @version 1.0
*/
public class HelloQueue extends Queue{
/**
* Here,you need't write anything
*/
}
5:编写Jms高级队列的Sample
/*
*Copyright (c) jmin Organization. All rights reserved.
*/
package first;
import org.jmin.kernel.aspect.msg.jms.xqueue.XQueue;
/**
* advansted queue sample
*
* @author Chris liao
* @version 1.0
*/
public class HelloXQueue extends XQueue{
/**
* Here,you need't write anything
*/
}
第三步:编写服务配置文件:
接下来我们开始编写服务配置文件:META-INF/service.xml 内容如下:
<?xml version="1.0"?>
<service id="admin">
<components>
<component id="firstService" type="service">
<class>
first.FirstService
</class>
<property name="aspectPool">
<map>
<entry key="helloRPC" class="first.HelloRPCAssistant"/>
<entry key="helloJob" class="first.HelloJobAssisant"/>
<entry key="helloTopic" class="first.HelloTopic"/>
<entry key="helloQueue" class="first.HelloQueue"/>
<entry key="helloXQueue" class="first.HelloXQueue"/>
</map>
</property>
</component>
</components>
</service>
第四步: 编译,打包,部署到Jmin的deploy 目录中就好拉,接下来就可以进行测试拉!
购买商务邮、经济邮即送加密U盘
21CN 与您携手共进,诚征广告代理商