geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: custom jndi resources
Date Thu, 10 Nov 2011 18:30:47 GMT
Usually strings in jndi are resource-env-ref not resource-ref?

david jencks

On Nov 10, 2011, at 10:21 AM, Radim Kolar wrote:

> i have in web.xml
> 
> <resource-ref>
> <description>Adresa Cassandra clusteru</description>
> <res-ref-name>cass</res-ref-name>
> <res-type>java.lang.String</res-type>
> <res-auth>Container</res-auth>
> <res-sharing-scope>Shareable</res-sharing-scope>
> </resource-ref>
> 
> I need  to define String resource and bind it to jndi to make application work. From
IBM documentation it seems that writing Gbean is needed:
> 
> >>>
> If you were exposing resources other than JMS or database resources through JNDI, you
> can do the same by writing GBeans to act as a wrapper around your resources. First,
> check for any plug-ins that are already available for exposing such resources as part
of
> JNDI in Community Edition.
> <<<
> 
> Because i need String then my custom bean must subclass String?
> 
> public  class StringWrapperGBeanimplements  InterfaceNamed {
> 
>    public  StringWrapperGBean(String  gbeanName) {
> 	super(gbeanName);
>    }
> 
>   private  static  final  GBeanInfo GBEAN_INFO;
> 
>    static  {
> 	    GBeanInfoBuilder infoFactory =new  GBeanInfoBuilder(
> 	    StringWrapperGBean.class.getName(), StringWrapperGBean.class);
> 
> 	    infoFactory.addAttribute("gbeanName",String.class,false);
> 	    infoFactory.addInterface(InterfaceNamed.class);
> 	    infoFactory.setConstructor(new  String[] {"gbeanName"  });
> 
> 	    GBEAN_INFO = infoFactory.getBeanInfo();
>        }
> 
>     public  static  GBeanInfo getGBeanInfo() {
> 		return  GBEAN_INFO;
>    }
> 
> I am kinda confused


Mime
View raw message