A few comments and questions inline.
ant elder wrote:
On 8/12/07, Florian Rosenberg <[EMAIL PROTECTED]> wrote:
hi SCA folks,
I'm pretty new to SCA and I want to develop a new component type
implementation, similar to BPEL (sorry for any terminology mismatch). The
stuff I'm currently having here is basically a composition engine for
RESTful services which I currently running on Tomcat (as a servlet with
some backend stuff). Now I want to bring the whole stuff into SCA to
allow
component types to be implemented as RESTful compositions.
Sounds really interesting!
I'm curious, what will the business interface of these SCA components
look like? get/post/put/delete? or something else?
The problem I'm having now is the following: we envision that the user
creates a Tuscany based web-app
OK let me stop here and ask a few questions to make sure I understand
the context and what you're looking for :)
What do you mean by Tuscany based web-app?
Are you talking about an SCA component that provides a Web UI? if this
is the case what technology are you using to provide the UI? Servlet?
JSP? Faces? Struts?
Or do you mean a JEE WAR as a way for you to package a set of SCA
components and deploy them such that they can talk REST/HTTP?
deployed on a servlet container and we
dynamically register our composition engine servlet during startup of the
container. Nevertheless, I could not figure out how to do that. I have it
running in the embedded mode, where I start a tomcat server by myself in
the provider implementation but that is not what is desired (for example,
if the user deploys this Tuscany app in a Tomcat then, it crashed since
the
port is already used). What I would need is a way to get access to the
servlet host (which runs the Tuscany app) and register my servlet there,
but all I tried started a new servlet host internally (which can't work if
the Tomcat hosting the SCA app is already using port 8080 and using
another
one is not really desired).
You don't need to start your own server :) The Tuscany runtime can take
care of that for you:
- Just place tuscany-http-tomcat-1.0-incubating-SNAPSHOT.jar or
tuscany-http-jetty-1.0-incubating-SNAPSHOT.jar on the classpath of the
J2SE program that starts Tuscany. I'm assuming that you're doing
something like this to start Tuscany:
public static void main(String[] args) {
SCADomain scaDomain =
SCADomain.newInstance("helloworldws.composite");
try {
System.out.println("HelloWorld server started (press enter
to shutdown)");
System.in.read();
} catch (IOException e) {
e.printStackTrace();
}
scaDomain.close();
System.out.println("HelloWorld server stopped");
}
When Tuscany starts, it'll boot up an embedded Tomcat or Jetty server
for you.
- Then, I'm assuming that you're extending Tuscany with a new Component
implementation extension, so if you've already done that you must have
written an ImplementationProviderFactory. In your
ImplementationProviderFactory constructor do this:
public class RESTFulStuffImplementationProviderFactory implements
ImplementationProviderFactory<RESTFulStuffImplementation> {
public
RESTFulStuffImplementationProviderFactory(ExtensionPointRegistry registry) {
ServletHostExtensionPoint servletHostExtensionPoint =
extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
// Here you can select whatever Servlet Host you have added to
your environment
// Typically people will only have one, Jetty or Tomcat, but if
you added both
// both JARs to your classpath you'll see two entries, and if
you really want
// to, then you can go over this list and pick the one that your
are interested
servletHost = servletHostExtensionPoint.getServletHosts().get(0);
}
- Then later in your code you can register whatever servlet you want to
register with that ServletHost, like this:
servletHost.addServletMapping("/my/restful/resource",
myRestFulThingServlet)
That being said, I don't know yet what your new component implementation
does and how it works, but I'm curious about why the component
implementation extension would need to deal with servlets directly. If
this is about talking REST / XML/HTTP then this is typically done in SCA
with a binding, independent of the component implementation itself.
Would you mind giving a little more background on what you're doing in
the component implementation to help me understand?
Thanks...
Any help and ideas are appreciated.
-Florian
--
Jean-Sebastien
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]