While you are fixing the tutorial, there is also a small typo with the
ant task
in the second chapter of the tutorial
<!--
<taskdef name="wsdl2Java"
classname="org.apache.ws.resource.Wsdl2JavaTask"
classpathref="apollo.classpath.id" />
-->
The classname is org.apache.ws.resource.tool.Wsdl2JavaTask (the 'tool'
part is missing). This is correctly specified in the build.xml in the
tutorial directory, but I was writing my own WS-Resource by looking at
the tutorial, not using the FileSystem stuff. In any case, (sorry for
nitpicking ;-), but fixing this will be good.
And while using the task
<!--
<wsdl2Java wsdl="path/to/your.wsdl"
srcOutputDir="generated/src"
classesOutputDir="generated/classes"
classpathref="apollo.classpath.id" />
-->
The srcOutputDir and classesOutputDir are not valid options for this
task (mebbe the
doc refers to some old version of the ant task). There is just one
attribute for
specifying the output dir . It is 'outputdir'. Again the build file in
the tutorial directory of your distrib has this right - just the
tutorial has this issue.
Regards,
Shiva J
-----Original Message-----
From: Springer, Ian P.
Sent: Thursday, March 10, 2005 11:28 AM
To: Jayaraman, Shivakumar; Arriola, George
Cc: '[email protected]'
Subject: RE: Latest WSDM code
Hey Shiva,
Long time no talk! I hope you are well.
My responses are inline.
| I was looking at the Apollo tutorial (after downloading it from
| apache). What I need to do is create one WSRF service which front-ends
| a bunch of resources.
| From the FileSystem example, I was not sure how this needs to be done.
| I am planning to deploy it, run it and figure it out today, but feel
| that asking you in parallel might be useful too.
|
| Some questions I have (I have not yet run your stuff, I just read the
| specs and the tutorial) . Accept my apologies in advance, if these are
| stupid questions :)
No apologies necessary. I know there is plenty of room for improvements
in the tutorial and the Javadocs.
| - What is the lifecycle of the Service class and the Resource class ?
| Do you create one instance of the Service class for the whole
| WS-Resource and one instance of the Resource class for each resource
| Id ?
The service class is stateless. A new instance of the service is created
for each request. Its constructor is passed the ResourceContext which
provides the ability to obtain the Resource instance that was requested
via a WS-Addr header. In the Apollo model, similar to EJB, each type of
Resource has a corresponding ResourceHome that is in charge of creating
and managing Resource instances of that type. The method you would
override in your ResourceHome to create/lookup Resources is:
Resource getInstance( ResourceContext )
| - Is there a way to programatically add resources to the WS-Resource.
| In your example, the resourceId needs to be specified in the
| jndi-config.xml file that is loaded by the webapp. We would like to
| dynamically (during runtime) add resources to the single WS-Resource
| webservice. Would it work if I just looked up the Home class and call
| its 'add' method programatically to add a resource in ? (this is what
| the home implementation does). In our case the 'resources' we need to
| expose as WS-Resources are created during runtime by the user.
| Everytime they create one of these through our GUI, we need to add a
| resource to the WS-Resource. I am assuming that there is just one
| 'Service' instance which finds out the resource that the request is
| intended for by looking at the addressing headers and does stuff on it
| . However what confuses me is the fact that the 'ResourceContext'
| (which I am assuming, is the way to get a handle on the resource since
| it has a getResource method) is passed in to the Service, not in each
| operation, but in its constructor
|
| Example public
| FileSystemService::FileSystemService(ResourceContext rc)
The execution flow for a request is as follows:
1) request comes into Axis
2) Axis dispatches the request to the Apollo provider (ResourceProvider)
3) the provider creates a ResourceContext that contains context info for
this request
4) the provider creates an instance of the Apollo Service class that is
configured for this Axis service, passing the ResourceContext to the
Service's constructor
5) the provider deserializes the SOAP request to an XmlBean
6) via reflection, the provider invokes the method on the Service that
corresponds to the top-level element within the request Body, passing it
the request XmlBean
7) the various methods w/in the Service are then able to transparently
obtain the Resource instance by calling getResourceHome() on the
ResourceContext and then calling getInstance() on the ResourceHome,
passing it the ResourceContext
8) under the covers, the ResourceContext:
a) looks up the appropriate Home instance from JNDI based on the home
name configured for this service
b) creates a ResourceKey by looking up the SOAP header from the
request w/ the key name configured for this service
or something like that anyway :-)
| In your example - in the mount/unmount method's
| implementation, you just return a hardcoded response ((
| return XmlObject.Factory.parse( "<MountResponse />" ); ))
|
| Now if I wanted to really mount a filesystem in a 'more real'
| situation, I would need to get a handle to the resource inside of this
| method (the resource would indicate the filesystem which I want to
| mount/unmount). How do I do that ?
| The resourceContext is passed in at construction time, which makes me
| wonder if we are creating one instance of the service for every
| instance of the resource managed, in which case dynamically adding a
| resource to a WSRF service is not the way I am assuming it needs to be
| done.
We definitely need to make the impls of Mount and Unmount more
realistic. I'll file an issue for this. In the meantime, if you want to
play with chaning the filesystem example yourself, I'd change
AbstractFileSystemService to extend
org.apache.ws.resource.AbstractPortType. Then you'll be able to call
AbstractPortType's getResource() method from mount() or unmount() to
obtain the Resource instance.
| In anycase, I am going to read your code in more detail and work it
| out. However this is a bit confusing - (the tutorial probably needs to
| describe the lifecycle of a WS-Resource in more detail), so I thought
| I'd ask you guys.
Agreed. I will file an issue that we need to add a step-by-step
description of processing a request to the tutorial.
| I might have a few more questions. Let me know if it is not Ok to ask
| you guys this way. I was wondering if we guys (being HP) could talk to
| you guys through the 'inside track'
| inside of sending mails to the apache mail lists.
Actually, we are asking HP folks to post all generic questions to the
Apache lists, so that others in the communities can benefit from and
participate in the threads. In that spirit, I am cc'ing my response to
the Apollo list.
| Thanks in advance.
No prob!
| Regards,
| Shiva J
Likewise,
Ian
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]