1 19 package org.netbeans.modules.j2ee.sun.share.configbean; 20 21 import javax.enterprise.deploy.spi.DConfigBean ; 22 import javax.enterprise.deploy.spi.DeploymentConfiguration ; 23 import javax.enterprise.deploy.spi.exceptions.ConfigurationException ; 24 import javax.enterprise.deploy.model.DDBean ; 25 import javax.enterprise.deploy.model.DDBeanRoot ; 26 import javax.enterprise.deploy.model.DeployableObject ; 27 import javax.enterprise.deploy.model.J2eeApplicationObject ; 28 29 import org.netbeans.modules.j2ee.sun.share.Constants; 30 31 32 37 public abstract class AbstractDCBFactory implements DCBFactory, Constants { 38 39 abstract protected Class getClass(DDBean ddBean, Base dcbParent) throws ConfigurationException ; 40 41 public Base createDCB(DDBean ddBean, Base dcbParent) throws ConfigurationException { 42 Class dcbClass = getClass(ddBean, dcbParent); 43 48 Base newDCB = null; 49 51 try { 52 newDCB = (Base) dcbClass.newInstance(); 53 newDCB.init(ddBean, dcbParent); 54 } catch(InstantiationException ex) { 55 Object [] args = new Object [1]; 56 args[0] = dcbClass.getName(); 57 throw Utils.makeCE("ERR_UnexpectedInstantiateException", args, ex); } catch(IllegalAccessException ex) { 59 Object [] args = new Object [1]; 60 args[0] = dcbClass.getName(); 61 throw Utils.makeCE("ERR_UnexpectedIllegalAccessException", args, ex); } catch (RuntimeException ex) { 63 throw Utils.makeCE("ERR_UnexpectedRuntimeException", null, ex); } 65 66 81 return newDCB; 82 } 83 } 84 | Popular Tags |