Asterisk-Java

org.asteriskjava.manager.internal
Class ManagerUtil

java.lang.Object
  extended by org.asteriskjava.manager.internal.ManagerUtil

public class ManagerUtil
extends java.lang.Object

Utilitiy class with some static helper methods that are used in multiple contexts within the manager package.

The methods for handling the internal action id are used to make sure we send unique ids to Asterisk even when the user of Asterisk-Java does not provide a unique action id or no action id at all.

All the methods contained in this class are supposed to be internally only.

Version:
$Id: ManagerUtil.java 1124 2008-08-18 03:25:01Z srt $
Author:
srt

Field Summary
static char INTERNAL_ACTION_ID_DELIMITER
           
 
Constructor Summary
ManagerUtil()
           
 
Method Summary
static java.lang.String addInternalActionId(java.lang.String actionId, java.lang.String internalActionId)
          Adds the internal action id to the given action id.
static java.lang.String getInternalActionId(java.lang.String actionId)
          Returns the internal action id contained in the given action id.
static java.lang.String stripInternalActionId(java.lang.String actionId)
          Strips the internal action id from the given action id.
static java.lang.String toHexString(byte[] b)
          Converts a byte array to a hex string representing it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTERNAL_ACTION_ID_DELIMITER

public static final char INTERNAL_ACTION_ID_DELIMITER
See Also:
Constant Field Values
Constructor Detail

ManagerUtil

public ManagerUtil()
Method Detail

toHexString

public static java.lang.String toHexString(byte[] b)
Converts a byte array to a hex string representing it. The hex digits are lower case.

Parameters:
b - the byte array to convert
Returns:
the hex representation of b

getInternalActionId

public static java.lang.String getInternalActionId(java.lang.String actionId)
Returns the internal action id contained in the given action id.

Parameters:
actionId - the action id prefixed by the internal action id as received from Asterisk.
Returns:
the internal action id that has been added before.
See Also:
addInternalActionId(String, String)

stripInternalActionId

public static java.lang.String stripInternalActionId(java.lang.String actionId)
Strips the internal action id from the given action id.

Parameters:
actionId - the action id prefixed by the internal action id as received from Asterisk.
Returns:
the original action id, that is the action id as it was before the internal action id was added.
See Also:
addInternalActionId(String, String)

addInternalActionId

public static java.lang.String addInternalActionId(java.lang.String actionId,
                                                   java.lang.String internalActionId)
Adds the internal action id to the given action id.

Parameters:
actionId - the action id as set by the user.
internalActionId - the internal action id to add.
Returns:
the action id prefixed by the internal action id suitable to be sent to Asterisk.

Asterisk-Java

Copyright © 2004-2009 Stefan Reuter. All Rights Reserved.