124
              
// in modules/frascati-implementation-osgi/src/main/java/org/ow2/frascati/implementation/osgi/FrascatiImplementationOsgiProcessor.java
Override
  protected final void doCheck(OsgiImplementation osgiImplementation, ProcessingContext processingContext)
	      throws ProcessorException
  {
    String osgiImplementationBundle = osgiImplementation.getBundle();
    if(isNullOrEmpty(osgiImplementationBundle)) {
      error(processingContext, osgiImplementation, "The attribute 'bundle' must be set");
    } else {
      // TODO check that bundles are available?
    }
    // check attributes 'policySets' and 'requires'.
    checkImplementation(osgiImplementation, processingContext);
  }
              
// in modules/frascati-implementation-osgi/src/main/java/org/ow2/frascati/implementation/osgi/FrascatiImplementationOsgiProcessor.java
Override
  protected final void doGenerate(OsgiImplementation osgiImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    try {
      getComponentFactory().generateMembrane(getFractalComponentType(osgiImplementation, processingContext),
  	      "osgiPrimitive", osgiImplementation.getBundle());
    } catch (FactoryException te) {
  	  severe(new ProcessorException(osgiImplementation, "Error while creating OSGI component instance", te));
  	}
  }
              
// in modules/frascati-implementation-osgi/src/main/java/org/ow2/frascati/implementation/osgi/FrascatiImplementationOsgiProcessor.java
Override
  protected final void doInstantiate(OsgiImplementation osgiImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    // get instance of an OSGI primitive component
    Component component;
    try {
      component = getComponentFactory().createComponent(getFractalComponentType(osgiImplementation, processingContext),
    	            "osgiPrimitive", osgiImplementation.getBundle());
    } catch (FactoryException te) {
      severe(new ProcessorException(osgiImplementation, "Error while creating OSGI component instance", te));
      return;
    }
    // Store the created component into the processing context.
    processingContext.putData(osgiImplementation, Component.class, component);
  }
              
// in modules/frascati-binding-http/src/main/java/org/ow2/frascati/binding/http/FrascatiBindingHttpProcessor.java
Override
  protected final void doCheck(HTTPBinding httpBinding, ProcessingContext processingContext)
      throws ProcessorException
  {
    checkAttributeMustBeSet(httpBinding, "uri", httpBinding.getUri(), processingContext);
    checkAttributeNotSupported(httpBinding, "name", httpBinding.getName() != null, processingContext);
    if(!hasBaseService(httpBinding)) {
      error(processingContext, httpBinding, "Can only be child of <sca:service>");
    } else {
      // Get the Java class of the interface of the service.
      Class<?> interfaceClass = getBaseServiceJavaInterface(httpBinding, processingContext);
      if(interfaceClass != null) {
        if(!Servlet.class.isAssignableFrom(interfaceClass)) {
          error(processingContext, httpBinding, "The service's interface '",
              interfaceClass.getCanonicalName(), "' must be compatible with '",
              Servlet.class.getCanonicalName(), "'");
        }
      }
    }
    
    checkBinding(httpBinding, processingContext);
  }
              
// in modules/frascati-binding-http/src/main/java/org/ow2/frascati/binding/http/FrascatiBindingHttpProcessor.java
Override
  protected final void doGenerate(HTTPBinding httpBinding, ProcessingContext processingContext)
      throws ProcessorException
  {
    logFine(processingContext, httpBinding, "nothing to generate");
  }
              
// in modules/frascati-binding-http/src/main/java/org/ow2/frascati/binding/http/FrascatiBindingHttpProcessor.java
Override
  protected final void doInstantiate(HTTPBinding httpBinding, ProcessingContext processingContext)
      throws ProcessorException
  {
    // The following is safe as it was checked in the method check().
	BaseService service = getBaseService(httpBinding);
    Servlet servlet;
    try {
      // Get the component from the processing context.
      Component componentToBind = getFractalComponent(httpBinding, processingContext);
      // The following cast is safe as it was checked in the method check().
      servlet = (Servlet)componentToBind.getFcInterface(service.getName());
	} catch(NoSuchInterfaceException nsie) {
	  // Should not happen!
	  severe(new ProcessorException(httpBinding, "Internal Fractal error!", nsie));
	  return;
    }
	// TODO Here use Tinfi or Assembly Factory to create the binding component.
	final HttpBinding bindingHttp = new HttpBinding();
    bindingHttp.uri = completeBindingURI(httpBinding);
    bindingHttp.servlet = servlet;
    bindingHttp.servletManager = servletManager;
    // TODO: Following could be moved into complete() or @Init method of the binding component.
//
// It seems to be not needed to run a Thread to initialize the new binding.
// Moreover Google App Engine does not allow us to create threads.
//
//    new Thread() {
//       public void run() {
            try {
	            bindingHttp.initialize();
	        } catch(Exception exc) {
	        	log.throwing("", "", exc);
	        }
//	    }
//	}.start();
	logFine(processingContext, httpBinding, "exporting done");
  }
              
// in modules/frascati-binding-http/src/main/java/org/ow2/frascati/binding/http/FrascatiBindingHttpProcessor.java
Override
  protected final void doComplete(HTTPBinding httpBinding, ProcessingContext processingContext)
      throws ProcessorException
  {
    logFine(processingContext, httpBinding, "nothing to complete");
  }
              
// in modules/frascati-property-jaxb/src/main/java/org/ow2/frascati/property/jaxb/ScaPropertyTypeJaxbProcessor.java
Override
  protected final void doCheck(SCAPropertyBase property, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Obtain the property type for the given property.
	QName propertyType = processingContext.getData(property, QName.class);
    // When no propertyType set then return immediatly as this processor has nothing to do.
    if(propertyType == null) {
      return;
    }
    // Retrieve the package name associated to this property type.
    String packageName = NameConverter.standard.toPackageName(propertyType.getNamespaceURI());
    try {
      // try to retrieve the JAXB package info.
      log.fine("Try to load " + packageName + ".package-info.class");
      processingContext.loadClass(packageName + ".package-info");
      log.fine(packageName + ".package-info.class found.");
      // This property type processor is attached to the given property.
      processingContext.putData(property, Processor.class, this);
      // Compute the property value.
	  doComplete(property, processingContext);
     } catch(ClassNotFoundException cnfe) {
       log.fine("No " + packageName + ".package-info.class found.");
       return;
     }
  }
              
// in modules/frascati-property-jaxb/src/main/java/org/ow2/frascati/property/jaxb/ScaPropertyTypeJaxbProcessor.java
Override
  protected final void doComplete(SCAPropertyBase property, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Obtain the property type for the given property.
	QName propertyType = processingContext.getData(property, QName.class);
    // Set the property object as a root XML element.
    Map<Object, Object> options = new HashMap<Object, Object>();
    options.put(XMLResource.OPTION_ROOT_OBJECTS,
                Collections.singletonList(property));
    // Save the property resource in a new XML document.
    Document document = ((XMLResource) property.eResource()).save(null, options, null);
    // The XML node defining this SCA property value.
    Node node = document.getChildNodes().item(0).getChildNodes().item(0);
    // Search the first XML element.
    while(node != null && node.getNodeType() != Node.ELEMENT_NODE) {
      node = node.getNextSibling();
    }
    // No XML element found.
    if(node == null) {
      error(processingContext, property, "No XML element");
      return;
    }
    // Retrieve the package name.
    String packageName = NameConverter.standard.toPackageName(propertyType.getNamespaceURI());
    // Retrieve the JAXB package info class.
    Class<?> packageInfoClass;
    try {
      packageInfoClass = processingContext.loadClass(packageName + ".package-info");
    } catch (ClassNotFoundException cnfe) {
      // Should never happen but we never know.
      severe(new ProcessorException(property, "JAXB package info for " + toString(property) + " not found", cnfe));
      return;
    }
    // Retrieve the JAXB Unmarshaller for the cache.
    Unmarshaller unmarshaller = cacheOfUnmarshallers.get(packageInfoClass);
 
    // If not found, then create the JAXB unmarshaller.
    if(unmarshaller == null) {
      // Create the JAXB context for the Java package of the property type.
      JAXBContext jaxbContext;
      try {
        jaxbContext = JAXBContext.newInstance(packageName, processingContext.getClassLoader());
      } catch (JAXBException je) {
        severe(new ProcessorException(property, "create JAXB context failed for " + toString(property), je));
        return;
      }
      // Create the JAXB unmarshaller.
      try {
        unmarshaller = jaxbContext.createUnmarshaller();
        // Turn on XML validation.
        // Not supported by sun's JAXB implementation.
//        unmarshaller.setValidating(true);
      } catch (JAXBException je) {
        severe(new ProcessorException(property, "create JAXB unmarshaller failed for " + toString(property), je));
        return;
      }
      // Store the unmarshaller into the cache.
      cacheOfUnmarshallers.put(packageInfoClass, unmarshaller);
      
    }
    // Unmarshal the property node with JAXB.
    Object computedPropertyValue;
    try {
      computedPropertyValue = unmarshaller.unmarshal((Element) node);
    } catch (JAXBException je) {
      error(processingContext, property, "XML unmarshalling error: " + je.getMessage());
      return;
    }
    // Attach the computed property value to the given property.
	processingContext.putData(property, Object.class, computedPropertyValue);
  }
              
// in modules/frascati-implementation-script/src/main/java/org/ow2/frascati/implementation/script/FrascatiImplementationScriptProcessor.java
Override
  protected final void doCheck(ScriptImplementation scriptImplementation, ProcessingContext processingContext)
	      throws ProcessorException
  {
    String scriptImplementationScript = scriptImplementation.getScript();
    if(isNullOrEmpty(scriptImplementationScript)) {
      error(processingContext, scriptImplementation, "The attribute 'script' must be set");
    } else {
      if(processingContext.getResource(scriptImplementationScript) == null) {
        error(processingContext, scriptImplementation, "Script '", scriptImplementationScript, "' not found");
      }
    }
    // TODO check that the required script engine is available?
    // TODO evaluate the script to see it is correct
    // check attributes 'policySets' and 'requires'.
    checkImplementation(scriptImplementation, processingContext);
  }
              
// in modules/frascati-implementation-script/src/main/java/org/ow2/frascati/implementation/script/FrascatiImplementationScriptProcessor.java
Override
  protected final void doInstantiate(ScriptImplementation scriptImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Initialize the script engine manager if not already done.
    // At this moment the FraSCAti assembly factory runtime classloader
    // is initialized.
    //
    // TODO: Perhaps the script engine manager should be instantiated
    // each time a ScriptEngine is instantiated in order to be sure that
    // all script engines present in the runtime classloader are useable.
    // For instance, we could imagine a reconfiguration scenario where
    // we dynamically add a new script engine at runtime.
    if(scriptEngineManager == null) {
      initializeScriptEngineManager(processingContext.getClassLoader());
    }
    // Get the script.
    String script = scriptImplementation.getScript();
    log.info("Create an SCA component for <frascati:implementation.script script=\""
        + script + "\" language=\"" + scriptImplementation.getLanguage() + "\"> and the Fractal component type "
        + getFractalComponentType(scriptImplementation, processingContext).toString());
    // Obtain an input stream reader to the script.
    // TODO: Could 'script' contain a url or filename, and not just a resource in the classpath?
    // TODO move into check()
    URL scriptUrl = processingContext.getResource(script);
    if(scriptUrl == null) {
      severe(new ProcessorException(scriptImplementation, "Script '" + script + "' not found"));
      return;
    }
    InputStream scriptInputStream = null;
    try {
      scriptInputStream = scriptUrl.openStream();
    } catch (IOException ioe) {
      severe(new ProcessorException(scriptImplementation, "Script '" + script + "' not found", ioe));
      return;
    }
    InputStreamReader scriptReader = new InputStreamReader(scriptInputStream);
    // Obtain a scripting engine for evaluating the script.
    // TODO: Use scriptImplementation.getLanguage() if not null
    // TODO move into check
    String scriptExtension = script.substring(script.lastIndexOf('.') + 1);
    ScriptEngine scriptEngine = scriptEngineManager.getEngineByExtension(scriptExtension);
    if(scriptEngine == null) {
      severe(new ProcessorException(scriptImplementation, "ScriptEngine for '" + script + "' not found"));
      return;
    }
    // Add a reference to the SCA domain into the script engine
    scriptEngine.put("domain", compositeManager.getTopLevelDomainComposite());
    // Switch the current thread's context class loader to the processing context class loader
    // in order to be sure that the script will be evaluated into the right class loader.
    ClassLoader previousClassLoader = FrascatiClassLoader.getAndSetCurrentThreadContextClassLoader(processingContext.getClassLoader());
    // Evaluate the script.
    try {
      scriptEngine.eval(scriptReader);
	} catch(ScriptException se) {
      severe(new ProcessorException(scriptImplementation, "Error when evaluating '" + script + "'", se));
      return;
    } finally {
      // Restore the previous class loader.
      FrascatiClassLoader.setCurrentThreadContextClassLoader(previousClassLoader);
    }
    // Create the Fractal component as a composite.
	Component component = doInstantiate(scriptImplementation, processingContext, scriptEngine);
    // Create a primitive component encapsulating the scripting engine.
    try {
      ScriptEngineComponent scriptEngineContent = new ScriptEngineComponent(component, scriptEngine);
      ComponentType scriptEngineType = tf.createComponentType(new InterfaceType[] {
            // type for attribute-controller
            tf.createInterfaceType("attribute-controller",
                ScriptEngineAttributes.class.getCanonicalName(),
                false, false, false) });
      Component scriptEngineComponent = getComponentFactory().createComponent(scriptEngineType,
                "primitive", scriptEngineContent);
      // add the scripting engine component as a sub component of the SCA composite.
      addFractalSubComponent(component, scriptEngineComponent);
    } catch(Exception exc) {
      // This should not happen!
      severe(new ProcessorException(scriptImplementation, "Internal Fractal error!", exc));
	  return;
    }
  }
              
