Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
joram
joram
Commits
9d57faa1
Commit
9d57faa1
authored
Jul 27, 2017
by
afreyssin
Browse files
Use DestinationConstants shared definition.
parent
e0252d5e
Changes
2
Hide whitespace changes
Inline
Side-by-side
joram/joram/client/jms/src/main/java/org/objectweb/joram/client/jms/admin/RestAcquisitionQueue.java
View file @
9d57faa1
...
...
@@ -27,6 +27,7 @@ import java.util.Properties;
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 @@ public class RestAcquisitionQueue {
/**
* 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
host
Name
=
"localhost"
;
private
String
host
=
"localhost"
;
private
int
port
=
8989
;
private
String
user
N
ame
=
"anonymous"
;
private
String
user
n
ame
=
"anonymous"
;
private
String
password
=
"anonymous"
;
private
int
nbMaxMsgByPeriode
=
100
;
private
boolean
mediaTypeJson
=
true
;;
private
long
timeout
=
5
00
;
private
int
acquisitionPeriod
=
100
;
private
long
timeout
=
100
00
;
private
int
acquisitionPeriod
=
100
;
// TODO (AF):
private
long
idleTimeout
;
/**
* @return the hostName
*/
public
String
getHost
Name
()
{
return
host
Name
;
public
String
getHost
()
{
return
host
;
}
/**
* @param hostName the hostName to set
*/
public
RestAcquisitionQueue
setHost
Name
(
String
host
Name
)
{
this
.
host
Name
=
host
Name
;
public
RestAcquisitionQueue
setHost
(
String
host
)
{
this
.
host
=
host
;
return
this
;
}
...
...
@@ -84,15 +85,15 @@ public class RestAcquisitionQueue {
/**
* @return the userName
*/
public
String
getUser
N
ame
()
{
return
user
N
ame
;
public
String
getUser
n
ame
()
{
return
user
n
ame
;
}
/**
* @param userName the userName to set
*/
public
RestAcquisitionQueue
setUser
N
ame
(
String
userName
)
{
this
.
user
N
ame
=
userName
;
public
RestAcquisitionQueue
setUser
n
ame
(
String
userName
)
{
this
.
user
n
ame
=
userName
;
return
this
;
}
...
...
@@ -111,21 +112,6 @@ public class RestAcquisitionQueue {
return
this
;
}
/**
* @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
*/
...
...
@@ -170,6 +156,15 @@ public class RestAcquisitionQueue {
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.
...
...
@@ -276,25 +271,25 @@ public class RestAcquisitionQueue {
if
(
props
==
null
)
props
=
new
Properties
();
props
.
setProperty
(
"acquisition.className"
,
RESTAcquisition
);
if
(!
props
.
containsKey
(
"r
est
.hostName"
))
props
.
setProperty
(
"r
est
.hostName"
,
host
Name
);
if
(!
props
.
containsKey
(
"r
est
.port"
))
props
.
setProperty
(
"r
est
.port"
,
""
+
port
);
if
(!
props
.
containsKey
(
"r
est
.userName"
))
props
.
setProperty
(
"r
est
.userName"
,
user
N
ame
);
if
(!
props
.
containsKey
(
"r
est
.password"
))
props
.
setProperty
(
"r
est
.password"
,
password
);
if
(!
props
.
containsKey
(
"r
est
.nbMaxMsgByPeriode"
))
props
.
setProperty
(
"r
est
.nbMaxMsgByPeriode"
,
""
+
nbMaxMsgByPeriode
);
if
(!
props
.
containsKey
(
"r
est
.mediaTypeJson"
))
props
.
setProperty
(
"r
est
.mediaTypeJson"
,
""
+
mediaTypeJson
);
if
(!
props
.
containsKey
(
"r
est
.timeout"
))
props
.
setProperty
(
"r
est
.timeout"
,
""
+
t
imeout
);
if
(!
props
.
containsKey
(
"acquisition.period"
))
props
.
setProperty
(
"acquisition.period"
,
""
+
acquisitionPeriod
);
props
.
setProperty
(
DestinationConstants
.
ACQUISITION_CLASS_NAME
,
RESTAcquisition
);
if
(!
props
.
containsKey
(
D
est
inationConstants
.
REST_HOST_PROP
))
props
.
setProperty
(
D
est
inationConstants
.
REST_HOST_PROP
,
host
);
if
(!
props
.
containsKey
(
D
est
inationConstants
.
REST_PORT_PROP
))
props
.
setProperty
(
D
est
inationConstants
.
REST_PORT_PROP
,
""
+
port
);
if
(!
props
.
containsKey
(
D
est
inationConstants
.
REST_USERNAME_PROP
))
props
.
setProperty
(
D
est
inationConstants
.
REST_USERNAME_PROP
,
user
n
ame
);
if
(!
props
.
containsKey
(
D
est
inationConstants
.
REST_PASSWORD_PROP
))
props
.
setProperty
(
D
est
inationConstants
.
REST_PASSWORD_PROP
,
password
);
if
(!
props
.
containsKey
(
D
est
inationConstants
.
MEDIA_TYPE_JSON_PROP
))
props
.
setProperty
(
D
est
inationConstants
.
MEDIA_TYPE_JSON_PROP
,
""
+
mediaTypeJson
);
if
(!
props
.
containsKey
(
D
est
inationConstants
.
TIMEOUT_PROP
))
props
.
setProperty
(
D
est
inationConstants
.
TIMEOUT_PROP
,
""
+
timeout
);
if
(!
props
.
containsKey
(
D
est
inationConstants
.
IDLETIMEOUT_PROP
))
props
.
setProperty
(
D
est
inationConstants
.
IDLETIMEOUT_PROP
,
""
+
idleT
imeout
);
if
(!
props
.
containsKey
(
DestinationConstants
.
ACQUISITION_PERIOD
))
props
.
setProperty
(
DestinationConstants
.
ACQUISITION_PERIOD
,
""
+
acquisitionPeriod
);
props
.
setProperty
(
"jms.d
estination
"
,
dest
);
props
.
setProperty
(
D
estination
Constants
.
DESTINATION_NAME_PROP
,
dest
);
return
Queue
.
create
(
serverId
,
name
,
Destination
.
ACQUISITION_QUEUE
,
props
);
}
...
...
joram/joram/client/jms/src/main/java/org/objectweb/joram/client/jms/admin/RestDistributionQueue.java
View file @
9d57faa1
...
...
@@ -27,6 +27,7 @@ import java.util.Properties;
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 @@ public class RestDistributionQueue {
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 @@ public class RestDistributionQueue {
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
)
{
...
...
@@ -124,6 +128,23 @@ public class RestDistributionQueue {
return
this
;
}
/**
* 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
*/
...
...
@@ -138,6 +159,15 @@ public class RestDistributionQueue {
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.
...
...
@@ -214,7 +244,8 @@ public class RestDistributionQueue {
* 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 @@ public class RestDistributionQueue {
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.d
estination
"
,
dest
);
props
.
setProperty
(
"period"
,
""
+
period
);
props
.
setProperty
(
D
estination
Constants
.
DESTINATION_NAME_PROP
,
dest
);
return
Queue
.
create
(
serverId
,
name
,
Destination
.
DISTRIBUTION_QUEUE
,
props
);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment