com.neeve.util
Class UtlFabricAddress

java.lang.Object
  extended by com.neeve.util.UtlFabricAddress

public final class UtlFabricAddress
extends Object

Utility class containing methods to work with fabric addresses.

This class contains runtime utility methods to create and manipulate fabric addresses.

This class IS NOT intended to be used by end users.


Constructor Summary
UtlFabricAddress()
           
 
Method Summary
static int create(short routerL2Addr, short routerL1Addr, short clientAddr)
          Create a fabric address
static short extractClient(int addr)
          Extract the client address from an fabric address
static int extractRouter(int addr)
          Extract the router address from an fabric address
static short extractRouterL1(int addr)
          Extract the level 1 router address from an fabric address
static short extractRouterL2(int addr)
          Extract the level 2 router address from an fabric address.
static int fromString(String str)
          Convert a fabric address from its dotted notation to a an encoded integer
static boolean isTargetingRouter(short destL1Addr, short destL2Addr, short routerL1Addr, short routerL2Addr)
          Check whether an fabric address addresses a specified router.
static String toString(int addr)
          Return an fabric address in its dotted notation.
static void validateClient(short clientAddr)
          Validate whether a client address is valid
static void validateRouterL1(short routerL1Addr)
          Validate whether a level 1 router address is valid
static void validateRouterL2(short routerL2Addr)
          Validate whether a level 2 router address is valid.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UtlFabricAddress

public UtlFabricAddress()
Method Detail

create

public static int create(short routerL2Addr,
                         short routerL1Addr,
                         short clientAddr)
Create a fabric address

Parameters:
routerL2Addr - The router level 2 address
routerL1Addr - The router level 1 address
clientAddr - The client address
Returns:
Returns the constructed address
Threading:
This method is safe for concurrent access by multiple threads

An fabric address consists of a router address and a client address. The router part of the address consists of a level 2 and level 1 address that, put together, uniquely identifies a router in the system. The client part uniquely identifies a client within the scope of the router it is connected to. Put together, these elements form a fabric address that uniquely identifies any agent in a deployment.


extractRouterL2

public static short extractRouterL2(int addr)
Extract the level 2 router address from an fabric address.

Parameters:
addr - The address to parse
Returns:
Returns the parsed router level 2 address
Threading:
This method is safe for concurrent access by multiple threads

extractRouterL1

public static short extractRouterL1(int addr)
Extract the level 1 router address from an fabric address

Parameters:
addr - The fabric address to parse
Returns:
Returns the parsed router level 1 address
Threading:
This method is safe for concurrent access by multiple threads

extractRouter

public static int extractRouter(int addr)
Extract the router address from an fabric address

Parameters:
addr - The fabric address to parse
Returns:
Returns the parsed router address
Threading:
This method is safe for concurrent access by multiple threads

extractClient

public static short extractClient(int addr)
Extract the client address from an fabric address

Parameters:
addr - The fabric address to parse
Returns:
Returns the parsed client address
Threading:
This method is safe for concurrent access by multiple threads

validateRouterL2

public static void validateRouterL2(short routerL2Addr)
Validate whether a level 2 router address is valid.

Parameters:
routerL2Addr - The address to validate
Throws:
IllegalArgumentException - Thrown if the address is not valid
Threading:
This method is safe for concurrent access by multiple threads

validateRouterL1

public static void validateRouterL1(short routerL1Addr)
Validate whether a level 1 router address is valid

Parameters:
routerL1Addr - The address to validate
Throws:
IllegalArgumentException - Thrown if the address is not valid
Threading:
This method is safe for concurrent access by multiple threads

validateClient

public static void validateClient(short clientAddr)
Validate whether a client address is valid

Parameters:
clientAddr - The address to validate
Throws:
IllegalArgumentException - Thrown if the address is not valid
Threading:
This method is safe for concurrent access by multiple threads

toString

public static String toString(int addr)
Return an fabric address in its dotted notation.

Parameters:
addr - The fabric address to parse
Returns:
Returns the address in dotted notation
Threading:
This method is safe for concurrent access by multiple threads

fromString

public static int fromString(String str)
Convert a fabric address from its dotted notation to a an encoded integer

Parameters:
str - The string to parse
Returns:
Returns the address as an encoded integer
Throws:
RuntimeException - Thrown is the format of the provided fabric address is incorrect.
Threading:
This method is safe for concurrent access by multiple threads

isTargetingRouter

public static boolean isTargetingRouter(short destL1Addr,
                                        short destL2Addr,
                                        short routerL1Addr,
                                        short routerL2Addr)
Check whether an fabric address addresses a specified router.

Parameters:
destL1Addr - The L1 address portion of the address to check.
destL2Addr - The L2 address portion of the address to check.
routerL1Addr - This router's L1 address
routerL2Addr - This router's L2 address
Returns:
A boolean value indicating whether the address targets this router or not.
Threading:
This method is safe for concurrent access by multiple threads


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.