Author: objectiser
Date: 2011-08-30 08:56:41 -0400 (Tue, 30 Aug 2011)
New Revision: 1453
Modified:
trunk/samples/quickstart/management/build.xml
trunk/samples/quickstart/management/readme.txt
trunk/samples/quickstart/management/src/org/jboss/riftsaw/management/ManagementClient.java
Log:
SOA-3307 further update to promote the properties into the build.xml
Modified: trunk/samples/quickstart/management/build.xml
===================================================================
--- trunk/samples/quickstart/management/build.xml 2011-08-30 12:55:34 UTC (rev 1452)
+++ trunk/samples/quickstart/management/build.xml 2011-08-30 12:56:41 UTC (rev 1453)
@@ -9,6 +9,9 @@
<property name="build.dir"
location="target/build/classes"/>
+ <property name="username" value="admin" />
+ <property name="password" value="admin" />
+
<target name="compile">
<mkdir dir="${build.dir}" />
<javac srcdir="src" destdir="${build.dir}"
debug="true">
@@ -25,7 +28,9 @@
<classpath>
<pathelement location="${build.dir}" />
<path refid="rs-exec-classpath" />
- </classpath>
+ </classpath>
+ <sysproperty key="username" value="${username}"/>
+ <sysproperty key="password" value="${password}"/>
</java>
</target>
</project>
Modified: trunk/samples/quickstart/management/readme.txt
===================================================================
--- trunk/samples/quickstart/management/readme.txt 2011-08-30 12:55:34 UTC (rev 1452)
+++ trunk/samples/quickstart/management/readme.txt 2011-08-30 12:56:41 UTC (rev 1453)
@@ -3,9 +3,10 @@
This is a simple example to demonstrate the management APIs that are exposed as RESTful
services.
-The code in the src folder has been hardcoded to use the default username 'admin'
and password 'admin'.
-If the username and/or password have been changed, then the code will need to be updated
with the
-appropriate details. To check whether the username and password work correctly, simply
log in to the
+The console username and password are defined as properties in the build.xml file, and
have been
+configured to use the default values of username 'admin' and password
'admin'. If the username
+and/or password have been changed, then the properties will need to be updated with the
+appropriate values. To check whether the username and password work correctly, simply log
in to the
BPEL console at:
http://localhost:8080/bpel-console
Before running this example, it is necessary to create some appropriate information upon
which to
Modified:
trunk/samples/quickstart/management/src/org/jboss/riftsaw/management/ManagementClient.java
===================================================================
---
trunk/samples/quickstart/management/src/org/jboss/riftsaw/management/ManagementClient.java 2011-08-30
12:55:34 UTC (rev 1452)
+++
trunk/samples/quickstart/management/src/org/jboss/riftsaw/management/ManagementClient.java 2011-08-30
12:56:41 UTC (rev 1453)
@@ -28,10 +28,19 @@
private static final String history_search_url =
"http://localhost:8080/gwt-console-server/rs/history/definition/";
+ private String username;
+ private String password;
+
+ public ManagementClient(String u, String p) {
+System.out.println("U="+u+" P="+p);
+ username = u;
+ password = p;
+ }
+
public void showAllDeployments() throws Exception {
System.out.println("-----------------------------");
System.out.println("Get all of deployments: ");
- String result = getDataFromService(deployment_url, "GET", null, null);
+ String result = getDataFromService(deployment_url, "GET");
System.out.println("-----------------------------");
System.out.println("Marshall the Json data into java class.");
@@ -48,7 +57,7 @@
public void showAllDefinitions() throws Exception {
System.out.println("-----------------------------");
System.out.println("Get all of process definitions: ");
- String result = getDataFromService(definitions_url, "GET",
"admin", "admin");
+ String result = getDataFromService(definitions_url, "GET");
System.out.println("-----------------------------");
System.out.println("Marshall the Json data into java class.");
@@ -68,7 +77,7 @@
String instances_url =
"http://localhost:8080/gwt-console-server/rs/process/definition" + "/"
+ encodedId + "/instances";
System.out.println("-----------------------------");
System.out.println("Get active process instances from process definition of
: " + processId );
- String result = getDataFromService(instances_url, "GET",
"admin", "admin");
+ String result = getDataFromService(instances_url, "GET");
System.out.println("-----------------------------");
System.out.println("Marshall the Json data into java class.");
@@ -96,7 +105,7 @@
System.out.println("-----------------------------");
System.out.println("Get historic process instances from process definition
of : " + processId );
- String result = getDataFromService(search_url, "GET",
"admin", "admin");
+ String result = getDataFromService(search_url, "GET");
System.out.println("-----------------------------");
System.out.println("Marshall the Json data into java class.");
@@ -110,7 +119,7 @@
}
- private String getDataFromService(String urlpath, String method, String username,
String password ) throws Exception{
+ private String getDataFromService(String urlpath, String method) throws Exception{
HttpClient httpclient = new HttpClient();
HttpMethod theMethod = null;
@@ -158,7 +167,8 @@
}
public static void main(String[] args) throws Exception {
- ManagementClient client = new ManagementClient();
+
+ ManagementClient client = new
ManagementClient(System.getProperty("username"),System.getProperty("password"));
client.showAllDeployments();
client.showAllDefinitions();
client.getActiveProcessInstance();