FileStrategyBuilderpublic class FileStrategyBuilder extends AbstractPersistenceStrategyBuilder Class to initialize Container with File based persistence |
Constructors Summary |
---|
public FileStrategyBuilder()Creates a new instance of FileStrategyBuilder
|
Methods Summary |
---|
private com.sun.ejb.spi.sfsb.store.SFSBStoreManager | createStoreManager(com.sun.ejb.spi.sfsb.initialization.SFSBContainerInitialization container, com.sun.enterprise.deployment.EjbDescriptor descriptor)
//Step 1. Create the StoreManager
FileStoreManager manager = new FileStoreManager();
//Step 2. Create a Map that contains store specific paramteters
Map map = new HashMap();
map.put(FileStoreManagerConstants.STORE_MANAGER_NAME,
descriptor.getName());
map.put(FileStoreManagerConstants.CONTAINER_ID,
new Long(descriptor.getUniqueId()));
CacheProperties cacheProps = new CacheProperties(descriptor);
map.put(FileStoreManagerConstants.SESSION_TIMEOUT_IN_SECONDS,
new Integer(cacheProps.getRemovalTimeoutInSeconds()));
map.put(FileStoreManagerConstants.GRACE_SESSION_TIMEOUT_IN_SECONDS,
new Integer(super.getRemovalGracePeriodInSeconds()));
map.put(FileStoreManagerConstants.PASSIVATION_DIRECTORY_NAME,
getPassivationDirectoryName(descriptor));
//Step 3. Initialize the store with the Map
_logger.log(Level.FINE, "Initialzing FileStoreManager with: " + map);
manager.initSessionStore(map);
_logger.log(Level.FINE, "INITIALZED FileStoreManager: " + manager);
return manager;
| private java.lang.String | getPassivationDirectoryName(com.sun.enterprise.deployment.EjbDescriptor desc)
String passivationDirName = null;
try {
// runtime server context
ServerContext ctx = ApplicationServer.getServerContext();
// environment object for this server instance
InstanceEnvironment env = ctx.getInstanceEnvironment();
// application object associated with this ejb
Application application = desc.getApplication();
String dirName = null;
String componentSeparator = "_";
if (application.isVirtual()) {
// ejb is part of a stand alone ejb module
String archURI = desc.getEjbBundleDescriptor().
getModuleDescriptor().getArchiveUri();
passivationDirName = env.getModulePassivatedEjbPath()
+ File.separator + FileUtils.makeFriendlyFilename(archURI)
+ componentSeparator + desc.getName();
} else {
// ejb is part of an application
passivationDirName = env.getApplicationPassivatedEjbPath()
+ File.separator + application.getRegistrationName()
+ componentSeparator + desc.getName()
+ componentSeparator + desc.getUniqueId();
}
} catch (Throwable th) {
_logger.log(Level.SEVERE,
"ejb.sfsb_helper_get_passivation_dir_failed", th);
}
return passivationDirName;
| public void | initializePersistenceStrategy(com.sun.ejb.spi.sfsb.initialization.SFSBContainerInitialization container, com.sun.enterprise.deployment.EjbDescriptor descriptor)
try {
super.initializePersistenceStrategy(container, descriptor);
SFSBStoreManager storeManager = createStoreManager(
container, descriptor);
container.setSFSBStoreManager(storeManager);
} catch (Throwable th) {
_logger.log(Level.SEVERE, "Could not initialize container "
+ "using FilestrategyBuilder", th);
}
|
|