Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 38127 invoked from network); 23 Sep 2008 16:36:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Sep 2008 16:36:37 -0000 Received: (qmail 79544 invoked by uid 500); 23 Sep 2008 16:36:32 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 79190 invoked by uid 500); 23 Sep 2008 16:36:31 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 79179 invoked by uid 99); 23 Sep 2008 16:36:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Sep 2008 09:36:31 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Sep 2008 16:35:39 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id CC0DA23889F1; Tue, 23 Sep 2008 09:35:42 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r698227 - in /tomcat/trunk/java/org/apache/catalina/realm: CombinedRealm.java RealmBase.java Date: Tue, 23 Sep 2008 16:35:42 -0000 To: dev@tomcat.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080923163542.CC0DA23889F1@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: markt Date: Tue Sep 23 09:35:42 2008 New Revision: 698227 URL: http://svn.apache.org/viewvc?rev=698227&view=rev Log: Now containers can have multiple realms, need to make sure we don't get duplicate names for the realms in jmx. Modified: tomcat/trunk/java/org/apache/catalina/realm/CombinedRealm.java tomcat/trunk/java/org/apache/catalina/realm/RealmBase.java Modified: tomcat/trunk/java/org/apache/catalina/realm/CombinedRealm.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/CombinedRealm.java?rev=698227&r1=698226&r2=698227&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/realm/CombinedRealm.java (original) +++ tomcat/trunk/java/org/apache/catalina/realm/CombinedRealm.java Tue Sep 23 09:35:42 2008 @@ -23,6 +23,8 @@ import java.util.LinkedList; import java.util.List; +import javax.management.ObjectName; + import org.apache.catalina.Container; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleException; @@ -67,6 +69,21 @@ } + /** + * Return the set of Realms that this Realm is wrapping + */ + public ObjectName[] getRealms() { + ObjectName[] result = new ObjectName[realms.size()]; + for (Realm realm : realms) { + if (realm instanceof RealmBase) { + result[realms.indexOf(realm)] = + ((RealmBase) realm).getObjectName(); + } + } + return result; + } + + /** * Return the Principal associated with the specified username and * credentials, if there is one; otherwise return null. @@ -180,8 +197,14 @@ * @param container The associated Container */ public void setContainer(Container container) { - // Set the container for sub-realms. Mainly so logging works. for(Realm realm : realms) { + // Set the realmPath for JMX naming + if (realm instanceof RealmBase) { + ((RealmBase) realm).setRealmPath( + getRealmPath() + "/realm" + realms.indexOf(realm)); + } + + // Set the container for sub-realms. Mainly so logging works. realm.setContainer(container); } super.setContainer(container); Modified: tomcat/trunk/java/org/apache/catalina/realm/RealmBase.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/RealmBase.java?rev=698227&r1=698226&r2=698227&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/realm/RealmBase.java (original) +++ tomcat/trunk/java/org/apache/catalina/realm/RealmBase.java Tue Sep 23 09:35:42 2008 @@ -1285,6 +1285,7 @@ protected String domain; protected String host; protected String path; + protected String realmPath = "/realm0"; protected ObjectName oname; protected ObjectName controller; protected MBeanServer mserver; @@ -1309,6 +1310,14 @@ return type; } + public String getRealmPath() { + return realmPath; + } + + public void setRealmPath(String theRealmPath) { + realmPath = theRealmPath; + } + public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception { oname=name; @@ -1370,7 +1379,8 @@ // register try { ContainerBase cb=(ContainerBase)container; - oname=new ObjectName(cb.getDomain()+":type=Realm" + cb.getContainerSuffix()); + oname=new ObjectName(cb.getDomain()+":type=Realm" + + getRealmSuffix() + cb.getContainerSuffix()); Registry.getRegistry(null, null).registerComponent(this, oname, null ); if(log.isDebugEnabled()) log.debug("Register Realm "+oname); @@ -1382,6 +1392,11 @@ } + protected String getRealmSuffix() { + return ",realmPath=" + getRealmPath(); + } + + protected static class AllRolesMode { private String name; --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org