Methods Summary |
---|
private java.lang.String | cleanFileParts(java.lang.String fileString)
String fileMainPart = getFileMainPart(fileString);
String fileSuffixPart = getFileSuffixPart(fileString);
if(fileMainPart == null) {
return null;
}
if(fileSuffixPart == null) {
return fileMainPart;
} else {
return fileMainPart + "." + fileSuffixPart;
}
|
private java.lang.String | getFileMainPart(java.lang.String fileString)
ArrayList results = new ArrayList();
StringTokenizer st = new StringTokenizer(fileString, ".");
while (st.hasMoreTokens()) {
results.add(st.nextToken());
}
if(results.size() > 0) {
return stripNonAlphaNumericsExceptUnderscore((String)results.get(0));
} else {
return null;
}
|
protected java.lang.String | getFilePartOf(java.lang.String str)
if(str == null)
return str;
int lastSlashIdx = str.lastIndexOf(File.separator);
String result = null;
if(lastSlashIdx == -1) {
result = cleanFileParts(str);
} else {
result = cleanFileParts(str.substring(lastSlashIdx + 1, str.length()));
}
//System.out.println("getFilePartOf result = " + result);
return result;
|
private java.lang.String | getFileSuffixPart(java.lang.String fileString)
ArrayList results = new ArrayList();
StringTokenizer st = new StringTokenizer(fileString, ".");
while (st.hasMoreTokens()) {
results.add(st.nextToken());
}
if(results.size() > 1) {
return stripNonAlphaNumericsExceptUnderscore((String)results.get(1));
} else {
return null;
}
|
public java.lang.String | getPassedInPersistenceType()
return _passedInPersistenceType;
|
public java.lang.String | getPersistenceFrequency()
return _persistenceFrequency;
|
public java.lang.String | getPersistenceScope()
return _persistenceScope;
|
public void | initializePersistenceStrategy(org.apache.catalina.Context ctx, com.sun.enterprise.deployment.runtime.web.SessionManager smBean)
//this method sets default values
//it may be extended in builder subclasses which will have their
//own inst vars for additional params
this.setDefaultParams(ctx, smBean );
//this method reads server instance-level parameter values from server.xml.
//Any values found here will over-ride defaults
//This method may be extended in builder subclasses which will have their
//own inst vars for additional params
this.readInstanceLevelParams();
//this method reads web app parameter values from sun-web.xml
//Any values found here will over-ride defaults & instance-level values
//This method may be extended in builder subclasses which will have their
//own inst vars for additional params
this.readWebAppParams(ctx, smBean);
ctx.setBackgroundProcessorDelay(reapInterval);
|
protected java.lang.String | prependContextPathTo(java.lang.String str, org.apache.catalina.Context ctx)
if(str == null)
return str;
String filePart = getFilePartOf(str);
if(filePart == null || filePart.equals("")) {
return null;
}
String strippedContextPath = stripNonAlphaNumericsExceptUnderscore(ctx.getPath());
String modifiedFilePart = null;
if(strippedContextPath != null && !strippedContextPath.equals("")) {
modifiedFilePart = strippedContextPath + "_" + filePart;
} else {
modifiedFilePart = filePart;
}
int lastSlashIdx = str.lastIndexOf(File.separator);
String result = null;
if(lastSlashIdx == -1) {
result = modifiedFilePart;
} else {
String firstPart = str.substring(0, lastSlashIdx);
result = firstPart + File.separator + modifiedFilePart;
}
//System.out.println("BasePersistenceStrategyBuilder>>prependContextPathTo: " + result);
return result;
|
public void | readInstanceLevelParams()
//debug("in readInstanceLevelParams");
ServerConfigLookup lookup = new ServerConfigLookup();
com.sun.enterprise.config.serverbeans.SessionManager smBean =
//com.iplanet.ias.config.serverbeans.SessionManager smBean =
lookup.getInstanceSessionManager();
if (smBean != null) {
// The persistence-type controls what properties of the
// session manager can be configured
//take these 2 lines out
//String pType = smBean.getAttributeValue("persistence-type");
//persistence = PersistenceType.parseType(pType);
com.sun.enterprise.config.serverbeans.ManagerProperties mgrBean =
//com.iplanet.ias.config.serverbeans.ManagerProperties mgrBean =
smBean.getManagerProperties();
if (mgrBean != null) {
// manager reap-interval-in-seconds
String reapIntervalInSecondsString = mgrBean.getReapIntervalInSeconds();
if (reapIntervalInSecondsString != null) {
try {
reapInterval = Integer.parseInt(reapIntervalInSecondsString);
_logger.finest(" mgr reapInterval set = " + reapInterval);
} catch (NumberFormatException e) {
// XXX need error message
}
} else {
if(_logger.isLoggable(Level.FINEST)) {
_logger.finest("no instance level value set for mgr reapInterval");
}
/* not correct message
Object[] params = { "reap-interval-in-seconds" };
_logger.log(Level.INFO, "webcontainer.notYet", params);
*/
}
//max-sessions
String maxSessionsString = mgrBean.getMaxSessions();
if (maxSessionsString != null) {
try {
maxSessions = Integer.parseInt(maxSessionsString);
_logger.finest("maxSessions set = " + maxSessions);
} catch (NumberFormatException e) {
// XXX need error message
}
} else {
if(_logger.isLoggable(Level.FINEST)) {
_logger.finest("no instance level value set for maxSessions");
}
/* not correct message
Object[] params = { "max-sessions" };
_logger.log(Level.INFO, "webcontainer.notYet", params);
*/
}
//session-file-name
String sessionFilenameString = mgrBean.getSessionFileName();
if (sessionFilenameString != null) {
sessionFilename = sessionFilenameString;
_logger.finest("sessionFilename set = " + sessionFilename);
}
// START CR 6275709
sessionIdGeneratorClassname =
mgrBean.getSessionIdGeneratorClassname();
if (sessionIdGeneratorClassname != null
&& _logger.isLoggable(Level.FINEST)) {
_logger.finest("sessionIdGeneratorClassname set = "
+ sessionIdGeneratorClassname);
}
// END CR 6275709
//now do properties under <manager-properties> element
com.sun.enterprise.config.serverbeans.ElementProperty[] props =
mgrBean.getElementProperty();
for (int i = 0; i < props.length; i++) {
String name = props[i].getAttributeValue("name");
String value = props[i].getAttributeValue("value");
//maxIdleBackupSeconds
if (name.equalsIgnoreCase("maxIdleBackupSeconds")) {
try {
maxIdleBackup = Integer.parseInt(value);
} catch (NumberFormatException e) {
// XXX need error message
}
}
}
}
com.sun.enterprise.config.serverbeans.StoreProperties storeBean =
//com.iplanet.ias.config.serverbeans.StoreProperties storeBean =
smBean.getStoreProperties();
if (storeBean != null) {
//store reap-interval-in-seconds
String reapIntervalInSecondsString = storeBean.getReapIntervalInSeconds();
if (reapIntervalInSecondsString != null) {
try {
storeReapInterval = Integer.parseInt(reapIntervalInSecondsString);
_logger.finest("storeReapInterval set = " + storeReapInterval);
} catch (NumberFormatException e) {
// XXX need error message
}
}
//directory
String directoryString = storeBean.getDirectory();
if (directoryString != null) {
directory = directoryString;
_logger.finest("directory set = " + directoryString);
}
}
}
//com.iplanet.ias.config.serverbeans.SessionProperties spBean =
com.sun.enterprise.config.serverbeans.SessionProperties spBean =
lookup.getInstanceSessionProperties();
if (spBean != null) {
//session timeout-in-seconds
String timeoutSecondsString = spBean.getTimeoutInSeconds();
if (timeoutSecondsString != null) {
try {
sessionMaxInactiveInterval = Integer.parseInt(timeoutSecondsString);
_logger.finest("sessionMaxInactiveInterval set = " + sessionMaxInactiveInterval);
} catch (NumberFormatException e) {
// XXX need error message
}
} else {
if(_logger.isLoggable(Level.FINEST)) {
_logger.finest("no instance level value set for sessionMaxInactiveInterval");
}
/* not correct message
Object[] params = { "timeout-in-seconds" };
_logger.log(Level.INFO, "webcontainer.notYet", params);
*/
}
}
|
public void | readWebAppParams(org.apache.catalina.Context ctx, com.sun.enterprise.deployment.runtime.web.SessionManager smBean)
if (smBean != null) {
// The persistence-type controls what properties of the
// session manager can be configured
//take these 2 lines out
//String pType = smBean.getAttributeValue("persistence-type");
//persistence = PersistenceType.parseType(pType);
ManagerProperties mgrBean = smBean.getManagerProperties();
if ((mgrBean != null) && (mgrBean.sizeWebProperty() > 0)) {
WebProperty[] props = mgrBean.getWebProperty();
for (int i = 0; i < props.length; i++) {
//String name = props[i].getAttributeValue("name");
//String value = props[i].getAttributeValue("value");
String name = props[i].getAttributeValue(WebProperty.NAME);
String value = props[i].getAttributeValue(WebProperty.VALUE);
if (name.equalsIgnoreCase("reapIntervalSeconds")) {
try {
reapInterval = Integer.parseInt(value);
} catch (NumberFormatException e) {
// XXX need error message
}
} else if (name.equalsIgnoreCase("maxSessions")) {
try {
maxSessions = Integer.parseInt(value);
} catch (NumberFormatException e) {
// XXX need error message
}
} else if (name.equalsIgnoreCase("maxIdleBackupSeconds")) {
try {
maxIdleBackup = Integer.parseInt(value);
} catch (NumberFormatException e) {
// XXX need error message
}
} else if (name.equalsIgnoreCase("sessionFilename")) {
sessionFilename = value;
} else if (name.equalsIgnoreCase("persistenceFrequency")) {
_persistenceFrequency = value;
} else {
Object[] params = { name };
_logger.log(Level.INFO, "webcontainer.notYet", params);
}
}
}
StoreProperties storeBean = smBean.getStoreProperties();
if ((storeBean != null) && (storeBean.sizeWebProperty() > 0)) {
WebProperty[] props = storeBean.getWebProperty();
for (int i = 0; i < props.length; i++) {
//String name = props[i].getAttributeValue("name");
//String value = props[i].getAttributeValue("value");
String name = props[i].getAttributeValue(WebProperty.NAME);
String value = props[i].getAttributeValue(WebProperty.VALUE);
if (name.equalsIgnoreCase("reapIntervalSeconds")) {
try {
storeReapInterval = Integer.parseInt(value);
} catch (NumberFormatException e) {
// XXX need error message
}
} else if (name.equalsIgnoreCase("directory")) {
directory = value;
} else if (name.equalsIgnoreCase("persistenceScope")) {
_persistenceScope = value;
} else {
Object[] params = { name };
_logger.log(Level.INFO, "webcontainer.notYet", params);
}
}
}
}
|
public void | setDefaultParams(org.apache.catalina.Context ctx, com.sun.enterprise.deployment.runtime.web.SessionManager smBean)
reapInterval = DEFAULT_REAP_INTERVAL;
maxSessions = -1;
//take this out
//PersistenceType persistence = PersistenceType.MEMORY;
// Default settings for persistence-type = 'memory'
sessionFilename = DEFAULT_SESSION_FILENAME;
// Default settings for persistence-type = 'file'
storeReapInterval = DEFAULT_REAP_INTERVAL;
directory = ((StandardContext) ctx).getWorkDir();
|
public void | setLogger(java.util.logging.Logger logger)
_logger = logger;
|
public void | setPassedInPersistenceType(java.lang.String persistenceType)
_passedInPersistenceType = persistenceType;
|
public void | setPersistenceFrequency(java.lang.String persistenceFrequency)
_persistenceFrequency = persistenceFrequency;
|
public void | setPersistenceScope(java.lang.String persistenceScope)
_persistenceScope = persistenceScope;
|
protected java.lang.String | stripNonAlphaNumerics(java.lang.String inputString)this method strips out all non-alphanumeric characters
StringBuffer sb = new StringBuffer(50);
for(int i=0; i<inputString.length(); i++) {
char nextChar = inputString.charAt(i);
if(Character.isLetterOrDigit(nextChar)) {
sb.append(nextChar);
}
}
return sb.toString();
|
protected java.lang.String | stripNonAlphaNumericsExceptUnderscore(java.lang.String inputString)this method strips out all non-alphanumeric characters
StringBuffer sb = new StringBuffer(50);
for(int i=0; i<inputString.length(); i++) {
char nextChar = inputString.charAt(i);
if(Character.isLetterOrDigit(nextChar) || "_".equals(String.valueOf(nextChar))) {
sb.append(nextChar);
}
}
return sb.toString();
|
protected java.lang.String | stripNonAlphas(java.lang.String inputString)this method strips out all non-alpha characters
StringBuffer sb = new StringBuffer(50);
for(int i=0; i<inputString.length(); i++) {
char nextChar = inputString.charAt(i);
if(Character.isLetter(nextChar)) {
sb.append(nextChar);
}
}
return sb.toString();
|