// in modules/frascati-interface-wsdl/src/main/java/org/ow2/frascati/wsdl/ScaInterfaceWsdlProcessor.java
Override
  protected final void doCheck(WSDLPortType wsdlPortType, ProcessingContext processingContext)
      throws ProcessorException
  {
	// Check the attribute 'interface'.
	String wsdlInterface = wsdlPortType.getInterface();
	if(wsdlInterface == null || wsdlInterface.equals("") ) {
      error(processingContext, wsdlPortType, "The attribute 'interface' must be set");
	} else {
      PortType portType = getPortType(wsdlPortType, processingContext, "interface", wsdlInterface);
      if(portType != null) {
        QName qname = portType.getQName();
        // Compute the Java interface name for the WSDL port type.
        String localPart = qname.getLocalPart();
        String javaInterface = NameConverter.standard.toPackageName(qname.getNamespaceURI()) + '.' + Character.toUpperCase(localPart.charAt(0)) + localPart.substring(1);
        log.info("The Java interface for '" + wsdlInterface + "' is " + javaInterface);
        // Load the Java interface.
        Class<?> clazz = null;
        try {
          clazz = processingContext.loadClass(javaInterface);
        } catch (ClassNotFoundException cnfe) {
          // If the Java interface is not found then this requires to compile WSDL to Java.
        }
        // TODO: check that this is a Java interface and not a Java class.
        // Store the Java class into the processing context.
        storeJavaInterface(wsdlPortType, processingContext, javaInterface, clazz);
      }
    }
    // Check the attribute 'callbackInterface'.
    wsdlInterface = wsdlPortType.getCallbackInterface();
    if(wsdlInterface != null) {
      getPortType(wsdlPortType, processingContext, "callback interface", wsdlInterface);
    }
  }
              
// in modules/frascati-interface-wsdl/src/main/java/org/ow2/frascati/wsdl/ScaInterfaceWsdlProcessor.java
private PortType getPortType(WSDLPortType wsdlPortType, ProcessingContext processingContext, String what, String scaWsdlInterface)
      throws ProcessorException
  {
    logDo(processingContext, wsdlPortType, "check the WSDL " + what + " " + scaWsdlInterface);
    PortType portType = null;
    // Compute uri and portTypeName from the SCA WSDL interface.
    String wsdlUri = null;
    String portTypeName = null;
    int idx = scaWsdlInterface.indexOf("#wsdl.interface(");
    if(idx != -1 && scaWsdlInterface.endsWith(")")) {
      wsdlUri = scaWsdlInterface.substring(0, idx);
      portTypeName = scaWsdlInterface.substring(idx + ("#wsdl.interface(").length(), scaWsdlInterface.length() - 1);
    }
    if(wsdlUri == null || portTypeName == null) {
      error(processingContext, wsdlPortType, "Invalid 'interface' value, must be uri#wsdl.interface(portType)");
    } else {
      // Search the WSDL file from the processing context's class loader.
      URL url = processingContext.getResource(wsdlUri);
      if(url != null) {
        wsdlUri = url.toString();
      }
      // Read the requested WSDL definition.
      Definition definition = null;
      try {
        definition = this.wsdlCompiler.readWSDL(wsdlUri);
      } catch(WSDLException we) {
  	    processingContext.error(toString(wsdlPortType) + " " + wsdlUri + ": " + we.getMessage());
  	    return null;
      }
      // Search the requested port type.
      portType = definition.getPortType(new QName(definition.getTargetNamespace(), portTypeName));
      if(portType == null) {
        error(processingContext, wsdlPortType, "Unknown port type name '", portTypeName, "'");
        return null;
      }
    }
    logDone(processingContext, wsdlPortType, "check the WSDL " + what + " " + scaWsdlInterface);
    return portType;
  }
              
