You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-user@ws.apache.org by "Huang, Lei [USA]" <hu...@bah.com> on 2008/02/24 22:49:44 UTC

referencing NotificationProducer from user defined classes

hi everyone,
I'm currently developing some business logic for a notification producer
and able to get a reference to the muse NotificationProducer class
through resource manager with this statement:
 
final NotificationProducer wsn = (NotificationProducer)
getResource().getCapability(WsnConstants.PRODUCER_URI);

My question is how do I get the muse NotificationProducer reference in
other than MyCapability class. If I use NotificationProducerClient
object, it doesn't provide me with APIs such as addTopic(), publish()
and etc.  Please advise.  Thanks in advance for everyone's help.

Lei 


RE: referencing NotificationProducer from user defined classes

Posted by Ch...@swisscom.com.
Ah, ok thats a different matter.  Sorry for the misunderstanding.

If any method is exposed by WSDL then you can implement a proxy to that
using the Muse proxy generation.  So if the current
NotificationProducerClient doesn't provide what you need you can always
add it.  Start here for some more help in that direction:

	
http://ws.apache.org/muse/docs/2.2.0/tutorial/03-wsdl2java.html#Section4

cheers,
Chris

-----Original Message-----
From: Huang, Lei [USA] [mailto:huang_lei@bah.com] 
Sent: Tuesday, February 26, 2008 6:24 AM
To: muse-user@ws.apache.org
Subject: RE: referencing NotificationProducer from user defined classes 

