Hi, Amindri.
The JmxModuleActivator should receive the injected ExtensionPointRegistry from
Tuscany runtime instead of instantiating its own instance. To do so, you need
to create a constructor of JmxModuleActivator that takes the
ExtensionPointRegistry argument and uses it for the start/stop methods.
For example,
public class JmxModuleActivator implements ModuleActivator {
private ExtensionPointRegistry registry;
public JmxModuleActivator(ExtensionPointRegistry registry) {
this.registry = registry;
...
}
public void start() {
// Do something with registry
}
...
}
Thanks,
Raymond
________________________________________________________________
Raymond Feng
[email protected]
Apache Tuscany PMC member and committer: tuscany.apache.org
Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com
Personal Web Site: www.enjoyjava.com
________________________________________________________________
On Jul 11, 2011, at 6:35 PM, Amindri Udugala wrote:
>
>
> On 10 July 2011 15:09, Luciano Resende <[email protected]> wrote:
> On Sat, Jul 9, 2011 at 9:53 PM, Amindri Udugala
> <[email protected]> wrote:
> > Hi,
> >
> >
> > After going through the Tuscany code carefully I decided that the best way
> > to access runtime artifacts like Endpoints, Components, Composites and
> > Services was to access the DomainRegistryFactoryExtension
> > Point. Bellow is code snippet where I access these objects.
> >
> > for (DomainRegistryFactory factory : factories.getDomainRegistryFactories())
> > {
> > Collection<DomainRegistry> domainRegistries =
> > factory.getEndpointRegistries();
> >
> > for (DomainRegistry domainRegistry : domainRegistries) {
> >
> > compositeManagement.register(domainRegistry.getDomainComposite());
> > List<Component> componentList =
> > domainRegistry.getDomainComposite().getComponents();
> >
> > for (Component component : componentList) {
> > componentManagement.register(component);
> >
> > List<ComponentService> componentServiceList =
> > component.getServices();
> > for (ComponentService componentService :
> > componentServiceList) {
> >
> > componentServiceManagement.register(componentService);
> > }
> > }
> >
> > Collection<Endpoint> endpointCollection =
> > domainRegistry.getEndpoints();
> > for (Endpoint ep : endpointCollection) {
> > endpointManagement.registerEndpoints(ep);
> > }
> > }
> > }
> >
> >
> > The problem is that when I run the code there it doesn't receive any data.
> > (I have attached an image of the Jconsole -nodata.png) . But the
> > PolicyProviderfactories in ProviderfactoryExtensionPoint are shown (have
> > attached an image of that too).
> >
> > What I did to bootstrap tuscany was, executing LaunchCalculatorContribution
> > with a Thread.sleep(10000) right after invoking node.getService(.....). I
> > found it a bit tedious to run the tuscany shell. Is it because the way I
> > have bootstrp tuscany that I don't get nay data to rest of the beans? Is
> > there a better way of accessing runtime artifacts?
> >
> > Also I have a problem with the jmx-activator module. This module should be
> > invoked when Tuscany is boot strapped as it implements the ModuleActivator
> > interface, also I have taken other necessary actions as mentioned in the
> > development guide. But it is not invoked, so just for testing purpose i
> > created an object of JmxModuleActivator in the LaunchCalculatorContribution
> > and called the start method in it.
> >
> > Hope you can give me some advice on these issues. Also I will attach the
> > revised patch to JIRA.
> >
> hi thanx for the feedback..
> Without knowing all the details, this seems like missing dependency
> issues.
> But I have added all the dependencies in relevent pom files. Is it
> something to do with the MANIFESTs? But I included all package imports and
> exports to the manifests as well, and still the jmx-activator module is not
> activated when tuscany is boot strapped.
>
> The Tuscany runtime use the service discover pattern to
> register extensions and to activate the module activators. Maybe this
> can give you a clue for further investigating the problem.
>
> To access the runtime objects Have created a new object of
> ExtensionPointRegistry
> ExtensionPointRegistry extensionPoints = new
> DefaultExtensionPointRegistry();
>
> Then the Domain's Composites, Components Endpoints are accessed by
> DomainRegistryFactoryExtensionPoint
> DomainRegistryFactoryExtensionPoint factories =
> extensionPoints.getExtensionPoint(DomainRegistryFactoryExtensionPoint.class);
>
> And I have posted the code snippet how I'm accessing these objects
>
> for (DomainRegistryFactory factory :
> factories.getDomainRegistryFactories()) {
> Collection<DomainRegistry> domainRegistries =
> factory.getEndpointRegistries();
>
> for (DomainRegistry domainRegistry : domainRegistries) {
>
> compositeManagement.register(domainRegistry.getDomainComposite());
> List<Component> componentList =
> domainRegistry.getDomainComposite().getComponents();
>
> for (Component component : componentList) {
> componentManagement.register(component);
>
> List<ComponentService> componentServiceList =
> component.getServices();
> for (ComponentService componentService :
> componentServiceList) {
> componentServiceManagement.register(componentService);
> }
> }
>
> Collection<Endpoint> endpointCollection =
> domainRegistry.getEndpoints();
> for (Endpoint ep : endpointCollection) {
> endpointManagement.registerEndpoints(ep);
> }
> }
> }
>
> Is it because of a missing dependency that I'm not getting data to these
> objects?
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
> Luciano Resende
> http://people.apache.org/~lresende
> http://twitter.com/lresende1975
> http://lresende.blogspot.com/
>
>
>
> --
> Thanks
>
> Amindri Udugala
> University of Colombo School of Computing,
> Sri Lanka.
>