net.rim.device.api.command.registrar
Class LocalCommandRegistrarConnection

java.lang.Object
  extended by net.rim.device.api.command.registrar.LocalCommandRegistrarConnection
All Implemented Interfaces:
CommandRegistrarConnection

public class LocalCommandRegistrarConnection
extends Object
implements CommandRegistrarConnection

Interacts with the command registrar that is available only to the current process.

Since:
BlackBerry API 6.0.0

Constructor Summary
LocalCommandRegistrarConnection()
          Creates a LocalCommandRegistrarConnection instance.
 
Method Summary
 Command getCommand(CommandRequest request)
          Returns a Command instance that matches specified criteria.
 Command[] getCommands(CommandRequest request)
          Returns an array of Command instances that match specified criteria.
 Command[] getCommands(CommandRequest request, int maximumNumberOfCommands)
          Returns an array of Command instances that match specified criteria.
 void registerCommand(CommandHandler handler, CommandMetadata metadata)
          Registers a command using its command handler and associated metadata.
 void registerCommand(CommandMetadata metadata)
          Registers a command using metadata only.
 void unregisterCommand(String commandId)
          Unregister the command with a given command identifier.
 void unregisterCommandCategory(String commandCategory)
          Unregister all commands belonging to a given category.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

LocalCommandRegistrarConnection

public LocalCommandRegistrarConnection()
Creates a LocalCommandRegistrarConnection instance.

Since:
BlackBerry API 6.0.0


Method Detail

getCommand

public Command getCommand(CommandRequest request)
Returns a Command instance that matches specified criteria.

Specified by:
getCommand in interface CommandRegistrarConnection
Parameters:
request - Criteria used to obtain commands.
Returns:
Command instance that matches the criteria. Only one instance is returned even if there are multiple matches. Returns null if there are no matching commands.
Since:
BlackBerry API 6.0.0

getCommands

public Command[] getCommands(CommandRequest request)
Returns an array of Command instances that match specified criteria.

Specified by:
getCommands in interface CommandRegistrarConnection
Parameters:
request - Criteria used to obtain commands.
Returns:
Command instances that match the criteria. Returns an empty array if no matches are found.
Since:
BlackBerry API 6.0.0

getCommands

public Command[] getCommands(CommandRequest request,
                             int maximumNumberOfCommands)
Returns an array of Command instances that match specified criteria.

Specified by:
getCommands in interface CommandRegistrarConnection
Parameters:
request - Criteria used to obtain commands.
maximumNumberOfCommands - Maximum number of commands to return.
Returns:
Command instances that match the criteria. Returns an empty array if no matches are found.
Since:
BlackBerry API 6.0.0

registerCommand

public void registerCommand(CommandMetadata metadata)
Registers a command using metadata only. Should be used when the command can be instantiated and executed by the client.

Parameters:
metadata - The command metadata.
Throws:
RegistrationException - If metadata is null or metadata with same id has already been registered..
Since:
BlackBerry API 6.0.0

registerCommand

public void registerCommand(CommandHandler handler,
                            CommandMetadata metadata)
Registers a command using its command handler and associated metadata. Should be used when the command cannot be instantiated by the client.

Specified by:
registerCommand in interface CommandRegistrarConnection
Parameters:
handler - The command handler.
metadata - The command metadata.
Throws:
RegistrationException - If metadata is null or metadata with same id has already been registered.
Since:
BlackBerry API 6.0.0

unregisterCommand

public void unregisterCommand(String commandId)
Unregister the command with a given command identifier.

Commands can only be unregistered by the module that registered them.

Parameters:
commandId - The id of the command to be unregistered.
Throws:
RegistrationException - If commandId is null, or registered command with given id does not exist, or current module did not register command with given id.
Since:
BlackBerry API 7.0.0

unregisterCommandCategory

public void unregisterCommandCategory(String commandCategory)
Unregister all commands belonging to a given category.

Only commands registered by the calling module will be affected.

Parameters:
commandCategory - Commands belonging to this category will be unregistered.
Throws:
RegistrationException - If commandCategory is null.
Since:
BlackBerry API 7.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal