You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2013/02/28 17:14:57 UTC
svn commit: r1451244 [23/45] - in /qpid/branches/asyncstore: ./ bin/ cpp/
cpp/bindings/ cpp/bindings/qmf/ cpp/bindings/qmf/python/
cpp/bindings/qmf/ruby/ cpp/bindings/qmf2/ cpp/bindings/qmf2/examples/cpp/
cpp/bindings/qmf2/python/ cpp/bindings/qmf2/rub...
Modified: qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslServlet.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslServlet.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslServlet.java (original)
+++ qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslServlet.java Thu Feb 28 16:14:30 2013
@@ -25,10 +25,9 @@ import org.codehaus.jackson.map.ObjectMa
import org.codehaus.jackson.map.SerializationConfig;
import org.apache.log4j.Logger;
-import org.apache.qpid.server.model.Broker;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.security.auth.manager.AuthenticationManager;
-import org.apache.qpid.server.security.auth.sasl.UsernamePrincipal;
+import org.apache.qpid.server.management.plugin.HttpManagement;
+import org.apache.qpid.server.security.SubjectCreator;
+import org.apache.qpid.server.security.auth.AuthenticatedPrincipal;
import javax.security.auth.Subject;
import javax.security.sasl.SaslException;
@@ -39,6 +38,7 @@ import javax.servlet.http.HttpServletRes
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;
+import java.security.AccessControlException;
import java.security.Principal;
import java.security.SecureRandom;
import java.util.LinkedHashMap;
@@ -47,6 +47,7 @@ import java.util.Random;
public class SaslServlet extends AbstractServlet
{
+
private static final Logger LOGGER = Logger.getLogger(SaslServlet.class);
private static final SecureRandom SECURE_RANDOM = new SecureRandom();
@@ -56,18 +57,12 @@ public class SaslServlet extends Abstrac
private static final String ATTR_EXPIRY = "SaslServlet.Expiry";
private static final long SASL_EXCHANGE_EXPIRY = 1000L;
-
public SaslServlet()
{
super();
}
- public SaslServlet(Broker broker)
- {
- super(broker);
- }
-
- protected void onGet(HttpServletRequest request, HttpServletResponse response) throws
+ protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws
ServletException,
IOException
{
@@ -79,15 +74,16 @@ public class SaslServlet extends Abstrac
response.setDateHeader ("Expires", 0);
HttpSession session = request.getSession();
- Random rand = getRandom(session);
+ getRandom(session);
- AuthenticationManager authManager = ApplicationRegistry.getInstance().getAuthenticationManager(getSocketAddress(request));
- String[] mechanisms = authManager.getMechanisms().split(" ");
+ SubjectCreator subjectCreator = getSubjectCreator(request);
+ String[] mechanisms = subjectCreator.getMechanisms().split(" ");
Map<String, Object> outputObject = new LinkedHashMap<String, Object>();
- final Subject subject = (Subject) session.getAttribute("subject");
+
+ final Subject subject = getAuthorisedSubjectFromSession(session);
if(subject != null)
{
- final Principal principal = subject.getPrincipals().iterator().next();
+ Principal principal = AuthenticatedPrincipal.getAuthenticatedPrincipalFromSubject(subject);
outputObject.put("user", principal.getName());
}
else if (request.getRemoteUser() != null)
@@ -121,9 +117,10 @@ public class SaslServlet extends Abstrac
@Override
- protected void onPost(final HttpServletRequest request, final HttpServletResponse response)
- throws ServletException, IOException
+ protected void doPostWithSubjectAndActor(final HttpServletRequest request, final HttpServletResponse response) throws IOException
{
+ checkSaslAuthEnabled(request);
+
try
{
response.setContentType("application/json");
@@ -137,14 +134,18 @@ public class SaslServlet extends Abstrac
String id = request.getParameter("id");
String saslResponse = request.getParameter("response");
- AuthenticationManager authManager = ApplicationRegistry.getInstance().getAuthenticationManager(getSocketAddress(request));
+ SubjectCreator subjectCreator = getSubjectCreator(request);
if(mechanism != null)
{
if(id == null)
{
- SaslServer saslServer = authManager.createSaslServer(mechanism, request.getServerName(), null/*TODO*/);
- evaluateSaslResponse(response, session, saslResponse, saslServer);
+ if(LOGGER.isDebugEnabled())
+ {
+ LOGGER.debug("Creating SaslServer for mechanism: " + mechanism);
+ }
+ SaslServer saslServer = subjectCreator.createSaslServer(mechanism, request.getServerName(), null/*TODO*/);
+ evaluateSaslResponse(request, response, session, saslResponse, saslServer, subjectCreator);
}
else
{
@@ -152,9 +153,7 @@ public class SaslServlet extends Abstrac
session.removeAttribute(ATTR_ID);
session.removeAttribute(ATTR_SASL_SERVER);
session.removeAttribute(ATTR_EXPIRY);
-
}
-
}
else
{
@@ -163,8 +162,7 @@ public class SaslServlet extends Abstrac
if(id.equals(session.getAttribute(ATTR_ID)) && System.currentTimeMillis() < (Long) session.getAttribute(ATTR_EXPIRY))
{
SaslServer saslServer = (SaslServer) session.getAttribute(ATTR_SASL_SERVER);
- evaluateSaslResponse(response, session, saslResponse, saslServer);
-
+ evaluateSaslResponse(request, response, session, saslResponse, saslServer, subjectCreator);
}
else
{
@@ -180,7 +178,6 @@ public class SaslServlet extends Abstrac
session.removeAttribute(ATTR_ID);
session.removeAttribute(ATTR_SASL_SERVER);
session.removeAttribute(ATTR_EXPIRY);
-
}
}
}
@@ -194,12 +191,30 @@ public class SaslServlet extends Abstrac
LOGGER.error("Error processing SASL request", e);
throw e;
}
+ }
+ private void checkSaslAuthEnabled(HttpServletRequest request)
+ {
+ boolean saslAuthEnabled;
+ HttpManagement management = getManagement();
+ if (request.isSecure())
+ {
+ saslAuthEnabled = management.isHttpsSaslAuthenticationEnabled();
+ }
+ else
+ {
+ saslAuthEnabled = management.isHttpSaslAuthenticationEnabled();
+ }
+
+ if (!saslAuthEnabled)
+ {
+ throw new RuntimeException("Sasl authentication disabled.");
+ }
}
- private void evaluateSaslResponse(final HttpServletResponse response,
- final HttpSession session,
- final String saslResponse, final SaslServer saslServer) throws IOException
+ private void evaluateSaslResponse(final HttpServletRequest request,
+ final HttpServletResponse response,
+ final HttpSession session, final String saslResponse, final SaslServer saslServer, SubjectCreator subjectCreator) throws IOException
{
final String id;
byte[] challenge;
@@ -209,27 +224,34 @@ public class SaslServlet extends Abstrac
}
catch(SaslException e)
{
-
session.removeAttribute(ATTR_ID);
session.removeAttribute(ATTR_SASL_SERVER);
session.removeAttribute(ATTR_EXPIRY);
- response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
+ response.setStatus(HttpServletResponse.SC_FORBIDDEN);
return;
}
if(saslServer.isComplete())
{
- final Subject subject = new Subject();
- subject.getPrincipals().add(new UsernamePrincipal(saslServer.getAuthorizationID()));
- session.setAttribute("subject", subject);
+ Subject subject = subjectCreator.createSubjectWithGroups(saslServer.getAuthorizationID());
+
+ try
+ {
+ authoriseManagement(request, subject);
+ }
+ catch (AccessControlException ace)
+ {
+ sendError(response, HttpServletResponse.SC_FORBIDDEN);
+ return;
+ }
+
+ setAuthorisedSubjectInSession(subject, request, session);
session.removeAttribute(ATTR_ID);
session.removeAttribute(ATTR_SASL_SERVER);
session.removeAttribute(ATTR_EXPIRY);
response.setStatus(HttpServletResponse.SC_OK);
-
-
}
else
{
@@ -250,7 +272,6 @@ public class SaslServlet extends Abstrac
ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
mapper.writeValue(writer, outputObject);
-
}
}
}
Modified: qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/StructureServlet.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/StructureServlet.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/StructureServlet.java (original)
+++ qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/StructureServlet.java Thu Feb 28 16:14:30 2013
@@ -41,13 +41,8 @@ public class StructureServlet extends Ab
super();
}
- public StructureServlet(Broker broker)
- {
- super(broker);
- }
-
@Override
- protected void onGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
+ protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
response.setContentType("application/json");
response.setStatus(HttpServletResponse.SC_OK);
@@ -56,6 +51,8 @@ public class StructureServlet extends Ab
response.setHeader("Pragma","no-cache");
response.setDateHeader ("Expires", 0);
+ // TODO filtering??? request.getParameter("filter"); // filter=1,2,3 /groups/*/*
+
Map<String,Object> structure = generateStructure(getBroker(), Broker.class);
final PrintWriter writer = response.getWriter();
Modified: qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/showPrincipalDatabaseAuthenticationManager.html
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/showPrincipalDatabaseAuthenticationManager.html?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/showPrincipalDatabaseAuthenticationManager.html (original)
+++ qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/showPrincipalDatabaseAuthenticationManager.html Thu Feb 28 16:14:30 2013
@@ -23,7 +23,5 @@
<div class="users"></div>
<button data-dojo-type="dijit.form.Button" class="addUserButton">Add User</button>
<button data-dojo-type="dijit.form.Button" class="deleteUserButton">Delete Users</button>
-
</div>
-
</div>
Modified: qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/authorization/sasl.js
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/authorization/sasl.js?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/authorization/sasl.js (original)
+++ qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/authorization/sasl.js Thu Feb 28 16:14:30 2013
@@ -71,7 +71,7 @@ var saslPlain = function saslPlain(user,
},
function(error)
{
- if(error.status == 401)
+ if(error.status == 403)
{
alert("Authentication Failed");
}
@@ -127,7 +127,7 @@ var saslCramMD5 = function saslCramMD5(u
},
function(error)
{
- if(error.status == 401)
+ if(error.status == 403)
{
alert("Authentication Failed");
}
@@ -141,7 +141,7 @@ var saslCramMD5 = function saslCramMD5(u
},
function(error)
{
- if(error.status == 401)
+ if(error.status == 403)
{
alert("Authentication Failed");
}
@@ -152,10 +152,45 @@ var saslCramMD5 = function saslCramMD5(u
});
};
+var containsMechanism = function containsMechanism(mechanisms, mech)
+{
+ for (var i = 0; i < mechanisms.length; i++) {
+ if (mechanisms[i] == mech) {
+ return true;
+ }
+ }
+
+ return false;
+};
+
var doAuthenticate = function doAuthenticate()
{
- saslCramMD5(dojo.byId("username").value, dojo.byId("pass").value);
- updateAuthentication();
+ dojo.xhrGet({
+ // The URL of the request
+ url: "rest/sasl",
+ handleAs: "json"
+ }).then(function(data)
+ {
+ var mechMap = data.mechanisms;
+
+ if (containsMechanism(mechMap, "CRAM-MD5"))
+ {
+ saslCramMD5(dojo.byId("username").value, dojo.byId("pass").value);
+ updateAuthentication();
+ }
+ else if (containsMechanism(mechMap, "PLAIN"))
+ {
+ saslPlain(dojo.byId("username").value, dojo.byId("pass").value);
+ updateAuthentication();
+ }
+ else
+ {
+ alert("No supported SASL mechanism offered: " + mechMap);
+ }
+ }
+ );
+
+
};
@@ -170,13 +205,13 @@ var updateAuthentication = function upda
if(data.user)
{
dojo.byId("authenticatedUser").innerHTML = data.user;
- dojo.style(button.domNode, {visibility: 'hidden'});
- dojo.style(usernameSpan, {visibility: 'visible'});
+ dojo.style(button.domNode, {display: 'none'});
+ dojo.style(usernameSpan, {display: 'block'});
}
else
{
- dojo.style(button.domNode, {visibility: 'visible'});
- dojo.style(usernameSpan, {visibility: 'hidden'});
+ dojo.style(button.domNode, {display: 'block'});
+ dojo.style(usernameSpan, {display: 'none'});
}
}
);
@@ -198,13 +233,13 @@ require(["dijit/form/DropDownButton", "d
dropDown: dialog
});
- usernameSpan = domConstruct.create("span", { innerHTML: '<strong>User: </strong><span id="authenticatedUser"></span>',
- style: { visibility: "hidden" }});
+ usernameSpan = domConstruct.create("span", { innerHTML: '<strong>User: </strong> <span id="authenticatedUser"></span><a href="logout">[logout]</a>',
+ style: { display: "none" }});
var loginDiv = dom.byId("login");
- loginDiv.appendChild(button.domNode);
loginDiv.appendChild(usernameSpan);
+ loginDiv.appendChild(button.domNode);
Modified: qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js (original)
+++ qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js Thu Feb 28 16:14:30 2013
@@ -58,10 +58,10 @@ define(["dojo/_base/xhr"],
return exchangeName == null || exchangeName == "" || "<<default>>" == exchangeName || exchangeName.indexOf("amq.") == 0 || exchangeName.indexOf("qpid.") == 0;
};
- util.deleteGridSelections = function(updater, gridName, url, confirmationMessageStart)
+ util.deleteGridSelections = function(updater, grid, url, confirmationMessageStart)
{
- var grid = updater[gridName].grid;
var data = grid.selection.getSelected();
+
if(data.length)
{
var confirmationMessage = null;
@@ -103,7 +103,8 @@ define(["dojo/_base/xhr"],
xhr.del({url: query, sync: true, handleAs: "json"}).then(
function(data)
{
- grid.setQuery({id: "*"});
+ // TODO why query *??
+ //grid.setQuery({id: "*"});
grid.selection.deselectAll();
updater.update();
},
Modified: qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Exchange.js
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Exchange.js?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Exchange.js (original)
+++ qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Exchange.js Thu Feb 28 16:14:30 2013
@@ -115,7 +115,7 @@ define(["dojo/_base/xhr",
{
util.deleteGridSelections(
this.exchangeUpdater,
- "bindingsGrid",
+ that.exchangeUpdater.bindingsGrid.grid,
"rest/binding/"+ encodeURIComponent(this.getVirtualHostName()) + "/" + encodeURIComponent(this.name),
"Are you sure you want to delete binding for queue");
}
Modified: qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.js
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.js?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.js (original)
+++ qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.js Thu Feb 28 16:14:30 2013
@@ -72,7 +72,7 @@ define(["dojo/_base/xhr",
function(evt){
util.deleteGridSelections(
that.vhostUpdater,
- "queuesGrid",
+ that.vhostUpdater.queuesGrid.grid,
"rest/queue/"+ encodeURIComponent(that.name),
"Are you sure you want to delete queue");
}
@@ -87,7 +87,7 @@ define(["dojo/_base/xhr",
{
util.deleteGridSelections(
that.vhostUpdater,
- "exchangesGrid",
+ that.vhostUpdater.exchangesGrid.grid,
"rest/exchange/"+ encodeURIComponent(that.name),
"Are you sure you want to delete exchange");
}
Modified: qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js (original)
+++ qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js Thu Feb 28 16:14:30 2013
@@ -27,13 +27,17 @@ define(["dojo/dom",
"qpid/management/Queue",
"qpid/management/Connection",
"qpid/management/AuthenticationProvider",
+ "qpid/management/GroupProvider",
+ "qpid/management/group/Group",
"dojo/ready",
"dojo/domReady!"],
- function (dom, registry, ContentPane, Broker, VirtualHost, Exchange, Queue, Connection, AuthProvider, ready) {
+ function (dom, registry, ContentPane, Broker, VirtualHost, Exchange, Queue, Connection, AuthProvider, GroupProvider, Group, ready) {
var controller = {};
var constructors = { broker: Broker, virtualhost: VirtualHost, exchange: Exchange,
- queue: Queue, connection: Connection, authenticationprovider: AuthProvider };
+ queue: Queue, connection: Connection,
+ authenticationprovider: AuthProvider, groupprovider: GroupProvider,
+ group: Group };
var tabDiv = dom.byId("managedViews");
Modified: qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js (original)
+++ qpid/branches/asyncstore/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js Thu Feb 28 16:14:30 2013
@@ -273,10 +273,12 @@ define(["dojo/_base/xhr",
controller.show("port", details.port, { type: "virtualhost", name: details.virtualhost, parent: {broker: {type:"broker", name:""}}});
} else if (details.type == 'authenticationprovider') {
controller.show("authenticationprovider", details.authenticationprovider, {broker: {type:"broker", name:""}});
+ } else if (details.type == 'groupprovider') {
+ controller.show("groupprovider", details.groupprovider, {broker: {type:"broker", name:""}});
+ } else if (details.type == 'group') {
+ controller.show("group", details.group, { type: "groupprovider", name: details.groupprovider, parent: {broker: {type:"broker", name:""}}});
}
-
-
};
TreeViewModel.prototype.update = function () {
Modified: qpid/branches/asyncstore/java/broker-plugins/management-jmx/build.xml
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker-plugins/management-jmx/build.xml?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker-plugins/management-jmx/build.xml (original)
+++ qpid/branches/asyncstore/java/broker-plugins/management-jmx/build.xml Thu Feb 28 16:14:30 2013
@@ -17,28 +17,14 @@
- under the License.
-->
<project name="Qpid Broker-Plugins Management JMX" default="build">
-
- <condition property="systests.optional.depends" value="bdbstore" else="">
- <or>
- <and>
- <contains string="${modules.opt}" substring="bdbstore"/>
- <contains string="${profile}" substring="bdb"/>
- </and>
- <and>
- <istrue value="${optional}"/>
- <contains string="${profile}" substring="bdb"/>
- </and>
- </or>
- </condition>
-
<property name="module.depends" value="common broker management/common" />
- <property name="module.test.depends" value="systests test broker/test common/test management/common client ${systests.optional.depends}" />
+ <property name="module.test.depends" value="broker/tests common/tests management/common client" />
- <property name="module.manifest" value="MANIFEST.MF" />
- <property name="module.plugin" value="true" />
<property name="module.genpom" value="true"/>
<property name="module.genpom.args" value="-Sqpid-common=provided -Sqpid-broker=provided -Sqpid-management-common=provided"/>
+ <property name="broker.plugin" value="true"/>
+
<property name="broker-plugins-management-jmx.libs" value=""/>
<import file="../../module.xml" />
Modified: qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagedObjectRegistry.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagedObjectRegistry.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagedObjectRegistry.java (original)
+++ qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/JMXManagedObjectRegistry.java Thu Feb 28 16:14:30 2013
@@ -20,171 +20,114 @@
*/
package org.apache.qpid.server.jmx;
-import org.apache.commons.configuration.ConfigurationException;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
+import org.apache.qpid.server.configuration.BrokerProperties;
+import org.apache.qpid.server.configuration.IllegalConfigurationException;
import org.apache.qpid.server.logging.actors.CurrentActor;
import org.apache.qpid.server.logging.messages.ManagementConsoleMessages;
-
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.registry.IApplicationRegistry;
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.Port;
+import org.apache.qpid.server.model.Transport;
import org.apache.qpid.server.security.auth.rmi.RMIPasswordAuthenticator;
-import org.apache.qpid.server.security.auth.sasl.UsernamePrincipal;
import javax.management.JMException;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
-import javax.management.Notification;
-import javax.management.NotificationFilterSupport;
-import javax.management.NotificationListener;
import javax.management.ObjectName;
-import javax.management.remote.JMXConnectionNotification;
import javax.management.remote.JMXConnectorServer;
import javax.management.remote.JMXServiceURL;
import javax.management.remote.MBeanServerForwarder;
-import javax.management.remote.rmi.RMIConnection;
import javax.management.remote.rmi.RMIConnectorServer;
-import javax.management.remote.rmi.RMIJRMPServerImpl;
-import javax.management.remote.rmi.RMIServerImpl;
import javax.rmi.ssl.SslRMIClientSocketFactory;
import javax.rmi.ssl.SslRMIServerSocketFactory;
-import javax.security.auth.Subject;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.management.ManagementFactory;
-import java.lang.reflect.Proxy;
import java.net.InetAddress;
import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
import java.net.UnknownHostException;
import java.rmi.AlreadyBoundException;
import java.rmi.NoSuchObjectException;
import java.rmi.NotBoundException;
+import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.RMIClientSocketFactory;
import java.rmi.server.RMIServerSocketFactory;
import java.rmi.server.UnicastRemoteObject;
import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
/**
- * This class starts up an MBeanserver. If out of the box agent has been enabled then there are no
+ * This class starts up an MBeanserver. If out of the box agent has been enabled then there are no
* security features implemented like user authentication and authorisation.
*/
public class JMXManagedObjectRegistry implements ManagedObjectRegistry
{
private static final Logger _log = Logger.getLogger(JMXManagedObjectRegistry.class);
+ private static final String OPERATIONAL_LOGGING_NAME = "JMX";
+
private final MBeanServer _mbeanServer;
+
private JMXConnectorServer _cs;
private Registry _rmiRegistry;
- private boolean _useCustomSocketFactory;
- private final int _jmxPortRegistryServer;
- private final int _jmxPortConnectorServer;
-
- public JMXManagedObjectRegistry() throws AMQException
+ private final Broker _broker;
+ private final Port _registryPort;
+ private final Port _connectorPort;
+
+ public JMXManagedObjectRegistry(
+ Broker broker,
+ Port connectorPort, Port registryPort,
+ JMXManagement jmxManagement)
{
- _log.info("Initialising managed object registry using platform MBean server");
- IApplicationRegistry appRegistry = ApplicationRegistry.getInstance();
+ _broker = broker;
+ _registryPort = registryPort;
+ _connectorPort = connectorPort;
- // Retrieve the config parameters
- _useCustomSocketFactory = appRegistry.getConfiguration().getUseCustomRMISocketFactory();
- boolean platformServer = appRegistry.getConfiguration().getPlatformMbeanserver();
+ boolean usePlatformServer = (Boolean)jmxManagement.getAttribute(JMXManagement.USE_PLATFORM_MBEAN_SERVER);
_mbeanServer =
- platformServer ? ManagementFactory.getPlatformMBeanServer()
+ usePlatformServer ? ManagementFactory.getPlatformMBeanServer()
: MBeanServerFactory.createMBeanServer(ManagedObject.DOMAIN);
+ }
- _jmxPortRegistryServer = appRegistry.getConfiguration().getJMXPortRegistryServer();
- _jmxPortConnectorServer = appRegistry.getConfiguration().getJMXConnectorServerPort();
-
- }
-
- public void start() throws IOException, ConfigurationException
+ @Override
+ public void start() throws IOException
{
-
- CurrentActor.get().message(ManagementConsoleMessages.STARTUP());
+ CurrentActor.get().message(ManagementConsoleMessages.STARTUP(OPERATIONAL_LOGGING_NAME));
//check if system properties are set to use the JVM's out-of-the-box JMXAgent
if (areOutOfTheBoxJMXOptionsSet())
{
- CurrentActor.get().message(ManagementConsoleMessages.READY(true));
- return;
+ CurrentActor.get().message(ManagementConsoleMessages.READY(OPERATIONAL_LOGGING_NAME));
}
+ else
+ {
+ startRegistryAndConnector();
+ }
+ }
- IApplicationRegistry appRegistry = ApplicationRegistry.getInstance();
-
-
- //Socket factories for the RMIConnectorServer, either default or SLL depending on configuration
+ private void startRegistryAndConnector() throws IOException
+ {
+ //Socket factories for the RMIConnectorServer, either default or SSL depending on configuration
RMIClientSocketFactory csf;
RMIServerSocketFactory ssf;
- //check ssl enabled option in config, default to true if option is not set
- boolean sslEnabled = appRegistry.getConfiguration().getManagementSSLEnabled();
+ //check ssl enabled option on connector port (note we don't provide ssl for registry server at
+ //moment).
+ boolean connectorSslEnabled = _connectorPort.getTransports().contains(Transport.SSL);
- if (sslEnabled)
+ if (connectorSslEnabled)
{
- //set the SSL related system properties used by the SSL RMI socket factories to the values
- //given in the configuration file, unless command line settings have already been specified
- String keyStorePath;
+ String keyStorePath = System.getProperty("javax.net.ssl.keyStore");
+ String keyStorePassword = System.getProperty("javax.net.ssl.keyStorePassword");
- if(System.getProperty("javax.net.ssl.keyStore") != null)
- {
- keyStorePath = System.getProperty("javax.net.ssl.keyStore");
- }
- else
- {
- keyStorePath = appRegistry.getConfiguration().getManagementKeyStorePath();
- }
+ validateKeyStoreProperties(keyStorePath, keyStorePassword);
- //check the keystore path value is valid
- if (keyStorePath == null)
- {
- throw new ConfigurationException("JMX management SSL keystore path not defined, " +
- "unable to start SSL protected JMX ConnectorServer");
- }
- else
- {
- //ensure the system property is set
- System.setProperty("javax.net.ssl.keyStore", keyStorePath);
-
- //check the file is usable
- File ksf = new File(keyStorePath);
-
- if (!ksf.exists())
- {
- throw new FileNotFoundException("Cannot find JMX management SSL keystore file: " + ksf);
- }
- if (!ksf.canRead())
- {
- throw new FileNotFoundException("Cannot read JMX management SSL keystore file: "
- + ksf + ". Check permissions.");
- }
-
- CurrentActor.get().message(ManagementConsoleMessages.SSL_KEYSTORE(ksf.getAbsolutePath()));
- }
-
- //check the key store password is set
- if (System.getProperty("javax.net.ssl.keyStorePassword") == null)
- {
-
- if (appRegistry.getConfiguration().getManagementKeyStorePassword() == null)
- {
- throw new ConfigurationException("JMX management SSL keystore password not defined, " +
- "unable to start requested SSL protected JMX server");
- }
- else
- {
- System.setProperty("javax.net.ssl.keyStorePassword",
- appRegistry.getConfiguration().getManagementKeyStorePassword());
- }
- }
+ CurrentActor.get().message(ManagementConsoleMessages.SSL_KEYSTORE(keyStorePath));
//create the SSL RMI socket factories
csf = new SslRMIClientSocketFactory();
@@ -197,27 +140,23 @@ public class JMXManagedObjectRegistry im
ssf = null;
}
+ int jmxPortRegistryServer = _registryPort.getPort();
+ int jmxPortConnectorServer = _connectorPort.getPort();
+
//add a JMXAuthenticator implementation the env map to authenticate the RMI based JMX connector server
- RMIPasswordAuthenticator rmipa = new RMIPasswordAuthenticator(new InetSocketAddress(_jmxPortRegistryServer));
- HashMap<String,Object> env = new HashMap<String,Object>();
- env.put(JMXConnectorServer.AUTHENTICATOR, rmipa);
+ RMIPasswordAuthenticator rmipa = new RMIPasswordAuthenticator(_broker, new InetSocketAddress(jmxPortConnectorServer));
+ HashMap<String,Object> connectorEnv = new HashMap<String,Object>();
+ connectorEnv.put(JMXConnectorServer.AUTHENTICATOR, rmipa);
+
+ System.setProperty("java.rmi.server.randomIDs", "true");
+ boolean useCustomSocketFactory = Boolean.parseBoolean(System.getProperty(BrokerProperties.PROPERTY_USE_CUSTOM_RMI_SOCKET_FACTORY, Boolean.TRUE.toString()));
/*
* Start a RMI registry on the management port, to hold the JMX RMI ConnectorServer stub.
* Using custom socket factory to prevent anyone (including us unfortunately) binding to the registry using RMI.
* As a result, only binds made using the object reference will succeed, thus securing it from external change.
*/
- System.setProperty("java.rmi.server.randomIDs", "true");
- if(_useCustomSocketFactory)
- {
- _rmiRegistry = LocateRegistry.createRegistry(_jmxPortRegistryServer, null, new CustomRMIServerSocketFactory());
- }
- else
- {
- _rmiRegistry = LocateRegistry.createRegistry(_jmxPortRegistryServer, null, null);
- }
-
- CurrentActor.get().message(ManagementConsoleMessages.LISTENING("RMI Registry", _jmxPortRegistryServer));
+ _rmiRegistry = createRmiRegistry(jmxPortRegistryServer, useCustomSocketFactory);
/*
* We must now create the RMI ConnectorServer manually, as the JMX Factory methods use RMI calls
@@ -225,57 +164,16 @@ public class JMXManagedObjectRegistry im
* locked it from any RMI based modifications, including our own. Instead, we will manually bind
* the RMIConnectorServer stub to the registry using its object reference, which will still succeed.
*
- * The registry is exported on the defined management port 'port'. We will export the RMIConnectorServer
- * on 'port +1'. Use of these two well-defined ports will ease any navigation through firewall's.
+ * The registry is exported on the defined management port 'port'.
*/
- final Map<String, String> connectionIdUsernameMap = new ConcurrentHashMap<String, String>();
- final RMIServerImpl rmiConnectorServerStub = new RMIJRMPServerImpl(_jmxPortConnectorServer, csf, ssf, env)
- {
-
- /**
- * Override makeClient so we can cache the username of the client in a Map keyed by connectionId.
- * ConnectionId is guaranteed to be unique per client connection, according to the JMS spec.
- * An instance of NotificationListener (mapCleanupListener) will be responsible for removing these Map
- * entries.
- *
- * @see javax.management.remote.rmi.RMIJRMPServerImpl#makeClient(String, javax.security.auth.Subject)
- */
- @Override
- protected RMIConnection makeClient(String connectionId, Subject subject) throws IOException
- {
- final RMIConnection makeClient = super.makeClient(connectionId, subject);
- final UsernamePrincipal usernamePrincipalFromSubject = UsernamePrincipal.getUsernamePrincipalFromSubject(subject);
- connectionIdUsernameMap.put(connectionId, usernamePrincipalFromSubject.getName());
- return makeClient;
- }
- };
-
- // Create a Listener responsible for removing the map entries add by the #makeClient entry above.
- final NotificationListener mapCleanupListener = new NotificationListener()
- {
-
- public void handleNotification(Notification notification, Object handback)
- {
- final String connectionId = ((JMXConnectionNotification) notification).getConnectionId();
- connectionIdUsernameMap.remove(connectionId);
- }
- };
+ final UsernameCachingRMIJRMPServer usernameCachingRmiServer = new UsernameCachingRMIJRMPServer(jmxPortConnectorServer, csf, ssf, connectorEnv);
- String localHost;
- try
- {
- localHost = InetAddress.getLocalHost().getHostName();
- }
- catch(UnknownHostException ex)
- {
- localHost="127.0.0.1";
- }
- final String hostname = localHost;
+ final String localHostName = getLocalhost();
final JMXServiceURL externalUrl = new JMXServiceURL(
- "service:jmx:rmi://"+hostname+":"+(_jmxPortConnectorServer)+"/jndi/rmi://"+hostname+":"+_jmxPortRegistryServer+"/jmxrmi");
+ "service:jmx:rmi://"+localHostName+":"+(jmxPortConnectorServer)+"/jndi/rmi://"+localHostName+":"+jmxPortRegistryServer+"/jmxrmi");
- final JMXServiceURL internalUrl = new JMXServiceURL("rmi", hostname, _jmxPortConnectorServer);
- _cs = new RMIConnectorServer(internalUrl, env, rmiConnectorServerStub, _mbeanServer)
+ final JMXServiceURL internalUrl = new JMXServiceURL("rmi", localHostName, jmxPortConnectorServer);
+ _cs = new RMIConnectorServer(internalUrl, connectorEnv, usernameCachingRmiServer, _mbeanServer)
{
@Override
public synchronized void start() throws IOException
@@ -283,7 +181,7 @@ public class JMXManagedObjectRegistry im
try
{
//manually bind the connector server to the registry at key 'jmxrmi', like the out-of-the-box agent
- _rmiRegistry.bind("jmxrmi", rmiConnectorServerStub);
+ _rmiRegistry.bind("jmxrmi", usernameCachingRmiServer);
}
catch (AlreadyBoundException abe)
{
@@ -311,7 +209,6 @@ public class JMXManagedObjectRegistry im
}
catch (NotBoundException nbe)
{
- // TODO consider if we want to keep new logging
_log.error("Failed to unbind jmxrmi", nbe);
//ignore
}
@@ -326,97 +223,100 @@ public class JMXManagedObjectRegistry im
//must return our pre-crafted url that includes the full details, inc JNDI details
return externalUrl;
}
-
};
-
//Add the custom invoker as an MBeanServerForwarder, and start the RMIConnectorServer.
- MBeanServerForwarder mbsf = MBeanInvocationHandlerImpl.newProxyInstance();
+ MBeanServerForwarder mbsf = MBeanInvocationHandlerImpl.newProxyInstance(_broker);
_cs.setMBeanServerForwarder(mbsf);
+ // Install a ManagementLogonLogoffReporter so we can report as users logon/logoff
+ ManagementLogonLogoffReporter jmxManagementUserLogonLogoffReporter = new ManagementLogonLogoffReporter(_broker.getRootMessageLogger(), usernameCachingRmiServer);
+ _cs.addNotificationListener(jmxManagementUserLogonLogoffReporter, jmxManagementUserLogonLogoffReporter, null);
- // Get the handler that is used by the above MBInvocationHandler Proxy.
- // which is the MBeanInvocationHandlerImpl and so also a NotificationListener.
- final NotificationListener invocationHandler = (NotificationListener) Proxy.getInvocationHandler(mbsf);
-
- // Install a notification listener on OPENED, CLOSED, and FAILED,
- // passing the map of connection-ids to usernames as hand-back data.
- final NotificationFilterSupport invocationHandlerFilter = new NotificationFilterSupport();
- invocationHandlerFilter.enableType(JMXConnectionNotification.OPENED);
- invocationHandlerFilter.enableType(JMXConnectionNotification.CLOSED);
- invocationHandlerFilter.enableType(JMXConnectionNotification.FAILED);
- _cs.addNotificationListener(invocationHandler, invocationHandlerFilter, connectionIdUsernameMap);
-
- // Install a second notification listener on CLOSED AND FAILED only to remove the entry from the
- // Map. Here we rely on the fact that JMX will call the listeners in the order in which they are
- // installed.
- final NotificationFilterSupport mapCleanupHandlerFilter = new NotificationFilterSupport();
- mapCleanupHandlerFilter.enableType(JMXConnectionNotification.CLOSED);
- mapCleanupHandlerFilter.enableType(JMXConnectionNotification.FAILED);
- _cs.addNotificationListener(mapCleanupListener, mapCleanupHandlerFilter, null);
+ // Install the usernameCachingRmiServer as a listener so it may cleanup as clients disconnect
+ _cs.addNotificationListener(usernameCachingRmiServer, usernameCachingRmiServer, null);
_cs.start();
- String connectorServer = (sslEnabled ? "SSL " : "") + "JMX RMIConnectorServer";
- CurrentActor.get().message(ManagementConsoleMessages.LISTENING(connectorServer, _jmxPortConnectorServer));
-
- CurrentActor.get().message(ManagementConsoleMessages.READY(false));
+ String connectorServer = (connectorSslEnabled ? "SSL " : "") + "JMX RMIConnectorServer";
+ CurrentActor.get().message(ManagementConsoleMessages.LISTENING(connectorServer, jmxPortConnectorServer));
+ CurrentActor.get().message(ManagementConsoleMessages.READY(OPERATIONAL_LOGGING_NAME));
}
- /*
- * Custom RMIServerSocketFactory class, used to prevent updates to the RMI registry.
- * Supplied to the registry at creation, this will prevent RMI-based operations on the
- * registry such as attempting to bind a new object, thereby securing it from tampering.
- * This is accomplished by always returning null when attempting to determine the address
- * of the caller, thus ensuring the registry will refuse the attempt. Calls to bind etc
- * made using the object reference will not be affected and continue to operate normally.
- */
-
- private static class CustomRMIServerSocketFactory implements RMIServerSocketFactory
+ private Registry createRmiRegistry(int jmxPortRegistryServer, boolean useCustomRmiRegistry)
+ throws RemoteException
{
-
- public ServerSocket createServerSocket(int port) throws IOException
+ Registry rmiRegistry;
+ if(useCustomRmiRegistry)
{
- return new NoLocalAddressServerSocket(port);
+ _log.debug("Using custom RMIServerSocketFactory");
+ rmiRegistry = LocateRegistry.createRegistry(jmxPortRegistryServer, null, new CustomRMIServerSocketFactory());
}
-
- private static class NoLocalAddressServerSocket extends ServerSocket
+ else
{
- NoLocalAddressServerSocket(int port) throws IOException
- {
- super(port);
- }
+ _log.debug("Using default RMIServerSocketFactory");
+ rmiRegistry = LocateRegistry.createRegistry(jmxPortRegistryServer, null, null);
+ }
- @Override
- public Socket accept() throws IOException
- {
- Socket s = new NoLocalAddressSocket();
- super.implAccept(s);
- return s;
- }
+ CurrentActor.get().message(ManagementConsoleMessages.LISTENING("RMI Registry", jmxPortRegistryServer));
+ return rmiRegistry;
+ }
+
+ private void validateKeyStoreProperties(String keyStorePath, String keyStorePassword) throws FileNotFoundException
+ {
+ if (keyStorePath == null)
+ {
+ throw new IllegalConfigurationException("JVM system property 'javax.net.ssl.keyStore' is not set, "
+ + "unable to start requested SSL protected JMX connector");
+ }
+ if (keyStorePassword == null)
+ {
+ throw new IllegalConfigurationException( "JVM system property 'javax.net.ssl.keyStorePassword' is not set, "
+ + "unable to start requested SSL protected JMX connector");
}
- private static class NoLocalAddressSocket extends Socket
+ File ksf = new File(keyStorePath);
+ if (!ksf.exists())
{
- @Override
- public InetAddress getInetAddress()
- {
- return null;
- }
+ throw new FileNotFoundException("Cannot find JMX management SSL keystore file: " + ksf);
+ }
+ if (!ksf.canRead())
+ {
+ throw new FileNotFoundException("Cannot read JMX management SSL keystore file: "
+ + ksf + ". Check permissions.");
}
}
-
+ @Override
public void registerObject(ManagedObject managedObject) throws JMException
{
_mbeanServer.registerMBean(managedObject, managedObject.getObjectName());
}
+ @Override
public void unregisterObject(ManagedObject managedObject) throws JMException
{
_mbeanServer.unregisterMBean(managedObject.getObjectName());
}
+ @Override
+ public void close()
+ {
+ _log.debug("close() called");
+
+ closeConnectorAndRegistryServers();
+
+ unregisterAllMbeans();
+
+ CurrentActor.get().message(ManagementConsoleMessages.STOPPED(OPERATIONAL_LOGGING_NAME));
+ }
+
+ private void closeConnectorAndRegistryServers()
+ {
+ closeConnectorServer();
+ closeRegistryServer();
+ }
+
// checks if the system properties are set which enable the JVM's out-of-the-box JMXAgent.
private boolean areOutOfTheBoxJMXOptionsSet()
{
@@ -433,29 +333,26 @@ public class JMXManagedObjectRegistry im
return false;
}
- //Stops the JMXConnectorServer and RMIRegistry, then unregisters any remaining MBeans from the MBeanServer
- public void close()
+ private String getLocalhost()
{
- _log.debug("close() called");
-
- if (_cs != null)
+ String localHost;
+ try
{
- // Stopping the JMX ConnectorServer
- try
- {
- CurrentActor.get().message(ManagementConsoleMessages.SHUTTING_DOWN("JMX RMIConnectorServer", _cs.getAddress().getPort()));
- _cs.stop();
- }
- catch (IOException e)
- {
- _log.error("Exception while closing the JMX ConnectorServer: ", e);
- }
+ localHost = InetAddress.getLocalHost().getHostName();
}
-
+ catch(UnknownHostException ex)
+ {
+ localHost="127.0.0.1";
+ }
+ return localHost;
+ }
+
+ private void closeRegistryServer()
+ {
if (_rmiRegistry != null)
{
// Stopping the RMI registry
- CurrentActor.get().message(ManagementConsoleMessages.SHUTTING_DOWN("RMI Registry", _jmxPortRegistryServer));
+ CurrentActor.get().message(ManagementConsoleMessages.SHUTTING_DOWN("RMI Registry", _registryPort.getPort()));
try
{
boolean success = UnicastRemoteObject.unexportObject(_rmiRegistry, false);
@@ -468,8 +365,36 @@ public class JMXManagedObjectRegistry im
{
_log.error("Exception while closing the RMI Registry: ", e);
}
+ finally
+ {
+ _rmiRegistry = null;
+ }
+ }
+ }
+
+ private void closeConnectorServer()
+ {
+ if (_cs != null)
+ {
+ // Stopping the JMX ConnectorServer
+ try
+ {
+ CurrentActor.get().message(ManagementConsoleMessages.SHUTTING_DOWN("JMX RMIConnectorServer", _cs.getAddress().getPort()));
+ _cs.stop();
+ }
+ catch (IOException e)
+ {
+ _log.error("Exception while closing the JMX ConnectorServer: ", e);
+ }
+ finally
+ {
+ _cs = null;
+ }
}
-
+ }
+
+ private void unregisterAllMbeans()
+ {
//ObjectName query to gather all Qpid related MBeans
ObjectName mbeanNameQuery = null;
try
@@ -492,8 +417,6 @@ public class JMXManagedObjectRegistry im
_log.error("Exception unregistering MBean '"+ name +"': " + e.getMessage());
}
}
-
- CurrentActor.get().message(ManagementConsoleMessages.STOPPED());
}
}
Modified: qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/MBeanInvocationHandlerImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/MBeanInvocationHandlerImpl.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/MBeanInvocationHandlerImpl.java (original)
+++ qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/MBeanInvocationHandlerImpl.java Thu Feb 28 16:14:30 2013
@@ -22,26 +22,22 @@ package org.apache.qpid.server.jmx;
import org.apache.log4j.Logger;
-import org.apache.qpid.server.logging.LogActor;
+import org.apache.qpid.server.configuration.BrokerProperties;
import org.apache.qpid.server.logging.actors.CurrentActor;
import org.apache.qpid.server.logging.actors.ManagementActor;
-import org.apache.qpid.server.logging.messages.ManagementConsoleMessages;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.registry.IApplicationRegistry;
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.security.SecurityManager;
import org.apache.qpid.server.security.access.Operation;
+import org.apache.qpid.server.security.auth.AuthenticatedPrincipal;
import javax.management.Attribute;
import javax.management.JMException;
import javax.management.MBeanInfo;
import javax.management.MBeanOperationInfo;
import javax.management.MBeanServer;
-import javax.management.Notification;
-import javax.management.NotificationListener;
import javax.management.ObjectName;
import javax.management.RuntimeErrorException;
-import javax.management.remote.JMXConnectionNotification;
-import javax.management.remote.JMXPrincipal;
import javax.management.remote.MBeanServerForwarder;
import javax.security.auth.Subject;
import java.lang.reflect.InvocationHandler;
@@ -51,27 +47,32 @@ import java.lang.reflect.Proxy;
import java.security.AccessControlContext;
import java.security.AccessController;
import java.util.Arrays;
-import java.util.Map;
-import java.util.Set;
/**
* This class can be used by the JMXConnectorServer as an InvocationHandler for the mbean operations. It delegates
* JMX access decisions to the SecurityPlugin.
*/
-public class MBeanInvocationHandlerImpl implements InvocationHandler, NotificationListener
+public class MBeanInvocationHandlerImpl implements InvocationHandler
{
private static final Logger _logger = Logger.getLogger(MBeanInvocationHandlerImpl.class);
- private final IApplicationRegistry _appRegistry = ApplicationRegistry.getInstance();
private final static String DELEGATE = "JMImplementation:type=MBeanServerDelegate";
private MBeanServer _mbs;
- private final ManagementActor _logActor = new ManagementActor(_appRegistry.getRootMessageLogger());
- private final boolean _managementRightsInferAllAccess =
- _appRegistry.getConfiguration().getManagementRightsInferAllAccess();
+ private final ManagementActor _logActor;
- public static MBeanServerForwarder newProxyInstance()
+ private final boolean _managementRightsInferAllAccess;
+ private final Broker _broker;
+
+ MBeanInvocationHandlerImpl(Broker broker)
+ {
+ _managementRightsInferAllAccess = Boolean.valueOf(System.getProperty(BrokerProperties.PROPERTY_MANAGEMENT_RIGHTS_INFER_ALL_ACCESS, "true"));
+ _broker = broker;
+ _logActor = new ManagementActor(broker.getRootMessageLogger());
+ }
+
+ public static MBeanServerForwarder newProxyInstance(Broker broker)
{
- final InvocationHandler handler = new MBeanInvocationHandlerImpl();
+ final InvocationHandler handler = new MBeanInvocationHandlerImpl(broker);
final Class<?>[] interfaces = new Class[] { MBeanServerForwarder.class };
Object proxy = Proxy.newProxyInstance(MBeanServerForwarder.class.getClassLoader(), interfaces, handler);
@@ -101,7 +102,7 @@ public class MBeanInvocationHandlerImpl
{
ObjectName mbean = (ObjectName) args[0];
- if(!DefaultManagedObject.DOMAIN.equalsIgnoreCase(mbean.getDomain()))
+ if(!ManagedObject.DOMAIN.equalsIgnoreCase(mbean.getDomain()))
{
return true;
}
@@ -151,11 +152,13 @@ public class MBeanInvocationHandlerImpl
return method.invoke(_mbs, args);
}
- // Retrieve JMXPrincipal from Subject
- Set<JMXPrincipal> principals = subject.getPrincipals(JMXPrincipal.class);
- if (principals == null || principals.isEmpty())
+ try
+ {
+ AuthenticatedPrincipal.getAuthenticatedPrincipalFromSubject(subject);
+ }
+ catch(Exception e)
{
- throw new SecurityException("Access denied: no JMX principal");
+ throw new SecurityException("Access denied: no authenticated principal", e);
}
// Save the subject
@@ -211,11 +214,16 @@ public class MBeanInvocationHandlerImpl
SecurityManager security;
if (vhost == null)
{
- security = _appRegistry.getSecurityManager();
+ security = _broker.getSecurityManager();
}
else
{
- security = _appRegistry.getVirtualHostRegistry().getVirtualHost(vhost).getSecurityManager();
+ VirtualHost virtualHost = _broker.findVirtualHostByName(vhost);
+ if (virtualHost == null)
+ {
+ throw new IllegalArgumentException("Virtual host with name '" + vhost + "' is not found.");
+ }
+ security = virtualHost.getSecurityManager();
}
methodName = getMethodName(method, args);
@@ -360,50 +368,5 @@ public class MBeanInvocationHandlerImpl
return (methodName.startsWith("query") || methodName.startsWith("get") || methodName.startsWith("is"));
}
- /**
- * Receives notifications from the MBeanServer.
- */
- public void handleNotification(final Notification notification, final Object handback)
- {
- assert notification instanceof JMXConnectionNotification;
-
- final String connectionId = ((JMXConnectionNotification) notification).getConnectionId();
- final String type = notification.getType();
-
- if (_logger.isDebugEnabled())
- {
- _logger.debug("Notification connectionId : " + connectionId + " type : " + type
- + " Notification handback : " + handback);
- }
-
- // Normally JMXManagedObjectRegistry provides a Map as handback data containing a map
- // between connection id and username.
- String user = null;
- if (handback instanceof Map)
- {
- final Map<String, String> connectionIdUsernameMap = (Map<String, String>) handback;
- user = connectionIdUsernameMap.get(connectionId);
- }
-
- // If user is still null, fallback to an unordered list of Principals from the connection id.
- if (user == null)
- {
- final String[] splitConnectionId = connectionId.split(" ");
- user = splitConnectionId[1];
- }
-
- // use a separate instance of actor as subject is not set on connect/disconnect
- // we need to pass principal name explicitly into log actor
- LogActor logActor = new ManagementActor(_appRegistry.getRootMessageLogger(), user);
- if (JMXConnectionNotification.OPENED.equals(type))
- {
- logActor.message(ManagementConsoleMessages.OPEN(user));
- }
- else if (JMXConnectionNotification.CLOSED.equals(type) ||
- JMXConnectionNotification.FAILED.equals(type))
- {
- logActor.message(ManagementConsoleMessages.CLOSE(user));
- }
- }
}
Modified: qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/MBeanProvider.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/MBeanProvider.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/MBeanProvider.java (original)
+++ qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/MBeanProvider.java Thu Feb 28 16:14:30 2013
@@ -21,17 +21,16 @@
package org.apache.qpid.server.jmx;
-import java.util.ServiceLoader;
-
import javax.management.JMException;
import javax.management.StandardMBean;
import org.apache.qpid.server.model.ConfiguredObject;
+import org.apache.qpid.server.plugin.QpidServiceLoader;
/**
* A provider of an mbean implementation.
*
- * Provider implementations are advertised as services and loaded via {@link ServiceLoader}.
+ * Provider implementations are advertised as services and loaded by a {@link QpidServiceLoader}.
*/
public interface MBeanProvider
{
Modified: qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/LoggingManagementMBean.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/LoggingManagementMBean.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/LoggingManagementMBean.java (original)
+++ qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/LoggingManagementMBean.java Thu Feb 28 16:14:30 2013
@@ -26,7 +26,7 @@ import org.apache.qpid.management.common
import org.apache.qpid.server.jmx.AMQManagedObject;
import org.apache.qpid.server.jmx.ManagedObject;
import org.apache.qpid.server.jmx.ManagedObjectRegistry;
-import org.apache.qpid.server.logging.log4j.LoggingFacade;
+import org.apache.qpid.server.logging.log4j.LoggingManagementFacade;
import org.apache.qpid.server.logging.log4j.LoggingFacadeException;
import javax.management.JMException;
@@ -55,7 +55,8 @@ public class LoggingManagementMBean exte
private static final TabularType LOGGER_LEVEL_TABULAR_TYE;
private static final CompositeType LOGGER_LEVEL_COMPOSITE_TYPE;
- private final LoggingFacade _configurator;
+ private final LoggingManagementFacade _loggingManagementFacade;
+ private final String[] _allAvailableLogLevels;
static
{
@@ -77,12 +78,13 @@ public class LoggingManagementMBean exte
throw new ExceptionInInitializerError(e);
}
}
-
- public LoggingManagementMBean(LoggingFacade configurator, ManagedObjectRegistry registry) throws JMException
+
+ public LoggingManagementMBean(LoggingManagementFacade loggingManagementFacade, ManagedObjectRegistry registry) throws JMException
{
super(LoggingManagement.class, LoggingManagement.TYPE, registry);
register();
- _configurator = configurator;
+ _loggingManagementFacade = loggingManagementFacade;
+ _allAvailableLogLevels = buildAllAvailableLoggerLevelsWithInheritedPsuedoLogLevel(_loggingManagementFacade);
}
@Override
@@ -100,30 +102,26 @@ public class LoggingManagementMBean exte
@Override
public Integer getLog4jLogWatchInterval()
{
- return _configurator.getLog4jLogWatchInterval();
+ return _loggingManagementFacade.getLog4jLogWatchInterval();
}
@Override
public String[] getAvailableLoggerLevels()
{
- List<String> levels = _configurator.getAvailableLoggerLevels();
- List<String> mbeanLevels = new ArrayList<String>(levels);
- mbeanLevels.add(INHERITED_PSUEDO_LOG_LEVEL);
-
- return mbeanLevels.toArray(new String[mbeanLevels.size()]);
+ return _allAvailableLogLevels;
}
@Override
public TabularData viewEffectiveRuntimeLoggerLevels()
{
- Map<String, String> levels = _configurator.retrieveRuntimeLoggersLevels();
+ Map<String, String> levels = _loggingManagementFacade.retrieveRuntimeLoggersLevels();
return createTabularDataFromLevelsMap(levels);
}
@Override
public String getRuntimeRootLoggerLevel()
{
- return _configurator.retrieveRuntimeRootLoggerLevel();
+ return _loggingManagementFacade.retrieveRuntimeRootLoggerLevel();
}
@Override
@@ -139,7 +137,7 @@ public class LoggingManagementMBean exte
return false;
}
- _configurator.setRuntimeRootLoggerLevel(level);
+ _loggingManagementFacade.setRuntimeRootLoggerLevel(level);
return true;
}
@@ -159,7 +157,7 @@ public class LoggingManagementMBean exte
try
{
- _configurator.setRuntimeLoggerLevel(logger, validatedLevel);
+ _loggingManagementFacade.setRuntimeLoggerLevel(logger, validatedLevel);
}
catch (LoggingFacadeException e)
{
@@ -175,7 +173,7 @@ public class LoggingManagementMBean exte
Map<String,String> levels;
try
{
- levels = _configurator.retrieveConfigFileLoggersLevels();
+ levels = _loggingManagementFacade.retrieveConfigFileLoggersLevels();
}
catch (LoggingFacadeException e)
{
@@ -191,7 +189,7 @@ public class LoggingManagementMBean exte
{
try
{
- return _configurator.retrieveConfigFileRootLoggerLevel().toUpperCase();
+ return _loggingManagementFacade.retrieveConfigFileRootLoggerLevel().toUpperCase();
}
catch (LoggingFacadeException e)
{
@@ -216,7 +214,7 @@ public class LoggingManagementMBean exte
try
{
- _configurator.setConfigFileLoggerLevel(logger, validatedLevel);
+ _loggingManagementFacade.setConfigFileLoggerLevel(logger, validatedLevel);
}
catch (LoggingFacadeException e)
{
@@ -241,7 +239,7 @@ public class LoggingManagementMBean exte
try
{
- _configurator.setConfigFileRootLoggerLevel(level);
+ _loggingManagementFacade.setConfigFileRootLoggerLevel(level);
return true;
}
catch (LoggingFacadeException e)
@@ -257,7 +255,7 @@ public class LoggingManagementMBean exte
try
{
- _configurator.reload();
+ _loggingManagementFacade.reload();
}
catch (LoggingFacadeException e)
{
@@ -283,9 +281,8 @@ public class LoggingManagementMBean exte
private void validateLevelNotAllowingInherited(String level)
{
- final List<String> availableLoggerLevels = _configurator.getAvailableLoggerLevels();
- if (!availableLoggerLevels.contains(level)
- && !availableLoggerLevels.contains(String.valueOf(level).toUpperCase()))
+ final List<String> availableLoggerLevels = _loggingManagementFacade.getAvailableLoggerLevels();
+ if (level == null || !availableLoggerLevels.contains(level.toUpperCase()))
{
throw new IllegalArgumentException(level + " not known");
}
@@ -305,7 +302,6 @@ public class LoggingManagementMBean exte
return loggerLevelList;
}
-
private CompositeData createRow(String loggerName, String level)
{
Object[] itemData = {loggerName, level.toUpperCase()};
@@ -321,4 +317,13 @@ public class LoggingManagementMBean exte
throw new RuntimeException(ode);
}
}
+
+ private String[] buildAllAvailableLoggerLevelsWithInheritedPsuedoLogLevel(LoggingManagementFacade loggingManagementFacade)
+ {
+ List<String> levels = loggingManagementFacade.getAvailableLoggerLevels();
+ List<String> mbeanLevels = new ArrayList<String>(levels);
+ mbeanLevels.add(INHERITED_PSUEDO_LOG_LEVEL);
+
+ return mbeanLevels.toArray(new String[mbeanLevels.size()]);
+ }
}
Modified: qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/QueueMBean.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/QueueMBean.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/QueueMBean.java (original)
+++ qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/QueueMBean.java Thu Feb 28 16:14:30 2013
@@ -513,7 +513,6 @@ public class QueueMBean extends AMQManag
{
_queue.visit(new QueueEntryVisitor()
{
-
public boolean visit(final QueueEntry entry)
{
final ServerMessage message = entry.getMessage();
@@ -525,11 +524,9 @@ public class QueueMBean extends AMQManag
&& (messageId <= toMessageId))
{
txn.dequeue(entry);
- return true;
}
- return false;
}
- return true;
+ return false;
}
});
}
Modified: qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/VirtualHostMBean.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/VirtualHostMBean.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/VirtualHostMBean.java (original)
+++ qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/VirtualHostMBean.java Thu Feb 28 16:14:30 2013
@@ -65,7 +65,7 @@ public class VirtualHostMBean extends AM
_managerMBean = new VirtualHostManagerMBean(this);
}
- private void initQueues() throws JMException
+ private void initQueues()
{
synchronized (_children)
{
@@ -73,13 +73,20 @@ public class VirtualHostMBean extends AM
{
if(!_children.containsKey(queue))
{
- _children.put(queue, new QueueMBean(queue, this));
+ try
+ {
+ _children.put(queue, new QueueMBean(queue, this));
+ }
+ catch(Exception e)
+ {
+ LOGGER.error("Cannot create queue mbean for queue " + queue.getName(), e);
+ }
}
}
}
}
- private void initExchanges() throws JMException
+ private void initExchanges()
{
synchronized (_children)
{
@@ -87,13 +94,20 @@ public class VirtualHostMBean extends AM
{
if(!_children.containsKey(exchange))
{
- _children.put(exchange, new ExchangeMBean(exchange, this));
+ try
+ {
+ _children.put(exchange, new ExchangeMBean(exchange, this));
+ }
+ catch(Exception e)
+ {
+ LOGGER.error("Cannot create exchange mbean for exchange " + exchange.getName(), e);
+ }
}
}
}
}
- private void initConnections() throws JMException
+ private void initConnections()
{
synchronized (_children)
{
@@ -101,7 +115,14 @@ public class VirtualHostMBean extends AM
{
if(!_children.containsKey(conn))
{
- _children.put(conn, new ConnectionMBean(conn, this));
+ try
+ {
+ _children.put(conn, new ConnectionMBean(conn, this));
+ }
+ catch(Exception e)
+ {
+ LOGGER.error("Cannot create connection mbean for connection " + conn.getName(), e);
+ }
}
}
}
@@ -119,7 +140,7 @@ public class VirtualHostMBean extends AM
public void stateChanged(ConfiguredObject object, State oldState, State newState)
{
- // ignore
+ // no-op
}
public void childAdded(ConfiguredObject object, ConfiguredObject child)
@@ -208,4 +229,35 @@ public class VirtualHostMBean extends AM
return queues;
}
+
+ @Override
+ public void unregister() throws JMException
+ {
+ synchronized (_children)
+ {
+ for (AMQManagedObject mbean : _children.values())
+ {
+ if(mbean != null)
+ {
+ try
+ {
+ mbean.unregister();
+ }
+ catch(JMException e)
+ {
+ LOGGER.error("Failed to remove mbean for child : " + mbean, e);
+ }
+ }
+ }
+ _children.clear();
+ }
+ _managerMBean.unregister();
+ }
+
+ @Override
+ public void attributeSet(ConfiguredObject object, String attributeName, Object oldAttributeValue, Object newAttributeValue)
+ {
+ // no-op
+ }
+
}
Modified: qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/VirtualHostManagerMBean.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/VirtualHostManagerMBean.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/VirtualHostManagerMBean.java (original)
+++ qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/main/java/org/apache/qpid/server/jmx/mbeans/VirtualHostManagerMBean.java Thu Feb 28 16:14:30 2013
@@ -229,10 +229,9 @@ public class VirtualHostManagerMBean ext
return getObjectNameForSingleInstanceMBean();
}
- public synchronized boolean isStatisticsEnabled()
+ public boolean isStatisticsEnabled()
{
- updateStats();
- return false; //TODO - implement isStatisticsEnabled
+ return true;
}
}
Modified: qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/LoggingManagementMBeanTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/LoggingManagementMBeanTest.java?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/LoggingManagementMBeanTest.java (original)
+++ qpid/branches/asyncstore/java/broker-plugins/management-jmx/src/test/java/org/apache/qpid/server/jmx/mbeans/LoggingManagementMBeanTest.java Thu Feb 28 16:14:30 2013
@@ -39,7 +39,7 @@ import junit.framework.TestCase;
import org.apache.qpid.management.common.mbeans.LoggingManagement;
import org.apache.qpid.server.jmx.ManagedObjectRegistry;
-import org.apache.qpid.server.logging.log4j.LoggingFacade;
+import org.apache.qpid.server.logging.log4j.LoggingManagementFacade;
public class LoggingManagementMBeanTest extends TestCase
{
@@ -47,13 +47,13 @@ public class LoggingManagementMBeanTest
private static final String TEST_LEVEL2 = "LEVEL2";
private LoggingManagementMBean _loggingMBean;
- private LoggingFacade _mockLoggingFacade;
+ private LoggingManagementFacade _mockLoggingFacade;
private ManagedObjectRegistry _mockManagedObjectRegistry;
@Override
protected void setUp() throws Exception
{
- _mockLoggingFacade = mock(LoggingFacade.class);
+ _mockLoggingFacade = mock(LoggingManagementFacade.class);
final List<String> listOfLevels = new ArrayList<String>()
{{
add(TEST_LEVEL1);
Propchange: qpid/branches/asyncstore/java/broker/bin/
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java/broker/bin:r1375509-1450773
Modified: qpid/branches/asyncstore/java/broker/bin/qpid-server
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker/bin/qpid-server?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker/bin/qpid-server (original)
+++ qpid/branches/asyncstore/java/broker/bin/qpid-server Thu Feb 28 16:14:30 2013
@@ -33,8 +33,8 @@ if [ -z "$QPID_PNAME" ]; then
export QPID_PNAME=" -DPNAME=QPBRKR"
fi
-# Set classpath to include the qpid-all manifest jar, and any jars supplied in lib/opt
-QPID_LIBS="$QPID_HOME/lib/qpid-all.jar:$QPID_HOME/lib/opt/*"
+# Set classpath to include the qpid-all manifest jar, plus jars in lib/plugins and lib/opt
+QPID_LIBS="$QPID_HOME/lib/qpid-all.jar:$QPID_HOME/lib/plugins/*:$QPID_HOME/lib/opt/*"
# Set other variables used by the qpid-run script before calling
export JAVA=java \
Modified: qpid/branches/asyncstore/java/broker/bin/qpid-server.bat
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker/bin/qpid-server.bat?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker/bin/qpid-server.bat (original)
+++ qpid/branches/asyncstore/java/broker/bin/qpid-server.bat Thu Feb 28 16:14:30 2013
@@ -76,8 +76,8 @@ echo Using CLASSPATH: %CLASSPATH%
goto afterQpidClasspath
:noQpidClasspath
-echo Warning: Qpid classpath not set. CLASSPATH set to %QPID_HOME%\lib\qpid-all.jar
-set CLASSPATH=%QPID_HOME%\lib\qpid-all.jar;%QPID_HOME%\lib\opt\*
+echo Warning: Qpid classpath not set. CLASSPATH set to %QPID_HOME%\lib\qpid-all.jar;%QPID_HOME%\lib\plugins\*;%QPID_HOME%\lib\opt\*
+set CLASSPATH=%QPID_HOME%\lib\qpid-all.jar;%QPID_HOME%\lib\plugins\*;%QPID_HOME%\lib\opt\*
:afterQpidClasspath
REM start parsing -run arguments
Modified: qpid/branches/asyncstore/java/broker/build.xml
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/broker/build.xml?rev=1451244&r1=1451243&r2=1451244&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/broker/build.xml (original)
+++ qpid/branches/asyncstore/java/broker/build.xml Thu Feb 28 16:14:30 2013
@@ -20,7 +20,7 @@
-->
<project name="AMQ Broker" default="build">
<property name="module.depends" value="management/common common amqp-1-0-common"/>
- <property name="module.test.depends" value="common/test" />
+ <property name="module.test.depends" value="common/tests" />
<property name="module.main" value="org.apache.qpid.server.Main"/>
<property name="module.genpom" value="true"/>
@@ -28,23 +28,7 @@
<property name="output.dir" value="${module.precompiled}/org/apache/qpid/server/filter/jms/selector"/>
- <property name="qmf.input.file" value="${project.root}/../specs/management-schema.xml"/>
- <property name="qmf.xsl.file" value="${project.root}/broker/src/xsl/qmf.xsl"/>
- <property name="qmf.output.dir" value="${module.precompiled}/org/apache/qpid/qmf/schema"/>
- <property name="qmf.output.file" value="BrokerSchema.java"/>
-
- <target name="precompile" depends="gen_logging,gen_qmf"/>
-
- <target name="check_qmf_deps">
- <uptodate property="gen_qmf.notRequired" targetfile="${qmf.output.dir}/${qmf.output.file}">
- <srcfiles file="${qmf.input.file}"/>
- <srcfiles file="${qmf.xsl.file}"/>
- </uptodate>
- </target>
-
- <target name="gen_qmf" depends="check_qmf_deps" unless="gen_qmf.notRequired">
- <xslt in="${qmf.input.file}" out="${qmf.output.dir}/${qmf.output.file}" style="${qmf.xsl.file}"/>
- </target>
+ <target name="precompile" depends="gen_logging"/>
<target name="copy-etc-release" if="module.etc.exists" description="copy etc directory if it exists to build tree">
<copy todir="${module.release}/etc" failonerror="false" flatten="true">
@@ -64,9 +48,15 @@
<fixcrlf srcdir="${module.release}/bin" fixlast="true" eol="dos" includes="*.bat"/>
</target>
- <target name="release-bin-other" depends="release-bin-other-bdbstore" description="copy broker-plugins into module release">
+ <target name="release-bin-other" depends="release-bin-other-lib-opt,release-bin-other-bdbstore,release-bin-copy-broker-plugins"/>
+
+ <target name="release-bin-other-lib-opt" depends="release-bin-other-bdbstore" description="make lib/opt dir in the module release">
+ <mkdir dir="${module.release}/lib/opt"/>
+ </target>
+
+ <target name="release-bin-copy-broker-plugins" description="copy broker-plugins into module release">
<copy todir="${module.release}/lib/plugins" failonerror="true">
- <fileset dir="${build.lib}/plugins"/>
+ <fileset dir="${build.scratch.broker.plugins.lib}"/>
</copy>
</target>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org