Commit c56826b6 authored by Andre Freyssinet's avatar Andre Freyssinet
Browse files

Allows to configure useOldAPI.

parent 44bef325
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2017 ScalAgent Distributed Technologies
* Copyright (C) 2017 - 2020 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -39,6 +39,7 @@ import org.objectweb.joram.shared.DestinationConstants;
* The valid properties define by this destination are:<ul>
* <li>rest.host: hostname or IP address of remote JMS REST server, by default "localhost".</li>
* <li>rest.port: listening port of remote JMS REST server, by default 8989.</li>
* <li>rest.useOldAPI: if true, use the old Rest/JMS API with authentication through query parameters.</li>
* <li>rest.user: user name needed to connect to remote JMS REST server, by default "anonymous".</li>
* <li>rest.pass: password needed to connect to remote JMS REST server, by default "anonymous".</li>
* <li>rest.mediaTypeJson: if true the acquisition queue accepts JSON message, default true.</li>
......@@ -60,6 +61,7 @@ public class RestAcquisitionQueue {
private String host = "localhost";
private int port = 8989;
private boolean useOldAPI = false;
private String username = "anonymous";
private String password = "anonymous";
private boolean mediaTypeJson = true;
......@@ -77,9 +79,6 @@ public class RestAcquisitionQueue {
return host;
}
/**
* @param hostName the hostName to set
*/
public RestAcquisitionQueue setHost(String host) {
this.host = host;
return this;
......@@ -100,6 +99,21 @@ public class RestAcquisitionQueue {
return this;
}
/**
* @return the useOldAPI
*/
public boolean isUseOldAPI() {
return useOldAPI;
}
/**
* @param useOldAPI the useOldAPI to set
*/
public RestAcquisitionQueue setUseOldAPI(boolean useOldAPI) {
this.useOldAPI = useOldAPI;
return this;
}
/**
* @return the userName
*/
......@@ -291,11 +305,14 @@ public class RestAcquisitionQueue {
if (props == null)
props = new Properties();
// TODO: It seems that only Async Acquisition can be activated.
props.setProperty(DestinationConstants.ACQUISITION_CLASS_NAME, RESTAcquisition);
if (!props.containsKey(DestinationConstants.REST_HOST_PROP))
props.setProperty(DestinationConstants.REST_HOST_PROP, host);
if (!props.containsKey(DestinationConstants.REST_PORT_PROP))
props.setProperty(DestinationConstants.REST_PORT_PROP, "" + port);
if (!props.containsKey(DestinationConstants.REST_USE_OLD_API))
props.setProperty(DestinationConstants.REST_USE_OLD_API, ""+useOldAPI);
if (!props.containsKey(DestinationConstants.REST_USERNAME_PROP))
props.setProperty(DestinationConstants.REST_USERNAME_PROP, username);
if (!props.containsKey(DestinationConstants.REST_PASSWORD_PROP))
......
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2017 ScalAgent Distributed Technologies
* Copyright (C) 2017 - 2020 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -39,6 +39,7 @@ import org.objectweb.joram.shared.DestinationConstants;
* The valid properties define by this destination are:<ul>
* <li>rest.host: hostname or IP address of remote JMS REST server, by default "localhost".</li>
* <li>rest.port: listening port of remote JMS REST server, by default 8989.</li>
* <li>rest.useOldAPI: if true, use the old Rest/JMS API with authentication through query parameters.</li>
* <li>rest.user: user name needed to connect to remote JMS REST server, by default "anonymous".</li>
* <li>rest.pass: password needed to connect to remote JMS REST server, by default "anonymous".</li>
* <li>distribution.async: default true.<li>
......@@ -58,6 +59,7 @@ public class RestDistributionQueue {
private String host = "localhost";
private int port = 8989;
private boolean useOldAPI = false;
private String userName = "anonymous";
private String password = "anonymous";
private boolean batch = true;
......@@ -72,9 +74,6 @@ public class RestDistributionQueue {
return host;
}
/**
* @param hostName the hostName to set
*/
public RestDistributionQueue setHost(String host) {
this.host = host;
return this;
......@@ -95,6 +94,21 @@ public class RestDistributionQueue {
return this;
}
/**
* @return the useOldAPI
*/
public boolean isUseOldAPI() {
return useOldAPI;
}
/**
* @param useOldAPI the useOldAPI to set
*/
public RestDistributionQueue setUseOldAPI(boolean useOldAPI) {
this.useOldAPI = useOldAPI;
return this;
}
/**
* @return the userName
*/
......@@ -294,6 +308,8 @@ public class RestDistributionQueue {
props.setProperty(DestinationConstants.REST_HOST_PROP, host);
if (!props.containsKey(DestinationConstants.REST_PORT_PROP))
props.setProperty(DestinationConstants.REST_PORT_PROP, ""+port);
if (!props.containsKey(DestinationConstants.REST_USE_OLD_API))
props.setProperty(DestinationConstants.REST_USE_OLD_API, ""+useOldAPI);
if (!props.containsKey(DestinationConstants.REST_USERNAME_PROP))
props.setProperty(DestinationConstants.REST_USERNAME_PROP, userName);
if (!props.containsKey(DestinationConstants.REST_PASSWORD_PROP))
......
......@@ -66,6 +66,7 @@ public final class DestinationConstants {
public static final String REST_HOST_PROP = "rest.host";
public static final String REST_PORT_PROP = "rest.port";
public static final String REST_USE_OLD_API = "rest.useOldAPI";
public static final String REST_USERNAME_PROP = "rest.user";
public static final String REST_PASSWORD_PROP = "rest.pass";
public static final String MEDIA_TYPE_JSON_PROP = "rest.mediaTypeJson";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment