planet.commonapi.factory
Interface NodeFactory

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

public interface NodeFactory
extends java.io.Serializable

It's a factory for Nodes abstraction. It pretends build Nodes of any class. It has got two parameters:

Theese two parameters are fixed by properties file or by use of the NodeFactory's methods. In the properties file exists the following parameter's names: IMPORTANT: The concrete implementation of Node must have one constructor:
  1. The constructor with the Node's Id in parameter.
    1. Author:
      Jordi Pujol
      See Also:
      Node

      Method Summary
       Node buildNode()
                Builds a Node using the default IdFactory and the default Class for him.
       Node buildNode(Id id)
                Builds a Node using the Id that appears in parameter, using the default Class for him.
       IdFactory getIdFactory()
                Returns the IdFactory that the concrete implementation uses to generate new Ids for new instances of Nodes.
       java.lang.Class getNodeClass()
                Gets Class for the generated Nodes.
       java.lang.String getTopology()
                Gets the actual topology for the network.
       void setIdFactory(IdFactory idFactory)
                Sets the IdFactory to use in the future, to generate new Ids.
       void setNodeClass(java.lang.Class nodeClass)
                Sets Class to generate new Nodes.
       void setTopology(java.lang.String topology)
                Sets the topology of the network to know how generates new Ids.
       

      Method Detail

      buildNode

      Node buildNode()
                     throws InitializationException
      Builds a Node using the default IdFactory and the default Class for him.

      Returns:
      A new instance of the default Node.
      Throws:
      InitializationException

      buildNode

      Node buildNode(Id id)
                     throws InitializationException
      Builds a Node using the Id that appears in parameter, using the default Class for him.

      Parameters:
      id -
      Returns:
      A new instance of the default Node with the specified Id.
      Throws:
      InitializationException

      getIdFactory

      IdFactory getIdFactory()
      Returns the IdFactory that the concrete implementation uses to generate new Ids for new instances of Nodes.

      Returns:
      IdFactory which is used to generade new Ids.

      setIdFactory

      void setIdFactory(IdFactory idFactory)
      Sets the IdFactory to use in the future, to generate new Ids.

      Parameters:
      idFactory - IdFactory to use to generate new Ids.

      getNodeClass

      java.lang.Class getNodeClass()
      Gets Class for the generated Nodes.

      Returns:
      Class for the generated Nodes.

      setNodeClass

      void setNodeClass(java.lang.Class nodeClass)
                        throws InitializationException
      Sets Class to generate new Nodes.

      Parameters:
      nodeClass - Class for the Nodes to build in the future.
      Throws:
      InitializationException

      getTopology

      java.lang.String getTopology()
      Gets the actual topology for the network. It is necessary to known how generate new Ids for the nodes.

      Returns:
      The topology of the network actually in use.

      setTopology

      void setTopology(java.lang.String topology)
                       throws InitializationException
      Sets the topology of the network to know how generates new Ids.

      Parameters:
      topology - Topology of the network.
      Throws:
      InitializationException