Author: markt
Date: Sun Dec 14 17:25:39 2014
New Revision: 1645475
URL: http://svn.apache.org/r1645475
Log:
No need to restrict StoreConfigListener to StandardServer.
Log a warning it it is added to anything other than a Server
Modified:
tomcat/trunk/java/org/apache/catalina/storeconfig/LocalStrings.properties
tomcat/trunk/java/org/apache/catalina/storeconfig/StoreConfigLifecycleListener.java
Modified:
tomcat/trunk/java/org/apache/catalina/storeconfig/LocalStrings.properties
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/storeconfig/LocalStrings.properties?rev=1645475&r1=1645474&r2=1645475&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/storeconfig/LocalStrings.properties
(original)
+++ tomcat/trunk/java/org/apache/catalina/storeconfig/LocalStrings.properties
Sun Dec 14 17:25:39 2014
@@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-factory.storeTag=store tag {0} ( Object: {1} )
-factory.storeNoDescriptor=Descriptor for element class {0} not configured!
config.storeServerError=Error storing server
config.storeContextError=Error storing context {0}
+factory.storeTag=store tag {0} ( Object: {1} )
+factory.storeNoDescriptor=Descriptor for element class {0} not configured!
+storeConfigListener.notServer=The listener was added to component other than
the Server and will therefore be ignored
\ No newline at end of file
Modified:
tomcat/trunk/java/org/apache/catalina/storeconfig/StoreConfigLifecycleListener.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/storeconfig/StoreConfigLifecycleListener.java?rev=1645475&r1=1645474&r2=1645475&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/catalina/storeconfig/StoreConfigLifecycleListener.java
(original)
+++
tomcat/trunk/java/org/apache/catalina/storeconfig/StoreConfigLifecycleListener.java
Sun Dec 14 17:25:39 2014
@@ -22,19 +22,23 @@ import javax.management.ObjectName;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;
-import org.apache.catalina.core.StandardServer;
+import org.apache.catalina.Server;
import org.apache.catalina.mbeans.MBeanUtils;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.modeler.ManagedBean;
import org.apache.tomcat.util.modeler.Registry;
+import org.apache.tomcat.util.res.StringManager;
/**
- * Load and Register StoreConfig MBean
<i>Catalina:type=StoreConfig,resource="url"</i>
+ * Loads and registers a StoreConfig MBean with the name
+ * <i>Catalina:type=StoreConfig</i>. This listener should only be used with a
+ * {@link Server}.
*/
public class StoreConfigLifecycleListener implements LifecycleListener {
- private static Log log = LogFactory
- .getLog(StoreConfigLifecycleListener.class);
+
+ private static Log log =
LogFactory.getLog(StoreConfigLifecycleListener.class);
+ private static StringManager sm =
StringManager.getManager(StoreConfigLifecycleListener.class);
/**
* The configuration information registry for our managed beans.
@@ -57,8 +61,10 @@ public class StoreConfigLifecycleListene
@Override
public void lifecycleEvent(LifecycleEvent event) {
if (Lifecycle.AFTER_START_EVENT.equals(event.getType())) {
- if (event.getSource() instanceof StandardServer) {
- createMBean((StandardServer) event.getSource());
+ if (event.getSource() instanceof Server) {
+ createMBean((Server) event.getSource());
+ } else {
+ log.warn(sm.getString("storeConfigListener.notServer"));
}
} else if (Lifecycle.AFTER_STOP_EVENT.equals(event.getType())) {
if (oname != null) {
@@ -72,7 +78,7 @@ public class StoreConfigLifecycleListene
* create StoreConfig MBean and load StoreRgistry MBeans name is
* <i>Catalina:type=StoreConfig </i>
*/
- protected void createMBean(StandardServer server) {
+ protected void createMBean(Server server) {
StoreLoader loader = new StoreLoader();
try {
Class<?> clazz = Class.forName(getStoreConfigClass(), true, this
@@ -82,7 +88,7 @@ public class StoreConfigLifecycleListene
// default Loading
loader.load();
else
- // load a spezial file registry (url)
+ // load a special file registry (url)
loader.load(getStoreRegistry());
// use the loader Registry
storeConfig.setRegistry(loader.getRegistry());
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]