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
3e1ff9b1
Commit
3e1ff9b1
authored
Mar 25, 2021
by
Andre Freyssinet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds JNDI lookup operation.
parent
b3056789
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
7 deletions
+31
-7
joram/joram/tools/jmstool/src/main/java/com/scalagent/jmstool/Tool.java
...ols/jmstool/src/main/java/com/scalagent/jmstool/Tool.java
+31
-7
No files found.
joram/joram/tools/jmstool/src/main/java/com/scalagent/jmstool/Tool.java
View file @
3e1ff9b1
...
...
@@ -65,7 +65,8 @@ import org.objectweb.joram.client.jms.Session;
* any user to send or receive messages on this queue.
* - delete: deletes the queue in the JMS server.
* - statistics: prints all statistics about the queue.
* - unbind: removes the binding in JNDI.
* - lookup: gets the registered object in JNDI (name asked on terminal).
* - unbind: removes the binding in JNDI (name asked on terminal).
* - password: updates a user password (parameters asked in command line).
*
* The client returns 0 if the command is ok, -1 otherwise.
...
...
@@ -86,6 +87,7 @@ public class Tool {
public
final
static
String
PAUSE_OFF_CMD
=
"pause_off"
;
public
final
static
String
STAT_CMD
=
"statistics"
;
public
final
static
String
LOOKUP_CMD
=
"lookup"
;
public
final
static
String
UNBIND_CMD
=
"unbind"
;
public
final
static
String
PASSWORD_CMD
=
"password"
;
...
...
@@ -110,7 +112,8 @@ public class Tool {
" -D"
+
CF
+
"=cf -D"
+
QUEUE
+
"=queue -D"
+
FORWARD_QUEUE
+
"=forward -jar jmstool.jar\n"
+
" ["
+
HELP_CMD
+
"|"
+
BROWSE_CMD
+
"|"
+
PURGE_CMD
+
"|"
+
FORWARD_CMD
+
"|"
+
REMOVE_CMD
+
"|"
+
PAUSE_ON_CMD
+
'/'
+
PAUSE_OFF_CMD
+
"|"
+
CREATE_CMD
+
"|"
+
DELETE_CMD
+
"|"
+
STAT_CMD
+
"|"
+
UNBIND_CMD
+
"|"
+
CREATE_CMD
+
"|"
+
DELETE_CMD
+
"|"
+
STAT_CMD
+
"|"
+
LOOKUP_CMD
+
"|"
+
UNBIND_CMD
+
"|"
+
PASSWORD_CMD
+
"]\n"
);
System
.
err
.
println
(
"Options and parameters, set by Java environment variable (\"-Dproperty=value\" in command line)"
);
...
...
@@ -145,8 +148,9 @@ public class Tool {
" any user to send or receive messages on this queue.\n"
+
" - delete: deletes the queue in the JMS server.\n"
+
" - statistics: prints all statistics about the queue.\n"
+
" - unbind: removes the binding in JNDI.\n"
+
" - password: updates a user password (parameters asked in command line)."
);
" - lookup: gets the registered object in JNDI (name asked on terminal).\n"
+
" - unbind: removes the binding in JNDI (name asked on terminal).\n"
+
" - password: updates a user password (parameters asked on terminal)."
);
}
static
Context
ictx
=
null
;
...
...
@@ -166,7 +170,7 @@ public class Tool {
!
FORWARD_CMD
.
equals
(
command
)
&&
!
REMOVE_CMD
.
equals
(
command
)
&&
!
PAUSE_ON_CMD
.
equals
(
command
)
&&
!
PAUSE_OFF_CMD
.
equals
(
command
)
&&
!
STAT_CMD
.
equals
(
command
)
&&
!
UNBIND_CMD
.
equals
(
command
)
&&
!
UNBIND_CMD
.
equals
(
command
)
&&
!
LOOKUP_CMD
.
equals
(
command
)
&&
!
PASSWORD_CMD
.
equals
(
command
))
{
usage
();
return
;
...
...
@@ -181,6 +185,14 @@ public class Tool {
System
.
exit
(-
1
);
}
if
(
LOOKUP_CMD
.
equals
(
command
))
{
String
name
=
System
.
console
().
readLine
(
"name: "
);
lookup
(
name
);
}
else
if
(
UNBIND_CMD
.
equals
(
command
))
{
String
name
=
System
.
console
().
readLine
(
"name: "
);
unbind
(
name
);
}
// Get the JMS administration connection
try
{
cnx
=
getJMSConnection
(
ictx
);
...
...
@@ -319,8 +331,6 @@ public class Tool {
pause
(
queue
,
false
);
}
else
if
(
STAT_CMD
.
equals
(
command
))
{
statistics
(
queue
);
}
else
if
(
UNBIND_CMD
.
equals
(
command
))
{
unbind
(
qname
);
}
}
catch
(
Exception
exc
)
{
System
.
exit
(-
1
);
...
...
@@ -664,6 +674,20 @@ public class Tool {
System
.
out
.
println
(
"Message \""
+
msgid
+
"\" forwarded."
);
}
/* ********************************************************************************
* Lookup in JNDI.
* ******************************************************************************** */
public
static
void
lookup
(
String
name
)
{
try
{
Object
obj
=
ictx
.
lookup
(
name
);
System
.
out
.
println
(
"Name \""
+
name
+
"\" bind to: "
+
obj
);
}
catch
(
NamingException
exc
)
{
System
.
err
.
println
(
"Name \""
+
name
+
"\" unknown."
);
if
(
debug
)
exc
.
printStackTrace
(
System
.
err
);
}
}
/* ********************************************************************************
* Unbind the queue.
* ******************************************************************************** */
...
...
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