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
39670c14
Commit
39670c14
authored
Dec 03, 2010
by
Guillaume Surrel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create a Helper to ease the creation of well formed messages.
parent
a7bc11a0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
15 deletions
+60
-15
joram/joram/mom/core/src/main/java/org/objectweb/joram/mom/dest/AdminTopic.java
...rc/main/java/org/objectweb/joram/mom/dest/AdminTopic.java
+2
-5
joram/joram/mom/core/src/main/java/org/objectweb/joram/mom/dest/Destination.java
...c/main/java/org/objectweb/joram/mom/dest/Destination.java
+2
-5
joram/joram/mom/core/src/main/java/org/objectweb/joram/mom/proxies/UserAgent.java
.../main/java/org/objectweb/joram/mom/proxies/UserAgent.java
+3
-5
joram/joram/shared/src/main/java/org/objectweb/joram/shared/messages/MessageHelper.java
...va/org/objectweb/joram/shared/messages/MessageHelper.java
+53
-0
No files found.
joram/joram/mom/core/src/main/java/org/objectweb/joram/mom/dest/AdminTopic.java
View file @
39670c14
...
...
@@ -88,6 +88,7 @@ import org.objectweb.joram.shared.admin.UserAdminRequest;
import
org.objectweb.joram.shared.excepts.MomException
;
import
org.objectweb.joram.shared.excepts.RequestException
;
import
org.objectweb.joram.shared.messages.Message
;
import
org.objectweb.joram.shared.messages.MessageHelper
;
import
org.objectweb.joram.shared.security.Identity
;
import
org.objectweb.joram.shared.security.SimpleIdentity
;
import
org.objectweb.util.monolog.api.BasicLevel
;
...
...
@@ -1481,11 +1482,7 @@ public final class AdminTopic extends Topic implements AdminTopicMBean {
if
(
to
==
null
)
return
;
Message
message
=
new
Message
();
message
.
id
=
createMessageId
();
message
.
correlationId
=
msgId
;
message
.
timestamp
=
System
.
currentTimeMillis
();
message
.
setDestination
(
getId
().
toString
(),
Message
.
TOPIC_TYPE
);
Message
message
=
MessageHelper
.
createMessage
(
createMessageId
(),
msgId
,
getAgentId
(),
getType
());
try
{
message
.
setAdminMessage
(
reply
);
ClientMessages
clientMessages
=
new
ClientMessages
(-
1
,
-
1
,
message
);
...
...
joram/joram/mom/core/src/main/java/org/objectweb/joram/mom/dest/Destination.java
View file @
39670c14
...
...
@@ -64,6 +64,7 @@ import org.objectweb.joram.shared.excepts.MomException;
import
org.objectweb.joram.shared.excepts.RequestException
;
import
org.objectweb.joram.shared.messages.ConversionHelper
;
import
org.objectweb.joram.shared.messages.Message
;
import
org.objectweb.joram.shared.messages.MessageHelper
;
import
org.objectweb.util.monolog.api.BasicLevel
;
import
org.objectweb.util.monolog.api.Logger
;
...
...
@@ -915,11 +916,7 @@ public abstract class Destination extends Agent implements DestinationMBean {
AgentId
replyTo
,
String
requestMsgId
,
String
replyMsgId
)
{
Message
message
=
new
Message
();
message
.
correlationId
=
requestMsgId
;
message
.
timestamp
=
System
.
currentTimeMillis
();
message
.
setDestination
(
replyTo
.
toString
(),
Message
.
TOPIC_TYPE
);
message
.
id
=
replyMsgId
;
Message
message
=
MessageHelper
.
createMessage
(
replyMsgId
,
requestMsgId
,
getAgentId
(),
getType
());
try
{
message
.
setAdminMessage
(
reply
);
ClientMessages
clientMessages
=
new
ClientMessages
(-
1
,
-
1
,
message
);
...
...
joram/joram/mom/core/src/main/java/org/objectweb/joram/mom/proxies/UserAgent.java
View file @
39670c14
...
...
@@ -132,6 +132,7 @@ import org.objectweb.joram.shared.excepts.DestinationException;
import
org.objectweb.joram.shared.excepts.MomException
;
import
org.objectweb.joram.shared.excepts.RequestException
;
import
org.objectweb.joram.shared.excepts.StateException
;
import
org.objectweb.joram.shared.messages.MessageHelper
;
import
org.objectweb.util.monolog.api.BasicLevel
;
import
org.objectweb.util.monolog.api.Logger
;
...
...
@@ -2773,11 +2774,8 @@ public final class UserAgent extends Agent implements UserAgentMBean, BagSeriali
}
private
void
replyToTopic
(
AdminReply
reply
,
AgentId
replyTo
,
String
requestMsgId
,
String
replyMsgId
)
{
org
.
objectweb
.
joram
.
shared
.
messages
.
Message
message
=
new
org
.
objectweb
.
joram
.
shared
.
messages
.
Message
();
message
.
correlationId
=
requestMsgId
;
message
.
timestamp
=
System
.
currentTimeMillis
();
message
.
setDestination
(
replyTo
.
toString
(),
org
.
objectweb
.
joram
.
shared
.
messages
.
Message
.
TOPIC_TYPE
);
message
.
id
=
replyMsgId
;
org
.
objectweb
.
joram
.
shared
.
messages
.
Message
message
=
MessageHelper
.
createMessage
(
replyMsgId
,
requestMsgId
,
replyTo
.
toString
(),
DestinationConstants
.
TOPIC_TYPE
);
try
{
message
.
setAdminMessage
(
reply
);
ClientMessages
clientMessages
=
new
ClientMessages
(-
1
,
-
1
,
message
);
...
...
joram/joram/shared/src/main/java/org/objectweb/joram/shared/messages/MessageHelper.java
0 → 100644
View file @
39670c14
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2010 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
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Initial developer(s): ScalAgent Distributed Technologies
* Contributor(s):
*/
package
org.objectweb.joram.shared.messages
;
import
org.objectweb.joram.shared.DestinationConstants
;
public
class
MessageHelper
{
// Suppresses default constructor, ensuring non-instantiability.
private
MessageHelper
()
{
}
/**
* Creates a well formed {@link Message}.
*
* @param msgId ID of the new message
* @param correlationId correlation ID of the new message
* @param destId ID of the destination creating the message
* @param destType type of the destination creating the message:
* {@link DestinationConstants#QUEUE_TYPE} or
* {@link DestinationConstants#TOPIC_TYPE}
* @return the new message.
*/
public
static
Message
createMessage
(
String
msgId
,
String
correlationId
,
String
destId
,
byte
destType
)
{
Message
message
=
new
Message
();
message
.
id
=
msgId
;
message
.
correlationId
=
correlationId
;
message
.
timestamp
=
System
.
currentTimeMillis
();
message
.
setDestination
(
destId
,
destType
);
return
message
;
}
}
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