1
votes

I saw an example about blueprint when using factory. In the example they hard code the value of argument like "2" in the example below.

 public class StaticAccountFactory {      
   public static Account createAccount(long number) {
   return new Account(number);
   }
 }
...

<bean id="accountTwo"
 class="org.apache.aries.simple.StaticAccountFactory" 
 factory-method="createAccount">   
   <argument **value="2"**/>

My question is how to sent this value from the client bundle that want to use this bean? and how to create service from this bean for that proposed? How about if that factory need a bundle object as a argument not the simple value, how the client bundle pass the bundle of itself to this factory?

Thanks in advance, anurak

2
I try to summarize my question. By using blueprint, if provider bundle using ServiceFactory for return an implementation service to client bundle then how can I write the blueprint for sent(client side)/receive (provider side) a client bundle (This is because getService() method of ServiceFactory need a bundle object)? - anurak

2 Answers

1
votes
  <bean id="combinedClassLoader" class="my.package.hazelcast.CombinedClassLoader" init-method="init" destroy-method="destroy"/>

  <bean id="hazelcastClient" class="my.package.hazelcast.HazelcastInstanceFactory" factory-method="create">
    <argument value="123"/>
    <argument ref="combinedClassLoader"/>
  </bean>
0
votes

You simply create a factory class with a method like the above but non static and expose it as a service. Or you simply let the client use the static method.