1 22 package org.jboss.injection; 23 24 import org.jboss.naming.Util; 25 26 import javax.naming.LinkRef ; 27 import javax.naming.NamingException ; 28 29 35 public class ValueEncInjector implements EncInjector 36 { 37 private Object obj; 38 private String encName; 39 private String error; 40 41 public ValueEncInjector(String name, Object obj, String error) 42 { 43 this.obj = obj; 44 this.encName = name; 45 this.error = error; 46 } 47 48 public void inject(InjectionContainer container) 49 { 50 try 51 { 52 Util.rebind(container.getEnc(), encName, obj); 53 } 54 catch (NamingException e) 55 { 56 throw new RuntimeException (new StringBuilder ().append("could not bind enc name '").append(encName).append("' for ").append(error).append(" for container ").append(container.getIdentifier()).append(e.getMessage()).toString()); 57 } 58 } 59 } 60 | Popular Tags |