hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 张博 <lin...@gmail.com>
Subject A problem about ServiceImplementationFactory
Date Wed, 15 Jun 2005 04:51:17 GMT
Hello everyone:

I'm new to hivemind. I'm from China.
I want to use ServiceImplementationFactory to produce Service, here is the 
code:
------------------------------------------------------------------------------------------------------------------------------------
Interface: Hello.java
package cn.topsmart.test;

public interface Hello {

public void sayHello();

}
---------------------------------------------------------------------------------------------------------------------------------------
HelloFactory.java
package cn.topsmart.test;

import org.apache.hivemind.ServiceImplementationFactory;
import org.apache.hivemind.ServiceImplementationFactoryParameters;

public class HelloFactory implements ServiceImplementationFactory {

public Object createCoreServiceImplementation(
ServiceImplementationFactoryParameters factoryParameters) {
return new Hello(){
public void sayHello() {
System.out.println("hello..............");
}
};
}

}
-------------------------------------------------------------------------------------------------------------------------------------------------
hivemodule.xml
<?xml version="1.0"?>

<module id="topsmart" version="0.0.1">

<service-point id="HelloFactory" interface="
org.apache.hivemind.ServiceImplementationFactory"/>
<service-point id="Hello" interface="cn.topsmart.test.Hello"/>

<implementation service-id="HelloFactory">
<invoke-factory>
<construct class="cn.topsmart.test.HelloFactory"/>
</invoke-factory>
</implementation>
<implementation service-id="Hello">
<invoke-factory service-id="HelloFactory"/>
</implementation>

</module>
-------------------------------------------------------------------------------------------------------------------------------------
Test.java
Hello hello = (Hello)registry.getService(Hello.class);
hello.sayHello();
-----------------------------------------------------------------------------------------------------------------------------------
But when I run the test code, the mistake appears:
06-15@10:16:58 ERROR (topsmart.Hello) - Error at 
file:/E:/projects/topsmart/build/classes/META-INF/hivemodule.xml, line 14, 
column 46: Parameters to service implementation factory HelloFactory 
contains no contributions but expects exactly one contribution.
I did not know why this is? Was any place makes a mistake?
Thanks!

Mime
View raw message