planet.commonapi.factory
Interface IdFactory

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
IdFactoryImpl

public interface IdFactory
extends java.io.Serializable

Author:
Jordi Pujol

Method Summary
 Id buildId()
          Builds an Id with the actual configuration of network topology and size.
 Id buildId(java.math.BigInteger material)
          Generate an Id from a BigInteger, that includes its internal value.
 Id buildId(byte[] material)
          Builds a protocol-specific Id given the source data.
 Id buildId(double material)
          Builds a protocol-specific Id given the source data.
 Id buildId(int material)
          Builds a protocol-specific Id given the source data.
 Id buildId(int[] material)
          Builds a protocol-specific Id given the source data as int[].
 Id buildId(java.lang.String material)
          Generate an Id from the String as its internal value.
 Id buildKey(java.lang.String materialToHash)
          Builds a protocol-specific Id by using the given string as source data for a hash function (like SHA-1).
 

Method Detail

buildId

public Id buildId()
           throws InitializationException
Builds an Id with the actual configuration of network topology and size.

Returns:
A new Id generated with the actual configuration.
Throws:
InitializationException - when an error occurs during the initialization of the Id or when this factory method is nonapplicable.

buildId

public Id buildId(int material)
           throws InitializationException
Builds a protocol-specific Id given the source data.

Parameters:
material - The material to use as double value.
Returns:
A new Id with the double value as internal one.
Throws:
InitializationException - when an error occurs during the initialization of the Id or when this factory method is nonapplicable.

buildId

public Id buildId(double material)
           throws InitializationException
Builds a protocol-specific Id given the source data.

Parameters:
material - The material to use as double value.
Returns:
A new Id with the double value as internal one.
Throws:
InitializationException - when an error occurs during the initialization of the Id or when this factory method is nonapplicable.

buildId

public Id buildId(byte[] material)
           throws InitializationException
Builds a protocol-specific Id given the source data.

Parameters:
material - The material to use to build the new Id.
Returns:
A new Id with the byte[] value.
Throws:
InitializationException - when an error occurs during the initialization of the Id or when this factory method is nonapplicable.

buildId

public Id buildId(int[] material)
           throws InitializationException
Builds a protocol-specific Id given the source data as int[].

Parameters:
material - The internal representation value of the new Id as int[].
Returns:
A new Id with the int[] value.
Throws:
InitializationException - when an error occurs during the initialization of the Id or when this factory method is nonapplicable.

buildKey

public Id buildKey(java.lang.String materialToHash)
            throws InitializationException
Builds a protocol-specific Id by using the given string as source data for a hash function (like SHA-1). The returned hash value will be the internal value for the new Id.

Parameters:
materialToHash - The string to use as source data for a hash function.
Returns:
The built Id as result to apply a hash function to the given String.
Throws:
InitializationException - when an error occurs during the initialization of the Id or when this factory method is nonapplicable.

buildId

public Id buildId(java.lang.String material)
           throws InitializationException
Generate an Id from the String as its internal value.

Parameters:
material - With the String representation of the internal value.
Returns:
A new Id with the value included in the StringBuffer.
Throws:
InitializationException - when an error occurs during the initialization of the Id or when this factory method is nonapplicable.

buildId

public Id buildId(java.math.BigInteger material)
           throws InitializationException
Generate an Id from a BigInteger, that includes its internal value.

Parameters:
material - BigInteger with the internal value for the new Id.
Returns:
A new Id with the value included in the BigInteger.
Throws:
InitializationException - when an error occurs during the initialization of the Id or when this factory method is nonapplicable.