geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <>
Subject Re: Custom resource factories in geronimo
Date Tue, 28 Oct 2008 07:11:19 GMT

On Oct 27, 2008, at 11:45 PM, Hearty wrote:

> My application is a web project (keeping war file for the deployment)
> and my application uses tomcat. I've an entry in context.xml as  
> follows.
> <Resource name="xy/filestorage" auth="Container"
> 		type="tools.filestorage.FileStorage"
> 		factory="tools.filestorage.FileStorageFactory"
> 		storageClassName="tools.filestorage.FileStorageFS"
> 		basePath="C:/tmp/files" />
> Later I am accessing xy/filestorage as jndi reference as below.
> <jee:jndi-lookup id="fileStorage"
>    jndi-name="java:comp/env/xy/filestorage" /> [This entry is used in
> applicationContext.xml
> , a spring based config file]
> I have a restriction to keep same jndi-name as mentioned above since
> I need to maintain the war file to compatible to tomcat as well as  
> apache
> geronimo
> Please provide me a solution for this with a sample code.

You are using proprietary features of tomcat so you'll have to  
duplicate the effect with proprietary features of geronimo.

I'm not very familiar with the Resource element: I think maybe it ends  
up creating an object.  In Geronimo you'll have to modify or extend  
that object to be a gbean and configure an instance somewhere  
accessible to your app such as the geronimo plan for your app.

Then in the part of the geronimo plan where you map jndi stuff such as  
resource-refs you need an element following this schema fragment:

     <xsd:complexType name="gbean-refType">
             <xsd:extension base="gernaming:abstract-naming-entryType">
                     <xsd:element name="ref-name" type="xsd:string">
                                 The element ref-name is used to  
identify this
                                 gbean reference. This name should be  
unique in a
                                 module and will be used by  
application to as a
                                 part of JNDI name for the referenced  
gbean. The
                                 JNDI name used will be "java:/comp/ 
                                 It should map to the "ref-name"  
provided in
                                 deployment descriptor.
                     <xsd:element name="ref-type" type="xsd:string"  
                                 The element ref-type is used to  
specify the
                                 interface implemented by GBean being  
                     <xsd:choice minOccurs="0" maxOccurs="unbounded">
                         <xsd:element name="pattern"
                                     The element pattern is used to  
                                     additional selection criterion  
for gbeans if
                                     multiple gbeans with same name  
exists in
                                     dependency modules. The pattern  
                                     should result in single gbean.

Hope this helps..... this is a bit of a user list question.  Ask if  
you need more hints.

david jencks

> djencks wrote:
>> On Oct 24, 2008, at 1:49 AM, Hearty Raphael wrote:
>>> Hi
>>>         Is there any way I can create custom resource factories/
>>> ObjectFactories in geronimo.?
>> probably, but knowing exactly what you are trying to achieve would
>> help a lot.  Geronimo has no persistent jndi so there's usually an
>> easier or more direct way to get stuff into jndi.
>> thanks
>> david jencks
>>> Regards,
>>> Hearty
> -- 
> View this message in context:
> Sent from the Apache Geronimo - Dev mailing list archive at  

View raw message