OW2 Consortium joram

Compare Revisions

Ignore whitespace Rev 6481 → Rev 6482

/trunk/joram/joram/client/jms/src/main/java/org/objectweb/joram/client/jms/admin/RestAcquisitionQueue.java
27,6 → 27,7
 
import org.objectweb.joram.client.jms.Destination;
import org.objectweb.joram.client.jms.Queue;
import org.objectweb.joram.shared.DestinationConstants;
 
/**
* The <code>RestAcquisitionQueue</code> class allows administrators to create REST
39,30 → 40,30
/**
* Class name of handler allowing to acquire messages to a foreign REST provider.
*/
public final static String RESTAcquisition = "com.scalagent.joram.mom.dest.rest.RESTAcquisitionDaemon";
// public final static String RESTAcquisition = "com.scalagent.joram.mom.dest.rest.RESTAcquisitionDaemon";
public final static String RESTAcquisition = "com.scalagent.joram.mom.dest.rest.RestAcquisitionAsync";
private String hostName = "localhost";
private String host = "localhost";
private int port = 8989;
private String userName = "anonymous";
private String username = "anonymous";
private String password = "anonymous";
private int nbMaxMsgByPeriode = 100;
private boolean mediaTypeJson = true;;
private long timeout = 500;
private int acquisitionPeriod = 100;
private long timeout = 10000;
private int acquisitionPeriod = 100; // TODO (AF):
private long idleTimeout;
 
