org.objectweb.proactive.core.component
Class Fractive

java.lang.Object
  extended byorg.objectweb.proactive.core.component.Fractive
All Implemented Interfaces:
Component, Factory, GenericFactory

public class Fractive
extends java.lang.Object
implements GenericFactory, Component, Factory

This class is used for creating components. It acts as :

  1. a bootstrap component
  2. a GenericFactory for instantiating new components
  3. a utility class providing static methods to create collective interfaces and retreive references to ComponentParametersController

Author:
Matthieu Morel

Constructor Summary
Fractive()
          no-arg constructor (used by Fractal to get a bootstrap component)
 
Method Summary
static ProActiveInterface createCollectiveClientInterface(java.lang.String itfName, java.lang.String itfSignature)
          Returns a generated interface reference, whose impl field is a group It is able to handle multiple bindings
static ProActiveInterface createCollectiveClientInterface(java.lang.String itfName, java.lang.String itfSignature, Component owner)
          Returns a generated interface reference, whose impl field is a group It is able to handle multiple bindings, and automatically adds it to an owner component
static InterfaceType[] getClientInterfaceTypes(ComponentType componentType)
          Helper method for extracting the types of client interfaces from the type of a component
static ComponentParametersController getComponentParametersController(Component component)
          Returns the ContentController interface of the given component.
static Component getComponentRepresentativeOnThis()
          Returns a component representative pointing to the component associated to the component whose active thread is calling this method.
 java.lang.Object getFcContentDesc()
           
 java.lang.Object getFcControllerDesc()
           
 Type getFcInstanceType()
           
 java.lang.Object getFcInterface(java.lang.String itfName)
           
 java.lang.Object[] getFcInterfaces()
           
 Type getFcType()
           
static ProActiveComponentRepresentative lookup(java.lang.String url)
          Looks-up a component object previously registered in a registry(RMI, IBIS, HTTP).
 Component newFcInstance()
           
 Component newFcInstance(Type componentType, java.lang.Object controllerDesc, java.lang.Object contentDesc)
           
static void register(Component ref, java.lang.String url)
          Registers a component into a registry(RMI or IBIS or HTTP, default is RMI).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Fractive

public Fractive()
no-arg constructor (used by Fractal to get a bootstrap component)

Method Detail

getComponentParametersController

public static ComponentParametersController getComponentParametersController(Component component)
                                                                      throws NoSuchInterfaceException
Returns the ContentController interface of the given component.

Parameters:
component - a component.
Returns:
the ContentController interface of the given component.
Throws:
NoSuchInterfaceException - if there is no such interface.

createCollectiveClientInterface

public static ProActiveInterface createCollectiveClientInterface(java.lang.String itfName,
                                                                 java.lang.String itfSignature,
                                                                 Component owner)
                                                          throws ProActiveRuntimeException
Returns a generated interface reference, whose impl field is a group It is able to handle multiple bindings, and automatically adds it to an owner component

Parameters:
itfName - the name of the interface
itfSignature - the signature of the interface
owner - the component to which this interface belongs
Returns:
ProActiveInterface the resulting collective client interface
Throws:
ProActiveRuntimeException - in case of a problem while creating the collective interface

createCollectiveClientInterface

public static ProActiveInterface createCollectiveClientInterface(java.lang.String itfName,
                                                                 java.lang.String itfSignature)
                                                          throws ProActiveRuntimeException
Returns a generated interface reference, whose impl field is a group It is able to handle multiple bindings

Parameters:
itfName - the name of the interface
itfSignature - the signature of the interface
Returns:
ProActiveInterface the resulting collective client interface
Throws:
ProActiveRuntimeException - in case of a problem while creating the collective interface

newFcInstance

public Component newFcInstance(Type componentType,
                               java.lang.Object controllerDesc,
                               java.lang.Object contentDesc)
                        throws InstantiationException
Specified by:
newFcInstance in interface GenericFactory
Parameters:
componentType - Type the type of the component
controllerDesc - Object a description of the controller. In this implementation, a ControllerDescription object
contentDesc - Object a description of the content. In this implementation, a ContentDescription object
Returns:
Component a reference on the instantiated component
Throws:
InstantiationException - if the instantiation of the component failed
See Also:
GenericFactory.newFcInstance(Type, Object, Object)

getFcInterface

public java.lang.Object getFcInterface(java.lang.String itfName)
                                throws NoSuchInterfaceException
Specified by:
getFcInterface in interface Component
Throws:
NoSuchInterfaceException

getFcInterfaces

public java.lang.Object[] getFcInterfaces()
Specified by:
getFcInterfaces in interface Component

getFcType

public Type getFcType()
Specified by:
getFcType in interface Component

getFcContentDesc

public java.lang.Object getFcContentDesc()
Specified by:
getFcContentDesc in interface Factory

getFcControllerDesc

public java.lang.Object getFcControllerDesc()
Specified by:
getFcControllerDesc in interface Factory

getFcInstanceType

public Type getFcInstanceType()
Specified by:
getFcInstanceType in interface Factory

newFcInstance

public Component newFcInstance()
                        throws InstantiationException
Specified by:
newFcInstance in interface Factory
Throws:
InstantiationException

getClientInterfaceTypes

public static InterfaceType[] getClientInterfaceTypes(ComponentType componentType)
Helper method for extracting the types of client interfaces from the type of a component

Parameters:
componentType - ComponentType
Returns:
the types of client interfacess

getComponentRepresentativeOnThis

public static Component getComponentRepresentativeOnThis()
Returns a component representative pointing to the component associated to the component whose active thread is calling this method. It can be used for a component to pass callback references to itself.

Returns:
a component representative for the component in which the current thread is running

register

public static void register(Component ref,
                            java.lang.String url)
                     throws java.io.IOException
Registers a component into a registry(RMI or IBIS or HTTP, default is RMI). This method is similar to ProActive.register(Object, String).

Parameters:
ref - the component to register.
url - the url under which the component is registered. The url must point to the localhost since registering is always a local action. The url can take the form:protocol://localhost:port/nam or //localhost:port/name if protocol is RMI or //localhost/name if port is 1099 or only the name. The registered component will be reachable with the following url: protocol://machine_name:port/name using lookupActive method. Protocol and port can be removed if default
Throws:
java.io.IOException - if the remote body cannot be registered

lookup

public static ProActiveComponentRepresentative lookup(java.lang.String url)
                                               throws java.io.IOException,
                                                      javax.naming.NamingException
Looks-up a component object previously registered in a registry(RMI, IBIS, HTTP). It is similar to the ProActive.lookupActive(String, String) method.

Parameters:
url - the url under which the remote component is registered. The url takes the following form: protocol://machine_name:port/name. Protocol and port can be ommited if respectively RMI and 1099: //machine_name/name
Returns:
a remote reference on a Component
Throws:
java.io.IOException - if the remote component cannot be found under the given url
javax.naming.NamingException


Copyright 2001-2005 INRIA All Rights Reserved.