• Fractal Concepts
 
Fractal Concepts

Fractal Concepts


Chapter 1. Introduction

This document presents the concepts of the Fractal component model.

The Fractal model has been created in order to build, deploy and manage complex systems like applications, middleware platform or operating systems. The model is based on the following principles:

  • composite components (component which contains sub-components) allowing to have a homogeneous view of the software architecture at different abstraction levels.
  • shared components (sub-components encapsulated by many different composite components) allowing the modeling of shared ressources, without losing encapsulation properties.
  • introspection capabilities allowing to explore system during the runtime execution.
  • reconfiguration capabilities allowing to deploy and reconfigure systems at runtime execution.

The Fractal component model has been implemented in various programming languages, Java, C, C++, Smalltalk...A Fractal implementation allows you to manipulate Fractal concepts in the target language.

Implementations don't always implement all concepts for various reasons,there is often more than one way to map concepts.

The Fractal specification provides conformance levels. These conformance levels describe the number of Fractal concepts that are implemented by the implementation. It allows you to know that kind of concepts you will be able to manipulate in the target implementation.

The reference implementation of the Fractal component model is named Julia, it is written in Java for Java programmers. We will use this implementation along this tutorial, but in the first section we'll try just to talk about the Fractal concepts without care about limitations, or specificities created by implementations.

Fractal is a component model. With object model like Java you think problems as a set of objects. With a component model approach you think problems as a set of components.

But what is a component ? and more precisely what is the fractal definition of a component ? And what is the utility of a such approach ?

Chapter 2. Fractal Concepts

2.1. Fractal Component Definition

There is a lot of component models, EJB, OSGi...and of course a lot of component definitions.

In the Fractal world, a component is an runtime entity with recursive structure and reflexive capabilities. A component is composed of a content and a membrane and has access points named interfaces.

2.2. Interfaces

Interfaces allow you to emit and receive calls. As you can see, there are different kinds of interfaces :

  • The provided (or server) interfaces are access points to the functional services provided by the component. By convention, they are at graphically drawn at the left side of the component.
  • The required (or client) interfaces are the access points to receive services from others components. By convention, they are graphically drawn at the left side of the component.
  • The control interfaces are access points to add non-business functionalities like reflexivity, life-cycle or recursive properties of the component. We will see that control interfaces are just provided interfaces with special names. By convention they are graphically drawn at the top side of the component.

2.3. Membrane and Content

A Fractal component has two parts :

  • one membrane which have functional interfaces and control interfaces allowing the introspection and the configuration of the component.
  • one content which is composed by a finite set of sub-components.

The membrane is composed by a set of controllers. Controllers implement control interfaces. Each controller has a special function : for example, to control the life cycle of a component or control the behaviours of sub-components...

2.4. Subcomponents

A component can contain recursively other components. The subcomponents are stored in the content of the component. A component that contains other components is named composite component and has a control interface named "content-controller" that allows to add, list and remove subcomponents from its content. A component without ContentController interface is named a primitive component because we can not inspect its content, it is a black box.

The same component can be added in different components, it becomes shared by different parents (also named super-components). A component has a SuperController control interface that allows to access to the list of its parents.

2.5. Component Name

A component can have a name. Its name is controlled by the NameController control interface.

2.6. Life-Cycle

A component has a life-cycle. This life-cycle can be controlled via the LifeCycle Controller control interface of the component. A component can be in the state STARTED or STOPPED.

2.7. Component Attributes

A component can also have attributes. These attributes are generally not represented graphically, they can be controller via an AttributeController control interface.

2.8. Bindings

Sub components that are in the same component can be connected via bindings.

A binding is an oriented communication path between a required interface and a provided interface.

A binding belongs to the content of the component of the required interface.

All bindings of a component are controlled by the control interface named BindingController (BC). This BindingController interface allows to bind and unbind the required interfaces of the component.

Chapter 3. Concepts Details

3.1. Bindings Rules

  • A binding is a connection from a required interface to a provided interface.
  • A binding can't pass across a membrane.
  • The components related to the bindings must be in a common super-component.

Some examples :

Often we want what our composite provides services implemented infact by its subcomponents . So we would like to make a binding between the provided interface of a composite component and a provided interface of its sub component. But it is not possible to do this, because it does not repect the binding rules at all !

