1 23 24 package com.sun.ejb.containers.builder; 25 26 import java.lang.reflect.Method ; 27 28 import java.net.InetAddress ; 29 30 import java.util.logging.Logger ; 31 import java.util.logging.Level ; 32 33 import com.sun.ejb.spi.sfsb.initialization.PersistenceStrategyBuilder; 34 import com.sun.ejb.spi.sfsb.initialization.SFSBContainerInitialization; 35 import com.sun.ejb.spi.sfsb.util.CheckpointPolicy; 36 37 import com.sun.ejb.base.container.util.CacheProperties; 38 39 import com.sun.ejb.base.sfsb.util.CheckpointPolicyImpl; 40 import com.sun.ejb.base.sfsb.util.ScrambledKeyGenerator; 41 import com.sun.ejb.base.sfsb.util.SimpleKeyGenerator; 42 43 import com.sun.ejb.containers.BaseContainer; 44 import com.sun.ejb.containers.StatefulSessionContainer; 45 46 import com.sun.enterprise.config.ConfigContext; 47 48 import com.sun.enterprise.deployment.EjbDescriptor; 49 import com.sun.enterprise.deployment.EjbMessageBeanDescriptor; 50 51 import com.sun.enterprise.SecurityManager; 52 import com.sun.enterprise.util.Utility; 53 54 import com.sun.logging.LogDomains; 55 56 61 public abstract class BaseContainerBuilder { 62 63 protected static Logger _logger = 64 LogDomains.getLogger(LogDomains.EJB_LOGGER); 65 66 protected EjbDescriptor ejbDescriptor; 67 protected ClassLoader loader; 68 protected BaseContainer baseContainer; 69 70 private byte[] ipAddress; 72 private int port; 73 74 public BaseContainerBuilder() { 75 } 76 77 public final void buildContainer(EjbDescriptor ejbDescriptor, 78 ClassLoader loader, ConfigContext dynamicConfigContext) 79 throws Exception 80 { 81 this.ejbDescriptor = ejbDescriptor; 82 this.loader = loader; 83 84 readDescriptor(); 85 86 baseContainer = createContainer(ejbDescriptor, loader); buildComponents(dynamicConfigContext); } 89 90 public final BaseContainer getContainer() { 91 return baseContainer; 92 } 93 94 public final void postInitialize(SecurityManager sm) { 96 98 boolean hasHome = !(ejbDescriptor instanceof EjbMessageBeanDescriptor); 99 if (hasHome) { 100 } 103 } 104 105 107 protected abstract BaseContainer createContainer( 108 EjbDescriptor ejbDescriptor, ClassLoader loader) 109 throws Exception ; 110 111 protected abstract void buildComponents(ConfigContext dynamicConfigContext) 112 throws Exception ; 113 114 protected byte[] getIPAddress() { 115 return this.ipAddress; 116 } 117 118 protected int getPort() { 119 return this.port; 120 } 121 122 124 private void readDescriptor() { 125 this.ipAddress = new byte[4]; 127 try { 128 this.ipAddress = InetAddress.getLocalHost().getAddress(); 129 } catch (Exception ex) { 130 long val = System.identityHashCode(ipAddress) 131 + System.currentTimeMillis(); 132 Utility.longToBytes(val, this.ipAddress, 0); 133 } 134 135 this.port = 8080; 137 } 138 139 } 140 | Popular Tags |