[Mulgara-dev] Blobs and MulgaraTransactionManager

Eric Brown yogieric.dev at gmail.com
Tue Apr 3 06:56:03 UTC 2007


Hi Andrae, (Your name is on the MulgaraTransactionManager)

Topaz would like to modify mulgara slightly so that we can write a  
BLOB management service next to mulgara but within the same JOTM  
session. As you know, we use SOAP to talk to mulgara. Our plan is to  
use REST to talk to our BLOB service.  Essentially what we're  
shooting for is this:

begin
POST /blobservlet -> identifier
insert s p identifier (via soap)
end

I'm new to JTA and mulgara internals so am feeling around a bit in  
the dark. But my thought is that I'd like to try and make a call to  
the ItqlInterpreter between _begin_ and _POST_ and get a handle (a  
string) to the mulgara transaction (or mulgara session which can then  
map to the transaction) and send that handle with the POST so that I  
can get the specific BLOB resource to enlist its XAResource. Do you  
see a better way or a problem here? Any suggestions on how to do this  
mapping and expose relevant interfaces?


I imagine it might be less hassle (from a JTA standards perspective)  
if we tried to use the same soap session and used soap attachments to  
stream blobs to and from our new blob service. But I'm a bit confused  
from the JTA docs as they imply I should use JNDI to grab a  
"java:comp/UserTransaction" to enlist my XAResource. I don't think  
Mulgara's handling of JOTM would support that and the (oldish) JTA  
specs I looked at never mentioned SOAP -- not sure if using JNDI is  
the right way in this context. But all said, I'd rather stream with  
REST than SOAP unless using SOAP somehow greatly simplifies the JTA  
implementation.


It looks like Mulgara is acting like both a container (application  
server) and the application with the resolvers being the resource  
managers? That's my read anyway. Do you know any other way to hook in?


BTW, our fall-back idea is to write a resolver that also has a  
servlet service() method and would maintain some resource-id to  
XAResource mapping such that we'd have the following (simplified)  
semantics:

begin
select $urlWithEmbededResourceId from <blobModel>
   where s <blob:isMutable> $urlWithEmbededResourceId;
POST urlWithEmbededResourceId
end

The returned url of course would be specific to the current  
transaction and invalid outside the transaction. The url could be a  
literal or a uri, doesn't matter as far as I can tell.

I believe this can be done without any modifications to mulgara. The  
advantages of this approach are that we can add additional predicates  
to our resolver to get meta-data about the blobs. The disadvantages  
though are this ugly transient url and the fact that mulgara now  
needs to manage more things - knowledge of blobs and this resource-id  
to XA mapping. It is hard to say how important querying meta-data  
inside mulgara is (instead of through the BLOB REST service). Of  
course we can still write a custom resolver later just to get the  
meta-data.

Cheers,
Eric




More information about the Mulgara-dev mailing list