/**
* @return the hostName
*/
public String getHostName() {
return hostName;
public String getHost() {
return host;
}
 
/**
* @param hostName the hostName to set
*/
public RestAcquisitionQueue setHostName(String hostName) {
this.hostName = hostName;
public RestAcquisitionQueue setHost(String host) {
this.host = host;
return this;
}
 
84,15 → 85,15
/**
* @return the userName
*/
public String getUserName() {
return userName;
public String getUsername() {
return username;
}
 
/**
* @param userName the userName to set
*/
public RestAcquisitionQueue setUserName(String userName) {
this.userName = userName;
public RestAcquisitionQueue setUsername(String userName) {
this.username = userName;
return this;
}
 
112,21 → 113,6
}
 
/**
* @return the nbMaxMsgByPeriode
*/
public int getNbMaxMsgByPeriode() {
return nbMaxMsgByPeriode;
}
 
/**
* @param nbMaxMsgByPeriode the nbMaxMsgByPeriode to set
*/
public RestAcquisitionQueue setNbMaxMsgByPeriode(int nbMaxMsgByPeriode) {
this.nbMaxMsgByPeriode = nbMaxMsgByPeriode;
return this;
}
 
/**
* @return the mediaTypeJson
*/
public boolean isMediaTypeJson() {
170,7 → 156,16
this.acquisitionPeriod = acquisitionPeriod;
return this;
}
public long getIdleTimeout() {
return idleTimeout;
}
 
public RestAcquisitionQueue setIdleTimeout(long idleTimeout) {
this.idleTimeout = idleTimeout;
return this;
}
 
/**
* Administration method creating and deploying a REST acquisition queue on the local server.
* <p>
276,25 → 271,25
if (props == null)
props = new Properties();
props.setProperty("acquisition.className", RESTAcquisition);
if (!props.containsKey("rest.hostName"))
props.setProperty("rest.hostName", hostName);
if (!props.containsKey("rest.port"))
props.setProperty("rest.port", ""+port);
if (!props.containsKey("rest.userName"))
props.setProperty("rest.userName", userName);
if (!props.containsKey("rest.password"))
props.setProperty("rest.password", password);
if (!props.containsKey("rest.nbMaxMsgByPeriode"))
props.setProperty("rest.nbMaxMsgByPeriode", ""+nbMaxMsgByPeriode);
if (!props.containsKey("rest.mediaTypeJson"))
props.setProperty("rest.mediaTypeJson", ""+mediaTypeJson);
if (!props.containsKey("rest.timeout"))
props.setProperty("rest.timeout", ""+timeout);
if (!props.containsKey("acquisition.period"))
props.setProperty("acquisition.period", ""+acquisitionPeriod);
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_USERNAME_PROP))
props.setProperty(DestinationConstants.REST_USERNAME_PROP, username);
if (!props.containsKey(DestinationConstants.REST_PASSWORD_PROP))
props.setProperty(DestinationConstants.REST_PASSWORD_PROP, password);
if (!props.containsKey(DestinationConstants.MEDIA_TYPE_JSON_PROP))
props.setProperty(DestinationConstants.MEDIA_TYPE_JSON_PROP, ""+mediaTypeJson);
if (!props.containsKey(DestinationConstants.TIMEOUT_PROP))
props.setProperty(DestinationConstants.TIMEOUT_PROP, ""+timeout);
if (!props.containsKey(DestinationConstants.IDLETIMEOUT_PROP))
props.setProperty(DestinationConstants.IDLETIMEOUT_PROP, ""+ idleTimeout);
if (!props.containsKey(DestinationConstants.ACQUISITION_PERIOD))
props.setProperty(DestinationConstants.ACQUISITION_PERIOD, ""+ acquisitionPeriod);
props.setProperty("jms.destination", dest);
props.setProperty(DestinationConstants.DESTINATION_NAME_PROP, dest);
return Queue.create(serverId, name, Destination.ACQUISITION_QUEUE, props);
}
/trunk/joram/joram/client/jms/src/main/java/org/objectweb/joram/client/jms/admin/RestDistributionQueue.java
27,6 → 27,7
 
import org.objectweb.joram.client.jms.Destination;
import org.objectweb.joram.client.jms.Queue;
import org.objectweb.joram.shared.DestinationConstants;
 
/**
* The <code>RestDistributionQueue</code> class allows administrators to create REST
45,8 → 46,10
private int port = 8989;
private String userName = "anonymous";
private String password = "anonymous";
private boolean batch = true;
private boolean batch = false;
private boolean async = true;
private int period = 1000;
private long idleTimeout;
/**
* @return the hostName
108,15 → 111,16
return this;
}
 
 
/**
* @return the batch
* Gets the batch parameter.
* @return the batch parameter
*/
public boolean isBatch() {
return batch;
}
 
/**
* Sets the batch parameter.
* @param batch the batch to set
*/
public RestDistributionQueue setBatch(boolean batch) {
125,6 → 129,23
}
 
/**
* Gets the async parameter.
* @return the async parameter
*/
public boolean isAsync() {
return async;
}
 
/**
* Sets the async parameter.
* @param async the batch to set
*/
public RestDistributionQueue setAsync(boolean async) {
this.async = async;
return this;
}
 
/**
* @return the period
*/
public int getPeriod() {
138,7 → 159,16
this.period = period;
return this;
}
public long getIdleTimeout() {
return idleTimeout;
}
 
public RestDistributionQueue setIdleTimeout(long idleTimeout) {
this.idleTimeout = idleTimeout;
return this;
}
 
/**
* Administration method creating and deploying a REST distribution queue on the local server.
* <p>
214,7 → 244,8
* message, regardless of distribution errors. This can lead to the loss of message ordering, but will
* prevent a blocking message from blocking every following message. When set to false, the distribution
* process will stop on the first error. Default is false.</li>
* <li>distribution.async - If set to true, the messages are asynchronously forwarded through a daemon.</li>
* <li>distribution.async - If set to true, the messages are asynchronously forwarded through a daemon.
* Default is true.</li>
* </ul>
* The request fails if the target server does not belong to the platform,
* or if the destination deployment fails server side.
237,21 → 268,25
if (props == null)
props = new Properties();
props.setProperty("distribution.className", RESTDistribution);
if (!props.containsKey("rest.hostName"))
props.setProperty("rest.hostName", hostName);
if (!props.containsKey("rest.port"))
props.setProperty("rest.port", ""+port);
if (!props.containsKey("rest.userName"))
props.setProperty("rest.userName", userName);
if (!props.containsKey("rest.password"))
props.setProperty("rest.password", password);
if (!props.containsKey("distribution.batch"))
props.setProperty("distribution.batch", ""+batch);
if (!props.containsKey(DestinationConstants.REST_HOST_PROP))
props.setProperty(DestinationConstants.REST_HOST_PROP, hostName);
if (!props.containsKey(DestinationConstants.REST_PORT_PROP))
props.setProperty(DestinationConstants.REST_PORT_PROP, ""+port);
if (!props.containsKey(DestinationConstants.REST_USERNAME_PROP))
props.setProperty(DestinationConstants.REST_USERNAME_PROP, userName);
if (!props.containsKey(DestinationConstants.REST_PASSWORD_PROP))
props.setProperty(DestinationConstants.REST_PASSWORD_PROP, password);
if (!props.containsKey(DestinationConstants.ASYNC_DISTRIBUTION_OPTION))
props.setProperty(DestinationConstants.ASYNC_DISTRIBUTION_OPTION, ""+async);
if (!props.containsKey(DestinationConstants.BATCH_DISTRIBUTION_OPTION))
props.setProperty(DestinationConstants.BATCH_DISTRIBUTION_OPTION, ""+batch);
if (!props.containsKey(DestinationConstants.IDLETIMEOUT_PROP))
props.setProperty(DestinationConstants.IDLETIMEOUT_PROP, ""+ idleTimeout);
if (!props.containsKey("period"))
props.setProperty("period", ""+period);
props.setProperty("jms.destination", dest);
props.setProperty("period", ""+period);
 
props.setProperty(DestinationConstants.DESTINATION_NAME_PROP, dest);
 
return Queue.create(serverId, name, Destination.DISTRIBUTION_QUEUE, props);
}
}