ObjectFactory have to be defined in context.xml. tomee.xml doesnt define
jndi factories but directly objects
Le 6 avr. 2013 18:24, "[email protected]" <[email protected]>
a écrit :
> Assuming you had the following code:
>
> package com.jndi;
>
> import java.util.Hashtable;
> import javax.naming.Context;
> import javax.naming.Name;
> import javax.naming.NamingException;
> import javax.naming.RefAddr;
> import javax.naming.Reference;
> import javax.naming.spi.ObjectFactory;
>
> public class GitObjectFactory implements ObjectFactory {
>
> public GitObjectFactory() {
>
> }
>
> public Object getObjectInstance(Object obj, Name name, Context
> nameCtx,
> Hashtable environment) throws NamingException {
> GitConnection gitConnection = new GitConnection();
> // Customize the bean properties from our attributes
> Reference ref = (Reference) obj;
> RefAddr refAddr = ref.get("gitLocation");
> String value = (String) refAddr.getContent();
> gitConnection.setGitLocation(value);
> return gitConnection;
> }
>
> <Resource class-name="GitConnectionFactory">
> gitLocation C:\jGitClone\.git
> </Resource>
>
> In tomee.xml how would you do it?
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Getting-Started-TomEE-Plus-and-Custom-Resources-tp4662031p4662046.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>