To do this, a Fractal interface has the notion of visibility. A visibility of a interface indicates if the interface is on the internal face of the membrane or at the external face. For the moment all our interfaces were external interfaces. In practice you'll only see external interfaces, the internal interfaces are automatically created by the Fractal implementation. The connexion between the internal and external interfaces of the membrane one is also created automatically.

Note : As control interfaces are specials provided interfaces but are provided interfaces, you can connect a required interface to a control interface.

It is also possible to bind a required interface of a component to one of its own provided interface.

3.2. Fractal Interface Definition

3.2. Fractal Interface Definition

We have already seen three kinds of Fractal interfaces : provided, required and control interfaces. We have also seen that they have a visibility that can be external or internal.

To be exhaustive a Fractal interface is described by : a name, a visibility and a type.

The name is just a string that lets you have access to the interface. In practice component has a control interface that provides a getFcInterface(in string interfaceName) method that returns the Fractal interface identified by the name 'interfaceName'.

The visibility, we have already seen it, can be external or internal. In practice they are only used for composite component and are automatically created.

Finally, the type of a Fractal interface is described by a name, a role, a cardinality, a contingency and a signature.

  • role : required or provided (control interface is just a provided interface with special name)
  • contingency : it is a property of an interface that indicates if the functionality of this interface is guaranteed to be available or not, while its component is running. The contingency is either optional or mandatory.
  • cardinality : it is a property of an interface type that indicates how many interfaces of this type a given component may have. The cardinality is either singleton or collection.
  • signature :is the name of the language interface type corresponding to this component interface.. In Julia which is a Java implementation of Fractal, the signature is the name of a Java interface's class.

Note: In practice Fractal interface is not a Java interface. In Julia for example, a Fractal interface is a java object which implements the java signature and other specific java interface allowing you to get the name, type, and other attributes of a Fractal interface.

The type of a component is just the set of its interfaces.

3.3. Interfaces Access

There are different kinds of interfaces and we can't access to all of them by the same way.

  • required interfaces are controlled by the binding controller interface.
  • external interfaces are controlled by the component controller interface.
  • internal interfaces are controlled by the content controller interface.

3.4. Bootstrap Component and Factories

In order to create components, and types, Fractal has the notion of factories.

There is two important factories :

  • the type factory: allowing the creation of interface types, and component types.
  • the generic factory (component factory) : allowing the creation of components.

These factories are accessible from the bootstrap component. The bootstrap component is just a component which does not need to be created explicitly and which is directly accessible. Note that the bootstrap component creates components but not need to contain them. The created components are not subcomponents of the bootstrap component.

Chapter 4. Standard Fractal API

To manipulate Fractal concepts we need APIs. And you will see that the set of standard Fractal APIs is small. There is a mapping of the Fractal API for the IDL, C and Java language. Here we will describe the Java API.

4.1. Fractal Types

public interface Type {
	boolean isFcSubTypeOf (Type type);
} 

public interface ComponentType extends org.objectweb.fractal.api.Type {
	InterfaceType[] getFcInterfaceTypes ();
	InterfaceType getFcInterfaceType (String name) throws NoSuchInterfaceException;
}

public interface InterfaceType extends org.objectweb.fractal.api.Type {
	String getFcItfName ();
	String getFcItfSignature ();
	boolean isFcClientItf ();
	boolean isFcOptionalItf ();
	boolean isFcCollectionItf ();
} 

public interface TypeFactory {
	InterfaceType createFcItfType (
		String name, String signature, boolean isClient, boolean isOptional, boolean isCollection)
 		throws org.objectweb.fractal.api.factory.InstantiationException;
	ComponentType createFcType (InterfaceType[] interfaceTypes)
		throws org.objectweb.fractal.api.factory.InstantiationException;
} 

public interface Interface {
	Component getFcItfOwner ();
	String getFcItfName ();
	Type getFcItfType ();
	boolean isFcInternalItf ();
} 
		

In Fractal all types are subtypes of Type. This Type interface just has one method : boolean isFcSubTypeOf (in Type type); which allows to know if types are compatible. In practive you don't have to use it often. But for a Fractal implementation it means that your target language has to provide or simulate type checking. For example, in a Java world, when we try to compare to Fractal interfaces, the Fractal implementation checks the role, the cardinality, and the contingency of the Fractal interfaces, but it has also to check the compatibility of the signatures which is Java interface casting verification.

