diff --git a/.gitignore b/.gitignore
index fe27ec71..3dbe50ee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@ target
.ant-targets-build.xml
src/ant/.ant-targets-upload-dist.xml
*.swp
+erl_crash.dump
diff --git a/spring-amqp-parent/pom.xml b/spring-amqp-parent/pom.xml
index 1ac1d022..60ac0024 100644
--- a/spring-amqp-parent/pom.xml
+++ b/spring-amqp-parent/pom.xml
@@ -19,7 +19,7 @@
1.5.101.4.31.5.3
- 2.0.0
+ 2.1.03.0.3.RELEASE
diff --git a/spring-amqp-samples/helloworld/src/main/java/org/springframework/amqp/helloworld/BrokerConfigurationApplication.java b/spring-amqp-samples/helloworld/src/main/java/org/springframework/amqp/helloworld/BrokerConfigurationApplication.java
index b4bb07c2..ea51f138 100644
--- a/spring-amqp-samples/helloworld/src/main/java/org/springframework/amqp/helloworld/BrokerConfigurationApplication.java
+++ b/spring-amqp-samples/helloworld/src/main/java/org/springframework/amqp/helloworld/BrokerConfigurationApplication.java
@@ -10,7 +10,7 @@ public class BrokerConfigurationApplication {
/**
* An example application that only configures the AMQP broker
*/
- public static void main(String[] args) {
+ public static void main(String[] args) throws Exception {
ApplicationContext context = new ClassPathXmlApplicationContext("rabbitConfiguration.xml");
AmqpAdmin amqpAdmin = context.getBean(AmqpAdmin.class);
Queue helloWorldQueue = new Queue("hello.world.queue");
diff --git a/spring-erlang/src/main/java/org/springframework/erlang/OtpAuthException.java b/spring-erlang/src/main/java/org/springframework/erlang/OtpAuthException.java
index 04535bc6..e043cd05 100644
--- a/spring-erlang/src/main/java/org/springframework/erlang/OtpAuthException.java
+++ b/spring-erlang/src/main/java/org/springframework/erlang/OtpAuthException.java
@@ -28,4 +28,8 @@ public class OtpAuthException extends OtpException {
super(cause);
}
+ public OtpAuthException(String msg, com.ericsson.otp.erlang.OtpAuthException cause) {
+ super(msg, cause);
+ }
+
}
diff --git a/spring-erlang/src/main/java/org/springframework/erlang/connection/SimpleConnectionFactory.java b/spring-erlang/src/main/java/org/springframework/erlang/connection/SimpleConnectionFactory.java
index 205071a0..62876258 100644
--- a/spring-erlang/src/main/java/org/springframework/erlang/connection/SimpleConnectionFactory.java
+++ b/spring-erlang/src/main/java/org/springframework/erlang/connection/SimpleConnectionFactory.java
@@ -46,9 +46,8 @@ public class SimpleConnectionFactory implements ConnectionFactory, InitializingB
public SimpleConnectionFactory(String selfNodeName, String cookie, String peerNodeName) {
- this.selfNodeName = selfNodeName;
+ this(selfNodeName, peerNodeName);
this.cookie = cookie;
- this.peerNodeName = peerNodeName;
}
public SimpleConnectionFactory(String selfNodeName, String peerNodeName) {
diff --git a/spring-erlang/src/main/java/org/springframework/erlang/support/ErlangUtils.java b/spring-erlang/src/main/java/org/springframework/erlang/support/ErlangUtils.java
index 553277eb..b678f426 100644
--- a/spring-erlang/src/main/java/org/springframework/erlang/support/ErlangUtils.java
+++ b/spring-erlang/src/main/java/org/springframework/erlang/support/ErlangUtils.java
@@ -23,6 +23,7 @@ import org.springframework.erlang.OtpIOException;
import org.springframework.erlang.UncategorizedOtpException;
import org.springframework.util.Assert;
+import com.ericsson.otp.erlang.OtpAuthException;
import com.ericsson.otp.erlang.OtpConnection;
/**
@@ -47,6 +48,9 @@ public class ErlangUtils {
if (ex instanceof IOException) {
return new OtpIOException((IOException) ex);
}
+ if (ex instanceof OtpAuthException) {
+ return new org.springframework.erlang.OtpAuthException((OtpAuthException) ex);
+ }
//fallback
return new UncategorizedOtpException(ex);
}
diff --git a/spring-erlang/src/main/java/org/springframework/util/exec/Execute.java b/spring-erlang/src/main/java/org/springframework/util/exec/Execute.java
index 8ba47334..0fa825d0 100644
--- a/spring-erlang/src/main/java/org/springframework/util/exec/Execute.java
+++ b/spring-erlang/src/main/java/org/springframework/util/exec/Execute.java
@@ -16,389 +16,404 @@
package org.springframework.util.exec;
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
-
-import java.io.BufferedReader;
import java.io.StringReader;
-import java.io.ByteArrayOutputStream;
-import java.util.*;
-
+import java.util.StringTokenizer;
+import java.util.Vector;
/* Derived from ant exec task. All the 'backward compat with jdk1.1, 1.2'
- removed. Since jdk1.3 supports working dir, no need for scripts.
+ removed. Since jdk1.3 supports working dir, no need for scripts.
- All ant-specific code has been removed as well, this is a completely
- independent component.
-
- Costin
-*/
+ All ant-specific code has been removed as well, this is a completely
+ independent component.
+
+ Costin
+ */
/**
* Runs an external program.
- *
+ *
* @author thomas.haas@softwired-inc.com
*/
public class Execute {
- /** Invalid exit code. **/
- public final static int INVALID = Integer.MAX_VALUE;
+ /** Invalid exit code. **/
+ public final static int INVALID = Integer.MAX_VALUE;
- private String[] cmdl = null;
- private String[] env = null;
- private int exitValue = INVALID;
- private ExecuteStreamHandler streamHandler;
- private ExecuteWatchdog watchdog;
- private File workingDirectory = null;
- private boolean newEnvironment = false;
+ private String[] cmdl = null;
+ private String[] env = null;
+ private int exitValue = INVALID;
+ private ExecuteStreamHandler streamHandler;
+ private ExecuteWatchdog watchdog;
+ private File workingDirectory = null;
+ private boolean newEnvironment = false;
+ private Process process;
- private static Vector procEnvironment = null;
+ private static Vector procEnvironment = null;
- /**
- * Find the list of environment variables for this process.
- */
- public static synchronized Vector getProcEnvironment() {
- if (procEnvironment != null) return procEnvironment;
+ /**
+ * Find the list of environment variables for this process.
+ */
+ public static synchronized Vector getProcEnvironment() {
+ if (procEnvironment != null)
+ return procEnvironment;
- procEnvironment = new Vector();
- try {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- Execute exe = new Execute(new PumpStreamHandler(out));
- exe.setCommandline(getProcEnvCommand());
- // Make sure we do not recurse forever
- exe.setNewenvironment(true);
- int retval = exe.execute();
- if ( retval != 0 ) {
- // Just try to use what we got
- }
+ procEnvironment = new Vector();
+ try {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ Execute exe = new Execute(new PumpStreamHandler(out));
+ exe.setCommandline(getProcEnvCommand());
+ // Make sure we do not recurse forever
+ exe.setNewenvironment(true);
+ int retval = exe.execute();
+ if (retval != 0) {
+ // Just try to use what we got
+ }
- BufferedReader in =
- new BufferedReader(new StringReader(out.toString()));
- String var = null;
- String line, lineSep = System.getProperty("line.separator");
- while ((line = in.readLine()) != null) {
- if (line.indexOf('=') == -1) {
- // Chunk part of previous env var (UNIX env vars can
- // contain embedded new lines).
- if (var == null) {
- var = lineSep + line;
- }
- else {
- var += lineSep + line;
- }
- }
- else {
- // New env var...append the previous one if we have it.
- if (var != null) {
- procEnvironment.addElement(var);
- }
- var = line;
- }
- }
- // Since we "look ahead" before adding, there's one last env var.
- procEnvironment.addElement(var);
- }
- catch (Exception exc) {
- exc.printStackTrace();
- // Just try to see how much we got
- }
- return procEnvironment;
- }
+ BufferedReader in = new BufferedReader(new StringReader(
+ out.toString()));
+ String var = null;
+ String line, lineSep = System.getProperty("line.separator");
+ while ((line = in.readLine()) != null) {
+ if (line.indexOf('=') == -1) {
+ // Chunk part of previous env var (UNIX env vars can
+ // contain embedded new lines).
+ if (var == null) {
+ var = lineSep + line;
+ } else {
+ var += lineSep + line;
+ }
+ } else {
+ // New env var...append the previous one if we have it.
+ if (var != null) {
+ procEnvironment.addElement(var);
+ }
+ var = line;
+ }
+ }
+ // Since we "look ahead" before adding, there's one last env var.
+ procEnvironment.addElement(var);
+ } catch (Exception exc) {
+ exc.printStackTrace();
+ // Just try to see how much we got
+ }
+ return procEnvironment;
+ }
- private static String[] getProcEnvCommand() {
- if ( Os.isFamily("os/2") ) {
- // OS/2 - use same mechanism as Windows 2000
- // Not sure
- String[] cmd = {"cmd", "/c", "set" };
- return cmd;
- }
- else if ( Os.isFamily("windows") ) {
- String[] cmd = {"cmd", "/c", "set" };
- return cmd;
- }
- else if ( Os.isFamily("unix") ) {
- // Generic UNIX
- // Alternatively one could use: /bin/sh -c env
- String[] cmd = {"/usr/bin/env"};
- return cmd;
- }
- else if ( Os.isFamily("netware") ) {
- String[] cmd = {"env"};
- return cmd;
- }
- else {
- // MAC OS 9 and previous
- // TODO: I have no idea how to get it, someone must fix it
- String[] cmd = null;
- return cmd;
- }
- }
+ private static String[] getProcEnvCommand() {
+ if (Os.isFamily("os/2")) {
+ // OS/2 - use same mechanism as Windows 2000
+ // Not sure
+ String[] cmd = { "cmd", "/c", "set" };
+ return cmd;
+ } else if (Os.isFamily("windows")) {
+ String[] cmd = { "cmd", "/c", "set" };
+ return cmd;
+ } else if (Os.isFamily("unix")) {
+ // Generic UNIX
+ // Alternatively one could use: /bin/sh -c env
+ String[] cmd = { "/usr/bin/env" };
+ return cmd;
+ } else if (Os.isFamily("netware")) {
+ String[] cmd = { "env" };
+ return cmd;
+ } else {
+ // MAC OS 9 and previous
+ // TODO: I have no idea how to get it, someone must fix it
+ String[] cmd = null;
+ return cmd;
+ }
+ }
- /**
- * Creates a new execute object using PumpStreamHandler for
- * stream handling.
- */
- public Execute() {
- this(new PumpStreamHandler(), null);
- }
+ /**
+ * Creates a new execute object using PumpStreamHandler for
+ * stream handling.
+ */
+ public Execute() {
+ this(new PumpStreamHandler(), null);
+ }
+ /**
+ * Creates a new execute object.
+ *
+ * @param streamHandler
+ * the stream handler used to handle the input and output streams
+ * of the subprocess.
+ */
+ public Execute(ExecuteStreamHandler streamHandler) {
+ this(streamHandler, null);
+ }
- /**
- * Creates a new execute object.
- *
- * @param streamHandler the stream handler used to handle the input and
- * output streams of the subprocess.
- */
- public Execute(ExecuteStreamHandler streamHandler) {
- this(streamHandler, null);
- }
+ /**
+ * Creates a new execute object.
+ *
+ * @param streamHandler
+ * the stream handler used to handle the input and output streams
+ * of the subprocess.
+ * @param watchdog
+ * a watchdog for the subprocess or null to to
+ * disable a timeout for the subprocess.
+ */
+ public Execute(ExecuteStreamHandler streamHandler, ExecuteWatchdog watchdog) {
+ this.streamHandler = streamHandler;
+ this.watchdog = watchdog;
+ }
- /**
- * Creates a new execute object.
- *
- * @param streamHandler the stream handler used to handle the input and
- * output streams of the subprocess.
- * @param watchdog a watchdog for the subprocess or null to
- * to disable a timeout for the subprocess.
- */
- public Execute(ExecuteStreamHandler streamHandler, ExecuteWatchdog watchdog) {
- this.streamHandler = streamHandler;
- this.watchdog = watchdog;
- }
+ /**
+ * Returns the commandline used to create a subprocess.
+ *
+ * @return the commandline used to create a subprocess
+ */
+ public String[] getCommandline() {
+ return cmdl;
+ }
+ public String getCommandLineString() {
+ return array2string(getCommandline());
+ }
- /**
- * Returns the commandline used to create a subprocess.
- *
- * @return the commandline used to create a subprocess
- */
- public String[] getCommandline() {
- return cmdl;
- }
+ /**
+ * Sets the commandline of the subprocess to launch.
+ *
+ * @param commandline
+ * the commandline of the subprocess to launch
+ */
+ public void setCommandline(String[] commandline) {
+ cmdl = commandline;
+ }
- public String getCommandLineString() {
- return array2string(getCommandline());
- }
+ /**
+ * Set whether to propagate the default environment or not.
+ *
+ * @param newenv
+ * whether to propagate the process environment.
+ */
+ public void setNewenvironment(boolean newenv) {
+ newEnvironment = newenv;
+ }
- /**
- * Sets the commandline of the subprocess to launch.
- *
- * @param commandline the commandline of the subprocess to launch
- */
- public void setCommandline(String[] commandline) {
- cmdl = commandline;
- }
+ /**
+ * Returns the environment used to create a subprocess.
+ *
+ * @return the environment used to create a subprocess
+ */
+ public String[] getEnvironment() {
+ if (env == null || newEnvironment)
+ return env;
+ return patchEnvironment();
+ }
- /**
- * Set whether to propagate the default environment or not.
- *
- * @param newenv whether to propagate the process environment.
- */
- public void setNewenvironment(boolean newenv) {
- newEnvironment = newenv;
- }
+ /**
+ * Sets the environment variables for the subprocess to launch.
+ *
+ * @param env
+ * array of Strings, each element of which has an environment
+ * variable settings in format key=value
+ */
+ public void setEnvironment(String[] env) {
+ this.env = env;
+ }
- /**
- * Returns the environment used to create a subprocess.
- *
- * @return the environment used to create a subprocess
- */
- public String[] getEnvironment() {
- if (env == null || newEnvironment) return env;
- return patchEnvironment();
- }
+ /**
+ * Sets the working directory of the process to execute.
+ *
+ *
+ * This is emulated using the antRun scripts unless the OS is Windows NT in
+ * which case a cmd.exe is spawned, or MRJ and setting user.dir works, or
+ * JDK 1.3 and there is official support in java.lang.Runtime.
+ *
+ * @param wd
+ * the working directory of the process.
+ */
+ public void setWorkingDirectory(File wd) {
+ workingDirectory = wd;
+ }
+ /**
+ * Runs a process defined by the command line and returns its exit status.
+ *
+ * @return the exit status of the subprocess or INVALID
+ * @throws Exception
+ * if launching of the subprocess failed
+ */
+ public int execute() throws Exception {
+ process = Runtime.getRuntime().exec(getCommandline(), getEnvironment(),
+ workingDirectory);
+ try {
+ streamHandler.setProcessInputStream(process.getOutputStream());
+ streamHandler.setProcessOutputStream(process.getInputStream());
+ streamHandler.setProcessErrorStream(process.getErrorStream());
+ } catch (IOException e) {
+ process.destroy();
+ throw e;
+ }
+ streamHandler.start();
- /**
- * Sets the environment variables for the subprocess to launch.
- *
- * @param env array of Strings, each element of which has
- * an environment variable settings in format key=value
- */
- public void setEnvironment(String[] env) {
- this.env = env;
- }
+ if (watchdog != null)
+ watchdog.start(process, Thread.currentThread());
- /**
- * Sets the working directory of the process to execute.
- *
- *
This is emulated using the antRun scripts unless the OS is
- * Windows NT in which case a cmd.exe is spawned,
- * or MRJ and setting user.dir works, or JDK 1.3 and there is
- * official support in java.lang.Runtime.
- *
- * @param wd the working directory of the process.
- */
- public void setWorkingDirectory(File wd) {
- workingDirectory = wd;
- }
+ if (log.isTraceEnabled())
+ log.trace("Waiting process ");
+ waitFor(process);
+ process = null;
- // costin
-
- boolean wait=true;
- public void setWait( boolean b ) {
- wait=b;
- }
+ if (log.isTraceEnabled())
+ log.trace("End waiting, stop threads ");
+ if (watchdog != null)
+ watchdog.stop();
+ if (log.isTraceEnabled())
+ log.trace("Watchdog stopped ");
+ streamHandler.stop();
+ if (log.isTraceEnabled())
+ log.trace("Stream handler stopped ");
+ if (watchdog != null) {
+ Exception ex = watchdog.getException();
+ if (ex != null)
+ throw ex;
+ }
+ int exit = getExitValue();
- Process process;
- /**
- * Runs a process defined by the command line and returns its exit status.
- *
- * @return the exit status of the subprocess or INVALID
- * @throws Exception if launching of the subprocess failed
- */
- public int execute() throws Exception {
- process =
- Runtime.getRuntime().exec( getCommandline(), getEnvironment(),
- workingDirectory );
- try {
- streamHandler.setProcessInputStream(process.getOutputStream());
- streamHandler.setProcessOutputStream(process.getInputStream());
- streamHandler.setProcessErrorStream(process.getErrorStream());
- } catch (IOException e) {
- process.destroy();
- throw e;
- }
- streamHandler.start();
+ if (log.isDebugEnabled()) {
+ log.debug("Done exit=" + exit + " " + getCommandLineString());
+ }
+ return exit;
+ }
- if (watchdog != null) watchdog.start(process,
- Thread.currentThread());
+ public void kill() {
+ if (process != null) {
+ process.destroy();
+ }
+ }
- if( log.isTraceEnabled() ) log.trace("Waiting process ");
- waitFor(process);
+ private String array2string(String sa[]) {
+ if (sa == null)
+ return "null";
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < sa.length; i++)
+ sb.append(sa[i]).append(" ");
+ return sb.toString();
+ }
- if( log.isTraceEnabled() ) log.trace("End waiting, stop threads ");
- if (watchdog != null) watchdog.stop();
- if( log.isTraceEnabled() ) log.trace("Watchdog stopped ");
- streamHandler.stop();
- if( log.isTraceEnabled() ) log.trace("Stream handler stopped ");
- if (watchdog != null) {
- Exception ex=watchdog.getException();
- if( ex!=null )
- throw ex;
- }
- int exit= getExitValue();
+ protected void waitFor(Process process) {
+ try {
+ process.waitFor();
+ setExitValue(process.exitValue());
+ } catch (InterruptedException e) {
+ log.info("waitFor() interrupted ");
+ }
+ }
- if( log.isDebugEnabled() ) {
- log.debug("Done exit=" + exit + " " + getCommandLineString());
- }
- return exit;
- }
+ protected void setExitValue(int value) {
+ exitValue = value;
+ }
- private String array2string( String sa[]) {
- if( sa==null ) return "null";
- StringBuffer sb=new StringBuffer();
- for( int i=0; i osEnv = (Vector) getProcEnvironment().clone();
- for (int i = 0; i < env.length; i++) {
- int pos = env[i].indexOf('=');
- // Get key including "="
- String key = env[i].substring(0, pos+1);
- int size = osEnv.size();
- for (int j = 0; j < size; j++) {
- if ((osEnv.elementAt(j)).startsWith(key)) {
- osEnv.removeElementAt(j);
- break;
- }
- }
- osEnv.addElement(env[i]);
- }
- String[] result = new String[osEnv.size()];
- osEnv.copyInto(result);
- return result;
- }
+ for (int i = 0; i < env.length; i++) {
+ int pos = env[i].indexOf('=');
+ // Get key including "="
+ String key = env[i].substring(0, pos + 1);
+ int size = osEnv.size();
+ for (int j = 0; j < size; j++) {
+ if ((osEnv.elementAt(j)).startsWith(key)) {
+ osEnv.removeElementAt(j);
+ break;
+ }
+ }
+ osEnv.addElement(env[i]);
+ }
+ String[] result = new String[osEnv.size()];
+ osEnv.copyInto(result);
+ return result;
+ }
- public static int execute(Vector envVars, String cmd, File baseDir ) {
- Vector v = new Vector();
- StringTokenizer st=new StringTokenizer( cmd, " " );
- while( st.hasMoreTokens() ) {
- v.addElement( st.nextToken() );
- }
+ public static int execute(Vector envVars, String cmd, File baseDir) {
+ Vector v = new Vector();
+ StringTokenizer st = new StringTokenizer(cmd, " ");
+ while (st.hasMoreTokens()) {
+ v.addElement(st.nextToken());
+ }
- return execute( envVars, v, baseDir );
- }
-
- public static int execute(Vector envVars, Vector cmd, File baseDir) {
- return execute( envVars, cmd, baseDir, 10000 /* default time to wait */);
- }
+ return execute(envVars, v, baseDir);
+ }
- /** Wrapper for common execution patterns
- * @param envVars Environment variables to execute with (optional)
- * @param cmd a vector of the commands to execute
- * @param baseDir the base directory to run from (optional)
- * @param timeToWait milliseconds to wait for completion
- */
- public static int execute(Vector envVars, Vector cmd, File baseDir, int timeToWait) {
- try {
- // We can collect the out or provide in if needed
- ExecuteWatchdog watchdog=new ExecuteWatchdog( timeToWait );
- watchdog.setDontkill( true );
- PumpStreamHandler out=new PumpStreamHandler();
- Execute exec=new Execute(out,watchdog);
+ public static int execute(Vector envVars, Vector cmd,
+ File baseDir) {
+ return execute(envVars, cmd, baseDir, 10000 /* default time to wait */);
+ }
- String cmdA[]=new String[ cmd.size() ];
- cmd.toArray( cmdA );
- if( log.isDebugEnabled() ) {
- StringBuffer sb=new StringBuffer();
- for(int i=0; i envVars, Vector cmd,
+ File baseDir, int timeToWait) {
+ try {
+ // We can collect the out or provide in if needed
+ ExecuteWatchdog watchdog = new ExecuteWatchdog(timeToWait);
+ watchdog.setDontkill(true);
+ PumpStreamHandler out = new PumpStreamHandler();
+ Execute exec = new Execute(out, watchdog);
- if( envVars!=null ) {
- String env[]=new String[envVars.size()];
- envVars.toArray( env );
- exec.setEnvironment( env );
- }
+ String cmdA[] = new String[cmd.size()];
+ cmd.toArray(cmdA);
+ if (log.isDebugEnabled()) {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < cmdA.length; i++) {
+ sb.append(cmdA[i] + " ");
+ }
+ log.debug("Exec: " + sb.toString());
+ }
+ exec.setCommandline(cmdA);
- exec.setNewenvironment( false );
- if( baseDir!=null)
- exec.setWorkingDirectory( baseDir );
+ if (envVars != null) {
+ String env[] = new String[envVars.size()];
+ envVars.toArray(env);
+ exec.setEnvironment(env);
+ }
- exec.execute();
- int status=exec.getExitValue();
- log.debug("Exit value " + status );
- return status;
- } catch( Exception ex ) {
-// ex.printStackTrace();
- System.err.println("An error has occurred in Execute.");
- return -1;
- }
- }
+ exec.setNewenvironment(false);
+ if (baseDir != null)
+ exec.setWorkingDirectory(baseDir);
+
+ exec.execute();
+ int status = exec.getExitValue();
+ log.debug("Exit value " + status);
+ return status;
+ } catch (Exception ex) {
+ // ex.printStackTrace();
+ System.err.println("An error has occurred in Execute.");
+ return -1;
+ }
+ }
+
+ private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory
+ .getLog(Execute.class);
- private static org.apache.commons.logging.Log log=
- org.apache.commons.logging.LogFactory.getLog( Execute.class );
-
}
diff --git a/spring-rabbit-admin/.classpath b/spring-rabbit-admin/.classpath
index 10ac4a5f..3bde1346 100644
--- a/spring-rabbit-admin/.classpath
+++ b/spring-rabbit-admin/.classpath
@@ -1,9 +1,9 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/spring-rabbit-admin/src/main/java/org/springframework/amqp/rabbit/admin/RabbitAdminAuthException.java b/spring-rabbit-admin/src/main/java/org/springframework/amqp/rabbit/admin/RabbitAdminAuthException.java
new file mode 100644
index 00000000..14d7edaa
--- /dev/null
+++ b/spring-rabbit-admin/src/main/java/org/springframework/amqp/rabbit/admin/RabbitAdminAuthException.java
@@ -0,0 +1,12 @@
+package org.springframework.amqp.rabbit.admin;
+
+import org.springframework.erlang.OtpAuthException;
+
+@SuppressWarnings("serial")
+public class RabbitAdminAuthException extends OtpAuthException {
+
+ public RabbitAdminAuthException(String message, OtpAuthException cause) {
+ super(message, (com.ericsson.otp.erlang.OtpAuthException) cause.getCause());
+ }
+
+}
diff --git a/spring-rabbit-admin/src/main/java/org/springframework/amqp/rabbit/admin/RabbitBrokerAdmin.java b/spring-rabbit-admin/src/main/java/org/springframework/amqp/rabbit/admin/RabbitBrokerAdmin.java
index c5aa2c25..6bfff860 100644
--- a/spring-rabbit-admin/src/main/java/org/springframework/amqp/rabbit/admin/RabbitBrokerAdmin.java
+++ b/spring-rabbit-admin/src/main/java/org/springframework/amqp/rabbit/admin/RabbitBrokerAdmin.java
@@ -16,13 +16,17 @@
package org.springframework.amqp.rabbit.admin;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Pattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.Exchange;
import org.springframework.amqp.core.Queue;
@@ -31,44 +35,48 @@ import org.springframework.amqp.rabbit.core.ChannelCallback;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.core.task.SimpleAsyncTaskExecutor;
+import org.springframework.erlang.OtpAuthException;
+import org.springframework.erlang.OtpIOException;
import org.springframework.erlang.connection.SimpleConnectionFactory;
+import org.springframework.erlang.core.Application;
import org.springframework.erlang.core.ErlangTemplate;
+import org.springframework.erlang.core.Node;
import org.springframework.jmx.export.annotation.ManagedOperation;
import org.springframework.jmx.export.annotation.ManagedOperationParameter;
import org.springframework.jmx.export.annotation.ManagedOperationParameters;
import org.springframework.util.Assert;
+import org.springframework.util.StringUtils;
import org.springframework.util.exec.Execute;
import org.springframework.util.exec.Os;
-import com.rabbitmq.client.Channel;
import com.rabbitmq.client.AMQP.Exchange.DeleteOk;
+import com.rabbitmq.client.Channel;
/**
* Rabbit broker administration implementation exposed via JMX annotations.
- *
+ *
* @author Mark Pollack
*/
public class RabbitBrokerAdmin implements RabbitBrokerOperations {
/** Logger available to subclasses */
protected final Log logger = LogFactory.getLog(getClass());
-
+
private RabbitTemplate rabbitTemplate;
-
+
private RabbitAdmin rabbitAdmin;
-
+
private ErlangTemplate erlangTemplate;
-
+
private String virtualHost;
-
+
public RabbitBrokerAdmin(ConnectionFactory connectionFactory) {
this.virtualHost = connectionFactory.getVirtualHost();
this.rabbitTemplate = new RabbitTemplate(connectionFactory);
this.rabbitAdmin = new RabbitAdmin(connectionFactory);
- initializeDefaultErlangTemplate(rabbitTemplate);
+ initializeDefaultErlangTemplate(rabbitTemplate);
}
-
-
+
// Exchange Operations
public void declareExchange(Exchange exchange) {
@@ -76,33 +84,33 @@ public class RabbitBrokerAdmin implements RabbitBrokerOperations {
}
/**
- * Declare an exchange specifying its durability and auto-delete behavior. Explicit arguments are given so as to
- * make this method easily accessible from JMX management consoles.
- * Durable exchanges last until they are deleted, they will survive a server restart.
- * Auto-deleted exchanges last until they are no longer used
+ * Declare an exchange specifying its durability and auto-delete behavior. Explicit arguments are given so as to
+ * make this method easily accessible from JMX management consoles. Durable exchanges last until they are deleted,
+ * they will survive a server restart. Auto-deleted exchanges last until they are no longer used
+ *
* @param exchangeName the name of the exchange
* @param exchangeType the exchange type
* @param durable true if we are declaring a durable exchange (the exchange will survive a server restart)
* @param autoDelete true if the server should delete the exchange when it is no longer in use
*/
@ManagedOperation
- public void declareExchange(final String exchangeName, final String exchangeType, final boolean durable, final boolean autoDelete) {
+ public void declareExchange(final String exchangeName, final String exchangeType, final boolean durable,
+ final boolean autoDelete) {
rabbitTemplate.execute(new ChannelCallback