You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kf...@apache.org on 2015/05/18 07:43:35 UTC
svn commit: r1679938 - in /tomcat/tc8.0.x/trunk:
java/org/apache/catalina/ha/authenticator/
java/org/apache/catalina/ha/context/ java/org/apache/catalina/ha/session/
java/org/apache/catalina/ha/tcp/ webapps/docs/
Author: kfujino
Date: Mon May 18 05:43:35 2015
New Revision: 1679938
URL: http://svn.apache.org/r1679938
Log:
Use StringManager to provide i18n support in the org.apache.catalina.ha packages.
Added:
tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/authenticator/LocalStrings.properties (with props)
tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/context/LocalStrings.properties (with props)
Modified:
tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java
tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/context/ReplicatedContext.java
tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/session/ClusterSessionListener.java
tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/session/DeltaRequest.java
tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/session/LocalStrings.properties
tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/tcp/LocalStrings.properties
tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml
Modified: tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java?rev=1679938&r1=1679937&r2=1679938&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java (original)
+++ tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java Mon May 18 05:43:35 2015
@@ -31,6 +31,7 @@ import org.apache.catalina.tribes.Channe
import org.apache.catalina.tribes.tipis.AbstractReplicatedMap.MapOwner;
import org.apache.catalina.tribes.tipis.ReplicatedMap;
import org.apache.tomcat.util.ExceptionUtils;
+import org.apache.tomcat.util.res.StringManager;
/**
* A <strong>Valve</strong> that supports a "single sign on" user experience on
@@ -53,6 +54,9 @@ import org.apache.tomcat.util.ExceptionU
*/
public class ClusterSingleSignOn extends SingleSignOn implements ClusterValve, MapOwner {
+ private static final StringManager sm =
+ StringManager.getManager(ClusterSingleSignOn.class.getPackage().getName());
+
// -------------------------------------------------------------- Properties
private CatalinaCluster cluster = null;
@@ -151,8 +155,7 @@ public class ClusterSingleSignOn extends
}
}
if (cluster == null) {
- throw new LifecycleException(
- "There is no Cluster for ClusterSingleSignOn");
+ throw new LifecycleException(sm.getString("clusterSingleSignOn.nocluster"));
}
ClassLoader[] cls = new ClassLoader[] { this.getClass().getClassLoader() };
@@ -164,8 +167,7 @@ public class ClusterSingleSignOn extends
this.cache = cache;
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
- throw new LifecycleException(
- "ClusterSingleSignOn exception during clusterLoad " + t);
+ throw new LifecycleException(sm.getString("clusterSingleSignOn.clusterLoad.fail"), t);
}
super.startInternal();
Added: tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/authenticator/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/authenticator/LocalStrings.properties?rev=1679938&view=auto
==============================================================================
--- tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/authenticator/LocalStrings.properties (added)
+++ tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/authenticator/LocalStrings.properties Mon May 18 05:43:35 2015
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+clusterSingleSignOn.nocluster=There is no Cluster for ClusterSingleSignOn
+clusterSingleSignOn.clusterLoad.fail=ClusterSingleSignOn exception during clusterLoad
\ No newline at end of file
Propchange: tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/authenticator/LocalStrings.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/context/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/context/LocalStrings.properties?rev=1679938&view=auto
==============================================================================
--- tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/context/LocalStrings.properties (added)
+++ tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/context/LocalStrings.properties Mon May 18 05:43:35 2015
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+applicationContext.setAttribute.namenull=Name cannot be null
+
+replicatedContext.startUnable=Unable to start ReplicatedContext
+replicatedContext.startFailed=Failed to start ReplicatedContext
\ No newline at end of file
Propchange: tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/context/LocalStrings.properties
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/context/ReplicatedContext.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/context/ReplicatedContext.java?rev=1679938&r1=1679937&r2=1679938&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/context/ReplicatedContext.java (original)
+++ tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/context/ReplicatedContext.java Mon May 18 05:43:35 2015
@@ -36,6 +36,7 @@ import org.apache.catalina.tribes.tipis.
import org.apache.catalina.tribes.tipis.ReplicatedMap;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.res.StringManager;
/**
* @version 1.0
@@ -44,6 +45,7 @@ public class ReplicatedContext extends S
private int mapSendOptions = Channel.SEND_OPTIONS_DEFAULT;
private static final Log log = LogFactory.getLog( ReplicatedContext.class );
protected static final long DEFAULT_REPL_TIMEOUT = 15000;//15 seconds
+ private static final StringManager sm = StringManager.getManager(ReplicatedContext.class.getPackage().getName());
/**
* Start this component and implement the requirements
@@ -68,8 +70,8 @@ public class ReplicatedContext extends S
}
super.startInternal();
} catch ( Exception x ) {
- log.error("Unable to start ReplicatedContext",x);
- throw new LifecycleException("Failed to start ReplicatedContext",x);
+ log.error(sm.getString("replicatedContext.startUnable"),x);
+ throw new LifecycleException(sm.getString("replicatedContext.startFailed"),x);
}
}
Modified: tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/session/ClusterSessionListener.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/session/ClusterSessionListener.java?rev=1679938&r1=1679937&r2=1679938&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/session/ClusterSessionListener.java (original)
+++ tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/session/ClusterSessionListener.java Mon May 18 05:43:35 2015
@@ -24,6 +24,7 @@ import org.apache.catalina.ha.ClusterMan
import org.apache.catalina.ha.ClusterMessage;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.res.StringManager;
/**
* Receive replicated SessionMessage form other cluster node.
@@ -33,6 +34,7 @@ public class ClusterSessionListener exte
private static final Log log =
LogFactory.getLog(ClusterSessionListener.class);
+ private static final StringManager sm = StringManager.getManager(Constants.Package);
//--Constructor---------------------------------------------
@@ -66,8 +68,7 @@ public class ClusterSessionListener exte
//this happens a lot before the system has started
// up
if (log.isDebugEnabled())
- log.debug("Context manager doesn't exist:"
- + entry.getKey());
+ log.debug(sm.getString("clusterSessionListener.noManager", entry.getKey()));
}
}
} else {
@@ -76,7 +77,7 @@ public class ClusterSessionListener exte
mgr.messageDataReceived(msg);
} else {
if (log.isWarnEnabled())
- log.warn("Context manager doesn't exist:" + ctxname);
+ log.warn(sm.getString("clusterSessionListener.noManager", ctxname));
// A no context manager message is replied in order to avoid
// timeout of GET_ALL_SESSIONS sync phase.
Modified: tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/session/DeltaRequest.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/session/DeltaRequest.java?rev=1679938&r1=1679937&r2=1679938&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/session/DeltaRequest.java (original)
+++ tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/session/DeltaRequest.java Mon May 18 05:43:35 2015
@@ -142,7 +142,7 @@ public class DeltaRequest implements Ext
try {
info = actionPool.removeFirst();
}catch ( Exception x ) {
- log.error("Unable to remove element:",x);
+ log.error(sm.getString("deltaRequest.removeUnable"),x);
info = new AttributeInfo(type, action, name, value);
}
info.init(type,action,name,value);
@@ -164,7 +164,7 @@ public class DeltaRequest implements Ext
public void execute(DeltaSession session, boolean notifyListeners) {
if ( !this.sessionId.equals( session.getId() ) )
- throw new java.lang.IllegalArgumentException("Session id mismatch, not executing the delta request");
+ throw new java.lang.IllegalArgumentException(sm.getString("deltaRequest.ssid.mismatch"));
session.access();
for ( int i=0; i<actions.size(); i++ ) {
AttributeInfo info = actions.get(i);
@@ -210,7 +210,7 @@ public class DeltaRequest implements Ext
}
break;
default :
- throw new java.lang.IllegalArgumentException("Invalid attribute info type="+info);
+ throw new java.lang.IllegalArgumentException(sm.getString("deltaRequest.invalidAttributeInfoType", info));
}//switch
}//for
session.endAccess();
@@ -224,7 +224,7 @@ public class DeltaRequest implements Ext
info.recycle();
actionPool.addLast(info);
}catch ( Exception x ) {
- log.error("Unable to remove element",x);
+ log.error(sm.getString("deltaRequest.removeUnable"),x);
}
}
actions.clear();
@@ -236,7 +236,7 @@ public class DeltaRequest implements Ext
public void setSessionId(String sessionId) {
this.sessionId = sessionId;
if ( sessionId == null ) {
- new Exception("Session Id is null for setSessionId").fillInStackTrace().printStackTrace();
+ new Exception(sm.getString("deltaRequest.ssid.null")).fillInStackTrace().printStackTrace();
}
}
public int getSize() {
@@ -268,7 +268,7 @@ public class DeltaRequest implements Ext
try {
info = actionPool.removeFirst();
} catch ( Exception x ) {
- log.error("Unable to remove element",x);
+ log.error(sm.getString("deltaRequest.removeUnable"),x);
info = new AttributeInfo();
}
}
Modified: tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/session/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/session/LocalStrings.properties?rev=1679938&r1=1679937&r2=1679938&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/session/LocalStrings.properties (original)
+++ tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/session/LocalStrings.properties Mon May 18 05:43:35 2015
@@ -55,6 +55,10 @@ deltaManager.waitForSessionState=Manager
deltaManager.unableSerializeSessionID =Unable to serialize sessionID [{0}]
deltaRequest.showPrincipal=Principal [{0}] is set to session {1}
deltaRequest.wrongPrincipalClass=DeltaManager only support GenericPrincipal. Your realm used principal class {0}.
+deltaRequest.removeUnable=Unable to remove element:
+deltaRequest.ssid.mismatch=Session id mismatch, not executing the delta request
+deltaRequest.invalidAttributeInfoType=Invalid attribute info type={0}
+deltaRequest.ssid.null=Session Id is null for setSessionId
deltaSession.notifying=Notifying cluster of expiration primary={0} sessionId [{1}]
deltaSession.readSession=readObject() loading session [{0}]
deltaSession.writeSession=writeObject() storing session [{0}]
@@ -83,3 +87,4 @@ backupManager.noCluster=no cluster assoc
backupManager.startUnable=Unable to start BackupManager: [{0}]
backupManager.startFailed=Failed to start BackupManager: [{0}]
backupManager.stopped=Manager [{0}] is stopping
+clusterSessionListener.noManager=Context manager doesn''t exist:{0}
\ No newline at end of file
Modified: tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/tcp/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/tcp/LocalStrings.properties?rev=1679938&r1=1679937&r2=1679938&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/tcp/LocalStrings.properties (original)
+++ tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/tcp/LocalStrings.properties Mon May 18 05:43:35 2015
@@ -28,4 +28,14 @@ ReplicationValve.session.found=Context {
ReplicationValve.session.indicator=Context {0}: Primarity of session {0} in request attribute {1} is {2}.
ReplicationValve.session.invalid=Context {0}: Requested session {1} is invalid, removed or not replicated at this node.
ReplicationValve.stats=Average request time= {0} ms for Cluster overhead time={1} ms for {2} requests {3} filter requests {4} send requests {5} cross context requests (Request={6} ms Cluster={7} ms).
-
+simpleTcpCluster.clustermanager.cloneFailed=Unable to clone cluster manager, defaulting to org.apache.catalina.ha.session.DeltaManager
+simpleTcpCluster.clustermanager.notImplement=Manager [{0}] does not implement ClusterManager, addition to cluster has been aborted.
+simpleTcpCluster.start=Cluster is about to start
+simpleTcpCluster.startUnable=Unable to start cluster.
+simpleTcpCluster.stopUnable=Unable to stop cluster.
+simpleTcpCluster.unableSend.localMember=Unable to send message to local member {0}
+simpleTcpCluster.sendFailed=Unable to send message through cluster sender.
+simpleTcpCluster.member.added=Replication member added:{0}
+simpleTcpCluster.member.addFailed=Unable to connect to replication system.
+simpleTcpCluster.member.disappeared=Received member disappeared:{0}
+simpleTcpCluster.member.removeFailed=Unable remove cluster node from replication system.
\ No newline at end of file
Modified: tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java?rev=1679938&r1=1679937&r2=1679938&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java (original)
+++ tomcat/tc8.0.x/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java Mon May 18 05:43:35 2015
@@ -406,7 +406,7 @@ public class SimpleTcpCluster extends Li
manager = managerTemplate.cloneFromTemplate();
manager.setName(name);
} catch (Exception x) {
- log.error("Unable to clone cluster manager, defaulting to org.apache.catalina.ha.session.DeltaManager", x);
+ log.error(sm.getString("simpleTcpCluster.clustermanager.cloneFailed"), x);
manager = new org.apache.catalina.ha.session.DeltaManager();
} finally {
if ( manager != null) manager.setCluster(this);
@@ -418,7 +418,7 @@ public class SimpleTcpCluster extends Li
public void registerManager(Manager manager) {
if (! (manager instanceof ClusterManager)) {
- log.warn("Manager [ " + manager + "] does not implement ClusterManager, addition to cluster has been aborted.");
+ log.warn(sm.getString("simpleTcpCluster.clustermanager.notImplement", manager));
return;
}
ClusterManager cmanager = (ClusterManager) manager ;
@@ -534,7 +534,7 @@ public class SimpleTcpCluster extends Li
@Override
protected void startInternal() throws LifecycleException {
- if (log.isInfoEnabled()) log.info("Cluster is about to start");
+ if (log.isInfoEnabled()) log.info(sm.getString("simpleTcpCluster.start"));
try {
checkDefaults();
@@ -545,7 +545,7 @@ public class SimpleTcpCluster extends Li
if (clusterDeployer != null) clusterDeployer.start();
registerMember(channel.getLocalMember(false));
} catch (Exception x) {
- log.error("Unable to start cluster.", x);
+ log.error(sm.getString("simpleTcpCluster.startUnable"), x);
throw new LifecycleException(x);
}
@@ -625,7 +625,7 @@ public class SimpleTcpCluster extends Li
channel.removeMembershipListener(this);
this.unregisterClusterValve();
} catch (Exception x) {
- log.error("Unable to stop cluster.", x);
+ log.error(sm.getString("simpleTcpCluster.stopUnable"), x);
}
}
@@ -689,7 +689,7 @@ public class SimpleTcpCluster extends Li
if (!getLocalMember().equals(dest)) {
channel.send(new Member[] {dest}, msg, sendOptions);
} else
- log.error("Unable to send message to local member " + msg);
+ log.error(sm.getString("simpleTcpCluster.unableSend.localMember", msg));
} else {
Member[] destmembers = channel.getMembers();
if (destmembers.length>0)
@@ -698,7 +698,7 @@ public class SimpleTcpCluster extends Li
log.debug("No members in cluster, ignoring message:"+msg);
}
} catch (Exception x) {
- log.error("Unable to send message through cluster sender.", x);
+ log.error(sm.getString("simpleTcpCluster.sendFailed"), x);
}
}
@@ -711,7 +711,7 @@ public class SimpleTcpCluster extends Li
public void memberAdded(Member member) {
try {
hasMembers = channel.hasMembers();
- if (log.isInfoEnabled()) log.info("Replication member added:" + member);
+ if (log.isInfoEnabled()) log.info(sm.getString("simpleTcpCluster.member.added", member));
// Notify our interested LifecycleListeners
fireLifecycleEvent(BEFORE_MEMBERREGISTER_EVENT, member);
@@ -720,7 +720,7 @@ public class SimpleTcpCluster extends Li
// Notify our interested LifecycleListeners
fireLifecycleEvent(AFTER_MEMBERREGISTER_EVENT, member);
} catch (Exception x) {
- log.error("Unable to connect to replication system.", x);
+ log.error(sm.getString("simpleTcpCluster.member.addFailed"), x);
}
}
@@ -734,7 +734,7 @@ public class SimpleTcpCluster extends Li
public void memberDisappeared(Member member) {
try {
hasMembers = channel.hasMembers();
- if (log.isInfoEnabled()) log.info("Received member disappeared:" + member);
+ if (log.isInfoEnabled()) log.info(sm.getString("simpleTcpCluster.member.disappeared", member));
// Notify our interested LifecycleListeners
fireLifecycleEvent(BEFORE_MEMBERUNREGISTER_EVENT, member);
@@ -743,7 +743,7 @@ public class SimpleTcpCluster extends Li
// Notify our interested LifecycleListeners
fireLifecycleEvent(AFTER_MEMBERUNREGISTER_EVENT, member);
} catch (Exception x) {
- log.error("Unable remove cluster node from replication system.", x);
+ log.error(sm.getString("simpleTcpCluster.member.removeFailed"), x);
}
}
Modified: tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml?rev=1679938&r1=1679937&r2=1679938&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Mon May 18 05:43:35 2015
@@ -98,6 +98,10 @@
Make sure that stream is closed after using it in
<code>DeltaSession.applyDiff()</code>. (kfujino)
</fix>
+ <scode>
+ Use <code>StringManager</code> to provide i18n support in the
+ <code>org.apache.catalina.ha packages</code>. (kfujino)
+ </scode>
</changelog>
</subsection>
<subsection name="Web applications">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org