Maybe I can ask the question a little differently.  I'm trying to
develop an external producer client that requires muse's
NotificationProducer to expose publish() and addTopic() methods (I don't
understand why the current NotificationProducerClient implementation
doesn't expose them).  What in your opinion is the best way to achieve
my goal? Like I mentioned, I'm very new to Muse and appreciate your
response below but I'm having some difficulties grasping how to proceed
with the below recommendation.

Thanks,
Lei

-----Original Message-----
From: Chris.Twiner@swisscom.com [mailto:Chris.Twiner@swisscom.com]
Sent: Monday, February 25, 2008 10:51 AM
To: muse-user@ws.apache.org
Subject: RE: referencing NotificationProducer from user defined classes 

Hi Lei,

It really depends on your environment as to how to integrate.  The
simplest thing to do is just customise your existing muse platform to
provide that information.  Its simple to enhance and you have 3
different environments from which to copy sample code (axis, mini soap,
j2me / osgi).

I would recommend looking at the mini soap platform, its a simple
servlet and very easy to follow.  Wrapping the platform itself allows
you to directly access it without resorting to use of statics, jmx, jndi
etc.

cheers,
Chris

-----Original Message-----
From: Huang, Lei [USA] [mailto:huang_lei@bah.com]
Sent: Monday, February 25, 2008 4:24 PM
To: muse-user@ws.apache.org
Subject: RE: referencing NotificationProducer from user defined classes 

Chris,
Thanks for your quick response. I'm actually trying to access the
NotificationProducer from external code.  I'm still new to Muse, so can
you elaborate more on how to provide a hook to the ResourceManager? Some
sample code will be greatly appreciated.

Thanks,
Lei

-----Original Message-----
From: Chris.Twiner@swisscom.com [mailto:Chris.Twiner@swisscom.com]
Sent: Monday, February 25, 2008 4:26 AM
To: muse-user@ws.apache.org
Subject: RE: referencing NotificationProducer from user defined classes 

Hi Lei,

Are you trying to access the NotificationProducer from code external to
muse or just another capability that isn't part of your resource?

If its from another capability or resource you can use :

	public Resource getDefaultResource(String resourceName) {
		Resource resource = null;
		try {
			resource = manager.getResource(new
EndpointReference(
					new
URI(museIsoLayer.getRouter().getEnvironment().getDefaultURI()+resourceNa
me)));
		} catch (URISyntaxException e) {
			// handle the case wherethe uri is bad
		}
		
		// got a resource?
		if (resource == null) {
			// throw some kind of exception etc
		}
		return resource;
	}

where 

 manager = ( (SimpleResourceRouter) museIsoLayer.getRouter()
).getResourceManager();

or

 manager = getResource().getResourceManager();

and the resourceName is the resource name present in your muse.xml and
that you only have one instance of that resource.

If the code is to be accessed from outside of Muse resources or
capabilities then you must provide a hook to the ResourceManager.  You
can pass the instance via a custom capability into the code that needs
it.

cheers,
Chris

-----Original Message-----
From: Huang, Lei [USA] [mailto:huang_lei@bah.com]
Sent: Sunday, February 24, 2008 10:50 PM
To: muse-user@ws.apache.org
Subject: referencing NotificationProducer from user defined classes 

hi everyone,
I'm currently developing some business logic for a notification producer
and able to get a reference to the muse NotificationProducer class
through resource manager with this statement:
 
final NotificationProducer wsn = (NotificationProducer)
getResource().getCapability(WsnConstants.PRODUCER_URI);

My question is how do I get the muse NotificationProducer reference in
other than MyCapability class. If I use NotificationProducerClient
object, it doesn't provide me with APIs such as addTopic(), publish()
and etc.  Please advise.  Thanks in advance for everyone's help.

Lei 


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org


RE: referencing NotificationProducer from user defined classes

Posted by "Huang, Lei [USA]" <hu...@bah.com>.
Maybe I can ask the question a little differently.  I'm trying to
develop an external producer client that requires muse's
NotificationProducer to expose publish() and addTopic() methods (I don't
understand why the current NotificationProducerClient implementation
doesn't expose them).  What in your opinion is the best way to achieve
my goal? Like I mentioned, I'm very new to Muse and appreciate your
response below but I'm having some difficulties grasping how to proceed
with the below recommendation.

Thanks,
Lei

-----Original Message-----
From: Chris.Twiner@swisscom.com [mailto:Chris.Twiner@swisscom.com] 
Sent: Monday, February 25, 2008 10:51 AM
To: muse-user@ws.apache.org
Subject: RE: referencing NotificationProducer from user defined classes 

Hi Lei,

It really depends on your environment as to how to integrate.  The
simplest thing to do is just customise your existing muse platform to
provide that information.  Its simple to enhance and you have 3
different environments from which to copy sample code (axis, mini soap,
j2me / osgi).

I would recommend looking at the mini soap platform, its a simple
servlet and very easy to follow.  Wrapping the platform itself allows
you to directly access it without resorting to use of statics, jmx, jndi
etc.

cheers,
Chris

-----Original Message-----
From: Huang, Lei [USA] [mailto:huang_lei@bah.com]
Sent: Monday, February 25, 2008 4:24 PM
To: muse-user@ws.apache.org
Subject: RE: referencing NotificationProducer from user defined classes 

Chris,
Thanks for your quick response. I'm actually trying to access the
NotificationProducer from external code.  I'm still new to Muse, so can
you elaborate more on how to provide a hook to the ResourceManager? Some
sample code will be greatly appreciated.

Thanks,
Lei

-----Original Message-----
From: Chris.Twiner@swisscom.com [mailto:Chris.Twiner@swisscom.com]
Sent: Monday, February 25, 2008 4:26 AM
To: muse-user@ws.apache.org
Subject: RE: referencing NotificationProducer from user defined classes 

Hi Lei,

Are you trying to access the NotificationProducer from code external to
muse or just another capability that isn't part of your resource?

If its from another capability or resource you can use :

	public Resource getDefaultResource(String resourceName) {
		Resource resource = null;
		try {
			resource = manager.getResource(new
EndpointReference(
					new
URI(museIsoLayer.getRouter().getEnvironment().getDefaultURI()+resourceNa
me)));
		} catch (URISyntaxException e) {
			// handle the case wherethe uri is bad
		}
		
		// got a resource?
		if (resource == null) {
			// throw some kind of exception etc
		}
		return resource;
	}

where 

 manager = ( (SimpleResourceRouter) museIsoLayer.getRouter()
).getResourceManager();

or

 manager = getResource().getResourceManager();

and the resourceName is the resource name present in your muse.xml and
that you only have one instance of that resource.

If the code is to be accessed from outside of Muse resources or
capabilities then you must provide a hook to the ResourceManager.  You
can pass the instance via a custom capability into the code that needs
it.

cheers,
Chris

-----Original Message-----
From: Huang, Lei [USA] [mailto:huang_lei@bah.com]
Sent: Sunday, February 24, 2008 10:50 PM
To: muse-user@ws.apache.org
Subject: referencing NotificationProducer from user defined classes 

hi everyone,
I'm currently developing some business logic for a notification producer
and able to get a reference to the muse NotificationProducer class
through resource manager with this statement:
 
final NotificationProducer wsn = (NotificationProducer)
getResource().getCapability(WsnConstants.PRODUCER_URI);

My question is how do I get the muse NotificationProducer reference in
other than MyCapability class. If I use NotificationProducerClient
object, it doesn't provide me with APIs such as addTopic(), publish()
and etc.  Please advise.  Thanks in advance for everyone's help.

Lei 


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org


RE: referencing NotificationProducer from user defined classes

Posted by Ch...@swisscom.com.
Hi Lei,

It really depends on your environment as to how to integrate.  The
simplest thing to do is just customise your existing muse platform to
provide that information.  Its simple to enhance and you have 3
different environments from which to copy sample code (axis, mini soap,
j2me / osgi).

I would recommend looking at the mini soap platform, its a simple
servlet and very easy to follow.  Wrapping the platform itself allows
you to directly access it without resorting to use of statics, jmx, jndi
etc.

cheers,
Chris

-----Original Message-----
From: Huang, Lei [USA] [mailto:huang_lei@bah.com] 
Sent: Monday, February 25, 2008 4:24 PM
To: muse-user@ws.apache.org
Subject: RE: referencing NotificationProducer from user defined classes 

Chris,
Thanks for your quick response. I'm actually trying to access the
NotificationProducer from external code.  I'm still new to Muse, so can
you elaborate more on how to provide a hook to the ResourceManager? Some
sample code will be greatly appreciated.

Thanks,
Lei

-----Original Message-----
From: Chris.Twiner@swisscom.com [mailto:Chris.Twiner@swisscom.com]
Sent: Monday, February 25, 2008 4:26 AM
To: muse-user@ws.apache.org
Subject: RE: referencing NotificationProducer from user defined classes 

Hi Lei,

Are you trying to access the NotificationProducer from code external to
muse or just another capability that isn't part of your resource?

If its from another capability or resource you can use :

	public Resource getDefaultResource(String resourceName) {
		Resource resource = null;
		try {
			resource = manager.getResource(new
EndpointReference(
					new
URI(museIsoLayer.getRouter().getEnvironment().getDefaultURI()+resourceNa
me)));
		} catch (URISyntaxException e) {
			// handle the case wherethe uri is bad
		}
		
		// got a resource?
		if (resource == null) {
			// throw some kind of exception etc
		}
		return resource;
	}

where 

 manager = ( (SimpleResourceRouter) museIsoLayer.getRouter()
).getResourceManager();

or

 manager = getResource().getResourceManager();

and the resourceName is the resource name present in your muse.xml and
that you only have one instance of that resource.

If the code is to be accessed from outside of Muse resources or
capabilities then you must provide a hook to the ResourceManager.  You
can pass the instance via a custom capability into the code that needs
it.

cheers,
Chris

-----Original Message-----
From: Huang, Lei [USA] [mailto:huang_lei@bah.com]
Sent: Sunday, February 24, 2008 10:50 PM
To: muse-user@ws.apache.org
Subject: referencing NotificationProducer from user defined classes 

hi everyone,
I'm currently developing some business logic for a notification producer
and able to get a reference to the muse NotificationProducer class
through resource manager with this statement:
 
final NotificationProducer wsn = (NotificationProducer)
getResource().getCapability(WsnConstants.PRODUCER_URI);

My question is how do I get the muse NotificationProducer reference in
other than MyCapability class. If I use NotificationProducerClient
object, it doesn't provide me with APIs such as addTopic(), publish()
and etc.  Please advise.  Thanks in advance for everyone's help.

Lei 


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org


RE: referencing NotificationProducer from user defined classes

Posted by "Huang, Lei [USA]" <hu...@bah.com>.
Chris,
Thanks for your quick response. I'm actually trying to access the
NotificationProducer from external code.  I'm still new to Muse, so can
you elaborate more on how to provide a hook to the ResourceManager? Some
sample code will be greatly appreciated.

Thanks,
Lei

-----Original Message-----
From: Chris.Twiner@swisscom.com [mailto:Chris.Twiner@swisscom.com] 
Sent: Monday, February 25, 2008 4:26 AM
To: muse-user@ws.apache.org
Subject: RE: referencing NotificationProducer from user defined classes 

Hi Lei,

Are you trying to access the NotificationProducer from code external to
muse or just another capability that isn't part of your resource?

If its from another capability or resource you can use :

	public Resource getDefaultResource(String resourceName) {
		Resource resource = null;
		try {
			resource = manager.getResource(new
EndpointReference(
					new
URI(museIsoLayer.getRouter().getEnvironment().getDefaultURI()+resourceNa
me)));
		} catch (URISyntaxException e) {
			// handle the case wherethe uri is bad
		}
		
		// got a resource?
		if (resource == null) {
			// throw some kind of exception etc
		}
		return resource;
	}

where 

 manager = ( (SimpleResourceRouter) museIsoLayer.getRouter()
).getResourceManager();

or

 manager = getResource().getResourceManager();

and the resourceName is the resource name present in your muse.xml and
that you only have one instance of that resource.

If the code is to be accessed from outside of Muse resources or
capabilities then you must provide a hook to the ResourceManager.  You
can pass the instance via a custom capability into the code that needs
it.

cheers,
Chris

-----Original Message-----
From: Huang, Lei [USA] [mailto:huang_lei@bah.com]
Sent: Sunday, February 24, 2008 10:50 PM
To: muse-user@ws.apache.org
Subject: referencing NotificationProducer from user defined classes 

hi everyone,
I'm currently developing some business logic for a notification producer
and able to get a reference to the muse NotificationProducer class
through resource manager with this statement:
 
final NotificationProducer wsn = (NotificationProducer)
getResource().getCapability(WsnConstants.PRODUCER_URI);

My question is how do I get the muse NotificationProducer reference in
other than MyCapability class. If I use NotificationProducerClient
object, it doesn't provide me with APIs such as addTopic(), publish()
and etc.  Please advise.  Thanks in advance for everyone's help.

Lei 


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org


RE: referencing NotificationProducer from user defined classes

Posted by Ch...@swisscom.com.
Hi Lei,

Are you trying to access the NotificationProducer from code external to
muse or just another capability that isn't part of your resource?

If its from another capability or resource you can use :

	public Resource getDefaultResource(String resourceName) {
		Resource resource = null;
		try {
			resource = manager.getResource(new
EndpointReference(
					new
URI(museIsoLayer.getRouter().getEnvironment().getDefaultURI()+resourceNa
me)));
		} catch (URISyntaxException e) {
			// handle the case wherethe uri is bad
		}
		
		// got a resource?
		if (resource == null) {
			// throw some kind of exception etc
		}
		return resource;
	}

where 

 manager = ( (SimpleResourceRouter) museIsoLayer.getRouter()
).getResourceManager();

or

 manager = getResource().getResourceManager();

and the resourceName is the resource name present in your muse.xml and
that you only have one instance of that resource.

If the code is to be accessed from outside of Muse resources or
capabilities then you must provide a hook to the ResourceManager.  You
can pass the instance via a custom capability into the code that needs
it.

cheers,
Chris

-----Original Message-----
From: Huang, Lei [USA] [mailto:huang_lei@bah.com] 
Sent: Sunday, February 24, 2008 10:50 PM
To: muse-user@ws.apache.org
Subject: referencing NotificationProducer from user defined classes 

hi everyone,
I'm currently developing some business logic for a notification producer
and able to get a reference to the muse NotificationProducer class
through resource manager with this statement:
 
final NotificationProducer wsn = (NotificationProducer)
getResource().getCapability(WsnConstants.PRODUCER_URI);

My question is how do I get the muse NotificationProducer reference in
other than MyCapability class. If I use NotificationProducerClient
object, it doesn't provide me with APIs such as addTopic(), publish()
and etc.  Please advise.  Thanks in advance for everyone's help.

Lei 


---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org