net.sf.asterisk.manager.impl
Class Util

java.lang.Object
  extended by net.sf.asterisk.manager.impl.Util

public class Util
extends java.lang.Object

Utilitiy class with some static helper methods that are used in multiple contexts.
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: Util.java,v 1.1 2005/10/25 23:08:02 srt Exp $
Author:
srt

Field Summary
static char INTERNAL_ACTION_ID_DELIMITER
           
 
Constructor Summary
Util()
           
 
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 char INTERNAL_ACTION_ID_DELIMITER
Constructor Detail

Util

public Util()
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.


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