// in modules/frascati-interface-wsdl/src/main/java/org/ow2/frascati/wsdl/ScaInterfaceWsdlProcessor.java
Override
  protected final void doGenerate(WSDLPortType wsdlPortType, ProcessingContext processingContext)
      throws ProcessorException
  {
    // If no Java interface computed during doCheck() then compile the WDSL file.
    if(getClass(wsdlPortType, processingContext) == null) {
      String scaWsdlInterface = wsdlPortType.getInterface();
      int idx = scaWsdlInterface.indexOf("#wsdl.interface(");
  	  String wsdlUri = scaWsdlInterface.substring(0, idx);
      // Search the WSDL file from the processing context's class loader.
      URL url = processingContext.getResource(wsdlUri);
      if(url != null) {
        wsdlUri = url.toString();
      }
      // Compile the WSDL description.
      try {
        this.wsdlCompiler.compileWSDL(wsdlUri, processingContext);
      } catch(Exception exc) {
        severe(new ProcessorException("Error when compiling WSDL", exc));
        return;
      }
    }
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaWireProcessor.java
Override
  protected final void doCheck(Wire wire, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Get the map of components stored into the processing context.
    ComponentMap mapOfComponents = processingContext.getData(wire.eContainer(), ComponentMap.class);
	if(wire.getSource() == null) {
      error(processingContext, wire, "The attribute 'source' must be set");
    } else {
      if(wire.getSource2() == null) {
        // Retrieve both source component and reference.
        String source[] = wire.getSource().split("/");
        if(source.length != 2) {
          error(processingContext, wire, "The attribute 'source' must be 'componentName/referenceName'");
        } else {
          Component sourceComponent = mapOfComponents.get(source[0]);
          if(sourceComponent == null) {
            error(processingContext, wire, "Unknown source component '", source[0], "'");
          } else {
            ComponentReference sourceReference = null;
            for(ComponentReference reference : sourceComponent.getReference()) {
              if(source[1].equals(reference.getName())) {
                sourceReference = reference;
                break; // the for loop
              }
            }
            if(sourceReference == null) {
              error(processingContext, wire, "Unknown source reference '", source[1], "'");
            } else {
              wire.setSource2(sourceReference);
            }
          }
        }
      }
    }
	if(wire.getTarget() == null) {
      error(processingContext, wire, "The attribute 'target' must be set");    	  
    } else {
      if(wire.getTarget2() == null) {
        // Retrieve both target component and service.
        String target[] = wire.getTarget().split("/");
        if(target.length != 2) {
          error(processingContext, wire, "The attribute 'target' must be 'componentName/serviceName'");
        } else {
          org.eclipse.stp.sca.Component targetComponent = mapOfComponents.get(target[0]);
          if(targetComponent == null) {
            error(processingContext, wire, "Unknown target component '", target[0], "'");
          } else {
            ComponentService targetService = null;
            for(ComponentService service : targetComponent.getService()) {
              if(target[1].equals(service.getName())) {
                targetService = service;
                break; // the for loop
              }
            }
            if(targetService == null) {
              error(processingContext, wire, "Unknown target service '", target[1], "'");
            } else {
              wire.setTarget2(targetService);
            }
          }
        }
      }
    }
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaWireProcessor.java
Override
  protected final void doComplete(Wire wire, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Retrieve source reference, source reference name, source reference multiplicity,
    // source component, and source Fractal component.
    ComponentReference sourceReference = wire.getSource2();
    String sourceReferenceName = sourceReference.getName();
    Component sourceComponent = (Component)sourceReference.eContainer();
    Multiplicity sourceReferenceMultiplicity = sourceReference.getMultiplicity();
    org.objectweb.fractal.api.Component sourceComponentInstance =
      getFractalComponent(sourceComponent, processingContext);
    // Retrieve target service, target service name, target component, and target Fractal component.
    ComponentService targetService = wire.getTarget2();
    String targetServiceName = targetService.getName();
    Component targetComponent = (Component)targetService.eContainer();
    org.objectweb.fractal.api.Component targetComponentInstance =
      getFractalComponent(targetComponent, processingContext);
    // when the source reference multiplicity is 0..n or 1..n
    // then add the target component name to the reference source name.
    // In this way, each Fractal collection client interface has a unique name.
    if(Multiplicity._0N.equals(sourceReferenceMultiplicity)
       || Multiplicity._1N.equals(sourceReferenceMultiplicity)) {
  	  sourceReferenceName = sourceReferenceName + '-' + targetComponent.getName();
    }
    // etablish a Fractal binding between source reference and target service.
    try {
      bindFractalComponent(
          sourceComponentInstance,
          sourceReferenceName,
          getFractalInterface(targetComponentInstance, targetServiceName));
    } catch (Exception e) {
      severe(new ProcessorException(wire, "Cannot etablish " + toString(wire), e));
      return;
    }
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaCompositeServiceProcessor.java
Override
  protected final void doCheck(Service service, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Check the attribute 'promote'.
    if(service.getPromote() == null) {
      error(processingContext, service, "The attribute 'promote' must be set");    	  
    } else {
      if(service.getPromote2() == null) {
        // Retrieve both target component and service.
        String promote[] = service.getPromote().split("/");
        if(promote.length != 2) {
          error(processingContext, service, "The attribute 'promote' must be 'componentName/serviceName'");
        } else {
          org.eclipse.stp.sca.Component promotedComponent =
              processingContext.getData(service.eContainer(), ComponentMap.class).get(promote[0]);
          if(promotedComponent == null) {
            error(processingContext, service, "Unknown promoted component '", promote[0], "'");
          } else {
            ComponentService promotedService = null;
            for(ComponentService cs : promotedComponent.getService()) {
              if(promote[1].equals(cs.getName())) {
                promotedService = cs;
                break; // the for loop
              }
            }
            if(promotedService == null) {
              error(processingContext, service, "Unknown promoted service '", promote[1], "'");
            } else {
              service.setPromote2(promotedService);
            }
          }
        }
      }
    }
    // Check the composite service as a base service.
    checkBaseService(service, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaCompositeServiceProcessor.java
Override
  protected final void doComplete(Service service, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Retrieve the component from the processing context.
	Component component = getFractalComponent(service.eContainer(), processingContext);
	// Retrieve the promoted component service, and the promoted Fractal component.
    ComponentService promotedComponentService = service.getPromote2();
    Component promotedComponentInstance =
        getFractalComponent(promotedComponentService.eContainer(), processingContext);
    // Etablish a Fractal binding between the composite service and the promoted component service.
    try {
      bindFractalComponent(
          component,
          service.getName(),
    	  getFractalInterface(promotedComponentInstance, promotedComponentService.getName()));
    } catch (Exception e) {
      severe(new ProcessorException(service, "Can't promote " + toString(service), e));
      return ;
    }
    // Complete the composite service as a base service.
    completeBaseService(service, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractCompositeBasedImplementationProcessor.java
Override
  protected void doGenerate(ImplementationType implementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    try {
      getComponentFactory().generateMembrane(
        getFractalComponentType(implementation, processingContext),
  	    getMembrane(),
  	    null);
    } catch (FactoryException te) {
  	  severe(new ProcessorException(implementation, "Error while generating " + toString(implementation), te));
  	}
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractCompositeBasedImplementationProcessor.java
protected final Component doInstantiate(ImplementationType implementation, ProcessingContext processingContext, ContentType content)
      throws ProcessorException
  {
    // Create the SCA composite for the implementation.
    Component component = createFractalComposite(implementation, processingContext);
    // Connect the Fractal composite to the content.
    connectFractalComposite(implementation, processingContext, content);
    return component;
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractCompositeBasedImplementationProcessor.java
protected final Component createFractalComposite(ImplementationType implementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Create the SCA composite for the implementation.
    Component component;
    try {
      component = getComponentFactory().createComponent(
        getFractalComponentType(implementation, processingContext),
        getMembrane(),
        null);
    } catch (FactoryException te) {
      severe(new ProcessorException(implementation, "Error while creating " + toString(implementation), te));
      return null;
    }
    // Store the created composite into the processing context.
    processingContext.putData(implementation, Component.class, component);
    return component;
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractCompositeBasedImplementationProcessor.java
protected final void connectFractalComposite(ImplementationType implementation, ProcessingContext processingContext, ContentType content)
      throws ProcessorException
  {
    // Get the binding and content controller of the component.
    Component component = getFractalComponent(implementation, processingContext);
    BindingController bindingController = getFractalBindingController(component);
    ContentController contentController = getFractalContentController(component);
    
    // Traverse all the interface types of the component type.
    for (InterfaceType interfaceType : getFractalComponentType(implementation, processingContext).getFcInterfaceTypes()) {
      String interfaceName = interfaceType.getFcItfName();
      String interfaceSignature = interfaceType.getFcItfSignature();
      Class<?> interfaze;
      try {
        interfaze = processingContext.loadClass(interfaceSignature);
      } catch(ClassNotFoundException cnfe) {
        severe(new ProcessorException(implementation, "Java interface '" + interfaceSignature + "' not found", cnfe));
        return;
      }
	  if (!interfaceType.isFcClientItf()) {
	    // When this is a server interface type.
        // Get a service instance.
	    Object service = null;
	    try {
	      service = getService(content, interfaceName, interfaze);
	    } catch(Exception exc) {
	      severe(new ProcessorException(implementation, "Can not obtain the SCA service '" + interfaceName + "'", exc));
	      return;  	
	    }
        // Bind the SCA composite to the service instance.
	    bindFractalComponent(bindingController, interfaceName, service);
      } else {
        // When this is a client interface type.
    	Object itf = getFractalInternalInterface(contentController, interfaceName);
        try {
          setReference(content, interfaceName, itf, interfaze);
  	    } catch(Exception exc) {
  	      severe(new ProcessorException(implementation, "Can not set the SCA reference '" + interfaceName + "'", exc));
  	      return;  	
  	    }
      }
    }
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaCompositePropertyProcessor.java
Override
  protected final void doCheck(Property property, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Check the property attribute 'name'.
    checkAttributeMustBeSet(property, "name", property.getName(), processingContext);
    // Check the property value.
//
// Until FraSCAti 1.4, the value of a composite property is mandatory.
//
//    logDo(processingContext, property, "check the property value");
//    if(property.getValue() == null) {
//      error(processingContext, property, "The property value must be set");
//    }
//    logDone(processingContext, property, "check the property value");
//
// Since FraSCAti 1.5, the value of a composite property is optional
// in order to pass the OASIS CSA Assembly Model Test Suite.
//
    // Check the property attribute 'many'.
    checkAttributeNotSupported(property, "many", property.isSetMany(), processingContext);
    // Check the property attribute 'mustSupply'.
    checkAttributeNotSupported(property, "mustSupply", property.isSetMustSupply(), processingContext);
    // TODO: check attribute 'promote': Has the enclosing composite a property of this name?
	    
    // Check the component property type and value.
    QName propertyType = (property.getElement() != null) ? property.getElement() : property.getType();
    checkProperty(property, propertyType, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaCompositePropertyProcessor.java
Override
  protected final void doComplete(Property property, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Since FraSCAti 1.5, the value of a composite property is optional
    // in order to pass the OASIS CSA Assembly Model Test Suite.
    if(property.getValue() != null) {
      // Set the composite property value.
      setProperty(property, property.getName(), processingContext);
    }
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractComponentFactoryBasedImplementationProcessor.java
protected final void generateScaPrimitiveComponent(ImplementationType implementation,
		                                             ProcessingContext processingContext,
		                                             String className)
      throws ProcessorException
  {
    try {
      logDo(processingContext, implementation, "generate the implementation");
      ComponentType componentType = getFractalComponentType(implementation, processingContext);
      getComponentFactory().generateScaPrimitiveMembrane(componentType, className);
      logDone(processingContext, implementation, "generate the implementation");
    } catch(FactoryException fe) {
      severe(new ProcessorException(implementation, "generation failed", fe));
      return;
    }
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractComponentFactoryBasedImplementationProcessor.java
protected final Component instantiateScaPrimitiveComponent(ImplementationType implementation,
                                                        ProcessingContext processingContext,
                                                        String className)
      throws ProcessorException
  {
    Component component;
    try {
      logDo(processingContext, implementation, "instantiate the implementation");
      ComponentType componentType = getFractalComponentType(implementation, processingContext);
      // create instance of an SCA primitive component for this implementation.
      component = getComponentFactory().createScaPrimitiveComponent(componentType, className);
      logDone(processingContext, implementation, "instantiate the implementation");
   	} catch(FactoryException fe) {
      severe(new ProcessorException(implementation, "instantiation failed", fe));
      return null;
    }
   	processingContext.putData(implementation, Component.class, component);
   	return component;
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaCompositeProcessor.java
Override
  protected final void doCheck(Composite composite, ProcessingContext processingContext)
      throws ProcessorException
  {
    // The OW2 FraSCAti Parser already manages:
    // - attribute 'autowire'
    // - attribute 'constrainingType'
    // - list of <sca:include>
    // So we needn't to redo these checkings.
    // Check the composite name.
    checkAttributeMustBeSet(composite, "name", composite.getName(), processingContext);
    // Check the composite local.
    checkAttributeNotSupported(composite, "local", composite.isSetLocal(), processingContext);
    // Check the composite target namespace.
    checkAttributeNotSupported(composite, "targetNamespace", composite.getTargetNamespace() != null, processingContext);
    // Check the composite policy sets.
    checkAttributeNotSupported(composite, "policySets", composite.getPolicySets() != null, processingContext);
    // TODO: 'requires' must be checked here.
    // Does each intent composite exist?
    // Is each composite an intent (service Intent of interface IntentHandler)?
    // Check that each component has a unique name and
    // store all <component name, component> tuples into a map of components.
    ComponentMap mapOfComponents = new ComponentMap();
    for(org.eclipse.stp.sca.Component component : composite.getComponent()) {
      String name = component.getName();
      if(name != null) {
        if(mapOfComponents.containsKey(name)) {
          error(processingContext, composite, "<component name='", name, "'> is already defined");
         } else {
           mapOfComponents.put(name, component);
         }
      }
    }
    // Store the map of components into the processing context.
    processingContext.putData(composite, ComponentMap.class, mapOfComponents);
    // Check the composite components.
    check(composite, SCA_COMPONENT, composite.getComponent(), componentProcessor, processingContext);
    // Check the composite services.
    check(composite, SCA_SERVICE, composite.getService(), serviceProcessor, processingContext);
    // Check the composite references.
    check(composite, SCA_REFERENCE, composite.getReference(), referenceProcessor, processingContext);
    // Check the composite properties.
    check(composite, SCA_PROPERTY, composite.getProperty(), propertyProcessor, processingContext);
    // Check the composite wires.
    check(composite, SCA_WIRE, composite.getWire(), wireProcessor, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaCompositeProcessor.java
Override
  protected final void doGenerate(Composite composite, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Generate the composite container.
    try {
      logDo(processingContext, composite, "generate the composite container");
      componentFactory.generateScaCompositeMembrane(null);
      logDone(processingContext, composite, "generate the composite container");
    } catch (FactoryException fe) {
      severe(new ProcessorException(composite,
	                "Unable to generate the composite container", fe));
      return;
    }
    // Generate the component type for this composite.
    // Also generate the composite services and references.
    ComponentType compositeComponentType =
      generateComponentType(composite, composite.getService(), serviceProcessor, composite.getReference(), referenceProcessor, processingContext);
    // Generating the composite.
    try {
      logDo(processingContext, composite, "generate the composite component");
	  componentFactory.generateScaCompositeMembrane(compositeComponentType);
      logDone(processingContext, composite, "generate the composite component");
    } catch (FactoryException fe) {
      severe(new ProcessorException(composite,
                     "Unable to generate the composite component", fe));
      return;
    }
	// Generate the composite components.
    generate(composite, SCA_COMPONENT, composite.getComponent(), componentProcessor, processingContext);
    // Generate the composite properties.
    generate(composite, SCA_PROPERTY, composite.getProperty(), propertyProcessor, processingContext);
    // Generate the composite wires.
    generate(composite, SCA_WIRE, composite.getWire(), wireProcessor, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaCompositeProcessor.java
Override
  protected final void doInstantiate(Composite composite, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Instantiate the composite container.
    Component containerComponent = null;
    // Create a container for root composites only and
    // not for composites enclosed into composites.
    boolean isTheRootComposite = processingContext.getRootComposite() == composite;
    if(isTheRootComposite) {
      try {
        logDo(processingContext, composite, "instantiate the composite container");
        containerComponent = componentFactory.createScaCompositeComponent(null);
        logDone(processingContext, composite, "instantiate the composite container");
      } catch (FactoryException fe) {
        severe(new ProcessorException(composite,
                     "Unable to create the composite container", fe));
        return;
      }
      // Set the name for the composite container.
      setComponentName(composite, "composite container", containerComponent, composite.getName() + "-container", processingContext);
    }
    // Retrieve the composite type from the processing context.
    ComponentType compositeComponentType = getFractalComponentType(composite, processingContext);
    // Instantiate the composite component.
    Component compositeComponent;
    try {
      logDo(processingContext, composite, "instantiate the composite component");
      compositeComponent = componentFactory.createScaCompositeComponent(compositeComponentType);
      logDone(processingContext, composite, "instantiate the composite component");
    } catch (FactoryException fe) {
      error(processingContext, composite, "Unable to instantiate the composite: " + fe.getMessage() +
          ".\nPlease check that frascati-runtime-factory-<major>.<minor>.jar is present into your classpath.");
      throw new ProcessorException(composite, "Unable to instantiate the composite", fe);
    }
    // Keep the composite component into the processing context.
    processingContext.putData(composite, Component.class, compositeComponent);
    // Set the name for this assembly.
    setComponentName(composite, "composite", compositeComponent, composite.getName(), processingContext);
    // Add the SCA composite into the composite container.
    if(isTheRootComposite) {
      addFractalSubComponent(containerComponent, compositeComponent);
    }
    // Instantiate the composite components.
    instantiate(composite, SCA_COMPONENT, composite.getComponent(), componentProcessor, processingContext);
    // Instantiate the composite services.
    instantiate(composite, SCA_SERVICE, composite.getService(), serviceProcessor, processingContext);
    // Instantiate composite references.
    instantiate(composite, SCA_REFERENCE, composite.getReference(), referenceProcessor, processingContext);
    // Instantiate composite properties.
    instantiate(composite, SCA_PROPERTY, composite.getProperty(), propertyProcessor, processingContext);
    // Instantiate the composite wires.
    instantiate(composite, SCA_WIRE, composite.getWire(), wireProcessor, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaCompositeProcessor.java
Override
  protected final void doComplete(Composite composite, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Complete the composite components.
    complete(composite, SCA_COMPONENT, composite.getComponent(), componentProcessor, processingContext);
    // Complete the composite services.
    complete(composite, SCA_SERVICE, composite.getService(), serviceProcessor, processingContext);
    // Complete the composite references.
    complete(composite, SCA_REFERENCE, composite.getReference(), referenceProcessor, processingContext);
    // Complete the composite properties.
    complete(composite, SCA_PROPERTY, composite.getProperty(), propertyProcessor, processingContext);
    // Complete the composite wires.
    complete(composite, SCA_WIRE, composite.getWire(), wireProcessor, processingContext);
    // Retrieve the composite component from the processing context.
    Component compositeComponent = getFractalComponent(composite, processingContext);
    // Complete required intents for the composite.
    completeRequires(composite, composite.getRequires(), compositeComponent, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractIntentProcessor.java
protected final void completeRequires(EObjectType element, List<QName> requires, Component component, ProcessingContext processingContext)
      throws ProcessorException
  {
    logDo(processingContext, element, "complete required intents");
	if(requires == null) {
      return;
	}
    // Get the intent controller of the given component.
    SCABasicIntentController intentController;
    try {
      intentController = (SCABasicIntentController) component.getFcInterface(SCABasicIntentController.NAME);
    } catch (NoSuchInterfaceException nsie) {
      severe(new ProcessorException(element, "Cannot get to the FraSCAti intent controller", nsie));
      return;
    }
    for (QName require : requires) {
      // Try to retrieve intent service from cache.
      Component intentComponent;
      try {
    	intentComponent = intentLoader.getComposite(require);
      } catch(ManagerException me) {
        warning(new ProcessorException("Error while getting intent '" + require
                  + "'", me));
        return;
      }
      IntentHandler intentHandler;
      try {
        // Get the intent handler of the intent composite.
        intentHandler = (IntentHandler)intentComponent.getFcInterface("intent");
      } catch (NoSuchInterfaceException nsie) {
        warning(new ProcessorException(element, "Intent '" + require
              + "' does not provide an 'intent' service", nsie));
        return;
      } catch (ClassCastException cce) {
        warning(new ProcessorException(element, "Intent '" + require
                  + "' does not provide an 'intent' service of interface " +
                  IntentHandler.class.getCanonicalName(), cce));
        return;
      }
      try {
        // Add the intent handler.
    	logDo(processingContext, element, "adding intent handler");
        addIntentHandler(element, intentController, intentHandler);
    	logDone(processingContext, element, "adding intent handler");
      } catch (Exception e) {
        severe(new ProcessorException(element, "Intent '" + require + "' cannot be added", e));
        return;
      }
    }
    logDone(processingContext, element, "complete required intents");
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaImplementationCompositeProcessor.java
Override
  protected final void doCheck(SCAImplementation scaImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Check the implementation composite name.
    checkAttributeMustBeSet(scaImplementation, "name", scaImplementation.getName(), processingContext);
    if(scaImplementation.getName() != null) {
      // Retrieve the parsed composite from the processing context.
      // This data was put by the FraSCAti SCA Parser ImplementationCompositeResolver.
      Composite composite = processingContext.getData(scaImplementation, Composite.class);
      compositeProcessor.check(composite, processingContext);
    }
    // TODO: 'requires' must be checked here.
    // Does the intent composite exist?
    // Is this composite an intent (service Intent of interface IntentHandler)?
    // check attributes 'policySets' and 'requires'.
    checkImplementation(scaImplementation, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaImplementationCompositeProcessor.java
Override
  protected final void doGenerate(SCAImplementation scaImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Retrieve the composite from the processing context.
    Composite composite = processingContext.getData(scaImplementation, Composite.class);
    // Generating the composite.
    compositeProcessor.generate(composite, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaImplementationCompositeProcessor.java
Override
  protected final void doInstantiate(SCAImplementation scaImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Retrieve the composite from the processing context.
    Composite composite = processingContext.getData(scaImplementation, Composite.class);
    // Instantiating the composite component.
    compositeProcessor.instantiate(composite, processingContext);
    // store the component into the processing context.
    processingContext.putData(scaImplementation, Component.class, getFractalComponent(composite, processingContext));
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaImplementationCompositeProcessor.java
Override
  protected final void doComplete(SCAImplementation scaImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Retrieve the composite from the processing context.
    Composite composite = processingContext.getData(scaImplementation, Composite.class);
    // Completing the composite.
    compositeProcessor.complete(composite, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractImplementationProcessor.java
protected final void checkImplementation(ImplementationType implementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Check the implementation policy sets.
	checkAttributeNotSupported(implementation, "policySets", implementation.getPolicySets() != null, processingContext);
    // Check the composite requires.
    checkAttributeNotSupported(implementation, "requires", implementation.getRequires() != null, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaBindingScaProcessor.java
Override
  protected final void doCheck(SCABinding scaBinding, ProcessingContext processingContext)
      throws ProcessorException
  {
    String uri = scaBinding.getUri();
	if(hasBaseService(scaBinding)) {
	  // The parent of this binding is a <service>.
	  if(uri != null) {
        warning(processingContext, scaBinding, "The attribute 'uri' on a SCA service is not supported by OW2 FraSCAti");
	  }
	} else {
	  // The parent of this binding is a <reference>.
	  if(isNullOrEmpty(uri)) {
        error(processingContext, scaBinding, "The attribute 'uri' must be 'compositeName/componentName*/serviceName'");
	  } else {
        String[] parts = uri.split("/");
        if(parts.length < 2) {
          error(processingContext, scaBinding, "The attribute 'uri' must be 'compositeName/componentName*/serviceName'");
        } else {
          // Obtain the composite.
          String compositeName = parts[0];
          if(compositeName.equals(processingContext.getRootComposite().getName())) {
            // The searched composite is the currently processed root SCA composite.
        	// TODO Check if the SCA service exists.
          } else {
            // The searched composite is another composite loaded into the domain, so get it.
            Component component = null;
            try {
              component = compositeManager.getComposite(compositeName);
            } catch(ManagerException me) {
              error(processingContext, scaBinding, "Composite '", compositeName, "' not found");
            }
            if(component != null) {
              // Find the service from the uri.
              Object service = findService(scaBinding, processingContext, component, parts);
              if(service != null) {
                // Store the found service into the processing context.
                processingContext.putData(scaBinding, Object.class, service);
              }
            }
          }
        }
	  }
	}
	// Check other attributes of the binding.
    checkBinding(scaBinding, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaBindingScaProcessor.java
protected final Object findService(SCABinding scaBinding, ProcessingContext processingContext, Component initialComponent, String[] parts)
    throws ProcessorException
  {
    Component component = initialComponent;
    boolean found = true;
    // Traverse the componentName parts of the uri.
    for(int i=1; i<parts.length-1; i++) {
      found = false;
      // Search the sub component having the searched component name.
      for(Component subComponent : getFractalSubComponents(component)) {
        if(parts[i].equals(getFractalComponentName(subComponent))) {
          component = subComponent;
          found = true;
          break; // the for loop.
        }
      }
      if(!found) {
        error(processingContext, scaBinding, "Component '", parts[i], "' not found");
        return null;
      }
    }
    if(found) {
      // Get the service of the last found component.
      String serviceName = parts[parts.length - 1];
      try {
        return component.getFcInterface(serviceName);
      } catch(NoSuchInterfaceException nsie) {
        error(processingContext, scaBinding, "Service '", serviceName, "' not found");
        return null;
      }
    }
    return null;
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaBindingScaProcessor.java
Override
  protected final void doComplete(SCABinding scaBinding, ProcessingContext processingContext)
      throws ProcessorException
  {
    if(hasBaseService(scaBinding)) {
      // Nothing to do.
      return;
    }
    // Obtain the service computed during doCheck()
    Object service = processingContext.getData(scaBinding, Object.class);
    if(service == null) {
       // The uri should refer to a service of the currently processed SCA composite.
       String[] parts = scaBinding.getUri().split("/");
       if(parts[0].equals(processingContext.getRootComposite().getName())) {
         Component component = getFractalComponent(processingContext.getRootComposite(), processingContext);
         service = findService(scaBinding, processingContext, component, parts);
       }
       if(service == null) {
         // This case should never happen because it should be checked by doCheck()
    	 severe(new ProcessorException(scaBinding, "Should never happen!!!"));
    	 return;
       } 
    }
    // Create a dynamic proxy invocation handler.
    BindingScaInvocationHandler bsih = new BindingScaInvocationHandler();
    // Its delegates to the service found.
    bsih.setDelegate(service);
    // Create a dynamic proxy with the created invocation handler.
    Object proxy = Proxy.newProxyInstance(
                       processingContext.getClassLoader(),
                       new Class<?>[] { getBaseReferenceJavaInterface(scaBinding, processingContext) },
                       bsih);
    // Bind the proxy to the component owning this <binding.sca>.
    bindFractalComponent(
        getFractalComponent(scaBinding, processingContext),
        getBaseReference(scaBinding).getName(),
        proxy);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaComponentProcessor.java
Override
  protected final void doCheck(Component component, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Check the component's name.
    checkAttributeMustBeSet(component, "name", component.getName(), processingContext);
    // Check the component's policy sets.
    checkAttributeNotSupported(component, "policySets", component.getPolicySets() != null, processingContext);
    // Check the component's implementation.
    checkMustBeDefined(component, SCA_IMPLEMENTATION, component.getImplementation(), implementationProcessor, processingContext);      
    // Check the component's services.
    check(component, SCA_SERVICE, component.getService(), serviceProcessor, processingContext);
    // Check the component's references.
    check(component, SCA_REFERENCE, component.getReference(), referenceProcessor, processingContext);
    // Check the component's properties.
    check(component, SCA_PROPERTY, component.getProperty(), propertyProcessor, processingContext);
    // TODO: 'requires' must be checked here.
    // Does the intent composite exist?
    // Is this composite an intent (service Intent of interface IntentHandler)?
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaComponentProcessor.java
Override
  protected final void doGenerate(Component component, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Generate the component type.
    // Also generate the component services and references.
    ComponentType componentType = generateComponentType(component,
         component.getService(), serviceProcessor, component.getReference(), referenceProcessor, processingContext);
    // Keep the component type into the processing context.
    processingContext.putData(component.getImplementation(), ComponentType.class, componentType);
    // Generate the component's implementation.
    generate(component, SCA_IMPLEMENTATION, component.getImplementation(), implementationProcessor, processingContext);
    // Generate the component's properties.
    generate(component, SCA_PROPERTY, component.getProperty(), propertyProcessor, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaComponentProcessor.java
Override
  protected final void doInstantiate(Component component, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Instantiate the component's implementation.
    instantiate(component, SCA_IMPLEMENTATION, component.getImplementation(), implementationProcessor, processingContext);
  	org.objectweb.fractal.api.Component componentInstance =
  	    getFractalComponent(component.getImplementation(), processingContext);
  	// Add the new component to its enclosing composite.
    org.objectweb.fractal.api.Component enclosingComposite =
        getFractalComponent(component.eContainer(), processingContext);
    addFractalSubComponent(enclosingComposite, componentInstance);
    // set the name for this component.
    setComponentName(component, "component", componentInstance, component.getName(), processingContext);
    // Keep the component instance into the processing context.
    processingContext.putData(component, org.objectweb.fractal.api.Component.class, componentInstance);
    // Instantiate the component's services.
    instantiate(component, SCA_SERVICE, component.getService(), serviceProcessor, processingContext);
    // Instantiate the component's references.
    instantiate(component, SCA_REFERENCE, component.getReference(), referenceProcessor, processingContext);
    // Instantiate the component's properties.
    instantiate(component, SCA_PROPERTY, component.getProperty(), propertyProcessor, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaComponentProcessor.java
Override
  protected final void doComplete(Component component, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Complete the component's implementation.
    complete(component, SCA_IMPLEMENTATION, component.getImplementation(), implementationProcessor, processingContext);
    // Complete the component's services.
    complete(component, SCA_SERVICE, component.getService(), serviceProcessor, processingContext);
    // Complete the component's references.
    complete(component, SCA_REFERENCE, component.getReference(), referenceProcessor, processingContext);
    // Complete the component's properties.
    complete(component, SCA_PROPERTY, component.getProperty(), propertyProcessor, processingContext);
    // Retrieve the component from the processing context.
    org.objectweb.fractal.api.Component componentInstance =
        getFractalComponent(component, processingContext);
    // Complete required intents for the component.
    completeRequires(component, component.getRequires(), componentInstance, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaImplementationJavaProcessor.java
Override
  protected final void doCheck(JavaImplementation javaImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Test if the Java class is present in the current classloader.
    try {
      processingContext.loadClass(javaImplementation.getClass_());
    } catch (ClassNotFoundException cnfe) {
      error(processingContext, javaImplementation, "class '",
          javaImplementation.getClass_(), "' not found");
	  return;
    }
    // check attributes 'policySets' and 'requires'.
    checkImplementation(javaImplementation, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaImplementationJavaProcessor.java
Override
  protected final void doGenerate(JavaImplementation javaImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Generate a FraSCAti SCA primitive component.
    generateScaPrimitiveComponent(javaImplementation, processingContext, javaImplementation.getClass_());
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaImplementationJavaProcessor.java
Override
  protected final void doInstantiate(JavaImplementation javaImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Instantiate a FraSCAti SCA primitive component.
    instantiateScaPrimitiveComponent(javaImplementation, processingContext, javaImplementation.getClass_());
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaPropertyTypeJavaProcessor.java
Override
  protected final void doCheck(SCAPropertyBase property, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Obtain the property type for the given property.
	QName propertyType = processingContext.getData(property, QName.class);
	if(isMatchingOneJavaType(propertyType)) {
	  // This property type processor is attached to the given property.
      processingContext.putData(property, Processor.class, this);
      
      if(propertyType != null) {
    	// if the property type is set then compute the property value.
        doComplete(property, processingContext);
      }
	}
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaPropertyTypeJavaProcessor.java
Override
  protected final void doComplete(SCAPropertyBase property, ProcessingContext processingContext)
      throws ProcessorException
  {
    // The property value as given in a .composite file.
    String propertyValue = property.getValue();
	// Obtain the property type for the given property.
	QName propertyType = processingContext.getData(property, QName.class);
	// Search which the Java type is.
	JavaType javaType = JavaType.VALUES.get(propertyType.getLocalPart());
	if(javaType == null) {
      // Should never happen but we never know!
	  severe(new ProcessorException(property,
          "Java type '" + propertyType.getLocalPart() + "' not supported"));
      return;
	}
	// Compute the property value.
	Object computedPropertyValue;
	try {
		computedPropertyValue = stringToValue(javaType, propertyValue, processingContext.getClassLoader());
	} catch(ClassNotFoundException cnfe) {
      error(processingContext, property, "Java class '", propertyValue, "' not found");
      return;
	} catch(URISyntaxException exc) {
      error(processingContext, property, "Syntax error in URI '", propertyValue, "'");
      return;
	} catch(MalformedURLException exc) {
      error(processingContext, property, "Malformed URL '", propertyValue, "'");
      return;
	} catch(NumberFormatException nfe) {
      error(processingContext, property, "Number format error in '", propertyValue, "'");
      return;
	}
	if (computedPropertyValue == null) {
        // Should never happen but we never know!
        severe(new ProcessorException("Java type known but not dealt by OW2 FraSCAti: " + propertyType));
        return;
	}
    // Attach the computed property value to the given property.
	processingContext.putData(property, Object.class, computedPropertyValue);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessorManager.java
protected final Processor<ElementType> getProcessor(ElementType eObj)
      throws ProcessorException
  {
    if(processorsByID == null) {
      initializeProcessorsByID();
    }
    // retrieve registered processor associated to eObj.
    Processor<ElementType> processor = processorsByID.get(getID(eObj));
    if(processor == null) {
      severe(new ProcessorException(eObj, "No processor for " + getID(eObj)));
      return null;
    }
    return processor;
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessorManager.java
Override
  protected final void doCheck(ElementType element, ProcessingContext processingContext)
      throws ProcessorException
  {
    getProcessor(element).check(element, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessorManager.java
Override
  protected final void doGenerate(ElementType element, ProcessingContext processingContext)
      throws ProcessorException
  {
    getProcessor(element).generate(element, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessorManager.java
Override
  protected final void doInstantiate(ElementType element, ProcessingContext processingContext)
      throws ProcessorException
  {
    getProcessor(element).instantiate(element, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessorManager.java
Override
  protected final void doComplete(ElementType element, ProcessingContext processingContext)
      throws ProcessorException
  {
    getProcessor(element).complete(element, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaComponentReferenceProcessor.java
Override
  protected final void doCheck(ComponentReference componentReference, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Check the attribute 'target'.
    if(componentReference.getTarget() == null) {
      // Let's note that this is not an error as a wire could have this reference as source.
      // TODO: perhaps a trace should be reported, or better
      // all component references without target must be stored in an array, and
      // check at the end of ScaCompositeProcessor.check() if these are promoted
      // by composite references or the source of a wire.
      // An error must be thrown for component references not promoted or wired.
    } else {
      if(componentReference.getTarget2() == null) {
        // Retrieve both target component and service.
        String target[] = componentReference.getTarget().split("/");
        if(target.length != 2) {
          error(processingContext, componentReference, "The attribute 'target' must be 'componentName/serviceName'");
        } else {
          // retrieve the map of components associated to the composite of the component of this reference.
          ComponentMap mapOfComponents = processingContext.getData(componentReference.eContainer().eContainer(), ComponentMap.class);
          org.eclipse.stp.sca.Component targetComponent = mapOfComponents.get(target[0]);
          if(targetComponent == null) {
            error(processingContext, componentReference, "Unknown target component '", target[0], "'");
          } else {
            ComponentService targetComponentService = null;
            for(ComponentService service : targetComponent.getService()) {
              if(target[1].equals(service.getName())) {
              	targetComponentService = service;
                break; // the for loop
              }
            }
            if(targetComponentService == null) {
              error(processingContext, componentReference, "Unknown target service '", target[1], "'");
            } else {
              componentReference.setTarget2(targetComponentService);
            }
          }
        }
      }
    }
    // Check this component reference as a base reference.
    checkBaseReference(componentReference, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaComponentReferenceProcessor.java
Override
  protected final void doComplete(ComponentReference componentReference, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Retrieve the component from the processing context.
	Component component = getFractalComponent(componentReference.eContainer(), processingContext);
	// Etablish the binding to the target.
    if(componentReference.getTarget() != null) {
   	  // Retrieve the target component service, and the target Fractal component.
      BaseService targetComponentService = componentReference.getTarget2();
      org.eclipse.stp.sca.Component targetComponent =
          (org.eclipse.stp.sca.Component)targetComponentService.eContainer();
      String targetComponentServiceName = targetComponentService.getName();
      Component targetComponentInstance = getFractalComponent(targetComponent, processingContext);
      // Etablish a Fractal binding between the reference and the target component service.
      try {
        bindFractalComponent(
          component,
          componentReference.getName(),
    	  getFractalInterface(targetComponentInstance, targetComponentServiceName));
      } catch (Exception e) {
        severe(new ProcessorException(componentReference, "Can't promote " + toString(componentReference), e));
        return;
      }
    }
    // Complete this component reference as a base reference.
    completeBaseReference(componentReference, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractBindingProcessor.java
protected final void checkBinding(BindingType binding, ProcessingContext processingContext)
      throws ProcessorException
  {
    checkAttributeNotSupported(binding, "policySets", binding.getPolicySets() != null, processingContext);
    checkAttributeNotSupported(binding, "requires", binding.getRequires() != null, processingContext);
    checkChildrenNotSupported(binding, "sca:operation", binding.getOperation().size() > 0, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaComponentServiceProcessor.java
Override
  protected final void doCheck(ComponentService componentService, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Check the component service as a base service.
    checkBaseService(componentService, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaComponentServiceProcessor.java
Override
  protected final void doComplete(ComponentService componentService, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Complete the component service as a base service.
    completeBaseService(componentService, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessor.java
protected final <T> void checkMustBeDefined(EObjectType element,
                                        String childName,
                                        T item,
                                        Processor<T> processor,
                                        ProcessingContext processingContext)
      throws ProcessorException
  {
    String message = "check <" + childName + '>';
    logDo(processingContext, element, message);
    if(item == null) {
      error(processingContext, element, "<", childName, "> must be defined");      
    } else {
      processor.check(item, processingContext);
    }
    logDone(processingContext, element, message);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessor.java
protected final <T> void check(EObjectType element,
                           String childName,
                           List<T> list,
                           Processor<T> processor,
                           ProcessingContext processingContext)
      throws ProcessorException
  {
    String message = "check list of <" + childName + '>';
    logDo(processingContext, element, message);
    for (T item : list) {
      processor.check(item, processingContext);
    }
    logDone(processingContext, element, message);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessor.java
protected final <T> void generate(EObjectType element,
                              String childName,
                              T item,
                              Processor<T> processor,
                              ProcessingContext processingContext)
      throws ProcessorException
  {
    String message = "generate <" + childName + '>';
    logDo(processingContext, element, message);
    processor.generate(item, processingContext);
    logDone(processingContext, element, message);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessor.java
protected final <T> void generate(EObjectType element,
                              String childName,
                              List<T> list,
                              Processor<T> processor,
                              ProcessingContext processingContext)
      throws ProcessorException
  {
    String message = "generate list of <" + childName + '>';
    logDo(processingContext, element, message);
    for (T item : list) {
      processor.generate(item, processingContext);
    }
    logDone(processingContext, element, message);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessor.java
protected final <T> void instantiate(EObjectType element,
                                 String childName,
                                 T item,
                                 Processor<T> processor,
                                 ProcessingContext processingContext)
      throws ProcessorException
  {
    String message = "instantiate <" + childName + '>';
    logDo(processingContext, element, message);
    processor.instantiate(item, processingContext);
    logDone(processingContext, element, message);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessor.java
protected final <T> void instantiate(EObjectType element,
                                 String childName,
                                 List<T> list,
                                 Processor<T> processor,
                                 ProcessingContext processingContext)
      throws ProcessorException
  {
    String message = "instantiate list of <" + childName + '>';
    logDo(processingContext, element, message);
    for (T item : list) {
      processor.instantiate(item, processingContext);
     }
    logDone(processingContext, element, message);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessor.java
protected final <T> void complete(EObjectType element,
                              String childName,
                              T item,
                              Processor<T> processor,
                              ProcessingContext processingContext)
      throws ProcessorException
  {
    String message = "complete <" + childName + '>';
    logDo(processingContext, element, message);
    processor.complete(item, processingContext);
    logDone(processingContext, element, message);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessor.java
protected final <T> void complete(EObjectType element,
                              String childName,
                              List<T> list,
                              Processor<T> processor,
                              ProcessingContext processingContext)
      throws ProcessorException
  {
    String message = "complete list of <" + childName + '>';
    logDo(processingContext, element, message);
    for (T item : list) {
      processor.complete(item, processingContext);
    }
    logDone(processingContext, element, message);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessor.java
protected void doCheck(EObjectType element, ProcessingContext processingContext)
      throws ProcessorException
  {
    logFine(processingContext, element, "nothing to check");
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessor.java
protected void doGenerate(EObjectType element, ProcessingContext processingContext)
      throws ProcessorException
  {
    logFine(processingContext, element, "nothing to generate");
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessor.java
protected void doInstantiate(EObjectType element, ProcessingContext processingContext)
      throws ProcessorException
  {
    logFine(processingContext, element, "nothing to instantiate");
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessor.java
protected void doComplete(EObjectType element, ProcessingContext processingContext)
      throws ProcessorException
  {
    logFine(processingContext, element, "nothing to complete");
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessor.java
public final void check(EObjectType element, ProcessingContext processingContext)
      throws ProcessorException
  {
    logFine(processingContext, element, "check...");
    doCheck(element, processingContext);
    logFine(processingContext, element, "checked.");
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessor.java
public final void generate(EObjectType element, ProcessingContext processingContext)
      throws ProcessorException
  {
    logFine(processingContext, element, "generate...");
    doGenerate(element, processingContext);
    logFine(processingContext, element, "successfully generated.");
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessor.java
public final void instantiate(EObjectType element, ProcessingContext processingContext)
      throws ProcessorException
  {
    logFine(processingContext, element, "instantiate...");
    doInstantiate(element, processingContext);
    logFine(processingContext, element, "successfully instantiated.");
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractProcessor.java
public final void complete(EObjectType element, ProcessingContext processingContext)
      throws ProcessorException
  {
    logFine(processingContext, element, "complete...");
    doComplete(element, processingContext);
    logFine(processingContext, element, "successfully completed.");
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaPropertyTypeXsdProcessor.java
Override
  protected final void doCheck(SCAPropertyBase property, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Get the property type of the given property.
	QName propertyType = processingContext.getData(property, QName.class);
	// Check that this property type is an XSD datatype.
	if(getXsdType(propertyType) != null) {
      // Affect this property type processor to the given property.
      processingContext.putData(property, Processor.class, this);
      // Compute the property value to set.
      doComplete(property, processingContext);
	}
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaPropertyTypeXsdProcessor.java
Override
  protected final void doComplete(SCAPropertyBase property, ProcessingContext processingContext)
      throws ProcessorException
  {
    // The property value as given in a .composite file.
    String propertyValue = property.getValue();
    // Get the property type of the given property.
	QName propertyType = processingContext.getData(property, QName.class);
	// Search which the XSD datatype is.
    XsdType xsdType = getXsdType(propertyType);
    if(xsdType == null) {
      // Should never happen but we never know!
      severe(new ProcessorException("Error while converting XSD property datatype: unknown XML type '" + propertyType + "'"));
      return;
    }
    // Compute the property value.
	Object computedPropertyValue;
	try {
      switch (xsdType) {
      case ANYURI:
          try {
            computedPropertyValue = new URI(propertyValue);
          } catch(URISyntaxException exc) {
            error(processingContext, property, "Syntax error in URI '", propertyValue, "'");
            return;
          }
          break;
      case ANYSIMPLETYPE:
          computedPropertyValue = propertyValue;
          break;
      case BASE64BINARY:
          // TODO: is it the right thing to do?
          computedPropertyValue = propertyValue.getBytes();
          break;
      case BOOLEAN:
          computedPropertyValue = Boolean.valueOf(propertyValue);
          break;
      case BYTE:
          computedPropertyValue = Byte.valueOf(propertyValue);
          break;
      case DATE:
      case DATETIME:
      case TIME:
      case G:
          try {
            computedPropertyValue = datatypeFactory.newXMLGregorianCalendar(propertyValue);
          } catch(IllegalArgumentException iae) {
            error(processingContext, property, "Invalid lexical representation '", propertyValue, "'");
            return;
          }
          break;
      case DECIMAL:
          computedPropertyValue = new BigDecimal(propertyValue);
          break;
      case DOUBLE:
          computedPropertyValue = Double.valueOf(propertyValue);
          break;
      case DURATION:
          try {
            computedPropertyValue = datatypeFactory.newDuration(propertyValue);
          } catch(IllegalArgumentException iae) {
            error(processingContext, property, "Invalid lexical representation '", propertyValue, "'");
            return;
          }
          break;
      case FLOAT:
          computedPropertyValue = Float.valueOf(propertyValue);
          break;
      case HEXBINARY:
          // TODO: is it the right thing to do?
    	  computedPropertyValue = propertyValue.getBytes();
          break;
      case INT:
          computedPropertyValue = Integer.valueOf(propertyValue); 
          break;
      case INTEGER:
      case LONG:
          computedPropertyValue = Long.valueOf(propertyValue);
          break;
      case NEGATIVEINTEGER:
      case NONPOSITIVEINTEGER:
          Long negativeInteger = Long.valueOf(propertyValue);
          if(negativeInteger.longValue() > 0) {
            error(processingContext, property, "The value must be a negative integer");
            return;
    	  }
          computedPropertyValue = negativeInteger;
          break;
      case NONNEGATIVEINTEGER:
          Long nonNegativeInteger = Long.valueOf(propertyValue);
          if(nonNegativeInteger.longValue() < 0) {
            error(processingContext, property, "The value must be a non negative integer");
            return;
          }
          computedPropertyValue = nonNegativeInteger;
          break;
      case POSITIVEINTEGER:
          BigInteger positiveInteger = new BigInteger(propertyValue);
          if(positiveInteger.longValue() < 0) {
            error(processingContext, property, "The value must be a positive integer");
            return;
          }
          computedPropertyValue = positiveInteger;
          break;
      case NOTATION:
          computedPropertyValue = QName.valueOf(propertyValue);
          break;
      case UNSIGNEDBYTE:
          Short unsignedByte = Short.valueOf(propertyValue);
          if(unsignedByte.shortValue() < 0) {
            error(processingContext, property, "The value must be a positive byte");
            return;
          }
          computedPropertyValue = unsignedByte;
          break;
      case UNSIGNEDINT:
          Long unsignedInt = Long.valueOf(propertyValue);
          if(unsignedInt.longValue() < 0) {
            error(processingContext, property, "The value must be a positive integer");
            return;
          }
          computedPropertyValue = unsignedInt;
          break;
      case UNSIGNEDLONG:
          Long unsignedLong = Long.valueOf(propertyValue);
          if(unsignedLong.longValue() < 0) {
            error(processingContext, property, "The value must be a positive long");
            return;
          }
          computedPropertyValue = unsignedLong;
          break;
      case UNSIGNEDSHORT:
    	  Integer unsignedShort = Integer.valueOf(propertyValue);
          if(unsignedShort.intValue() < 0) {
            error(processingContext, property, "The value must be a positive short");
            return;
          }
          computedPropertyValue = unsignedShort;
          break;
      case SHORT:
          computedPropertyValue = Short.valueOf(propertyValue);
          break;
      case STRING:
          computedPropertyValue = propertyValue;
          break;
      case QNAME:
          computedPropertyValue = QName.valueOf(propertyValue);
          break;
      default:
          // Should never happen but we never know!
          severe(new ProcessorException(property, "The XSD-based '" + propertyType + "' property datatype is known but not dealt by OW2 FraSCAti!"));
          return ;
      }
    } catch(NumberFormatException nfe) {
      error(processingContext, property, "Number format error in '", propertyValue, "'");
      return;
    }
    // Attach the computed property value to the given property.
	processingContext.putData(property, Object.class, computedPropertyValue);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractBaseReferencePortIntentProcessor.java
protected final void checkBaseReference(EObjectType baseReference, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Check the base reference name.
    checkAttributeMustBeSet(baseReference, "name", baseReference.getName(), processingContext);
    // Check the base reference policy sets.
    checkAttributeNotSupported(baseReference, "policySets", baseReference.getPolicySets() != null, processingContext);
    // Check the base reference wiredByImpl.
    checkAttributeNotSupported(baseReference, "wiredByImpl", baseReference.isSetWiredByImpl(), processingContext);
    // TODO: 'requires' must be checked here.
    // Does the intent composite exist?
    // Is this composite an intent (service Intent of interface IntentHandler)?
    // Check the base reference interface.
    checkMustBeDefined(baseReference, SCA_INTERFACE, baseReference.getInterface(), getInterfaceProcessor(), processingContext);
    // TODO check callback
    // interfaceProcessor.check(baseReference.getCallback(), processingContext);
    // Check the base reference bindings.
    check(baseReference, SCA_BINDING, baseReference.getBinding(), getBindingProcessor(), processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractBaseReferencePortIntentProcessor.java
private void generateInterfaceType(EObjectType baseReference, ProcessingContext processingContext)
    throws ProcessorException
  {
    // Generate the base reference interface.
    generate(baseReference, SCA_INTERFACE, baseReference.getInterface(), getInterfaceProcessor(), processingContext);
	// Corresponding Java interface class name.
	String interfaceClassName = processingContext.getData(baseReference.getInterface(), JavaClass.class)
	                            .getClassName();
	// Name for the generated interface type.
    String interfaceName = baseReference.getName();
    Multiplicity multiplicity = baseReference.getMultiplicity();
    // Indicates if the interface is mandatory or optional.
    boolean contingency = CONTINGENCIES.get(multiplicity);
    // indicates if component interface is single or collection.
    boolean cardinality = CARDINALITIES.get(multiplicity);
    // Create the Fractal interface type.
    InterfaceType interfaceType;
    String logMessage = "create a Fractal client interface type " + interfaceClassName + " for "
                      + interfaceName + " with contingency = " + contingency
                      + " and cardinality = " + cardinality;
    try {
      logDo(processingContext, baseReference, logMessage);
      interfaceType = getTypeFactory().createInterfaceType(interfaceName, interfaceClassName,
	    		  TypeFactory.CLIENT, contingency, cardinality);
      logDone(processingContext, baseReference, logMessage);
    } catch (FactoryException te) {
      severe(new ProcessorException(baseReference, "Could not " + logMessage, te));
      return;
    }
    // Keep the Fractal interface type into the processing context.
    processingContext.putData(baseReference, InterfaceType.class, interfaceType);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractBaseReferencePortIntentProcessor.java
protected final void completeBaseReference(EObjectType baseReference, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Complete the composite reference interface.
    complete(baseReference, SCA_INTERFACE, baseReference.getInterface(), getInterfaceProcessor(), processingContext);
    // Complete the composite reference bindings.
    complete(baseReference, SCA_BINDING, baseReference.getBinding(), getBindingProcessor(), processingContext);
    // Retrieve the component from the processing context.
	Component component = getFractalComponent(baseReference.eContainer(), processingContext);
    // Complete the composite reference required intents.
	completeRequires(baseReference, baseReference.getRequires(), component, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractBaseReferencePortIntentProcessor.java
Override
  protected final void doGenerate(EObjectType baseReference, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Generate the base reference interface type.
    generateInterfaceType(baseReference, processingContext);
    // Generate the base reference bindings.
    generate(baseReference, SCA_BINDING, baseReference.getBinding(), getBindingProcessor(), processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractBaseReferencePortIntentProcessor.java
Override
  protected final void doInstantiate(EObjectType baseReference, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Instantiate the base reference interface.
    instantiate(baseReference, SCA_INTERFACE, baseReference.getInterface(), getInterfaceProcessor(), processingContext);
    // Instantiate the base reference bindings.
    instantiate(baseReference, SCA_BINDING, baseReference.getBinding(), getBindingProcessor(), processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractPropertyProcessor.java
protected final void checkProperty(PropertyType property, QName propertyType, ProcessingContext processingContext)
    throws ProcessorException
  {
    // Associate the property type to the property.
    processingContext.putData(property, QName.class, propertyType);
    // Search which property type processor matches the given property type.
    boolean isPropertyTypeMatchedByOnePropertyTypeProcessor = false;
    for(Processor<PropertyType> propertyTypeProcessor : propertyTypeProcessors) {
      // check the property type and value.
      propertyTypeProcessor.check(property, processingContext);
      if(processingContext.getData(property, Processor.class) != null) {
        // the current property type processor matched the property type.
        isPropertyTypeMatchedByOnePropertyTypeProcessor = true;
    	break; // the for loop.
      }
    }
    // Produce an error when no property processor type matches the property type.
    if(!isPropertyTypeMatchedByOnePropertyTypeProcessor) {
      error(processingContext, property, "Unknown property type '", propertyType.toString(), "'");
    }
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractPropertyProcessor.java
protected final void setProperty(PropertyType property, String propertyName, ProcessingContext processingContext)
    throws ProcessorException
  {
    // Retrieve the Fractal component associated to the SCA composite/component of the given property.
	Component component = getFractalComponent(property.eContainer(), processingContext);
    // Retrieve the SCA property controller of this Fractal component.
    SCAPropertyController propertyController;
    try {
      propertyController = (SCAPropertyController)component.getFcInterface(SCAPropertyController.NAME);
    } catch (NoSuchInterfaceException nsie) {
      severe(new ProcessorException(property, "Can't get the SCA property controller", nsie));
      return;
    }
    // Retrieve the property value set by the property type processor.
    Object propertyValue = processingContext.getData(property, Object.class);
    if(propertyValue == null) {
      // The property type processor didn't compute a property value during check()
      // Then it is needed to call complete() to compute this property value.
      // Retrieve the property type associated to this property.
      QName propertyType = processingContext.getData(property, QName.class);
      if(propertyType == null) {
        // When no property type then get the property type via the property controller.
        Class<?> clazz = propertyController.getType(propertyName);
        if(clazz == null) {
    	  // When no property type defined then consider that it is String
          clazz = String.class;
        }
        // Reput the property type into the processing context.
        processingContext.putData(property, QName.class,
            new QName(ScaPropertyTypeJavaProcessor.OW2_FRASCATI_JAVA_NAMESPACE, clazz.getCanonicalName()));
      }
      // Retrieve the property type processor set during the method checkProperty()
      @SuppressWarnings("unchecked")
      Processor<PropertyType> propertyTypeProcessor = (Processor<PropertyType>)
          processingContext.getData(property, Processor.class);
      // Compute the property value.
      propertyTypeProcessor.complete(property, processingContext);
      // Retrieve the property value set by the property type processor.
      propertyValue = processingContext.getData(property, Object.class);
    }
    // set the property value and type via the property controller.
    propertyController.setValue(propertyName, propertyValue);
    propertyController.setType(propertyName, propertyValue.getClass());
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaCompositeReferenceProcessor.java
Override
  protected final void doCheck(Reference reference, ProcessingContext processingContext)
      throws ProcessorException
  {
    // List for storing the promoted component references.
    List<ComponentReference> promotedComponentReferences = new ArrayList<ComponentReference>();
    // Check the attribute 'promote'.
    String promoteAttribute = reference.getPromote();
    if(promoteAttribute == null) {
      warning(processingContext, reference, "The attribute 'promote' is not set");    	  
    } else {
      // Retrieve the map of components for the composite of this reference.    	
      ComponentMap mapOfComponents = processingContext.getData(reference.eContainer(), ComponentMap.class);
      for (String promoteValue : promoteAttribute.split("\\s")) {
      	// Retrieve both promoted component and reference.
        String promoted[] = promoteValue.split("/");
        if(promoted.length != 2) {
          error(processingContext, reference, "The value '", promoteValue, "' must be 'componentName/referenceName'");
        } else {
          org.eclipse.stp.sca.Component promotedComponent = mapOfComponents.get(promoted[0]);
          if(promotedComponent == null) {
            error(processingContext, reference, "Unknown promoted component '", promoted[0], "'");
          } else {
            ComponentReference promotedComponentReference = null;
            for(ComponentReference cr : promotedComponent.getReference()) {
              if(promoted[1].equals(cr.getName())) {
                promotedComponentReference = cr;
                break; // the for loop
              }
            }
            if(promotedComponentReference == null) {
              error(processingContext, reference, "Unknown promoted reference '", promoted[1], "'");
            } else {
              promotedComponentReferences.add(promotedComponentReference);
            }
          }
        }
      }
    }
    // store the promoted component references to be dealt later in method complete().
    processingContext.putData(reference, ComponentReference[].class,
        promotedComponentReferences.toArray(new ComponentReference[promotedComponentReferences.size()]));
    // Check this composite reference as a base reference.
    checkBaseReference(reference, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaCompositeReferenceProcessor.java
Override
  protected final void doComplete(Reference reference, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Retrieve the component from the processing context.
	Component component = getFractalComponent(reference.eContainer(), processingContext);
    // Promote component references.
    for(ComponentReference componentReference :
        processingContext.getData(reference, ComponentReference[].class))
    {
      Component promotedComponent = getFractalComponent(componentReference.eContainer(), processingContext);
      bindFractalComponent(
          promotedComponent,
          componentReference.getName(),
          getFractalInternalInterface(component, reference.getName()));
    }
    // Complete this composite reference as a base reference.
    completeBaseReference(reference, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractBaseServicePortIntentProcessor.java
protected final void checkBaseService(EObjectType baseService, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Check the base service name.
    checkAttributeMustBeSet(baseService, "name", baseService.getName(), processingContext);
    // Check the base service policy sets.
    checkAttributeNotSupported(baseService, "policySets", baseService.getPolicySets() != null, processingContext);
    // TODO: 'requires' must be checked here.
    // Does the intent composite exist?
    // Is this composite an intent (service Intent of interface IntentHandler)?
    // Check the base service interface.
    checkMustBeDefined(baseService, SCA_INTERFACE, baseService.getInterface(), getInterfaceProcessor(), processingContext);
    // TODO interfaceProcessor.check(baseService.getCallback(), processingContext);
    
    // Check the base service operations.
    checkChildrenNotSupported(baseService, SCA_OPERATION, baseService.getOperation().size() > 0, processingContext);
    // TODO operationProcessor.check(baseService.getOperation(), processingContext);
    // Check the base service bindings.
    check(baseService, SCA_BINDING, baseService.getBinding(), getBindingProcessor(), processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractBaseServicePortIntentProcessor.java
private void generateInterfaceType(EObjectType baseService, ProcessingContext processingContext)
    throws ProcessorException
  {
    // Generate the base service interface.
    generate(baseService, SCA_INTERFACE, baseService.getInterface(), getInterfaceProcessor(), processingContext);
	// Corresponding Java interface class name.
	String interfaceClassName = processingContext.getData(baseService.getInterface(), JavaClass.class)
	                            .getClassName();
	// Name for the generated interface type.
    String interfaceName = baseService.getName();
    // Indicates if the interface is mandatory or optional.
    boolean contingency = TypeFactory.MANDATORY;
    // indicates if component interface is single or collection.
    boolean cardinality = TypeFactory.SINGLE;
    // Create the Fractal interface type.
    InterfaceType interfaceType;
    String logMessage = "create a Fractal server interface type " + interfaceClassName + " for "
                      + interfaceName + " with contingency = " + contingency
                      + " and cardinality = " + cardinality;
    try {
      logDo(processingContext, baseService, logMessage);
      interfaceType = getTypeFactory().createInterfaceType(interfaceName, interfaceClassName,
	    		  TypeFactory.SERVER, contingency, cardinality);
      logDone(processingContext, baseService, logMessage);
    } catch (FactoryException te) {
      severe(new ProcessorException(baseService, "Could not " + logMessage, te));
      return;
    }
    // Keep the Fractal interface type into the processing context.
    processingContext.putData(baseService, InterfaceType.class, interfaceType);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractBaseServicePortIntentProcessor.java
protected final void completeBaseService(EObjectType baseService, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Complete the base service interface.
    complete(baseService, SCA_INTERFACE, baseService.getInterface(), getInterfaceProcessor(), processingContext);
    // Complete the base service bindings.
    complete(baseService, SCA_BINDING, baseService.getBinding(), getBindingProcessor(), processingContext);
    // Retrieve the component from the processing context.
	Component component = getFractalComponent(baseService.eContainer(), processingContext);
	// Complete the base service required intents.
	completeRequires(baseService, baseService.getRequires(), component, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractBaseServicePortIntentProcessor.java
Override
  protected final void doGenerate(EObjectType baseService, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Generate the base service interface type.
    generateInterfaceType(baseService, processingContext);
    // Generate the base service bindings.
    generate(baseService, SCA_BINDING, baseService.getBinding(), getBindingProcessor(), processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractBaseServicePortIntentProcessor.java
Override
  protected final void doInstantiate(EObjectType baseService, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Instantiate the base service interface.
    instantiate(baseService, SCA_INTERFACE, baseService.getInterface(), getInterfaceProcessor(), processingContext);
    // Instantiate the base service bindings.
    instantiate(baseService, SCA_BINDING, baseService.getBinding(), getBindingProcessor(), processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractComponentProcessor.java
protected final ComponentType generateComponentType(
          ElementType element,
          List<ServiceType> services,
          Processor<ServiceType> serviceProcessor,
          List<ReferenceType> references,
          Processor<ReferenceType> referenceProcessor,
          ProcessingContext processingContext)
      throws ProcessorException
  {
	logDo(processingContext, element, "generate the component type");
	// Create a list of Fractal interface types.
    List<InterfaceType> interfaceTypes = new ArrayList<InterfaceType>();
    // Create interface types for services.
    for (ServiceType cs : services) {
      serviceProcessor.generate(cs, processingContext);
      interfaceTypes.add(processingContext.getData(cs, InterfaceType.class));
    }
    // Create interface types for references.
    for (ReferenceType cr : references) {
      referenceProcessor.generate(cr, processingContext);
      interfaceTypes.add(processingContext.getData(cr, InterfaceType.class));
    }
    InterfaceType[] itftype = interfaceTypes.toArray(new InterfaceType[interfaceTypes.size()]);
    ComponentType componentType;
    try {
      logDo(processingContext, element, "generate the associated component type");
      componentType = typeFactory.createComponentType(itftype);
      logDone(processingContext, element, "generate the associated component type");
    } catch(FactoryException te) {
      severe(new ProcessorException(element, "component type creation for " + toString(element) + " failed", te));
      return null;
    }
    // Keep the component type into the processing context.
    processingContext.putData(element, ComponentType.class, componentType);
    
    logDone(processingContext, element, "generate the component type");
    return componentType;
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/AbstractComponentProcessor.java
protected final void setComponentName(ElementType element, String whatComponent, Component component, String name, ProcessingContext processingContext)
      throws ProcessorException
  {
    String message = "set the component name of the " + whatComponent + " to '" + name + "'";
    logDo(processingContext, element, message);
    // set the name of the component.
    setFractalComponentName(component, name);
    logDone(processingContext, element, message);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaComponentPropertyProcessor.java
Override
  protected final void doCheck(PropertyValue property, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Check the property name.
    checkAttributeMustBeSet(property, "name", property.getName(), processingContext);
    // Check the property value or source.
    String propertyValue = property.getValue();
    String propertySource = property.getSource();
    logDo(processingContext, property, "check the attributes 'value' or 'source'");
    if( ( propertyValue == null && propertySource == null )
     || ( propertyValue != null && propertySource != null ) ) {
      error(processingContext, property, "The property value or the attribute 'source' must be set");
    }
    logDone(processingContext, property, "check the attributes 'value' or 'source'");
    // Check the attribute 'source'.   
    if(propertySource != null && propertyValue == null) {
      if(propertySource.equals("")) {
        error(processingContext, property, "The attribute 'source' must be set");
      } else {
        if (propertySource.startsWith("$")) {
          propertySource = propertySource.substring(1);
        }
        // Has the enclosing composite a property of this name?
        Property compositeProperty = null;
        for(Property cp : ((Composite)property.eContainer().eContainer()).getProperty()) {
          if(propertySource.equals(cp.getName())) {
            compositeProperty = cp;
            break; // the for loop.
          }
        }
        if(compositeProperty == null) {
          error(processingContext, property, "The source composite property '", propertySource, "' is not defined");
        }
      }
    }
        
    // Check the property attribute 'many'.
    checkAttributeNotSupported(property, "many", property.isSetMany(), processingContext);
    // Check the property attribute 'file'.
    checkAttributeNotSupported(property, "file", property.getFile() != null, processingContext);
    // Check the component property type and value.
    QName propertyType = (property.getElement() != null) ? property.getElement() : property.getType();
    checkProperty(property, propertyType, processingContext);
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaComponentPropertyProcessor.java
Override
  protected final void doComplete(PropertyValue property, ProcessingContext processingContext)
      throws ProcessorException
  {
	// Setting the property value.
    String propertySource = property.getSource();
    if (propertySource != null) {
      if (propertySource.startsWith("$")) {
        propertySource = propertySource.substring(1);
      }
      // Retrieve the component from the processing context.
      Component component = getFractalComponent(property.eContainer(), processingContext);
 
      // Retrieve the SCA property controller of the component.
      SCAPropertyController propertyController;
      try {
        propertyController = (SCAPropertyController)component.getFcInterface(SCAPropertyController.NAME);
      } catch (NoSuchInterfaceException nsie) {
        severe(new ProcessorException(property, "Could not get the SCA property controller", nsie));
        return;
      }
      // Retrieve the SCA property controller of the enclosing composite.
      Component enclosingComposite =
          getFractalComponent(property.eContainer().eContainer(), processingContext);
      SCAPropertyController enclosingCompositePropertyController;
      try {
    	  enclosingCompositePropertyController =
              (SCAPropertyController) enclosingComposite.getFcInterface(SCAPropertyController.NAME);
      } catch(NoSuchInterfaceException nsie) {
        severe(new ProcessorException(property,
            "Could not get the SCA property controller of the enclosing composite", nsie));
        return;
      }
      try {
        enclosingCompositePropertyController.setPromoter(propertySource, propertyController, property.getName());
      } catch (IllegalPromoterException ipe) {
        severe(new ProcessorException(property, "Property '" + property.getName()
  	          + "' cannot be promoted by the enclosing composite", ipe));
        return;
      }
    } else {
      // Set the component property.
      setProperty(property, property.getName(), processingContext);
    }
  }
              
// in modules/frascati-assembly-factory/src/main/java/org/ow2/frascati/assembly/factory/processor/ScaInterfaceJavaProcessor.java
Override
  protected final void doCheck(JavaInterface javaInterface, ProcessingContext processingContext)
      throws ProcessorException
  {
	if(javaInterface.getInterface() == null) {
      error(processingContext, javaInterface, "the attribute 'interface' must be set");
	} else {
      try {
        logDo(processingContext, javaInterface, "check the Java interface");
        Class<?> clazz = processingContext.loadClass(javaInterface.getInterface());
        logDone(processingContext, javaInterface, "check the Java interface");
        // Store the Java class into the processing context.
        storeJavaInterface(javaInterface, processingContext, javaInterface.getInterface(), clazz);
      } catch (ClassNotFoundException cnfe) {
	    error(processingContext, javaInterface,
	        "Java interface '", javaInterface.getInterface(), "' not found");
      }
    }
	if(javaInterface.getCallbackInterface() != null) {
      try {
       logDo(processingContext, javaInterface, "check the Java callback interface");
       processingContext.loadClass(javaInterface.getCallbackInterface());
       logDone(processingContext, javaInterface, "check the Java callback interface");
      } catch (ClassNotFoundException cnfe) {
	    error(processingContext, javaInterface,
            "Java callback interface '", javaInterface.getCallbackInterface(), "' not found");
      }
	}
  }
              
// in modules/frascati-implementation-fractal/src/main/java/org/ow2/frascati/implementation/fractal/FrascatiImplementationFractalProcessor.java
Override
  protected final void doCheck(FractalImplementation fractalImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    String fractalImplementationDefinition = fractalImplementation.getDefinition();
    if(isNullOrEmpty(fractalImplementationDefinition)) {
      error(processingContext, fractalImplementation, "The attribute 'definition' must be set");
    } else {
      int index = fractalImplementationDefinition.indexOf('(');
      String fractalFile = (index == -1)
                         ? fractalImplementationDefinition
                         : fractalImplementationDefinition.substring(0, index);
      if(processingContext.getResource(fractalFile.replace(".", "/") + ".fractal") == null) {
        error(processingContext, fractalImplementation, "Fractal definition '", fractalFile, "' not found");
      }
    }
    // check attributes 'policySets' and 'requires'.
    checkImplementation(fractalImplementation, processingContext);
  }
              
// in modules/frascati-implementation-fractal/src/main/java/org/ow2/frascati/implementation/fractal/FrascatiImplementationFractalProcessor.java
Override
  protected final void doGenerate(FractalImplementation fractalImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    logFine(processingContext, fractalImplementation, "nothing to generate");
  }
              
// in modules/frascati-implementation-fractal/src/main/java/org/ow2/frascati/implementation/fractal/FrascatiImplementationFractalProcessor.java
Override
  protected final void doInstantiate(FractalImplementation fractalImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    String definition = fractalImplementation.getDefinition();
    Component component;
    try {
      // Try loading from definition generated with Juliac
      Class<?> javaClass = processingContext.loadClass(definition);
      Factory object = (Factory) javaClass.newInstance();
      // Create the component instance.
      component = object.newFcInstance();
    } catch (ClassNotFoundException e) {
      // Create the Julia bootstrap component the first time is needed.
      if(juliaBootstrapComponent == null) {
        try {
          juliaBootstrapComponent = new MyJulia().newFcInstance();
        } catch (org.objectweb.fractal.api.factory.InstantiationException ie) {
          // Error on MyJulia
          severe(new ProcessorException(fractalImplementation, "Error into the Fractal implementation : "
                + definition, ie));
          return;
        }
      }
      // Generated class not found try with fractal definition and Fractal ADL
      try {
        // init a Fractal ADL factory.
        org.objectweb.fractal.adl.Factory fractalAdlFactory = FactoryFactory.getFactory(FactoryFactory.FRACTAL_BACKEND);
        // init a Fractal ADL context.
        Map<Object, Object> context = new HashMap<Object, Object>();
        // ask the Fractal ADL factory to the Julia Fractal bootstrap.
        context.put("bootstrap", juliaBootstrapComponent);
        // ask the Fractal ADL factory to use the current FraSCAti processing context classloader.
        context.put("classloader", processingContext.getClassLoader());
        // load the Fractal ADL definition and create the associated Fractal component.
        component = (Component) fractalAdlFactory.newComponent(definition, context);
      } catch (ADLException ae) {
        // Error with Fractal ADL
        severe(new ProcessorException(fractalImplementation, "Error into the Fractal implementation : "
            + definition, ae));
        return;
      }
    } catch (InstantiationException ie) {
      severe(new ProcessorException(fractalImplementation,
          "Error when building instance for class " + definition, ie));
      return;
    } catch (IllegalAccessException iae) {
      severe(new ProcessorException(fractalImplementation, "Can't access class "
          + definition, iae));
      return;
    } catch (org.objectweb.fractal.api.factory.InstantiationException ie) {
      severe(new ProcessorException(fractalImplementation,
          "Error when building component instance: " + definition, ie));
      return;
    }
 
    // Store the created component into the processing context.
    processingContext.putData(fractalImplementation, Component.class, component);
  }
              
// in modules/frascati-binding-factory/src/main/java/org/ow2/frascati/binding/factory/AbstractBindingFactoryProcessor.java
Override
  protected void doCheck(BindingType binding, ProcessingContext processingContext)
      throws ProcessorException
  {
    checkBinding(binding, processingContext);
  }
              
// in modules/frascati-binding-factory/src/main/java/org/ow2/frascati/binding/factory/AbstractBindingFactoryProcessor.java
Override
  protected final void doComplete(BindingType binding, ProcessingContext processingContext)
      throws ProcessorException
  {
    Component component = getFractalComponent(binding, processingContext);
    Map<String, Object> hints = createBindingFactoryHints(binding, processingContext.getClassLoader());
    if(hasBaseReference(binding)) {
      BaseReference reference = getBaseReference(binding);
      String referenceName = reference.getName();
      // Following deal with references having a 0..N or 1..N multiplicity and several bindings.
      Multiplicity multiplicity = reference.getMultiplicity();
      if(Multiplicity._0N.equals(multiplicity) || Multiplicity._1N.equals(multiplicity)) {
        // Add a unique suffix to the reference name.
        int index = reference.getBinding().indexOf(binding);
        referenceName = referenceName + '-' + index;
      }
      try {
        log.fine("Calling binding factory\n bind: "
            + getFractalComponentName(component) + " -> "
            + referenceName);
        bindingFactory.bind(component, referenceName, hints);
      } catch (BindingFactoryException bfe) {
        severe(new ProcessorException(binding, "Error while binding reference: " + referenceName, bfe));
        return;
      }
      return;
    }
    if(hasBaseService(binding)) {
      BaseService service = getBaseService(binding);
      String serviceName = service.getName();
      try {
        log.fine("Calling binding factory\n export : "
            + getFractalComponentName(component) + " -> "
            + serviceName);
        bindingFactory.export(component, serviceName, hints);
      } catch (BindingFactoryException bfe) {
        severe(new ProcessorException("Error while binding service: " + serviceName, bfe));
        return;
      }
    }
  }
              
// in modules/frascati-implementation-resource/src/main/java/org/ow2/frascati/implementation/resource/FrascatiImplementationResourceProcessor.java
Override
  protected final void doCheck(ResourceImplementation resourceImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    String location = resourceImplementation.getLocation();
    checkAttributeMustBeSet(resourceImplementation, "location", location, processingContext);
    // Check that location is present in the class path.
    if(!isNullOrEmpty(location) && processingContext.getClassLoader().getResourceAsStream(location) == null) {
      // Location not found.
      error(processingContext, resourceImplementation, "Location '" + location + "' not found");
    }
    // Get the enclosing SCA component.
    Component component = getParent(resourceImplementation, Component.class);
    if(component.getProperty().size() != 0) {
      error(processingContext, resourceImplementation, "<implementation.resource> can't have SCA properties");
    }
    if(component.getReference().size() != 0) {
      error(processingContext, resourceImplementation, "<implementation.resource> can't have SCA references");
    }
    List<ComponentService> services = component.getService();
    if(services.size() > 1) {
      error(processingContext, resourceImplementation, "<implementation.resource> can't have more than one SCA service");
    } else {
      ComponentService service = null;
      if(services.size() == 0) {
        // The component has zero service then add a service to the component.
        service = ScaFactory.eINSTANCE.createComponentService();
        service.setName("Resource");
        services.add(service);
      } else {
    	// The component has one service.
        service = services.get(0);
      }
      // Get the service interface.
      Interface itf = service.getInterface();
      if(itf == null) {
        // The component service has no interface than add a Java Servlet interface.
        JavaInterface javaInterface = ScaFactory.eINSTANCE.createJavaInterface();
        javaInterface.setInterface(Servlet.class.getName());
        service.setInterface(javaInterface);
      } else {
    	// Check if this is a Java Servlet interface.
        boolean isServletInterface = (itf instanceof JavaInterface)
                                   ? Servlet.class.getName().equals(((JavaInterface)itf).getInterface())
                                   : false;
    	if(!isServletInterface) {
          error(processingContext, resourceImplementation, "<service name=\"" + service.getName() + "\"> must have an <interface.java interface=\"" + Servlet.class.getName() + "\">");
    	} 
      }
    }
    // check attributes 'policySets' and 'requires'.
    checkImplementation(resourceImplementation, processingContext);
  }
              
// in modules/frascati-implementation-resource/src/main/java/org/ow2/frascati/implementation/resource/FrascatiImplementationResourceProcessor.java
Override
  protected final void doGenerate(ResourceImplementation resourceImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Generate a FraSCAti SCA primitive component.
    generateScaPrimitiveComponent(resourceImplementation, processingContext, ImplementationResourceComponent.class.getName());
  }
              
// in modules/frascati-implementation-resource/src/main/java/org/ow2/frascati/implementation/resource/FrascatiImplementationResourceProcessor.java
Override
  protected final void doInstantiate(ResourceImplementation resourceImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Instantiate a FraSCAti SCA primitive component.
    org.objectweb.fractal.api.Component component =
      instantiateScaPrimitiveComponent(resourceImplementation, processingContext, ImplementationResourceComponent.class.getName());
    // Retrieve the SCA property controller of this Fractal component.
    SCAPropertyController propertyController =  (SCAPropertyController)getFractalInterface(component, SCAPropertyController.NAME);
    // Set the classloader property.
    propertyController.setValue("classloader", processingContext.getClassLoader());
    // Set the location property.
    propertyController.setValue("location", resourceImplementation.getLocation());
  }
              
// in modules/frascati-implementation-velocity/src/main/java/org/ow2/frascati/implementation/velocity/ImplementationVelocityProcessor.java
Override
  protected final void doCheck(VelocityImplementation velocityImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    String location = velocityImplementation.getLocation();
    checkAttributeMustBeSet(velocityImplementation, "location", location, processingContext);
    boolean checkDefaultInClassLoader = true;
    // Check that location is present in the class path.
    if(!isNullOrEmpty(location) && processingContext.getClassLoader().getResourceAsStream(location) == null) {
      // Location not found.
      error(processingContext, velocityImplementation, "Location '" + location + "' not found");
      checkDefaultInClassLoader = false;
    }
    String default_ = velocityImplementation.getDefault();
    checkAttributeMustBeSet(velocityImplementation, "default", default_, processingContext);
    // Check that default is present in the class path.
    if(checkDefaultInClassLoader && !isNullOrEmpty(default_) && processingContext.getClassLoader().getResourceAsStream(location + '/' + default_) == null) {
      // Default not found.
      error(processingContext, velocityImplementation, "Default '" + default_ + "' not found");
    }
    // Get the enclosing SCA component.
    Component component = getParent(velocityImplementation, Component.class);
    List<ComponentService> services = component.getService();
    if(services.size() > 1) {
      error(processingContext, velocityImplementation, "<implementation.velocity> cannot have more than one SCA service");
    } else {
      ComponentService service = null;
      if(services.size() == 0) {
        // The component has zero service then add a service to the component.
        service = ScaFactory.eINSTANCE.createComponentService();
        service.setName("Velocity");
        services.add(service);
      } else { // The component has one service.
        service = services.get(0);
      }
      // Get the service interface.
      Interface itf = service.getInterface();
      if(itf == null) {
        // The component service has no interface then add a Java Servlet interface.
        JavaInterface javaInterface = ScaFactory.eINSTANCE.createJavaInterface();
        javaInterface.setInterface(Servlet.class.getName());
        service.setInterface(javaInterface);
        itf = javaInterface;
      }
      
      // Stores if the component provides the Servlet interface or not
      processingContext.putData(velocityImplementation, String.class, ((JavaInterface)itf).getInterface());
      processingContext.putData(velocityImplementation, Boolean.class, (itf instanceof JavaInterface)
              ? Servlet.class.getName().equals(((JavaInterface)itf).getInterface())
              : false);
    }
    // check attributes 'policySets' and 'requires'.
    checkImplementation(velocityImplementation, processingContext);
  }
              
// in modules/frascati-implementation-velocity/src/main/java/org/ow2/frascati/implementation/velocity/ImplementationVelocityProcessor.java
Override
  protected final void doGenerate(VelocityImplementation velocityImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
	// Get the parent component.
	Component component = getParent(velocityImplementation, Component.class);
	boolean isServletItf = processingContext.getData(velocityImplementation, Boolean.class);
    // Name of the content class.
    String contentFullClassName = null;
    if(isServletItf && component.getProperty().size() == 0 && component.getReference().size() == 0) {
      // if no property and no reference then use default ImplementationVelocity class.
      contentFullClassName = ServletImplementationVelocity.class.getName();
    } else {
      String basename = isServletItf ? velocityImplementation.getLocation() : velocityImplementation.getLocation()+velocityImplementation.getDefault();
      int hashCode =basename.hashCode();
      if(hashCode < 0) hashCode = -hashCode;
      
      // if some property or some reference then generate an ImplementationVelocity class.
      String contentClassName = "ImplementationVelocity" + hashCode;
      // Add the package to the content class name.
      contentFullClassName = this.packageGeneration + '.' + contentClassName;
      try {
        processingContext.loadClass(contentFullClassName);
      } catch(ClassNotFoundException cnfe) {
        // If the class can not be found then generate it.
        log.info(contentClassName);
        // Create the output directory for generation.
        String outputDirectory = this.membraneGeneration.getOutputDirectory() + "/generated-frascati-sources";
        // Add the output directory to the Java compilation process.
        this.membraneGeneration.addJavaSource(outputDirectory);
        try { // Generate a sub class of ImplementationVelocity declaring SCA references and properties.
            if (isServletItf) {
                ServletImplementationVelocity.generateContent(component, processingContext, outputDirectory, packageGeneration, contentClassName);
            } else {
                Class<?> itf = processingContext.loadClass(processingContext.getData(velocityImplementation, String.class)); 
                ProxyImplementationVelocity.generateContent(component, itf, processingContext, outputDirectory, packageGeneration, contentClassName);
            }
        } catch(FileNotFoundException fnfe) {
            severe(new ProcessorException(velocityImplementation, fnfe));
        } catch (ClassNotFoundException ex) {
            severe(new ProcessorException(velocityImplementation, ex));
        }
      }
    }
    // Generate a FraSCAti SCA primitive component.
    generateScaPrimitiveComponent(velocityImplementation, processingContext, contentFullClassName);
    // Store the content class name to retrieve it from next doInstantiate method.
    processingContext.putData(velocityImplementation, String.class, contentFullClassName);  
  }
              
// in modules/frascati-implementation-velocity/src/main/java/org/ow2/frascati/implementation/velocity/ImplementationVelocityProcessor.java
Override
  protected final void doInstantiate(VelocityImplementation velocityImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Instantiate a FraSCAti SCA primitive component.
    org.objectweb.fractal.api.Component component =
        instantiateScaPrimitiveComponent(velocityImplementation, processingContext,
        		                         processingContext.getData(velocityImplementation, String.class));
    // Retrieve the SCA property controller of this Fractal component.
    SCAPropertyController propertyController =  (SCAPropertyController)getFractalInterface(component, SCAPropertyController.NAME);
    // Set the classloader property.
    propertyController.setValue("classloader", processingContext.getClassLoader());
    // Set the location property.
    propertyController.setValue("location", velocityImplementation.getLocation());
    // Set the default property.
    propertyController.setValue("default", velocityImplementation.getDefault());
  }
              
// in modules/module-gcs/frascati-binding-jgroups/src/main/java/org/ow2/frascati/gcs/binding/FrascatiBindingJGroupsProcessor.java
Override
    protected final void doCheck(JGroupsBinding binding, ProcessingContext ctx)
            throws ProcessorException {
        checkBinding(binding, ctx);
    }
              
// in modules/module-gcs/frascati-binding-jgroups/src/main/java/org/ow2/frascati/gcs/binding/FrascatiBindingJGroupsProcessor.java
Override
    protected final void doGenerate(JGroupsBinding binding,
            ProcessingContext ctx) throws ProcessorException {
        logFine(ctx, binding, "nothing to generate");
    }
              
// in modules/module-gcs/frascati-binding-jgroups/src/main/java/org/ow2/frascati/gcs/binding/FrascatiBindingJGroupsProcessor.java
Override
    protected final void doInstantiate(JGroupsBinding binding,
            ProcessingContext ctx) throws ProcessorException {
        try {
            String cluster = binding.getCluster();
            Class<?> itf = null;
            if (hasBaseReference(binding)) { // Client side
                itf = getBaseReferenceJavaInterface(binding, ctx);
            }
            if (hasBaseService(binding)) { // Server side
                itf = getBaseServiceJavaInterface(binding, ctx);
            }
            if (cluster == null || cluster.equals(""))
                cluster = itf.getName();
            // TODO: Share connector instances for a given cluster
            @SuppressWarnings({ "rawtypes", "unchecked" })
            JGroupsRpcConnector content = new JGroupsRpcConnector(itf);
            ComponentType connectorType = content.getComponentType(tf);
            Component connector = cf.createComponent(connectorType, "primitive", content);
            Component port = getFractalComponent(binding, ctx);
            getNameController(connector).setFcName(
                    getNameController(port).getFcName() + "-jgroups-connector");
            JGroupsRpcAttributes ac = (JGroupsRpcAttributes) getAttributeController(connector);
            ac.setCluster(cluster);
            ac.setProperties(binding.getConfiguration());
            for (Component composite : getSuperController(port)
                    .getFcSuperComponents()) {
                addFractalSubComponent(composite, connector);
            }
            if (hasBaseService(binding)) { // Server side
                BaseService service = getBaseService(binding);
                bindFractalComponent(connector, "servant",
                        port.getFcInterface(service.getName()));
            }
            if (hasBaseReference(binding)) { // Client side
                BaseReference reference = getBaseReference(binding);
                bindFractalComponent(port, reference.getName(),content.getProxy(ctx.getClassLoader()));
            }
        }
              
// in modules/module-gcs/frascati-binding-jgroups/src/main/java/org/ow2/frascati/gcs/binding/FrascatiBindingJGroupsProcessor.java
Override
    protected final void doComplete(JGroupsBinding binding,
            ProcessingContext ctx) throws ProcessorException {
        logFine(ctx, binding, "nothing to complete");
    }
              
// in modules/module-native/frascati-interface-native/src/main/java/org/ow2/frascati/native_/FraSCAtiInterfaceNativeProcessor.java
Override
    protected final void doCheck(NativeInterface nativeItf,
            ProcessingContext processingContext) throws ProcessorException
    {
        // Check the attribute 'descriptor'
        String desc = nativeItf.getDescriptor();
        if (desc == null || desc.equals("")) {
            error(processingContext, nativeItf,
                    "The attribute 'descriptor' must be set");
            return;
        }
        File file = new File(desc);
        if (!file.exists()) {
            log.severe("The descriptor '" + desc
                    + "' does not exist on the system.");
        } else if (!file.canRead()) {
            log.severe("The descriptor '" + desc + "' is not readable.");
        }
        String javaInterface = this.compiler.packageName(file) + "."
                + this.compiler.interfaceName(file);
        Class<?> clazz = null;
        try {
            clazz = processingContext.loadClass(javaInterface);
        } catch (ClassNotFoundException cnfe) {
            // If the Java interface is not found then this requires to compile Native to Java.
        }
        storeJavaInterface(nativeItf, processingContext, javaInterface, clazz);
    }
              
// in modules/module-native/frascati-interface-native/src/main/java/org/ow2/frascati/native_/FraSCAtiInterfaceNativeProcessor.java
Override
    protected final void doGenerate(NativeInterface nativeItf,
            ProcessingContext processingContext) throws ProcessorException
    {
        // If no Java interface computed during doCheck() then compile
        if (getClass(nativeItf, processingContext) != null) {
            return;
        }
        final String filename = nativeItf.getDescriptor();
        if (this.log.isLoggable(INFO)) {
            this.log.info("Compiling the descriptor '" + filename + "'...");
        }
        File output = new File(this.membraneGen.getOutputDirectory() + "/"
                + targetDir);
        try {
            this.compiler.compile(new File(filename), output);
        } catch (IOException exc) {
            severe(new ProcessorException("Error when compiling descriptor",
                    exc));
        }
        // Ask OW2 FraSCAti Juliac to compile generated sources.
        this.membraneGen.addJavaSource(output.getAbsolutePath());
    }
              
// in modules/module-native/frascati-binding-jna/src/main/java/org/ow2/frascati/native_/binding/FrascatiBindingJnaProcessor.java
Override
    protected final void doCheck(JnaBinding jnaBinding,
            ProcessingContext processingContext) throws ProcessorException {
        checkAttributeMustBeSet(jnaBinding, "library", jnaBinding.getLibrary(),
                processingContext);
        if (!hasBaseReference(jnaBinding)) {
            error(processingContext, jnaBinding,
                    "<binding.jna> can only be child of <sca:reference>");
        }
        checkBinding(jnaBinding, processingContext);
    }
              
// in modules/module-native/frascati-binding-jna/src/main/java/org/ow2/frascati/native_/binding/FrascatiBindingJnaProcessor.java
Override
    protected final void doGenerate(JnaBinding jnaBinding,
            ProcessingContext processingContext) throws ProcessorException {
        logFine(processingContext, jnaBinding, "nothing to generate");
    }
              
// in modules/module-native/frascati-binding-jna/src/main/java/org/ow2/frascati/native_/binding/FrascatiBindingJnaProcessor.java
private Component createProxyComponent(JnaBinding binding, ProcessingContext ctx)
            throws ProcessorException {
        Class<?> cls = getBaseReferenceJavaInterface(binding, ctx);
        try {
            Object library = Native.loadLibrary(binding.getLibrary(), cls);
            ComponentType proxyType = tf
                    .createComponentType(new InterfaceType[] { tf
                            .createInterfaceType(JNA_ITF, cls.getName(), false,
                                    false, false) });
            return cf.createComponent(proxyType, "primitive", library);
        } catch (java.lang.UnsatisfiedLinkError ule) {
            throw new ProcessorException(binding, "Internal JNA Error: ", ule);
        } catch (FactoryException e) {
            throw new ProcessorException(binding, "JNA Proxy component failed: ", e);
        }
    }
              
// in modules/module-native/frascati-binding-jna/src/main/java/org/ow2/frascati/native_/binding/FrascatiBindingJnaProcessor.java
Override
    protected final void doInstantiate(JnaBinding binding, ProcessingContext ctx)
            throws ProcessorException {
        Component proxy = createProxyComponent(binding, ctx);
        Component port = getFractalComponent(binding, ctx);
        try {
            getNameController(proxy).setFcName(
                    getNameController(port).getFcName() + "-jna-proxy");
        for (Component composite : getSuperController(port)
                .getFcSuperComponents()) {
            addFractalSubComponent(composite, proxy);
        }
        BaseReference reference = getBaseReference(binding);
        bindFractalComponent(port, reference.getName(),
                proxy.getFcInterface(JNA_ITF));
        } catch (NoSuchInterfaceException e) {
            throw new ProcessorException(binding, "JNA Proxy interface not found: ", e);
        }
        logFine(ctx, binding, "importing done");
    }
              
// in modules/module-native/frascati-binding-jna/src/main/java/org/ow2/frascati/native_/binding/FrascatiBindingJnaProcessor.java
Override
    protected final void doComplete(JnaBinding jnaBinding,
            ProcessingContext processingContext) throws ProcessorException {
        logFine(processingContext, jnaBinding, "nothing to complete");
    }
              
// in modules/frascati-implementation-spring/src/main/java/org/ow2/frascati/implementation/spring/ScaImplementationSpringProcessor.java
Override
  protected final void doCheck(SpringImplementation springImplementation, ProcessingContext processingContext)
	      throws ProcessorException
  {
    String springImplementationLocation = springImplementation.getLocation();
    if(springImplementationLocation == null || springImplementationLocation.equals("")) {
      error(processingContext, springImplementation, "The attribute 'location' must be set");
    } else {
      if(processingContext.getResource(springImplementationLocation) == null) {
        error(processingContext, springImplementation, "Location '", springImplementationLocation, "' not found");
      }
    }
    // check attributes 'policySets' and 'requires'.
    checkImplementation(springImplementation, processingContext);
  }
              
// in modules/frascati-implementation-spring/src/main/java/org/ow2/frascati/implementation/spring/ScaImplementationSpringProcessor.java
Override
  protected final void doInstantiate(SpringImplementation springImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    // Get the Spring location.
    String springLocation = springImplementation.getLocation();
    log.finer("Create an SCA component with the Spring implementation "
            + springLocation + " and the Fractal component type "
            + getFractalComponentType(springImplementation, processingContext).toString());
   	// TODO: Must handle location as described in the SCA specification.
    // location could be a Jar file or a directory.
    // Currently, location is considered to refer a Spring XML file in the class path.
    // Create the SCA composite.
    Component component = createFractalComposite(springImplementation, processingContext);
    // Create the Spring application context.
    // TODO: Must use another ApplicationContext to read XML files from JAR
    // files or directories.
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
        new String[] { springLocation }, new ParentApplicationContext(component));
    // It must use the current thread class loader to load Java classes.
    context.setClassLoader(processingContext.getClassLoader());
    // Connect the Fractal composite to Spring beans.
    connectFractalComposite(springImplementation, processingContext, context);
  }
              
// in modules/frascati-binding-jms/src/main/java/org/ow2/frascati/binding/jms/FrascatiBindingJmsProcessor.java
Override
  protected final void doCheck(JMSBinding jmsBinding, ProcessingContext processingContext)
      throws ProcessorException {
    // Check if getUri() is well-formed.
    if (jmsBinding.getUri() != null && !jmsBinding.getUri().equals("")) {
      Matcher matcher = JMS_URI_PATTERN.matcher(jmsBinding.getUri());
      if (!matcher.matches()) {
        throw new ProcessorException(jmsBinding, "JMS URI is not well formed.");
      }
      String jmsvariant = matcher.group(1);
      try {
        jmsvariant = URLDecoder.decode(jmsvariant, "UTF-8");
      } catch (UnsupportedEncodingException e) {
        log.severe("UTF-8 format not supported: can't decode JMS URI.");
      }
      if (!jmsvariant.equals("jndi")) {
        throw new ProcessorException(jmsBinding, "Only jms:jndi: variant is supported.");
      }
      // When the @uri attribute is specified, the destination element
      // MUST NOT be present
      if (jmsBinding.getDestination() != null) {
        throw new ProcessorException(jmsBinding, "Binding can't have both a JMS URI and a destination element.");
      }
    }
	// Default checking done on any SCA binding.
	super.doCheck(jmsBinding, processingContext);
  }
              
// in modules/frascati-implementation-bpel/src/main/java/org/ow2/frascati/implementation/bpel/FrascatiImplementationBpelProcessor.java
Override
  protected final void doCheck(BpelImplementation bpelImplementation, ProcessingContext processingContext)
	      throws ProcessorException
  {
    // Check the 'process' attribute.
    QName bpelImplementationProcess = bpelImplementation.getProcess();
    if(bpelImplementationProcess == null) {
      error(processingContext, bpelImplementation, "The attribute 'process' must be set");
    } else {
      String processNamespace = bpelImplementationProcess.getNamespaceURI();
      String processUri = null;
      // When the process namespace starts by "classpath:"
      if(processNamespace.startsWith(CLASSPATH_NS)) {
        StringBuffer sb = new StringBuffer();
        sb.append(processNamespace.substring(CLASSPATH_NS.length()));
        if(sb.length() > 0) {
          sb.append('/');
        }
        sb.append(bpelImplementationProcess.getLocalPart());
        // Search the process file into the processing context's class loader.
        URL resource = processingContext.getResource(sb.toString());
        if(resource != null) {
          processUri = resource.toString();
        }
      }
      if(processUri == null) {
        processUri = processNamespace + '/' + bpelImplementationProcess.getLocalPart();
      }
      try {
        BPELProcess bpelProcess = bpelEngine.newBPELProcess(processUri);
        // Register of JAXB Object Factories.
        JAXB.registerObjectFactoryFromClassLoader(processingContext.getClassLoader());
//        System.out.println(bpelProcess);
        // Store the created BPELProcess into the processing context.
        processingContext.putData(bpelImplementation, BPELProcess.class, bpelProcess);
      } catch(FrascatiException exc) {
//        exc.printStackTrace();
        error(processingContext, bpelImplementation, "Can't read BPEL process ", bpelImplementationProcess.toString());
      } catch(Exception exc) {
        severe(new ProcessorException(bpelImplementation, "Can not read BPEL process " + bpelImplementationProcess, exc));
        return;
      }
    }
    // check attributes 'policySets' and 'requires'.
    checkImplementation(bpelImplementation, processingContext);
  }
              
// in modules/frascati-implementation-bpel/src/main/java/org/ow2/frascati/implementation/bpel/FrascatiImplementationBpelProcessor.java
Override
  protected final void doGenerate(BpelImplementation bpelImplementation, ProcessingContext processingContext)
	      throws ProcessorException
  {
    // Obtain the BPELProcess stored during doCheck()
    BPELProcess bpelProcess = processingContext.getData(bpelImplementation, BPELProcess.class);
    // Compile all WSDL imported by the BPEL process.
    for(String wsdlUri : bpelProcess.getAllImportedWsdlLocations()) {
      // Check if the WSDL file is present in the processing context's class loader.
      URL url = processingContext.getResource(wsdlUri);
      if(url != null) {
        wsdlUri = url.toString();
      }
      // Compile the WSDL file.
      try {
        this.wsdlCompiler.compileWSDL(wsdlUri, processingContext);
      } catch(Exception exc) {
        error(processingContext, bpelImplementation, "Can't compile WSDL '", wsdlUri, "'");
      }
    }
    super.doGenerate(bpelImplementation, processingContext);
  }
              
// in modules/frascati-implementation-bpel/src/main/java/org/ow2/frascati/implementation/bpel/FrascatiImplementationBpelProcessor.java
Override
  protected final void doInstantiate(BpelImplementation bpelImplementation, ProcessingContext processingContext)
      throws ProcessorException
  {
    Component containerOfProcesses = null;
    // Obtain the BPELProcess stored during doCheck()
    BPELProcess bpelProcess = processingContext.getData(bpelImplementation, BPELProcess.class);
    try {
      containerOfProcesses = bpelProcess.deploy();
    } catch(Exception e) {
      warning(new ProcessorException("Error during deployment of the BPEL process '" + bpelImplementation.getProcess() + "'", e));
      return;
    }
    // Instantiate the SCA composite containing the process.
    doInstantiate(bpelImplementation, processingContext, bpelProcess);
    // Set the name of the EasyBPEL container component.
    setFractalComponentName(containerOfProcesses, "implementation.bpel");
    // Add the EasyBPEL process component to the SCA BPEL composite.
    addFractalSubComponent(
      getFractalComponent(bpelImplementation, processingContext),
      containerOfProcesses);
  }