felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clement Escoffier" <clement.escoff...@gmail.com>
Subject RE: Composites, Components, POJOs; oh my!
Date Sun, 23 Nov 2008 19:50:42 GMT
Hi,

> -----Original Message-----
> From: Brad Cox [mailto:bcox@virtualschool.edu]
> Sent: dimanche 23 novembre 2008 19:50
> To: users@felix.apache.org
> Subject: Composites, Components, POJOs; oh my!
> 
> The problem now is; nothing's happening. How do I tell what's going on?
> I've got printouts scattered in obvious places but none are getting
> triggered; for example:
> 
> public class TestServiceImpl implements ServiceFactory {
> 	private BundleContext context;
> 	private Properties properties;
> 
> 	public TestServiceImpl(BundleContext context, Properties
> properties)
> 	{
> 		System.err.println("new TestServiceImpl(c, p)");
> 		log.info("new TestServiceImpl(..,..)");
> 		this.context = context;
> 		this.properties = properties;
> 	}
> ...
> 

Is this class expect to be an iPOJO powered components ? In this case, there
is an issue. iPOJO supports two types of constructor: empty one (no
argument), or with a bundle context (BundleContext bc).

Moreover, to be sure that you POJO objects are created, set your component
to 'immediate' (add immediate="true" in your <component> tag). Indeed if
your component provides services, POJO objects will be created only if the
service is used.


> I'm guessing they're all waiting on some prerequisite to start but I
> don't have a clue as to what. Suspecting a metadata.xml problem.
> Struggled to understand the ipojo documentation but its just not
> connecting for me.
> 
> What I'm trying to do build a software bus (soakit.core), several
> software cards (soakit.ports and soakit.transforms), and a test case
> (soakit.test). The metadata.xml files are:
> 
> soakit.core
> <ipojo>
> 	<component
> classname="com.gestalt.soakit.core.internal.CoreServiceImpl">
> 		<provides/>
> 	</component>
> 	<instance
> component="com.gestalt.soakit.core.internal.CoreServiceImpl"/>
> </ipojo>
> 
> soakit.transform.identity (one of the cards):
> <ipojo>
> 	<component
> classname="com.gestalt.soakit.transform.identity.internals.IdentityTran
> sformServiceImpl">
> 		<provides/>
> 	</component>
> 	<instance
> component="com.gestalt.soakit.transform.identity.internals.IdentityTran
> sformServiceImpl"/>
> </ipojo>
> 
> soakit.test:
> <ipojo>
> 	<composite name="soakit.test">
> 		<instance component="com.gestalt.soakit.core"/>
> 		<instance component="com.gestalt.soakit.port.file"/>
> 		<instance component="com.gestalt.soakit.port.http"/>
> 		<instance component="com.gestalt.soakit.port.jms"/>
> 		<instance
> component="com.gestalt.soakit.transform.identity"/>
> 		<instance component="com.gestalt.soakit.transform.log"/>
> 		<instance component="com.gestalt.soakit.transform.pep"/>
> 		<instance component="com.gestalt.soakit.transform.xsl"/>
> 	</composite>
> 	<instance component="soakit.test"/>
> </ipojo>

You do'nt reuse component type that you declare previously
(com.gestalt.soakit.transform.identity.internals.IdentityTransformServiceImp
l and com.gestalt.soakit.core.internal.CoreServiceImpl). Is it the expected
composition?

If you want to reuse the same one, you should avoid creating instances of
component types sued in you're the composite.
(<instance component="com.gestalt.soakit.core.internal.CoreServiceImpl"/>)


So, a last advice, if you use Felix, you should try the 'arch' command
(http://felix.apache.org/site/architecture-handler.html), that will give you
the structure of your system. 
Install and start the arch command (from the Felix download page).
Then list created instances (arch), and get info on them (arch -instance
instance_name).

If some instances are invalid, it means that services dependencies are not
satisfied (the failing dependency is contained in the instance description
given by the arch command).

If instances are not created, then check factories (i.e. component type):
arch -factories


Hope this help,

Regards,

Clement 



> 
> Can someone help me dig out of the weeds with the declarations? Any
> tips for diagnosing WTF is going on would be helpful too. Its
> discouraging that even basic System.err.println() doesn't help.
> 
> 
> 
> 
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message