org.ijsberg.iglu.configuration
Interface Component

All Known Implementing Classes:
StandardComponent

public interface Component

Components are elementary building blocks of an application's structure. An object that represents a structural part (component) of an application may be embedded in a component. A component facilitates setting of properties as well as references to other components.


Method Summary
 Set<Class<?>> getInjectedInterfaces(String componentId)
           
 Class<?>[] getInterfaces()
           
 Properties getProperties()
           
 Object getProxy(Class<?> interfaceClass)
           
 Object invoke(String methodName, Object... parameters)
           
 void register(Component component)
          Registers a component (as listener) in case the embedded object implements a method named 'register' with a suiting interface.
 void removeDependency(String componentId)
          Removes previously injected proxies for a certain component.
 void setInvocationIntercepter(Class<?> interfaceClass, InvocationHandler interceptor)
          Sets intercepter for invocations of a particular interface to deal with cross-cutting concerns.
 void setProperties(Properties properties)
          Injects properties into the embedded object.
 void setReference(Facade facade, String componentId, Class<?>... interfaces)
          Sets a reference to a component if the embedded class contains an appropriate setter.
 void unregister(Component component)
          Unregisters a previously registered component in case the embedded object implements a method named 'unregister' with a suitable interface.
 

Method Detail

setProperties

void setProperties(Properties properties)
Injects properties into the embedded object.

Parameters:
properties -

getProperties

Properties getProperties()
Returns:
previously set properties

getInterfaces

Class<?>[] getInterfaces()
Returns:
classes of interfaces implemented by the wrapped object

getProxy

Object getProxy(Class<?> interfaceClass)
Parameters:
interfaceClass -
Returns:
a proxy for the wrapped object implementing the given interface

setReference

void setReference(Facade facade,
                  String componentId,
                  Class<?>... interfaces)
Sets a reference to a component if the embedded class contains an appropriate setter. (Also known as dependency injection.) The component may actually have references for every exposed interface. This method must also be used to update references in case the exposure of interfaces changes.

Parameters:
facade - facade that must expose a component with id componentId and given interfaces
componentId - ID of the component
interfaces - the interfaces the component exposes

removeDependency

void removeDependency(String componentId)
Removes previously injected proxies for a certain component.

Parameters:
componentId -

register

void register(Component component)
Registers a component (as listener) in case the embedded object implements a method named 'register' with a suiting interface.

Parameters:
component -

unregister

void unregister(Component component)
Unregisters a previously registered component in case the embedded object implements a method named 'unregister' with a suitable interface.

Parameters:
component -

getInjectedInterfaces

Set<Class<?>> getInjectedInterfaces(String componentId)
Parameters:
componentId -
Returns:
a set of classes of interfaces that have been injected by setter

setInvocationIntercepter

void setInvocationIntercepter(Class<?> interfaceClass,
                              InvocationHandler interceptor)
Sets intercepter for invocations of a particular interface to deal with cross-cutting concerns.

Parameters:
interfaceClass - interface of which invocations must be intercepted
interceptor -

invoke

Object invoke(String methodName,
              Object... parameters)
              throws InvocationTargetException,
                     NoSuchMethodException,
                     IllegalArgumentException
Parameters:
methodName - name of a method declared by a component's interface
parameters -
Returns:
Throws:
InvocationTargetException - in case the invoked method throws
NoSuchMethodException - in case no suitable method is found
IllegalArgumentException - in case the arguments can not be converted


Copyright © 2011. All Rights Reserved.