p2pcm
Class ComponentFactory

java.lang.Object
  extended by p2pcm.ComponentFactory
All Implemented Interfaces:
dermi.listener.RemoteEventListener

public abstract class ComponentFactory
extends java.lang.Object
implements dermi.listener.RemoteEventListener

This class models the component's factory. It provides the necessary methods for instantiating new component instances

Version:
1.2
Author:
Carles Pairot

Constructor Summary
ComponentFactory()
          Void constructor
ComponentFactory(java.lang.String componentURL)
          Default factory constructor: Component's URL in DOLR must be known
 
Method Summary
 java.util.Hashtable anycallEventArrived(java.util.Hashtable evt)
          Callback method executed when an anycall event is received [IT IS CURRENTLY UNUSED]
 ComponentInterface createInstance(java.lang.String interf, java.lang.String instance)
          Creates a component's instance.
 ComponentInterface createInstance(java.lang.String interf, java.lang.String instance, java.lang.Object... args)
          Creates a component's instance.
 void eventArrived(java.util.Hashtable evt)
          Callback method executed when an event regarding the factory is received
 java.util.Properties getComponentMetadata()
          This method returns the component's metadata
 java.lang.String getComponentURL()
          This method returns the component's URL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentFactory

public ComponentFactory()
Void constructor


ComponentFactory

public ComponentFactory(java.lang.String componentURL)
                 throws dermi.exception.RemoteException
Default factory constructor: Component's URL in DOLR must be known

Parameters:
componentURL - String Component's URL
Throws:
dermi.exception.RemoteException
Method Detail

createInstance

public ComponentInterface createInstance(java.lang.String interf,
                                         java.lang.String instance)
                                  throws InterfaceNotFoundException,
                                         dermi.exception.RemoteException
Creates a component's instance. The component's constructor has no arguments.

Parameters:
interf - String Component's interface to be returned (component's desired view)
instance - String Component's instance identifier
Returns:
ComponentInterface An implementation of the ComponentInterface interface
Throws:
InterfaceNotFoundException - If the specified interface cannot be found
dermi.exception.RemoteException - If something else goes wrong ;-)

createInstance

public ComponentInterface createInstance(java.lang.String interf,
                                         java.lang.String instance,
                                         java.lang.Object... args)
                                  throws InterfaceNotFoundException,
                                         dermi.exception.RemoteException
Creates a component's instance. The component's constructor has arguments.

Parameters:
interf - String Component's interface to be returned (component's desired view)
instance - String Component's instance identifier
args - Object[] Component's constructor arguments
Returns:
ComponentInterface An implementation of the ComponentInterface interface
Throws:
InterfaceNotFoundException - If the specified interface cannot be found
dermi.exception.RemoteException - If something else goes wrong ;-)

getComponentURL

public java.lang.String getComponentURL()
This method returns the component's URL

Returns:
String Component's URL

getComponentMetadata

public java.util.Properties getComponentMetadata()
This method returns the component's metadata

Returns:
Properties Component's metadata

eventArrived

public void eventArrived(java.util.Hashtable evt)
Callback method executed when an event regarding the factory is received

Specified by:
eventArrived in interface dermi.listener.RemoteEventListener
Parameters:
evt - Hashtable Event data

anycallEventArrived

public java.util.Hashtable anycallEventArrived(java.util.Hashtable evt)
                                        throws dermi.exception.UnmatchedAnycallMethodException
Callback method executed when an anycall event is received [IT IS CURRENTLY UNUSED]

Specified by:
anycallEventArrived in interface dermi.listener.RemoteEventListener
Parameters:
evt - Hashtable Event data
Returns:
Hashtable Transformed event data
Throws:
dermi.exception.UnmatchedAnycallMethodException - Thrown whenever the specified method was not an anycall