Author: remm
Date: Tue Dec 11 16:46:24 2018
New Revision: 1848696
URL: http://svn.apache.org/viewvc?rev=1848696&view=rev
Log:
Add i18n for modeler package, and fix package name for mbeans strings.
Added:
tomcat/trunk/java/org/apache/tomcat/util/modeler/LocalStrings.properties
(with props)
Modified:
tomcat/trunk/java/org/apache/catalina/mbeans/ConnectorMBean.java
tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceLinkMBean.java
tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceMBean.java
tomcat/trunk/java/org/apache/catalina/mbeans/GroupMBean.java
tomcat/trunk/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java
tomcat/trunk/java/org/apache/catalina/mbeans/NamingResourcesMBean.java
tomcat/trunk/java/org/apache/catalina/mbeans/UserMBean.java
tomcat/trunk/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
tomcat/trunk/java/org/apache/tomcat/util/modeler/ManagedBean.java
tomcat/trunk/java/org/apache/tomcat/util/modeler/Registry.java
tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java
tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java
tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/ModelerSource.java
Modified: tomcat/trunk/java/org/apache/catalina/mbeans/ConnectorMBean.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/ConnectorMBean.java?rev=1848696&r1=1848695&r2=1848696&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/ConnectorMBean.java (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/ConnectorMBean.java Tue Dec 11
16:46:24 2018
@@ -24,6 +24,7 @@ import javax.management.RuntimeOperation
import org.apache.catalina.connector.Connector;
import org.apache.tomcat.util.IntrospectionUtils;
+import org.apache.tomcat.util.res.StringManager;
/**
* <p>A <strong>ModelMBean</strong> implementation for the
@@ -33,6 +34,8 @@ import org.apache.tomcat.util.Introspect
*/
public class ConnectorMBean extends ClassNameMBean<Connector> {
+ private static final StringManager sm =
StringManager.getManager(ConnectorMBean.class);
+
/**
* Obtain and return the value of a specific attribute of this MBean.
*
Modified:
tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceLinkMBean.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceLinkMBean.java?rev=1848696&r1=1848695&r2=1848696&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceLinkMBean.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceLinkMBean.java
Tue Dec 11 16:46:24 2018
@@ -24,6 +24,7 @@ import javax.management.RuntimeOperation
import org.apache.tomcat.util.descriptor.web.ContextResourceLink;
import org.apache.tomcat.util.descriptor.web.NamingResources;
+import org.apache.tomcat.util.res.StringManager;
/**
* <p>A <strong>ModelMBean</strong> implementation for the
@@ -33,6 +34,8 @@ import org.apache.tomcat.util.descriptor
*/
public class ContextResourceLinkMBean extends
BaseCatalinaMBean<ContextResourceLink> {
+ private static final StringManager sm =
StringManager.getManager(ContextResourceLinkMBean.class);
+
/**
* Obtain and return the value of a specific attribute of this MBean.
*
Modified: tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceMBean.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceMBean.java?rev=1848696&r1=1848695&r2=1848696&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceMBean.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/ContextResourceMBean.java Tue
Dec 11 16:46:24 2018
@@ -24,6 +24,7 @@ import javax.management.RuntimeOperation
import org.apache.tomcat.util.descriptor.web.ContextResource;
import org.apache.tomcat.util.descriptor.web.NamingResources;
+import org.apache.tomcat.util.res.StringManager;
/**
* <p>A <strong>ModelMBean</strong> implementation for the
@@ -33,6 +34,8 @@ import org.apache.tomcat.util.descriptor
*/
public class ContextResourceMBean extends BaseCatalinaMBean<ContextResource> {
+ private static final StringManager sm =
StringManager.getManager(ContextResourceMBean.class);
+
/**
* Obtain and return the value of a specific attribute of this MBean.
*
Modified: tomcat/trunk/java/org/apache/catalina/mbeans/GroupMBean.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/GroupMBean.java?rev=1848696&r1=1848695&r2=1848696&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/GroupMBean.java (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/GroupMBean.java Tue Dec 11
16:46:24 2018
@@ -29,6 +29,7 @@ import org.apache.catalina.User;
import org.apache.tomcat.util.modeler.BaseModelMBean;
import org.apache.tomcat.util.modeler.ManagedBean;
import org.apache.tomcat.util.modeler.Registry;
+import org.apache.tomcat.util.res.StringManager;
/**
* <p>A <strong>ModelMBean</strong> implementation for the
@@ -38,6 +39,8 @@ import org.apache.tomcat.util.modeler.Re
*/
public class GroupMBean extends BaseModelMBean {
+ private static final StringManager sm =
StringManager.getManager(GroupMBean.class);
+
/**
* The configuration information registry for our managed beans.
*/
Modified:
tomcat/trunk/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java?rev=1848696&r1=1848695&r2=1848696&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java
Tue Dec 11 16:46:24 2018
@@ -30,6 +30,7 @@ import org.apache.catalina.UserDatabase;
import org.apache.tomcat.util.modeler.BaseModelMBean;
import org.apache.tomcat.util.modeler.ManagedBean;
import org.apache.tomcat.util.modeler.Registry;
+import org.apache.tomcat.util.res.StringManager;
/**
* <p>A <strong>ModelMBean</strong> implementation for the
@@ -39,6 +40,8 @@ import org.apache.tomcat.util.modeler.Re
*/
public class MemoryUserDatabaseMBean extends BaseModelMBean {
+ private static final StringManager sm =
StringManager.getManager(MemoryUserDatabaseMBean.class);
+
// ----------------------------------------------------- Instance Variables
/**
Modified: tomcat/trunk/java/org/apache/catalina/mbeans/NamingResourcesMBean.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/NamingResourcesMBean.java?rev=1848696&r1=1848695&r2=1848696&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/NamingResourcesMBean.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/NamingResourcesMBean.java Tue
Dec 11 16:46:24 2018
@@ -29,6 +29,7 @@ import org.apache.tomcat.util.descriptor
import org.apache.tomcat.util.modeler.BaseModelMBean;
import org.apache.tomcat.util.modeler.ManagedBean;
import org.apache.tomcat.util.modeler.Registry;
+import org.apache.tomcat.util.res.StringManager;
/**
* <p>A <strong>ModelMBean</strong> implementation for the
@@ -38,6 +39,8 @@ import org.apache.tomcat.util.modeler.Re
*/
public class NamingResourcesMBean extends BaseModelMBean {
+ private static final StringManager sm =
StringManager.getManager(NamingResourcesMBean.class);
+
// ----------------------------------------------------- Instance Variables
/**
Modified: tomcat/trunk/java/org/apache/catalina/mbeans/UserMBean.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/UserMBean.java?rev=1848696&r1=1848695&r2=1848696&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/UserMBean.java (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/UserMBean.java Tue Dec 11
16:46:24 2018
@@ -29,6 +29,7 @@ import org.apache.catalina.User;
import org.apache.tomcat.util.modeler.BaseModelMBean;
import org.apache.tomcat.util.modeler.ManagedBean;
import org.apache.tomcat.util.modeler.Registry;
+import org.apache.tomcat.util.res.StringManager;
/**
* <p>A <strong>ModelMBean</strong> implementation for the
@@ -38,6 +39,7 @@ import org.apache.tomcat.util.modeler.Re
*/
public class UserMBean extends BaseModelMBean {
+ private static final StringManager sm =
StringManager.getManager(UserMBean.class);
// ----------------------------------------------------- Instance Variables
Modified: tomcat/trunk/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/modeler/BaseModelMBean.java?rev=1848696&r1=1848695&r2=1848696&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/modeler/BaseModelMBean.java Tue
Dec 11 16:46:24 2018
@@ -105,7 +105,7 @@ public class BaseModelMBean implements D
ModelMBeanNotificationBroadcaster {
private static final Log log = LogFactory.getLog(BaseModelMBean.class);
- protected static final StringManager sm =
StringManager.getManager(BaseModelMBean.class);
+ private static final StringManager sm =
StringManager.getManager(BaseModelMBean.class);
// ----------------------------------------------------- Instance Variables
@@ -158,8 +158,8 @@ public class BaseModelMBean implements D
// Validate the input parameters
if (name == null)
throw new RuntimeOperationsException
- (new IllegalArgumentException("Attribute name is null"),
- "Attribute name is null");
+ (new
IllegalArgumentException(sm.getString("baseModelMBean.nullAttributeName")),
+ sm.getString("baseModelMBean.nullAttributeName"));
if( (resource instanceof DynamicMBean) &&
! ( resource instanceof BaseModelMBean )) {
@@ -183,16 +183,16 @@ public class BaseModelMBean implements D
t = e;
if (t instanceof RuntimeException)
throw new RuntimeOperationsException
- ((RuntimeException) t, "Exception invoking method " +
name);
+ ((RuntimeException) t,
sm.getString("baseModelMBean.invokeError", name));
else if (t instanceof Error)
throw new RuntimeErrorException
- ((Error) t, "Error invoking method " + name);
+ ((Error) t, sm.getString("baseModelMBean.invokeError",
name));
else
throw new MBeanException
- (e, "Exception invoking method " + name);
+ (e, sm.getString("baseModelMBean.invokeError", name));
} catch (Exception e) {
throw new MBeanException
- (e, "Exception invoking method " + name);
+ (e, sm.getString("baseModelMBean.invokeError", name));
}
// Return the results of this method invocation
@@ -212,8 +212,8 @@ public class BaseModelMBean implements D
// Validate the input parameters
if (names == null)
throw new RuntimeOperationsException
- (new IllegalArgumentException("Attribute names list is null"),
- "Attribute names list is null");
+ (new
IllegalArgumentException(sm.getString("baseModelMBean.nullAttributeNameList")),
+ sm.getString("baseModelMBean.nullAttributeNameList"));
// Prepare our response, eating all exceptions
AttributeList response = new AttributeList();
@@ -273,8 +273,8 @@ public class BaseModelMBean implements D
// Validate the input parameters
if (name == null)
throw new RuntimeOperationsException
- (new IllegalArgumentException("Method name is null"),
- "Method name is null");
+ (new
IllegalArgumentException(sm.getString("baseModelMBean.nullMethodName")),
+ sm.getString("baseModelMBean.nullMethodName"));
if( log.isDebugEnabled()) log.debug("Invoke " + name);
@@ -290,22 +290,22 @@ public class BaseModelMBean implements D
}
} catch (InvocationTargetException e) {
Throwable t = e.getTargetException();
- log.error("Exception invoking method " + name , t );
+ log.error(sm.getString("baseModelMBean.invokeError", name), t );
if (t == null)
t = e;
if (t instanceof RuntimeException)
throw new RuntimeOperationsException
- ((RuntimeException) t, "Exception invoking method " +
name);
+ ((RuntimeException) t,
sm.getString("baseModelMBean.invokeError", name));
else if (t instanceof Error)
throw new RuntimeErrorException
- ((Error) t, "Error invoking method " + name);
+ ((Error) t, sm.getString("baseModelMBean.invokeError",
name));
else
throw new MBeanException
- ((Exception)t, "Exception invoking method " + name);
+ ((Exception)t, sm.getString("baseModelMBean.invokeError",
name));
} catch (Exception e) {
- log.error("Exception invoking method " + name , e );
+ log.error(sm.getString("baseModelMBean.invokeError", name), e );
throw new MBeanException
- (e, "Exception invoking method " + name);
+ (e, sm.getString("baseModelMBean.invokeError", name));
}
// Return the results of this method invocation
@@ -343,8 +343,7 @@ public class BaseModelMBean implements D
try {
return Class.forName(signature);
} catch (ClassNotFoundException e) {
- throw new ReflectionException
- (e, "Cannot find Class for " + signature);
+ throw new ReflectionException(e,
sm.getString("baseModelMBean.cnfeForSignature", signature));
}
}
}
@@ -383,16 +382,16 @@ public class BaseModelMBean implements D
// Validate the input parameters
if (attribute == null)
throw new RuntimeOperationsException
- (new IllegalArgumentException("Attribute is null"),
- "Attribute is null");
+ (new
IllegalArgumentException(sm.getString("baseModelMBean.nullAttribute")),
+ sm.getString("baseModelMBean.nullAttribute"));
String name = attribute.getName();
Object value = attribute.getValue();
if (name == null)
throw new RuntimeOperationsException
- (new IllegalArgumentException("Attribute name is null"),
- "Attribute name is null");
+ (new
IllegalArgumentException(sm.getString("baseModelMBean.nullAttributeName")),
+ sm.getString("baseModelMBean.nullAttributeName"));
Object oldValue=null;
//if( getAttMap.get(name) != null )
@@ -412,23 +411,23 @@ public class BaseModelMBean implements D
t = e;
if (t instanceof RuntimeException)
throw new RuntimeOperationsException
- ((RuntimeException) t, "Exception invoking method " +
name);
+ ((RuntimeException) t,
sm.getString("baseModelMBean.invokeError", name));
else if (t instanceof Error)
throw new RuntimeErrorException
- ((Error) t, "Error invoking method " + name);
+ ((Error) t, sm.getString("baseModelMBean.invokeError",
name));
else
throw new MBeanException
- (e, "Exception invoking method " + name);
+ (e, sm.getString("baseModelMBean.invokeError", name));
} catch (Exception e) {
- log.error("Exception invoking method " + name , e );
+ log.error(sm.getString("baseModelMBean.invokeError", name) , e );
throw new MBeanException
- (e, "Exception invoking method " + name);
+ (e, sm.getString("baseModelMBean.invokeError", name));
}
try {
sendAttributeChangeNotification(new Attribute( name, oldValue),
attribute);
} catch(Exception ex) {
- log.error("Error sending notification " + name, ex);
+ log.error(sm.getString("baseModelMBean.notificationError", name),
ex);
}
//attributes.put( name, value );
// if( source != null ) {
@@ -501,8 +500,8 @@ public class BaseModelMBean implements D
if (resource == null)
throw new RuntimeOperationsException
- (new IllegalArgumentException("Managed resource is null"),
- "Managed resource is null");
+ (new
IllegalArgumentException(sm.getString("baseModelMBean.nullResource")),
+ sm.getString("baseModelMBean.nullResource"));
return resource;
@@ -534,8 +533,8 @@ public class BaseModelMBean implements D
{
if (resource == null)
throw new RuntimeOperationsException
- (new IllegalArgumentException("Managed resource is null"),
- "Managed resource is null");
+ (new
IllegalArgumentException(sm.getString("baseModelMBean.nullResource")),
+ sm.getString("baseModelMBean.nullResource"));
// if (!"objectreference".equalsIgnoreCase(type))
// throw new InvalidTargetObjectTypeException(type);
@@ -578,7 +577,7 @@ public class BaseModelMBean implements D
throws IllegalArgumentException {
if (listener == null)
- throw new IllegalArgumentException("Listener is null");
+ throw new
IllegalArgumentException(sm.getString("baseModelMBean.nullListener"));
if (attributeBroadcaster == null)
attributeBroadcaster = new BaseNotificationBroadcaster();
@@ -609,7 +608,7 @@ public class BaseModelMBean implements D
throws ListenerNotFoundException {
if (listener == null)
- throw new IllegalArgumentException("Listener is null");
+ throw new
IllegalArgumentException(sm.getString("baseModelMBean.nullListener"));
// FIXME - currently this removes *all* notifications for this listener
if (attributeBroadcaster != null) {
@@ -638,8 +637,8 @@ public class BaseModelMBean implements D
if (notification == null)
throw new RuntimeOperationsException
- (new IllegalArgumentException("Notification is null"),
- "Notification is null");
+ (new
IllegalArgumentException(sm.getString("baseModelMBean.nullNotification")),
+ sm.getString("baseModelMBean.nullNotification"));
if (attributeBroadcaster == null)
return; // This means there are no registered listeners
if( log.isDebugEnabled() )
@@ -703,8 +702,8 @@ public class BaseModelMBean implements D
if (notification == null)
throw new RuntimeOperationsException
- (new IllegalArgumentException("Notification is null"),
- "Notification is null");
+ (new
IllegalArgumentException(sm.getString("baseModelMBean.nullNotification")),
+ sm.getString("baseModelMBean.nullNotification"));
if (generalBroadcaster == null)
return; // This means there are no registered listeners
generalBroadcaster.sendNotification(notification);
@@ -729,8 +728,8 @@ public class BaseModelMBean implements D
if (message == null)
throw new RuntimeOperationsException
- (new IllegalArgumentException("Message is null"),
- "Message is null");
+ (new
IllegalArgumentException(sm.getString("baseModelMBean.nullMessage")),
+ sm.getString("baseModelMBean.nullMessage"));
Notification notification = new Notification
("jmx.modelmbean.generic", this, 1, message);
sendNotification(notification);
@@ -759,7 +758,7 @@ public class BaseModelMBean implements D
throws IllegalArgumentException {
if (listener == null)
- throw new IllegalArgumentException("Listener is null");
+ throw new
IllegalArgumentException(sm.getString("baseModelMBean.nullListener"));
if( log.isDebugEnabled() ) log.debug("addNotificationListener " +
listener);
@@ -843,7 +842,7 @@ public class BaseModelMBean implements D
throws ListenerNotFoundException {
if (listener == null)
- throw new IllegalArgumentException("Listener is null");
+ throw new
IllegalArgumentException(sm.getString("baseModelMBean.nullListener"));
if (generalBroadcaster != null) {
generalBroadcaster.removeNotificationListener(listener);
Added: tomcat/trunk/java/org/apache/tomcat/util/modeler/LocalStrings.properties
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/modeler/LocalStrings.properties?rev=1848696&view=auto
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/modeler/LocalStrings.properties
(added)
+++ tomcat/trunk/java/org/apache/tomcat/util/modeler/LocalStrings.properties
Tue Dec 11 16:46:24 2018
@@ -0,0 +1,48 @@
+# 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.
+
+baseModelMBean.cnfeForSignature=Cannot find class for [{0}]
+baseModelMBean.invokeError=Exception invoking method [{0}]
+baseModelMBean.notificationError=Error sending notification [{0}]
+baseModelMBean.nullAttribute=The attribute is null
+baseModelMBean.nullAttributeName=The attribute name is null
+baseModelMBean.nullAttributeNameList=The attribute name list is null
+baseModelMBean.nullListener=The listener is null
+baseModelMBean.nullMessage=The message is null
+baseModelMBean.nullMethodName=The method name is null
+baseModelMBean.nullNotification=The notification is null
+baseModelMBean.nullResource=The managed resource is null
+
+managedMBean.cannotInstantiateClass=Cannot instantiate ModelMBean of class
[{0}]
+managedMBean.cannotLoadClass=Cannot load ModelMBean class [{0}]
+managedMBean.inconsistentArguments=Inconsistent arguments and signature
+managedMBean.noAttribute=Cannot find attribute [{0}] on resource [{1}]
+managedMBean.noGet=Cannot find getter method [{0}] on resource [{1}]
+managedMBean.noMethod=Cannot find method [{0}] with this signature
+managedMBean.noOperation=Cannot find operation [{0}]
+managedMBean.noSet=Cannot find setter method [{0}] on resource [{1}]
+
+modules.digesterParseError=Error parsing registry data
+modules.nullMethod=No method argument for [{0}]
+modules.readDescriptorsError=Error reading descriptors
+
+registry.initError=Error initializing [{0}]
+registry.loadError=Error loading desriptors from [{0}]
+registry.noMetadata=Cannot find metadata for object [{0}]
+registry.noTypeMetadata=Cannot find metadata for type [{0}]
+registry.nullBean=Cannot register null bean for [{0}]
+registry.objectNameCreateError=Error creating object name
+registry.registerError=Error registering MBean
+registry.unregisterError=Error unregistering MBean
Propchange:
tomcat/trunk/java/org/apache/tomcat/util/modeler/LocalStrings.properties
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tomcat/trunk/java/org/apache/tomcat/util/modeler/ManagedBean.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/modeler/ManagedBean.java?rev=1848696&r1=1848695&r2=1848696&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/modeler/ManagedBean.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/modeler/ManagedBean.java Tue Dec
11 16:46:24 2018
@@ -39,6 +39,7 @@ import javax.management.RuntimeOperation
import javax.management.ServiceNotFoundException;
import org.apache.tomcat.util.buf.StringUtils;
+import org.apache.tomcat.util.res.StringManager;
/**
@@ -50,6 +51,7 @@ import org.apache.tomcat.util.buf.String
public class ManagedBean implements java.io.Serializable {
private static final long serialVersionUID = 1L;
+ private static final StringManager sm =
StringManager.getManager(ManagedBean.class);
private static final String BASE_MBEAN =
"org.apache.tomcat.util.modeler.BaseModelMBean";
// ----------------------------------------------------- Instance Variables
@@ -314,7 +316,7 @@ public class ManagedBean implements java
if( clazz==null) {
throw new MBeanException
- (ex, "Cannot load ModelMBean class " + getClassName());
+ (ex, sm.getString("managedMBean.cannotLoadClass",
getClassName()));
}
try {
// Stupid - this will set the default minfo first....
@@ -323,8 +325,7 @@ public class ManagedBean implements java
throw e;
} catch (Exception e) {
throw new MBeanException
- (e, "Cannot instantiate ModelMBean of class " +
- getClassName());
+ (e, sm.getString("managedMBean.cannotInstantiateClass",
getClassName()));
}
}
@@ -431,7 +432,7 @@ public class ManagedBean implements java
AttributeInfo attrInfo = attributes.get(aname);
// Look up the actual operation to be used
if (attrInfo == null)
- throw new AttributeNotFoundException(" Cannot find attribute " +
aname + " for " + resource);
+ throw new
AttributeNotFoundException(sm.getString("managedMBean.noAttribute", aname,
resource));
String getMethod = attrInfo.getGetMethod();
@@ -453,8 +454,7 @@ public class ManagedBean implements java
}
}
if (exception != null) {
- throw new ReflectionException(exception,
- "Cannot find getter method " +
getMethod);
+ throw new ReflectionException(exception,
sm.getString("managedMBean.noGet", getMethod, resource));
}
return m;
@@ -467,7 +467,7 @@ public class ManagedBean implements java
AttributeInfo attrInfo = attributes.get(aname);
if (attrInfo == null) {
- throw new AttributeNotFoundException(" Cannot find attribute " +
aname);
+ throw new
AttributeNotFoundException(sm.getString("managedMBean.noAttribute", aname,
resource));
}
// Look up the actual operation to be used
@@ -494,8 +494,7 @@ public class ManagedBean implements java
}
}
if (exception != null) {
- throw new ReflectionException(exception,
- "Cannot find setter method " + setMethod + " " + resource);
+ throw new ReflectionException(exception,
sm.getString("managedMBean.noSet", setMethod, resource));
}
return m;
@@ -512,18 +511,16 @@ public class ManagedBean implements java
signature = new String[0];
if (params.length != signature.length)
throw new RuntimeOperationsException(
- new IllegalArgumentException(
- "Inconsistent arguments and signature"),
- "Inconsistent arguments and signature");
+ new
IllegalArgumentException(sm.getString("managedMBean.inconsistentArguments")),
+ sm.getString("managedMBean.inconsistentArguments"));
// Acquire the ModelMBeanOperationInfo information for
// the requested operation
OperationInfo opInfo =
operations.get(createOperationKey(aname, signature));
if (opInfo == null)
- throw new MBeanException(new ServiceNotFoundException(
- "Cannot find operation " + aname),
- "Cannot find operation " + aname);
+ throw new MBeanException(new
ServiceNotFoundException(sm.getString("managedMBean.noOperation", aname)),
+ sm.getString("managedMBean.noOperation", aname));
// Prepare the signature required by Java reflection APIs
// FIXME - should we use the signature from opInfo?
@@ -552,8 +549,7 @@ public class ManagedBean implements java
exception = e;
}
if (method == null) {
- throw new ReflectionException(exception, "Cannot find method "
- + aname + " with this signature");
+ throw new ReflectionException(exception,
sm.getString("managedMBean.noMethod", aname));
}
return method;
Modified: tomcat/trunk/java/org/apache/tomcat/util/modeler/Registry.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/modeler/Registry.java?rev=1848696&r1=1848695&r2=1848696&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/modeler/Registry.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/modeler/Registry.java Tue Dec 11
16:46:24 2018
@@ -39,6 +39,7 @@ import javax.management.ObjectName;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.tomcat.util.modeler.modules.ModelerSource;
+import org.apache.tomcat.util.res.StringManager;
/*
Issues:
@@ -70,6 +71,7 @@ public class Registry implements Registr
* The Log instance to which we will write our log messages.
*/
private static final Log log = LogFactory.getLog(Registry.class);
+ private static final StringManager sm =
StringManager.getManager(Registry.class);
// Support for the factory methods
@@ -237,7 +239,7 @@ public class Registry implements Registr
try {
unregisterComponent(new ObjectName(oname));
} catch (MalformedObjectNameException e) {
- log.info("Error creating object name " + e);
+ log.info(sm.getString("registry.objectNameCreateError"), e);
}
}
@@ -272,7 +274,7 @@ public class Registry implements Registr
} catch (Exception t) {
if (failFirst)
throw t;
- log.info("Error initializing " + current + " " + t.toString());
+ log.info(sm.getString("registry.initError"), t);
}
}
}
@@ -372,7 +374,7 @@ public class Registry implements Registr
try {
info = getMBeanServer().getMBeanInfo(oname);
} catch (Exception e) {
- log.info("Can't find metadata for object" + oname);
+ log.info(sm.getString("registry.noMetadata", oname));
return null;
}
@@ -399,7 +401,7 @@ public class Registry implements Registr
try {
info = getMBeanServer().getMBeanInfo(oname);
} catch (Exception e) {
- log.info("Can't find metadata " + oname);
+ log.info(sm.getString("registry.noMetadata", oname));
return null;
}
MBeanOperationInfo attInfo[] = info.getOperations();
@@ -424,7 +426,7 @@ public class Registry implements Registr
getMBeanServer().unregisterMBean(oname);
}
} catch (Throwable t) {
- log.error("Error unregistering mbean", t);
+ log.error(sm.getString("registry.unregisterError"), t);
}
}
@@ -503,7 +505,7 @@ public class Registry implements Registr
managed = findManagedBean(type);
if (managed == null) {
- log.warn("No metadata found for " + type);
+ log.warn(sm.getString("registry.noTypeMetadata", type));
return null;
}
managed.setName(type);
@@ -613,7 +615,7 @@ public class Registry implements Registr
}
if (bean == null) {
- log.error("Null component " + oname);
+ log.error(sm.getString("registry.nullBean", oname));
return;
}
@@ -636,7 +638,7 @@ public class Registry implements Registr
getMBeanServer().registerMBean(mbean, oname);
} catch (Exception ex) {
- log.error("Error registering " + oname, ex);
+ log.error(sm.getString("registry.registerError", oname), ex);
throw ex;
}
}
@@ -672,7 +674,7 @@ public class Registry implements Registr
try {
load("MbeansDescriptorsDigesterSource", dURL, null);
} catch (Exception ex) {
- log.error("Error loading " + dURL);
+ log.error(sm.getString("registry.loadError", dURL));
}
}
Modified:
tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java?rev=1848696&r1=1848695&r2=1848696&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java
(original)
+++
tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java
Tue Dec 11 16:46:24 2018
@@ -168,7 +168,7 @@ public class MbeansDescriptorsDigesterSo
digester.push(loadedMbeans);
digester.parse(stream);
} catch (Exception e) {
- log.error("Error digesting Registry data", e);
+ log.error(sm.getString("modules.digesterParseError"), e);
throw e;
} finally {
digester.reset();
Modified:
tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java?rev=1848696&r1=1848695&r2=1848696&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java
(original)
+++
tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java
Tue Dec 11 16:46:24 2018
@@ -83,7 +83,7 @@ public class MbeansDescriptorsIntrospect
registry.addManagedBean(managed);
} catch( Exception ex ) {
- log.error( "Error reading descriptors ", ex);
+ log.error(sm.getString("modules.readDescriptorsError"), ex);
}
}
@@ -351,7 +351,7 @@ public class MbeansDescriptorsIntrospect
}
mbean.addOperation(op);
} else {
- log.error("Null arg method for [" + name + "]");
+ log.error(sm.getString("modules.nullMethod", name));
}
}
Modified:
tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/ModelerSource.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/ModelerSource.java?rev=1848696&r1=1848695&r2=1848696&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/ModelerSource.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/modeler/modules/ModelerSource.java
Tue Dec 11 16:46:24 2018
@@ -21,11 +21,13 @@ import java.util.List;
import javax.management.ObjectName;
import org.apache.tomcat.util.modeler.Registry;
+import org.apache.tomcat.util.res.StringManager;
/**
* Source for descriptor data. More sources can be added.
*/
public abstract class ModelerSource {
+ protected static final StringManager sm =
StringManager.getManager(Registry.class);
protected Object source;
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]