You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2016/06/29 18:30:45 UTC
qpid-jms git commit: NO-JIRA: allow username and password used in
examples to be passed via system properties
Repository: qpid-jms
Updated Branches:
refs/heads/master 5874cb0b0 -> a3d418162
NO-JIRA: allow username and password used in examples to be passed via system properties
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/a3d41816
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/a3d41816
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/a3d41816
Branch: refs/heads/master
Commit: a3d41816226a13e64e2f08a69fca1ae100558b7b
Parents: 5874cb0
Author: Gordon Sim <gs...@redhat.com>
Authored: Wed Jun 29 19:30:21 2016 +0100
Committer: Gordon Sim <gs...@redhat.com>
Committed: Wed Jun 29 19:30:21 2016 +0100
----------------------------------------------------------------------
qpid-jms-examples/README.txt | 8 ++++++++
.../main/java/org/apache/qpid/jms/example/HelloWorld.java | 7 ++-----
.../src/main/java/org/apache/qpid/jms/example/Receiver.java | 6 ++----
.../src/main/java/org/apache/qpid/jms/example/Sender.java | 6 ++----
4 files changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/a3d41816/qpid-jms-examples/README.txt
----------------------------------------------------------------------
diff --git a/qpid-jms-examples/README.txt b/qpid-jms-examples/README.txt
index 8a64c7a..b54003b 100644
--- a/qpid-jms-examples/README.txt
+++ b/qpid-jms-examples/README.txt
@@ -16,6 +16,14 @@ Now you can run the examples using commands of the format:
NOTE: The examples expect to use a Queue named "queue". You may need to create
this before running the examples, depending on the broker/peer you are using.
+NOTE: A username and password with which the examples will
+authenticate themselves can be set through system properties named
+USER and PASSWORD respectively. E.g.
+
+ Linux: java -DUSER=guest -Dpassword=guest -cp "target/classes/:target/dependency/*" org.apache.qpid.jms.example.HelloWorld
+
+ Windows: java -DUSER=guest -Dpassword=guest -cp "target\classes\;target\dependency\*" org.apache.qpid.jms.example.HelloWorld
+
NOTE: You can configure the connection and queue details used by updating the
JNDI configuration file before building. It can be found at:
src/main/resources/jndi.properties
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/a3d41816/qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/HelloWorld.java
----------------------------------------------------------------------
diff --git a/qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/HelloWorld.java b/qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/HelloWorld.java
index 90ac0b7..4495ef9 100644
--- a/qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/HelloWorld.java
+++ b/qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/HelloWorld.java
@@ -35,9 +35,6 @@ import javax.naming.Context;
import javax.naming.InitialContext;
public class HelloWorld {
- private static final String USER = "guest";
- private static final String PASSWORD = "guest";
-
public static void main(String[] args) throws Exception {
try {
// The configuration for the Qpid InitialContextFactory has been supplied in
@@ -48,7 +45,7 @@ public class HelloWorld {
ConnectionFactory factory = (ConnectionFactory) context.lookup("myFactoryLookup");
Destination queue = (Destination) context.lookup("myQueueLookup");
- Connection connection = factory.createConnection(USER, PASSWORD);
+ Connection connection = factory.createConnection(System.getProperty("USER"), System.getProperty("PASSWORD"));
connection.setExceptionListener(new MyExceptionListener());
connection.start();
@@ -83,4 +80,4 @@ public class HelloWorld {
System.exit(1);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/a3d41816/qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Receiver.java
----------------------------------------------------------------------
diff --git a/qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Receiver.java b/qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Receiver.java
index a16dc11..89b51f2 100644
--- a/qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Receiver.java
+++ b/qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Receiver.java
@@ -32,8 +32,6 @@ import javax.naming.Context;
import javax.naming.InitialContext;
public class Receiver {
- private static final String USER = "guest";
- private static final String PASSWORD = "guest";
private static final int DEFAULT_COUNT = 10;
public static void main(String[] args) throws Exception {
@@ -55,7 +53,7 @@ public class Receiver {
ConnectionFactory factory = (ConnectionFactory) context.lookup("myFactoryLookup");
Destination queue = (Destination) context.lookup("myQueueLookup");
- Connection connection = factory.createConnection(USER, PASSWORD);
+ Connection connection = factory.createConnection(System.getProperty("USER"), System.getProperty("PASSWORD"));
connection.setExceptionListener(new MyExceptionListener());
connection.start();
@@ -103,4 +101,4 @@ public class Receiver {
System.exit(1);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/a3d41816/qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Sender.java
----------------------------------------------------------------------
diff --git a/qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Sender.java b/qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Sender.java
index 93d5de4..2c175e6 100644
--- a/qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Sender.java
+++ b/qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Sender.java
@@ -34,8 +34,6 @@ import javax.naming.Context;
import javax.naming.InitialContext;
public class Sender {
- private static final String USER = "guest";
- private static final String PASSWORD = "guest";
private static final int DEFAULT_COUNT = 10;
private static final int DELIVERY_MODE = DeliveryMode.NON_PERSISTENT;
@@ -58,7 +56,7 @@ public class Sender {
ConnectionFactory factory = (ConnectionFactory) context.lookup("myFactoryLookup");
Destination queue = (Destination) context.lookup("myQueueLookup");
- Connection connection = factory.createConnection(USER, PASSWORD);
+ Connection connection = factory.createConnection(System.getProperty("USER"), System.getProperty("PASSWORD"));
connection.setExceptionListener(new MyExceptionListener());
connection.start();
@@ -96,4 +94,4 @@ public class Sender {
System.exit(1);
}
}
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org