Package org.ow2.joram.shell.mom.commands
Class MOMCommandsImpl
- java.lang.Object
-
- org.ow2.joram.shell.mom.commands.MOMCommandsImpl
-
- All Implemented Interfaces:
MOMCommands
public class MOMCommandsImpl extends Object implements MOMCommands
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classMOMCommandsImpl.QueueNotFoundExceptionprivate classMOMCommandsImpl.SubscriptionNotFoundExceptionprivate classMOMCommandsImpl.TopicNotFoundExceptionprivate classMOMCommandsImpl.UserNotFoundException
-
Field Summary
Fields Modifier and Type Field Description private static org.osgi.util.tracker.ServiceTrackeradminTrackerprivate static org.osgi.framework.BundleContextbundleContextprivate static org.osgi.util.tracker.ServiceTrackerclientSubTrackerstatic String[]COMMANDSCommands listprivate static org.osgi.util.tracker.ServiceTrackerdestinationTrackerprivate static MOMCommandsImplINSTANCEstatic StringNAMESPACEprivate static org.osgi.util.tracker.ServiceTrackerqueueTrackerprivate static intTIMEOUTprivate static org.osgi.util.tracker.ServiceTrackertopicTrackerprivate static org.osgi.util.tracker.ServiceTrackeruserTracker
-
Constructor Summary
Constructors Constructor Description MOMCommandsImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclear(String[] args)Deletes all pending messages from a subscription or a queue.
Usage: [joram:mom:]clear queue
[joram:mom:]clear subscriptionvoidcreate(String[] args)Creates a destination or a user
Usage: [joram:mom:]create[option...]
[joram:mom:]create user []
Options: -sidSpecifies on which server the destination is to be created
Default: This server
-extSpecifies which extension class to instanciate
Default: Noneprivate voidcreateDestination(String[] args)private voidcreateUser(String[] args)Add a new user to the serversvoiddelete(String[] args)Delete a destination or a user
Usage: [joram:mom:]delete (topic|queue|user)voiddeleteMsg(String[] args)Delete a pending message from a queue or subscription
Usage: [joram:mom:]deleteMsg queue
[joram:mom:]deleteMsg subscriptionprivate voiddeleteMsgQueue(String queueName, String msgId)private voiddeleteMsgSub(String userName, String subName, String msgId)private AdminTopicMBeanfindAdminTopic()private ClientSubscriptionMBeanfindClientSubscription(String userName, String subName)private QueueMBeanfindQueue(String name)private TopicMBeanfindTopic(String name)private UserAgentMBeanfindUser(String userName)static MOMCommandsImplgetInstance()private List<? extends MessageView>getMessageRange(List<? extends MessageView> msgs, int start, int end)private MessageViewgetQueueMessage(String queueName, String msgId)private List<? extends MessageView>getQueueMessages(String queueName)private MessageViewgetSubscriptionMessage(String userName, String subName, String msgId)private List<MessageView>getSubscriptionMessages(String userName, String subscriptionName)static voidhelp()Prints all MOM commandsstatic voidhelp(String command)Prints the description of the given command
Usage: [joram:mom:]helpvoidinfo(String[] args)Show information about a destination
Usage: [joram:mom:]info (queue|topic)
[joram:mom:]info subscriptionvoidinfoMsg(String[] args)private voidinfoQueue(String name)private voidinfoSubscription(String userName, String subName)private voidinfoTopic(String name)static voidinit(org.osgi.framework.BundleContext context)voidlist(String[] args)Lists all queues, topics, both or users with useful informations
Usage: [joram:mom:]list[username]
Possible categories: destination, topic, queue, user, subscription
NB: For the subscription category, you must provide the user name.private voidlistDestination()private voidlistQueue()private voidlistSubscription(String userName)private voidlistTopic()private voidlistUser()voidlsMsg(String[] args)Displays pending messages from a destination
Usage: [joram:mom:]lsMsg queue[[first msg idx]:[last msg idx]]
[joram:mom:]lsMsg subscription[[first msg idx]:[last msg idx]] static voidmain(String[] args)voidping()Checks whether Joram works
Usage: [joram:mom:]pingvoidqueueLoad(String[] args)Shows the pending message count
Usage: [joram:mom:]queueLoadvoidreceiveMsg(String[] args)Deprecated.voidsendMsg(String[] args)Deprecated.voidsetFreeRead(String[] args)voidsetFreeWrite(String[] args)voidsubscriptionLoad(String[] args)Shows the pending message count of the subscription
Usage: [joram:mom:]subscriptionLoad
-
-
-
Field Detail
-
INSTANCE
private static MOMCommandsImpl INSTANCE
-
NAMESPACE
public static final String NAMESPACE
- See Also:
- Constant Field Values
-
TIMEOUT
private static final int TIMEOUT
- See Also:
- Constant Field Values
-
bundleContext
private static org.osgi.framework.BundleContext bundleContext
-
destinationTracker
private static org.osgi.util.tracker.ServiceTracker destinationTracker
-
queueTracker
private static org.osgi.util.tracker.ServiceTracker queueTracker
-
topicTracker
private static org.osgi.util.tracker.ServiceTracker topicTracker
-
userTracker
private static org.osgi.util.tracker.ServiceTracker userTracker
-
adminTracker
private static org.osgi.util.tracker.ServiceTracker adminTracker
-
clientSubTracker
private static org.osgi.util.tracker.ServiceTracker clientSubTracker
-
COMMANDS
public static String[] COMMANDS
Commands list
-
-
Method Detail
-
getInstance
public static MOMCommandsImpl getInstance() throws Exception
- Throws:
Exception
-
init
public static void init(org.osgi.framework.BundleContext context)
-
help
public static void help()
Prints all MOM commands
-
help
public static void help(String command)
Prints the description of the given command
Usage: [joram:mom:]help- Parameters:
command- Name of the command to describe
-
list
public void list(String[] args)
Lists all queues, topics, both or users with useful informations
Usage: [joram:mom:]list[username]
Possible categories: destination, topic, queue, user, subscription
NB: For the subscription category, you must provide the user name.- Specified by:
listin interfaceMOMCommands- Parameters:
args- Category of item to list: destination, queue, topic, user
-
listDestination
private void listDestination()
-
listQueue
private void listQueue()
-
listTopic
private void listTopic()
-
listUser
private void listUser()
-
listSubscription
private void listSubscription(String userName)
-
create
public void create(String[] args)
Creates a destination or a user
Usage: [joram:mom:]create[option...]
[joram:mom:]create user []
Options: -sidSpecifies on which server the destination is to be created
Default: This server
-extSpecifies which extension class to instanciate
Default: None- Specified by:
createin interfaceMOMCommands- Parameters:
args- parameters of the command
-
createDestination
private void createDestination(String[] args)
-
createUser
private void createUser(String[] args)
Add a new user to the servers- Parameters:
args- parameters of the command
-
delete
public void delete(String[] args)
Delete a destination or a user
Usage: [joram:mom:]delete (topic|queue|user)- Specified by:
deletein interfaceMOMCommands- Parameters:
args- {category, name}
-
setFreeRead
public void setFreeRead(String[] args)
-
setFreeWrite
public void setFreeWrite(String[] args)
-
queueLoad
public void queueLoad(String[] args)
Shows the pending message count
Usage: [joram:mom:]queueLoad- Specified by:
queueLoadin interfaceMOMCommands- Parameters:
args- parameters of the command
-
findQueue
private QueueMBean findQueue(String name) throws MOMCommandsImpl.QueueNotFoundException
-
findTopic
private TopicMBean findTopic(String name) throws MOMCommandsImpl.TopicNotFoundException
-
findAdminTopic
private AdminTopicMBean findAdminTopic()
-
subscriptionLoad
public void subscriptionLoad(String[] args)
Shows the pending message count of the subscription
Usage: [joram:mom:]subscriptionLoad- Specified by:
subscriptionLoadin interfaceMOMCommands- Parameters:
args- parameters of the command
-
findUser
private UserAgentMBean findUser(String userName)
-
findClientSubscription
private ClientSubscriptionMBean findClientSubscription(String userName, String subName) throws MOMCommandsImpl.UserNotFoundException, MOMCommandsImpl.SubscriptionNotFoundException
-
info
public void info(String[] args)
Show information about a destination
Usage: [joram:mom:]info (queue|topic)
[joram:mom:]info subscription- Specified by:
infoin interfaceMOMCommands- Parameters:
args- ???
-
infoTopic
private void infoTopic(String name)
-
infoQueue
private void infoQueue(String name)
-
lsMsg
public void lsMsg(String[] args)
Displays pending messages from a destination
Usage: [joram:mom:]lsMsg queue[[first msg idx]:[last msg idx]]
[joram:mom:]lsMsg subscription[[first msg idx]:[last msg idx]] - Specified by:
lsMsgin interfaceMOMCommands- Parameters:
args- {queue name, message range}
-
infoMsg
public void infoMsg(String[] args)
-
ping
public void ping()
Checks whether Joram works
Usage: [joram:mom:]ping- Specified by:
pingin interfaceMOMCommands
-
deleteMsg
public void deleteMsg(String[] args)
Delete a pending message from a queue or subscription
Usage: [joram:mom:]deleteMsg queue
[joram:mom:]deleteMsg subscription- Specified by:
deleteMsgin interfaceMOMCommands
-
clear
public void clear(String[] args)
Deletes all pending messages from a subscription or a queue.
Usage: [joram:mom:]clear queue
[joram:mom:]clear subscription- Specified by:
clearin interfaceMOMCommands
-
sendMsg
public void sendMsg(String[] args)
Deprecated.Description copied from interface:MOMCommandsSend a new message in a destination- Specified by:
sendMsgin interfaceMOMCommands
-
receiveMsg
public void receiveMsg(String[] args)
Deprecated.Description copied from interface:MOMCommandsReceive (a) message(s) from a destination- Specified by:
receiveMsgin interfaceMOMCommands
-
getQueueMessages
private List<? extends MessageView> getQueueMessages(String queueName) throws MOMCommandsImpl.QueueNotFoundException
-
getQueueMessage
private MessageView getQueueMessage(String queueName, String msgId) throws MOMCommandsImpl.QueueNotFoundException
-
getSubscriptionMessages
private List<MessageView> getSubscriptionMessages(String userName, String subscriptionName) throws MOMCommandsImpl.UserNotFoundException, MOMCommandsImpl.SubscriptionNotFoundException
-
getSubscriptionMessage
private MessageView getSubscriptionMessage(String userName, String subName, String msgId) throws MOMCommandsImpl.UserNotFoundException, MOMCommandsImpl.SubscriptionNotFoundException
-
getMessageRange
private List<? extends MessageView> getMessageRange(List<? extends MessageView> msgs, int start, int end)
-
main
public static void main(String[] args)
-
-