Alex,

Regarding the need to start/stop something along with the Component without 
creating a subclass, you should leverage the Service class and add it to the 
Component#services list. A Service has start() and stop() method that get 
invoked by the Component.

Regarding the JEE deployment, the ServerServlet adapter will look for a 
"/WEB-INF/restlet.xml" file to configure the Component. It should work well for 
you.

Best regards,
Jerome
--
Restlet ~ Founder and Technical Lead ~ http://www.restlet.o​rg
Noelios Technologies ~ http://www.noelios.com





-----Message d'origine-----
De : [email protected] [mailto:[email protected]] De la part de Alex 
Milowski
Envoyé : lundi 14 juin 2010 14:40
À : [email protected]
Objet : Re: Who is Using the Component XML Configuration?

On Sun, Jun 13, 2010 at 6:24 PM, Thierry Boileau <[email protected]> 
wrote:
> Hello Alex,
>
> could you precise the kind of adjustements you made?

Well, I've filed a couple small enhancement requests but I really have more 
things that I haven't started yet in mind.

For just about every project where I've used Restlet, I've developed a custom 
XML configuration for the component.
I did not switch over to try to use the XML configuration provided by the  
component when it became available.

My needs are somewhat more than what is provided by the current configuration 
XML.  My current theory is that I should be able to add to the configuration 
XML in Restlet to provide what I need.  It doesn't look like I'm that far away.

For example, in my Xeerkat [1] project, I use this XML to configure an agent:

<server xmlns='http://www.xeerkat.org/Vocabulary/Agent/Configuration/2007/1/0'>
   <!-- interfaces for http/https protocols -->
   <protocol name="http" address="*" port="8080"/>
   <!-- host names upon which the global services will be available
   <host name="localhost"/>
   -->
   <!-- global services
   <services href="services.xml"/>
   -->
   <agent id="[email protected]" password="password">
      <!-- host names on which the agent services will be available -->
      <host name="localhost"/>
      <services href="services.xml"/>
      <!-- You can add more services by just adding another service line
   <services href="services2.xml"/>
      -->
   </agent>
</server>

An agent binds a number of protocols running for the server and then connects 
to the XMPP id.  In reality, what I should be doing is attaching the services 
to the host or internal router and then exposing them via internal proxies 
between the actual Application instances.  I can do a lot of that with the 
current XML configuration + my 'href' enhancement.

One issue I'll have to address is that a lot of my current systems define 
global parameters/objects that are then used by applications within a 
particular host.  In my Component instance, I copy those particular objects as 
attributes in the child Context instance created for those applications.  I'll 
have to see if there is a good way to extract and represent that configuration 
pattern.

The XML configurations in my Atomojo [2] project are much more complicated to 
convert over and I'm not sure that is appropriate there but I do have a few 
candidates there as well.

Also, I keep developing the same kind of Component that needs to do something 
at start/stop but otherwise does exactly what the Component class does now.  
I'd like to be able to configure a "module" that is started and stopped with 
the component so that I don't have to subclass Component.

I'm also curious as to how this kind of configuration XML is used in J2EE 
hosted environments.  I just run my restlet instances directly using Jetty or 
Grizzly.  I'd like this projects to be able to run in servlet containers as 
well but I don't see any good examples of people doing this with the XML 
configuration files.  I'd like to know if anyone is doing that.

[1] http://code.google.com/p/xeerkat/
[2] http://code.google.com/p/atomojo/

--Alex Milowski

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2621140

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2652408

Reply via email to