[jboss-cvs] JBossAS SVN: r66949 - projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Nov 11 10:28:21 EST 2007
Author: bstansberry at jboss.com
Date: 2007-11-11 10:28:21 -0500 (Sun, 11 Nov 2007)
New Revision: 66949
Added:
projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/ReplicationGranularity.java
projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/ReplicationTrigger.java
projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/SnapshotMode.java
Modified:
projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/JBossWebMetaData.java
projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/PassivationConfig.java
projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/ReplicationConfig.java
Log:
[JBAS-4960] Fix clustering related elements of JBossWebMetaData -- first pass
Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/JBossWebMetaData.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/JBossWebMetaData.java 2007-11-10 14:13:58 UTC (rev 66948)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/JBossWebMetaData.java 2007-11-11 15:28:21 UTC (rev 66949)
@@ -149,35 +149,10 @@
*/
private HashMap arbitraryMetadata = new HashMap();
- public static final int SESSION_INVALIDATE_ACCESS = 0;
- public static final int SESSION_INVALIDATE_SET_AND_GET = 1;
- public static final int SESSION_INVALIDATE_SET_AND_NON_PRIMITIVE_GET = 2;
- public static final int SESSION_INVALIDATE_SET = 3;
-
- private int invalidateSessionPolicy = SESSION_INVALIDATE_SET_AND_NON_PRIMITIVE_GET;
-
- public static final int REPLICATION_TYPE_SYNC = 0;
- public static final int REPLICATION_TYPE_ASYNC = 1;
-
- /** Specify the session replication granularity level: session --- whole session level,
- * attribute --- per attribute change, field --- fine grained user object level.
- *
- */
- public static final int REPLICATION_GRANULARITY_SESSION = 0;
- public static final int REPLICATION_GRANULARITY_ATTRIBUTE = 1;
- public static final int REPLICATION_GRANULARITY_FIELD = 2;
- private int replicationGranularity = REPLICATION_GRANULARITY_SESSION;
-
/**
- * If the replication granularity is FIELD, specify whether to use batch mode
- * for pojo replication or not.
- */
- private boolean replicationFieldBatchMode = true;
-
- /**
* The maximum number of active sessions allowed, or -1 for no limit
*/
- private int maxActiveSessions = -1;
+ private Integer maxActiveSessions = null;
/** Should the context use session cookies or use default */
private int sessionCookies = SESSION_COOKIES_DEFAULT;
@@ -664,30 +639,6 @@
{
this.arbitraryMetadata = arbitraryMetadata;
}
- public int getInvalidateSessionPolicy()
- {
- return invalidateSessionPolicy;
- }
- public void setInvalidateSessionPolicy(int invalidateSessionPolicy)
- {
- this.invalidateSessionPolicy = invalidateSessionPolicy;
- }
- public boolean isReplicationFieldBatchMode()
- {
- return replicationFieldBatchMode;
- }
- public void setReplicationFieldBatchMode(boolean replicationFieldBatchMode)
- {
- this.replicationFieldBatchMode = replicationFieldBatchMode;
- }
- public int getReplicationGranularity()
- {
- return replicationGranularity;
- }
- public void setReplicationGranularity(int replicationGranularity)
- {
- this.replicationGranularity = replicationGranularity;
- }
public boolean isFlushOnSessionInvalidation()
{
return flushOnSessionInvalidation;
@@ -696,14 +647,24 @@
{
this.flushOnSessionInvalidation = flushOnSessionInvalidation;
}
+ /** FIXME Remove once a release with getMaxActiveSessions() is used by AS */
public int getMaxActiveSession()
{
- return maxActiveSessions;
+ return maxActiveSessions == null ? -1 : maxActiveSessions.intValue();
}
+ /** FIXME Remove once a release with setMaxActiveSessions() is used by AS */
public void setMaxActiveSession(int maxActiveSessions)
{
this.maxActiveSessions = maxActiveSessions;
}
+ public Integer getMaxActiveSessions()
+ {
+ return maxActiveSessions;
+ }
+ public void setMaxActiveSessions(Integer maxActiveSessions)
+ {
+ this.maxActiveSessions = maxActiveSessions;
+ }
public PassivationConfig getPassivationConfig()
{
return passivationConfig;
@@ -1087,15 +1048,6 @@
if(override != null && override.arbitraryMetadata!= null)
setArbitraryMetadata(override.arbitraryMetadata);
- if(override != null && override.invalidateSessionPolicy >= 0)
- setInvalidateSessionPolicy(override.invalidateSessionPolicy);
-
- if(override != null && override.replicationGranularity >= 0)
- setReplicationGranularity(override.replicationGranularity);
-
- if(override != null && override.replicationFieldBatchMode)
- setReplicationFieldBatchMode(override.replicationFieldBatchMode);
-
if(override != null && override.maxActiveSessions != -1)
setMaxActiveSession(override.maxActiveSessions);
Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/PassivationConfig.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/PassivationConfig.java 2007-11-10 14:13:58 UTC (rev 66948)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/PassivationConfig.java 2007-11-11 15:28:21 UTC (rev 66949)
@@ -27,6 +27,11 @@
* Represents a <passivation-config> element of the jboss-web.xml
* deployment descriptor
*
+ * FIXME There are overloaded versions of most of the properties here that are of
+ * type String. This is just part of a dance to convert the AS to the real types
+ * without having to risk breaking the AS build. I'll migrate the API over a couple
+ * snapshot releases of jboss-metadata.jar.
+ *
* @author Brian Stansberry
* @version <tt>$Revision$</tt>
*/
@@ -41,49 +46,79 @@
* If true then the session passivation is enabled for this web app.
* If false then the session passivation is disabled for this web app.
*/
- protected String useSessionPassivation;
+ private Boolean useSessionPassivation;
/**
* Min time (seconds) the session must be idle since lastAccesstime before it's eligable for passivation
* This overrides maxActive_, to prevent thrashing if the there are lots of active sessions.
* Setting to -1 means it's ignored
*/
- protected String passivationMinIdleTime;
+ private Integer passivationMinIdleTime;
/**
* Max time (seconds) the session must be idle since lastAccesstime before it's eligable for passivation
* This overrides maxActive_, to prevent thrashing if the there are lots of active sessions.
* Setting to -1 means session should not be forced out.
*/
- protected String passivationMaxIdleTime;
+ private Integer passivationMaxIdleTime;
public String getPassivationMaxIdleTime()
{
- return passivationMaxIdleTime == null ? IGNORE : passivationMaxIdleTime;
+ return passivationMaxIdleTime == null ? IGNORE : passivationMaxIdleTime.toString();
}
public void setPassivationMaxIdleTime(String passivationMaxIdleTime)
{
- this.passivationMaxIdleTime = passivationMaxIdleTime;
+ this.passivationMaxIdleTime = (passivationMaxIdleTime == null) ? null : Integer.valueOf(passivationMaxIdleTime);
}
public String getPassivationMinIdleTime()
{
- return passivationMinIdleTime == null ? IGNORE : passivationMinIdleTime;
+ return passivationMinIdleTime == null ? IGNORE : passivationMinIdleTime.toString();
}
public void setPassivationMinIdleTime(String passivationMinIdleTime)
{
- this.passivationMinIdleTime = passivationMinIdleTime;
+ this.passivationMinIdleTime = (passivationMinIdleTime == null) ? null : Integer.valueOf(passivationMinIdleTime);
}
public String getUseSessionPassivation()
{
- return useSessionPassivation;
+ return (useSessionPassivation == null) ? null : useSessionPassivation.toString();
}
public void setUseSessionPassivation(String useSessionPassivation)
{
+ this.useSessionPassivation = (useSessionPassivation == null) ? null : Boolean.valueOf(useSessionPassivation);
+ }
+
+ public Integer getPassivationMaxIdleTimeInteger()
+ {
+ return passivationMaxIdleTime;
+ }
+
+ public void setPassivationMaxIdleTimeInteger(Integer passivationMaxIdleTime)
+ {
+ this.passivationMaxIdleTime = passivationMaxIdleTime;
+ }
+
+ public Integer getPassivationMinIdleTimeInteger()
+ {
+ return passivationMinIdleTime;
+ }
+
+ public void setPassivationMinIdleTimeInteger(Integer passivationMinIdleTime)
+ {
+ this.passivationMinIdleTime = passivationMinIdleTime;
+ }
+
+ public Boolean getUseSessionPassivationBoolean()
+ {
+ return useSessionPassivation;
+ }
+
+ public void setUseSessionPassivation(Boolean useSessionPassivation)
+ {
this.useSessionPassivation = useSessionPassivation;
}
Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/ReplicationConfig.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/ReplicationConfig.java 2007-11-10 14:13:58 UTC (rev 66948)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/ReplicationConfig.java 2007-11-11 15:28:21 UTC (rev 66949)
@@ -26,50 +26,83 @@
/**
* Represents a <replication-config> element of the jboss-web.xml deployment descriptor
*
+ * FIXME There are overloaded versions of most of the properties here that are of
+ * type String. This is just part of a dance to convert the AS to the real types
+ * without having to risk breaking the AS build. I'll migrate the API over a couple
+ * snapshot releases of jboss-metadata.jar.
+ *
* @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
* @version <tt>$Revision$</tt>
*/
public class ReplicationConfig extends IdMetaDataImpl
{
private static final long serialVersionUID = 1;
- protected String trigger;
- protected String granularity;
- protected String fieldBatchMode;
- protected String defaultCacheName;
+ protected ReplicationTrigger trigger;
+ protected ReplicationGranularity granularity;
+ protected Boolean fieldBatchMode;
protected String cacheName;
- protected String useJK;
- protected String snapshotMode;
- protected String snapshotInterval;
- protected String useLocalCache;
+ protected Boolean useJK;
+ protected SnapshotMode snapshotMode;
+ protected Integer snapshotInterval;
- public String getTrigger()
+ public ReplicationTrigger getReplicationTrigger()
{
return trigger;
}
+ public void setReplicationTrigger(ReplicationTrigger trigger)
+ {
+ this.trigger = trigger;
+ }
+
+ public ReplicationGranularity getReplicationGranularity()
+ {
+ return granularity;
+ }
+
+ public void setReplicationGranularity(ReplicationGranularity granularity)
+ {
+ this.granularity = granularity;
+ }
+
+ public Boolean getReplicationFieldBatchMode()
+ {
+ return fieldBatchMode;
+ }
+
+ public void setReplicationFieldBatchMode(Boolean fieldBatchMode)
+ {
+ this.fieldBatchMode = fieldBatchMode;
+ }
+
+ public String getTrigger()
+ {
+ return trigger == null ? null : trigger.toString();
+ }
+
public void setTrigger(String trigger)
{
- this.trigger = (trigger == null ? null : trigger.toUpperCase());
+ this.trigger = (trigger == null ? null : ReplicationTrigger.fromString(trigger));
}
public String getGranularity()
{
- return granularity;
+ return granularity == null ? null : granularity.toString();
}
public void setGranularity(String granularity)
{
- this.granularity = (granularity == null ? null : granularity.toUpperCase());
+ this.granularity = (granularity == null ? null : ReplicationGranularity.fromString(granularity));
}
public String getFieldBatchMode()
{
- return fieldBatchMode;
+ return fieldBatchMode == null ? null : fieldBatchMode.toString();
}
public void setFieldBatchMode(String fieldBatchMode)
{
- this.fieldBatchMode = fieldBatchMode;
+ this.fieldBatchMode = fieldBatchMode == null ? null : new Boolean(Boolean.valueOf(fieldBatchMode));
}
public String getCacheName()
@@ -82,105 +115,88 @@
this.cacheName = cacheName;
}
- public String getDefaultCacheName()
+ public String getSnapshotInterval()
{
- return defaultCacheName;
+ return snapshotInterval == null ? null : snapshotInterval.toString();
}
- public void setDefaultCacheName(String defaultCacheName)
+ public void setSnapshotInterval(String snapshotInterval)
{
- this.defaultCacheName = defaultCacheName;
+ this.snapshotInterval = (snapshotInterval == null) ? null : Integer.valueOf(snapshotInterval);
}
- public String getSnapshotInterval()
+ public Integer getSnapshotIntervalInteger()
{
- return snapshotInterval;
+ return snapshotInterval == null ? 0 : snapshotInterval.intValue();
}
- public void setSnapshotInterval(String snapshotInterval)
+ public void setSnapshotIntervalInteger(Integer snapshotInterval)
{
this.snapshotInterval = snapshotInterval;
}
public String getSnapshotMode()
{
- return snapshotMode;
+ return snapshotMode == null ? null : snapshotMode.toString();
}
public void setSnapshotMode(String snapshotMode)
{
- this.snapshotMode = snapshotMode;
+ this.snapshotMode = snapshotMode == null ? null : SnapshotMode.fromString(snapshotMode);
}
- public String getUseJK()
+ public SnapshotMode getSnapshotModeEnum()
{
- return useJK;
+ return snapshotMode;
}
- public void setUseJK(String useJK)
+ public void setSnapshotModeEnum(SnapshotMode snapshotMode)
{
- this.useJK = useJK;
+ this.snapshotMode = snapshotMode;
}
- public String getUseLocalCache()
+ public String getUseJK()
{
- return useLocalCache;
+ return useJK == null ? null : useJK.toString();
}
- public void setUseLocalCache(String useLocalCache)
+ public void setUseJK(String useJK)
{
- this.useLocalCache = useLocalCache;
+ this.useJK = (useJK == null) ? null : Boolean.valueOf(useJK);
}
-
- public void setDefaultSnapshotMode(String mode)
+
+ public Boolean getUseJKBoolean()
{
- if (isEmpty(snapshotMode))
- {
- snapshotMode = mode;
- }
+ return useJK;
}
-
- public void setDefaultSnapshotInterval(int interval)
+
+ public void setUseJKBoolean(Boolean useJK)
{
- if (isEmpty(snapshotInterval))
- {
- snapshotInterval = String.valueOf(interval);
- }
+ this.useJK = useJK;
}
-
- public void setDefaultUseJK(boolean useJK)
+
+ /** FIXME Remove */
+ public String getUseLocalCache()
{
- if (isEmpty(this.useJK))
- {
- this.useJK = String.valueOf(useJK);
- }
+ return "true";
}
-
- public void setDefaultUseLocalCache(boolean useLocal)
+
+ /** FIXME Remove */
+ public void setUseLocalCache(String useLocalCache)
{
- if (isEmpty(this.useLocalCache))
- {
- this.useLocalCache = String.valueOf(useLocal);
- }
+ // no-op
}
public String toString()
{
StringBuffer sb = new StringBuffer(100);
sb.append("cacheName=").append(cacheName)
- .append(";defaultCacheName=").append(defaultCacheName)
.append(";granularity=").append(granularity)
.append(";trigger=").append(trigger)
.append(";fieldBatchMode=").append(fieldBatchMode)
.append(";useJK=").append(useJK)
.append(";snapshotMode=").append(snapshotMode)
- .append(";snapshotInterval=").append(snapshotInterval)
- .append(";useLocalCache=").append(useLocalCache);
+ .append(";snapshotInterval=").append(snapshotInterval);
return sb.toString();
}
-
- private static boolean isEmpty(String str)
- {
- return str == null || str.trim().length() == 0;
- }
}
Added: projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/ReplicationGranularity.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/ReplicationGranularity.java (rev 0)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/ReplicationGranularity.java 2007-11-11 15:28:21 UTC (rev 66949)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.metadata.web.jboss;
+
+public enum ReplicationGranularity
+{
+ SESSION, ATTRIBUTE, FIELD;
+
+ public static ReplicationGranularity fromString(String granularity)
+ {
+ return (granularity == null ? SESSION
+ : Enum.valueOf(ReplicationGranularity.class, granularity));
+ }
+}
Added: projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/ReplicationTrigger.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/ReplicationTrigger.java (rev 0)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/ReplicationTrigger.java 2007-11-11 15:28:21 UTC (rev 66949)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.metadata.web.jboss;
+
+public enum ReplicationTrigger
+{
+ /** Merely accessing the session marks the session as dirty */
+ ACCESS,
+ /** Calling setAttribute() or getAttribute() marks the session as dirty */
+ SET_AND_GET,
+ /** Calling setAttribute() marks the session as dirty, as does
+ * getAttribute() if the returned type is not String or Number */
+ SET_AND_NON_PRIMITIVE_GET,
+ /** Only calling setAttribute() marks the session as dirty */
+ SET;
+
+
+
+ public static ReplicationTrigger fromString(String policy)
+ {
+ return (policy == null ? ReplicationTrigger.SET_AND_NON_PRIMITIVE_GET
+ : Enum.valueOf(ReplicationTrigger.class, policy));
+ }
+
+ public static ReplicationTrigger fromInt(int ordinal)
+ {
+ switch (ordinal)
+ {
+ case 2:
+ return SET_AND_NON_PRIMITIVE_GET;
+ case 3:
+ return SET;
+ case 1:
+ return SET_AND_GET;
+ case 0:
+ return ACCESS;
+ default:
+ throw new IllegalArgumentException("Unknown ordinal " + ordinal);
+ }
+ }
+}
\ No newline at end of file
Added: projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/SnapshotMode.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/SnapshotMode.java (rev 0)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/web/jboss/SnapshotMode.java 2007-11-11 15:28:21 UTC (rev 66949)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.metadata.web.jboss;
+
+public enum SnapshotMode
+{
+ /** Merely accessing the session marks the session as dirty */
+ INSTANT,
+ /** Calling setAttribute() or getAttribute() marks the session as dirty */
+ INTERVAL;
+
+
+
+ public static SnapshotMode fromString(String mode)
+ {
+ return (mode == null ? INSTANT
+ : Enum.valueOf(SnapshotMode.class, mode));
+ }
+
+ public static SnapshotMode fromInt(int ordinal)
+ {
+ switch (ordinal)
+ {
+ case 0:
+ return INSTANT;
+ case 1:
+ return INTERVAL;
+ default:
+ throw new IllegalArgumentException("Unknown ordinal " + ordinal);
+ }
+ }
+}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list