You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Samppa Saarela <Sa...@cs.Helsinki.FI> on 2004/08/07 11:37:23 UTC

Accessing global

Hi,

I'm building a system that uses rdf graph model (Jena) as it's data
model. The problem in short is that the model is non serializable.
Building "read-only" browser was extremely easy using Tapestry but
obviously I ran into problems when defining forms to edit the data. In
RDF everything (at least almost everything ;-)) can be referenced with
uri or with a set of uris (statement) so the graph and any pointer to
the graph is basically easily serializable.

I'm planning to use wrapper classes to the graph objects (i.e. nodes and
statements) to 1) restrict access to the model and 2) havinging them
serializable. The wrappers basically know the uris and how to access the
model from which to get the actual objects.

The question is how to access the non serializable data model (Jena). In
my first test I stored it in global and it seemed to work. Referencing
the global from Pages etc. works too (ofcourse) but how should I
reference the global from the wrapper classes? Should I pass them a
reference to the engine or could I use HiveMind or maybe Spring?
HiveMind seems very appealing but the problem remains how to access the
registry from the wrappers. The actual datamodel and it's wrapper should
be singleton (though it can be duplicated on different servers in
clustered environment) since loading the model takes some time.

Any thoughts on the subject appreciated.

Regards
  Samppa


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


include problem

Posted by "Dmitry I. Zubarovsky" <au...@rambler.ru>.
Hello All!
In my component, i want to render a static file, locating under
tapestry context folder

In my components renderComponent() method
i am doing this:

pRequest.getRequestDispatcher("file.html").include(pRequest,
                    pResponse);

I see contents of "file.html" on a page but rendered in wrong place.

Any ideas how to solve this?

Dima


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


Re: Accessing global

Posted by Nikla Ratinen <ni...@dnainternet.net>.
On Sat, 2004-08-07 at 12:37, Samppa Saarela wrote:
> The question is how to access the non serializable data model (Jena). In
> my first test I stored it in global and it seemed to work. Referencing
> the global from Pages etc. works too (ofcourse) but how should I
> reference the global from the wrapper classes? Should I pass them a
> reference to the engine or could I use HiveMind or maybe Spring?
> HiveMind seems very appealing but the problem remains how to access the
> registry from the wrappers. The actual datamodel and it's wrapper should
> be singleton (though it can be duplicated on different servers in
> clustered environment) since loading the model takes some time.Hi,

In situations like this I've used java.lang.ThreadLocal successfully.

The idea is that you may use thread locals to access the engine
from anywhere as if it was a static singleton, ie. in your wrappers 
you may access engine/global with something like 

  MyEngine engine = MyEngine.getMyEngine();
  MyGlobal global = (MyGlobal) engine.getGlobal();

No need to pass references around, which is nice especially
when accessing synthetic getters/setters from ognl.

Override eg. service(RequestContext ctx) from engine to initialize the 
thread local to point to your engine before actually servicing the request. 
This works well since all your application code is most probably executed 
within service() anyway.
  
Of course thread locals only work well if you don't 
play tricks with threads in your app ;)

Rgds,
-- Nikla


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