Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
joram
joram
Commits
6dcbfa1c
Commit
6dcbfa1c
authored
Sep 27, 2017
by
afreyssin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix default value in coherence with default values of corresponding destination.
JavaDoc enhancements.
parent
f3227070
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
15 deletions
+27
-15
joram/joram/mom/extensions/restbridge/src/main/java/com/scalagent/joram/mom/dest/rest/RESTAcquisition.java
...va/com/scalagent/joram/mom/dest/rest/RESTAcquisition.java
+1
-2
joram/joram/mom/extensions/restbridge/src/main/java/com/scalagent/joram/mom/dest/rest/RESTDistribution.java
...a/com/scalagent/joram/mom/dest/rest/RESTDistribution.java
+11
-4
joram/joram/mom/extensions/restbridge/src/main/java/com/scalagent/joram/mom/dest/rest/RestAcquisitionAsync.java
...m/scalagent/joram/mom/dest/rest/RestAcquisitionAsync.java
+15
-9
No files found.
joram/joram/mom/extensions/restbridge/src/main/java/com/scalagent/joram/mom/dest/rest/RESTAcquisition.java
View file @
6dcbfa1c
...
@@ -58,10 +58,9 @@ import com.google.gson.GsonBuilder;
...
@@ -58,10 +58,9 @@ import com.google.gson.GsonBuilder;
import
fr.dyade.aaa.common.Debug
;
import
fr.dyade.aaa.common.Debug
;
/**
/**
*
A
cquisition handler for the REST acquisition bridge.
*
Simple a
cquisition handler for the REST acquisition bridge.
*/
*/
public
class
RESTAcquisition
implements
AcquisitionHandler
{
public
class
RESTAcquisition
implements
AcquisitionHandler
{
private
static
final
Logger
logger
=
Debug
.
getLogger
(
RESTAcquisition
.
class
.
getName
());
private
static
final
Logger
logger
=
Debug
.
getLogger
(
RESTAcquisition
.
class
.
getName
());
private
String
hostName
=
"localhost"
;
private
String
hostName
=
"localhost"
;
...
...
joram/joram/mom/extensions/restbridge/src/main/java/com/scalagent/joram/mom/dest/rest/RESTDistribution.java
View file @
6dcbfa1c
...
@@ -68,10 +68,10 @@ public class RESTDistribution implements DistributionHandler {
...
@@ -68,10 +68,10 @@ public class RESTDistribution implements DistributionHandler {
private
int
connectTimeout
=
10000
;
private
int
connectTimeout
=
10000
;
private
int
readTimeout
=
10000
;
private
int
readTimeout
=
10000
;
private
String
userName
=
null
;
private
String
userName
=
"anonymous"
;
private
String
password
=
null
;
private
String
password
=
"anonymous"
;
private
String
destName
;
private
String
destName
=
null
;
private
String
idleTimeout
=
"60"
;
// TODO (AF): default value (Be careful in seconds)
private
String
idleTimeout
=
"60"
;
// TODO (AF): default value (Be careful in seconds)
...
@@ -123,7 +123,8 @@ public class RESTDistribution implements DistributionHandler {
...
@@ -123,7 +123,8 @@ public class RESTDistribution implements DistributionHandler {
destName
=
properties
.
getProperty
(
DestinationConstants
.
DESTINATION_NAME_PROP
);
destName
=
properties
.
getProperty
(
DestinationConstants
.
DESTINATION_NAME_PROP
);
if
(
destName
==
null
)
{
if
(
destName
==
null
)
{
throw
new
IllegalArgumentException
(
"Missing Destination JNDI name."
);
logger
.
log
(
BasicLevel
.
ERROR
,
"Missing Destination JNDI name, should fixed property "
+
DestinationConstants
.
DESTINATION_NAME_PROP
);
}
}
}
}
...
@@ -216,6 +217,12 @@ public class RESTDistribution implements DistributionHandler {
...
@@ -216,6 +217,12 @@ public class RESTDistribution implements DistributionHandler {
if
(
logger
.
isLoggable
(
BasicLevel
.
DEBUG
))
if
(
logger
.
isLoggable
(
BasicLevel
.
DEBUG
))
logger
.
log
(
BasicLevel
.
DEBUG
,
"RESTDistribution.distribute("
+
message
+
')'
);
logger
.
log
(
BasicLevel
.
DEBUG
,
"RESTDistribution.distribute("
+
message
+
')'
);
if
(
destName
==
null
)
{
logger
.
log
(
BasicLevel
.
ERROR
,
"Missing Destination JNDI name, should fixed property "
+
DestinationConstants
.
DESTINATION_NAME_PROP
);
throw
new
Exception
(
"Missing Destination JNDI name, should fixed property "
+
DestinationConstants
.
DESTINATION_NAME_PROP
);
}
try
{
try
{
createProducer
(
userName
,
password
);
createProducer
(
userName
,
password
);
}
catch
(
Exception
exc
)
{
}
catch
(
Exception
exc
)
{
...
...
joram/joram/mom/extensions/restbridge/src/main/java/com/scalagent/joram/mom/dest/rest/RestAcquisitionAsync.java
View file @
6dcbfa1c
...
@@ -54,6 +54,9 @@ import com.google.gson.GsonBuilder;
...
@@ -54,6 +54,9 @@ import com.google.gson.GsonBuilder;
import
fr.dyade.aaa.common.Daemon
;
import
fr.dyade.aaa.common.Daemon
;
import
fr.dyade.aaa.common.Debug
;
import
fr.dyade.aaa.common.Debug
;
/**
* Asynchronous acquisition handler implementing the AcquisitionDaemon interface.
*/
public
class
RestAcquisitionAsync
implements
AcquisitionDaemon
{
public
class
RestAcquisitionAsync
implements
AcquisitionDaemon
{
private
static
final
Logger
logger
=
Debug
.
getLogger
(
RestAcquisitionAsync
.
class
.
getName
());
private
static
final
Logger
logger
=
Debug
.
getLogger
(
RestAcquisitionAsync
.
class
.
getName
());
...
@@ -63,18 +66,21 @@ public class RestAcquisitionAsync implements AcquisitionDaemon {
...
@@ -63,18 +66,21 @@ public class RestAcquisitionAsync implements AcquisitionDaemon {
private
String
hostName
=
"localhost"
;
private
String
hostName
=
"localhost"
;
private
int
port
=
8989
;
private
int
port
=
8989
;
private
int
connectTimeout
=
10
000
;
private
final
int
connectTimeout
=
5
000
;
// Value for jersey.config.client.connectTimeout.
private
int
readTimeout
=
10
000
;
private
final
int
readTimeout
=
5
000
;
// Base value for jersey.config.client.readTimeout (timeout is added).
private
String
userName
=
null
;
private
String
userName
=
"anonymous"
;
private
String
password
=
null
;
private
String
password
=
"anonymous"
;
private
String
destName
=
null
;
private
String
destName
=
null
;
private
String
consName
=
null
;
private
String
consName
=
null
;
private
String
clientId
=
null
;
private
String
clientId
=
null
;
private
String
idleTimeout
=
"60"
;
// TODO (AF): default value (Be careful in seconds)
// Normally each consumer resource need to be explicitly closed, this parameter allows to set the idle time
private
String
timeout
=
"30000"
;
// TODO (AF): default value (Be careful in milliseconds)
// in seconds in which the consumer context will be closed if idle.
private
String
idleTimeout
=
"60"
;
// Timeout for waiting for a message.
private
String
timeout
=
"10000"
;
private
boolean
mediaTypeJson
=
true
;
//default true, use "application/json"
private
boolean
mediaTypeJson
=
true
;
//default true, use "application/json"
private
boolean
persistent
=
true
;
private
boolean
persistent
=
true
;
...
@@ -136,9 +142,7 @@ public class RestAcquisitionAsync implements AcquisitionDaemon {
...
@@ -136,9 +142,7 @@ public class RestAcquisitionAsync implements AcquisitionDaemon {
destName
=
properties
.
getProperty
(
DestinationConstants
.
DESTINATION_NAME_PROP
);
destName
=
properties
.
getProperty
(
DestinationConstants
.
DESTINATION_NAME_PROP
);
if
(
destName
==
null
)
{
if
(
destName
==
null
)
{
logger
.
log
(
BasicLevel
.
ERROR
,
logger
.
log
(
BasicLevel
.
ERROR
,
"Missing property Destination JNDI name."
);
"Missing Destination JNDI name, should fixed property "
+
DestinationConstants
.
DESTINATION_NAME_PROP
);
// TODO (AF):
// throw new IllegalArgumentException("Missing Destination JNDI name.");
}
}
if
(
properties
.
containsKey
(
DestinationConstants
.
MEDIA_TYPE_JSON_PROP
))
{
if
(
properties
.
containsKey
(
DestinationConstants
.
MEDIA_TYPE_JSON_PROP
))
{
...
@@ -237,6 +241,8 @@ public class RestAcquisitionAsync implements AcquisitionDaemon {
...
@@ -237,6 +241,8 @@ public class RestAcquisitionAsync implements AcquisitionDaemon {
WebTarget
target
=
client
.
target
(
uriCreateConsumer
);
WebTarget
target
=
client
.
target
(
uriCreateConsumer
);
if
(
consName
!=
null
)
target
=
target
.
queryParam
(
"name"
,
consName
);
if
(
consName
!=
null
)
target
=
target
.
queryParam
(
"name"
,
consName
);
if
(
clientId
!=
null
)
target
=
target
.
queryParam
(
"client-id"
,
clientId
);
if
(
clientId
!=
null
)
target
=
target
.
queryParam
(
"client-id"
,
clientId
);
// Normally each consumer resource need to be explicitly closed, this parameter allows to set the idle time
// in seconds in which the consumer context will be closed if idle.
if
(
idleTimeout
!=
null
)
target
=
target
.
queryParam
(
"idle-timeout"
,
idleTimeout
);
if
(
idleTimeout
!=
null
)
target
=
target
.
queryParam
(
"idle-timeout"
,
idleTimeout
);
if
(
userName
!=
null
)
target
=
target
.
queryParam
(
"user"
,
userName
);
if
(
userName
!=
null
)
target
=
target
.
queryParam
(
"user"
,
userName
);
if
(
password
!=
null
)
target
=
target
.
queryParam
(
"password"
,
password
);
if
(
password
!=
null
)
target
=
target
.
queryParam
(
"password"
,
password
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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