Hi,
I am sorry for bothering you.Now,I want to invoke service's interface by a simple way.
The below way is feasible ? Please help me.
1: define service file
//Math.xml: this file will be deployed on server
<services>
<service id =”Math” class=”math.MathService” >
<property id =”assistants”>
<map>
<entry id =”cal ” value =”math.Cal ” >
<map>
</property>
</service>
</services>
2: Define Class files
package math;
public class MathService extends J2eeAbstractService{
}
package math;
public class Cal extends J2eeAbstractAssistant{
/**
* @BI
*/
public int add(int a, int b){
return (a + b);
}
/**
* @BI
*/
public int del(int a, int b) {
return (a – b);
}
}
3: Generate interface file for service
I think we can use some tools to generate some interface files,the following XML is expected result.
Of cource, We can also use a tool to generate stub file for service's aspect assistant, this like EJB stub file.
//MathBI.xml
<services>
<service id =”Math” >
<aspect id=”cal”>
<BI id =”add”>
<int/>
<int/>
</BI>
<BI id =”del”>
<int/>
<int/>
</BI>
</aspect>
</service>
</services>
4:How to contol invocation
……………………
J2eeService service = serviceContainer.getService(netRequest.getServiceId());
J2eeAssistant ast = service.getAssisant(netRequest.getAspectId());
Method method = ast.getDeclaredMehtod(netRequest.getOperation());
Object result = method.invoke(ast,netRequest.getParameters());
……………………
我个人是想尝试组件以外的方式来处理业务应用,在这过程我使用了服务方面助手来做EJB组件同样的事情,以达到企业应用.这个构思可以吗? 谢谢!
Chris Liao