Hi Clement, Thanks, Its working fine now.
Regards, Abdel On Mon, Jan 12, 2009 at 3:45 PM, Clement Escoffier < [email protected]> wrote: > > Hi, > > > On 12.01.2009, at 12:37, Abdel Olakara wrote: > > Hi all, >> >> I have been trying to work with iPOJO today. My hello world application >> is simply not working. Can anybody please help me out figure what could be >> the issue? >> I have a split my project into three.. one is service interface, service >> implementation and service client that will use the service. >> My hello service is given bellow: >> >> package hello.service: >> >> public interface HelloService { >> >> public String sayHello(); >> } >> >> I compiled all the projects using ant scripts. I also used bnd tool. >> >> My hello component (service implementation): >> >> package hello.component; >> >> import hello.service.HelloService; >> >> public class HelloComponent implements HelloService { >> >> String message = "Hello World"; >> >> public String sayHello() { >> return message; >> } >> } >> >> metadata.xml for this project is: >> >> <ipojo> >> <component classname="hello.component.HelloComponent"> >> <requires field="message"/> >> <provides/> >> </component> >> <instance component="hello.component.HelloComponent"/> >> </ipojo> >> > > The message field is just a String, not a service dependency and does not > need to be injected. Try with the following metadata: > >> <ipojo> >> <component classname="hello.component.HelloComponent"> >> <provides/> >> > > >> </component> >> <instance component="hello.component.HelloComponent"/> >> </ipojo> >> > > > This will create an instance of your HelloComponent that will provide the > Hello Service. > > > >> My Hello client: >> >> package hello.client; >> >> import hello.service.HelloService; >> >> public class HelloClient { >> >> private HelloService m_hello; >> >> >> public HelloClient() { >> super(); >> System.out.println("Hello Client constructor..."); >> } >> >> public void start() { >> System.out.println("Starting client..."); >> System.out.println("Service: " + m_hello.sayHello()); >> } >> >> public void stop() { >> System.out.println("Stoping client..."); >> } >> } >> >> metadata.xml for the client: >> >> <ipojo> >> <component classname="hello.client.HelloClient"> >> <requires field="m_hello"/> >> <callback transition="validate" method="start"/> >> <callback transition="invalidate" method="stop"/> >> </component> >> <instance component="hello.client.HelloClient"/> >> </ipojo> >> > > It should work with a consistent Hello Service provider. > No issue were raised, because iPOJO was looking for a java.lang.String > service :-), and your Hello service was not published as soon as a > java.lang.String service becomes available. > > Regards, > > > Clement > > > >> >> I have also attached the complete project as a zip. >> When I load the bundles, ideally when the client is loaded, the start() >> show get executed. but its not.. I do not see any sys out displayed on my >> console. Please help me to understand what is wrong. >> >> >> Thanks in advance, >> Abdel Raoof Olakara >> http://technopaper.blogspot.com >> >> <ipojo-example.zip>--------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > > -- -- Abdel Raoof Olakara [email protected] http://technopaper.blogspot.com