The InterfaceType describes the type of Fractal interfaces which are described by :

  • a name
  • a signature
  • a role : CLIENT (true) or SERVER (false)
  • a contingency :OPTIONAL (true) or MANDATORY (false)
  • a cardinality : COLLECTION (true) or SINGLETON (false)

A ComponentType is just a set of InterfaceType.

The

InterfaceType[] getFcInterfaceTypes ();

method returns all interface types that are part of the component type.

The

InterfaceType getFcInterfaceType (String name) throws NoSuchInterfaceException;

returns the type of a specific Fractal interface identified by its name.

Type factories have also a type which defines the methods that a type factorie must provide. No suprises, we find createFcItfType and a createFcType methods to create respectively interface and component types.

Finally the

Interface

java interface which is implemented by all Fractal interfaces. In practice julia creates a java object for each Fractal interface that implement the Interface java interface and the java interface of the signature. The implementation of java interface of the signature is delegate to the java class associated to the component that holds the Fractal interface.

4.2. Fractal Control

In the Fractal specification, seven controllers have been identified to introspect and manipulate the Fractal architecture. We have seen most of them.

4.2.1. Component control interface

A component interface to introspect the external interfaces of the component to which it belongs.

public interface Component {
	Type getFcType ();
	Object[] getFcInterfaces ();
	Object getFcInterface (String interfaceName) throws NoSuchInterfaceException;
} 
		

Note that the return type of each method has not a strong type. For example getFcType returns Type and not ComponentType, for getFcInterface a Object is returned not a Interface.

The Java object returned by getFcInterface can be cast in a Interface object, or in the

4.2.2. AttributeController control interface

A component interface to control the attributes of the component to which it belongs.

interface AttributeController { }; 

It doesn't have methods because the name of the attributes are unknown. The user will have to provide a control interface that extends this one and declare custom getters and setters in order to control attributes.

4.2.3. BindingController control interface

A component interface to control the bindings of the component to which it belongs.

public interface BindingController {
	String[] listFc ();
	Object lookupFc (String clientItfName) throws NoSuchInterfaceException;
	void bindFc (String clientItfName, Object serverItf) throws
    	NoSuchInterfaceException, IllegalBindingException, IllegalLifeCycleException;
	void unbindFc (String clientItfName) throws
    	NoSuchInterfaceException, IllegalBindingException, IllegalLifeCycleException;
} 
		

4.2.4. ContentController control interface

A component interface to control the content of the component to which it belongs.

public interface ContentController {
	Object[] getFcInternalInterfaces ();
	Object getFcInternalInterface (String interfaceName) throws NoSuchInterfaceException;
	Component[] getFcSubComponents ();
	void addFcSubComponent (Component subComponent)
		throws IllegalContentException, IllegalLifeCycleException;
	void removeFcSubComponent (Component subComponent)
    	throws IllegalContentException, IllegalLifeCycleException;
} 
		

4.2.5. LifeCycleController control interface

A component interface to control the lifecycle of the component to which it belongs.

public interface LifeCycleController {
	String getFcState ();
	void startFc () throws IllegalLifeCycleException;
	void stopFc () throws IllegalLifeCycleException;
} 
		

4.2.6. NameController control interface

A component interface to control the name of the component to which it belongs.

public interface NameController {
	String getFcName ();
	void setFcName (String name);
} 
		

4.2.7. SuperController control interface

A component interface to control the super components of the component to which it belongs.

public interface SuperController {
  Component[] getFcSuperComponents ();
} 
		

If you want news controller you have to create them. In practice with Julia implementation it is not easy.

4.3. Fractal Factory APIs

public interface GenericFactory {
	Component newFcInstance (Type type, Object controllerDesc, Object contentDesc)
    	throws InstantiationException;
}  
		
public interface Factory {
	Type getFcInstanceType ();
	Object getFcControllerDesc ();
	Object getFcContentDesc ();
	Component newFcInstance () throws InstantiationException;
} 
		
 
2001-2009 © ObjectWeb Consortium  | Last Published: 2009-02-03 18:27  | Version: 1.1.1-SNAPSHOT