Commit b24a32eb authored by Munilla Christophe's avatar Munilla Christophe

frascati-nuxeo-service-api : API of the service available in nuxeo to interact...

frascati-nuxeo-service-api : API of the service available in nuxeo to interact with the FraSCAti instance as a Nuxeo component
frascati-nuxeo-service : FraSCAti in Nuxeo API implementation
frascati-nuxeo : FraSCAti as a Nuxeo Component
parent 9a54e322
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.ow2.frascati.nuxeo</groupId>
<artifactId>parent</artifactId>
<version>1.5-SNAPSHOT</version>
</parent>
<properties>
<frascati.version>1.5-SNAPSHOT</frascati.version>
<fractal-bf.version>0.10-SNAPSHOT</fractal-bf.version>
</properties>
<artifactId>frascati-nuxeo-service-api</artifactId>
<name>OW2 FraSCAti SCA Component API for Nuxeo</name>
<dependencies>
<dependency>
<groupId>org.ow2.frascati.model</groupId>
<artifactId>frascati-model</artifactId>
<version>2.0.1.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>ecore</artifactId>
<version>2.4.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.ow2.frascati.model</groupId>
<artifactId>osoa-java-api</artifactId>
<version>2.0.1.3</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Compile with Java 1.5 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
/**
* OW2 FraSCAti Nuxeo
* Copyright (c) 2012 Inria, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: frascati@ow2.org
*
* Author: Christophe Munilla
*
* Contributor(s):
*
*/
package org.ow2.frascati.nuxeo;
/**
*
* An exception thrown by a FraSCAtiNuxeoServiceItf implementation instance
* Use to wrap FrascatiException which is not visible outside of the FraSCAti
* context
*/
public class FraSCAtiServiceException extends Exception
{
/**
* Generated serial ID
*/
private static final long serialVersionUID = 4118928600670547821L;
/**
* Constructor
*/
public FraSCAtiServiceException()
{
super();
}
/**
* Constructor with a message
*/
public FraSCAtiServiceException(String message)
{
super(message);
}
}
/**
* OW2 FraSCAti Nuxeo
* Copyright (c) 2012 Inria, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: frascati@ow2.org
*
* Author: Christophe Munilla
*
* Contributor(s):
*
*/
package org.ow2.frascati.nuxeo.api;
import java.net.URL;
import org.osoa.sca.annotations.Service;
import org.ow2.frascati.nuxeo.FraSCAtiServiceException;
@Service
public interface FraSCAtiNuxeoServiceItf
{
/**
* Process a contribution ZIP archive.
*
* @param contribution
* name of the contribution file to load.
* @return
* an array of loaded components' name
* @throws FraSCAtiServiceException
* if no component can be found in the contribution file
*/
String[] processContribution(String contribution)
throws FraSCAtiServiceException;
/**
* Loads an SCA composite and create the associate FraSCAti composite
* instance.
*
* @param composite
* name of the composite file to load.
* @param urls
* a set of URLs to build the FraSCAti ProcessingContext
* @return the FraSCAtiCompositeItf embedded resulting FraSCAti composite
* instance.
* @throws FraSCAtiServiceException
* if the composite can not be loaded
*/
String processComposite(String composite, URL... urls)
throws FraSCAtiServiceException;
/**
* Return the state of the component which name is passed on as a
* parameter
*
* @param componentName
* the name of the component to start
* @return
* "STARTED" if the component is started
* "STOPPED" if the component is stopped
*/
String state(String compositeName);
/**
* Start the component which name is passed on as parameter
*
* @param componentName
* the name of the component to start
*/
void start(String compositeName);
/**
* Stop the component which name is passed on as parameter
*
* @param componentName
* the name of the component to stop
*/
void stop(String compositeName);
/**
* Remove from FraSCAti the component which name is passed on as parameter
*
* @param componentName
* the name of the component to remove
* @throws FraSCAtiServiceException
* if the component doesn't exist
*/
void remove(String compositeName)
throws FraSCAtiServiceException;
/**
* Return the service associated to the component which name is passed on as
* parameter, with the name and class type also passed on as parameter
*
* @param compositeName
* the name of the composite to look the service in
* @param serviceName
* the service name
* @param serviceClass
* the service class
* @return the service instance
* @throws FraSCAtiServiceException
* if the service has not been found
*/
<T> T getService(String compositeName, String serviceName, Class<T> serviceClass)
throws FraSCAtiServiceException;
}
/**
* OW2 FraSCAti Nuxeo
* Copyright (c) 2012 Inria, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: frascati@ow2.org
*
* Author: Christophe Munilla
*
* Contributor(s):
*
*/
package org.ow2.frascati.nuxeo.api;
/**
* Provide an access to a FraSCAtiNuxeoServiceItf implementation instance
*/
public interface FraSCAtiNuxeoServiceProviderItf
{
/**
* Return a FraSCAtiNuxeoServiceItf implementation instance
*/
FraSCAtiNuxeoServiceItf getFraSCAtiService();
}
############################################################
# Default Logging Configuration File
#
# You can use a different file by specifying a filename
# with the java.util.logging.config.file system property.
# For example java -Djava.util.logging.config.file=myfile
############################################################
############################################################
# Global properties
############################################################
# "handlers" specifies a comma separated list of log Handler
# classes. These handlers will be installed during VM startup.
# Note that these classes must be on the system classpath.
# By default we only configure a ConsoleHandler, which will only
# show messages at the INFO and above levels.
handlers= java.util.logging.ConsoleHandler
# To also add the FileHandler, use the following line instead.
#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler
# Default global logging level.
# This specifies which kinds of events are logged across
# all loggers. For any given facility this global level
# can be overridden by a facility specific level
# Note that the ConsoleHandler also has a separate level
# setting to limit messages printed to the console.
.level=INFO
############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
# default file output is in user's home directory.
java.util.logging.FileHandler.pattern = %h/java%u.log
java.util.logging.FileHandler.limit = 50000
java.util.logging.FileHandler.count = 1
java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
# Limit the message that are printed on the console to INFO and above.
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################
org.ow2.frascati.level = INFO
org.ow2.frascati.assembly.factory.level = INFO
# org.ow2.frascati.assembly.factory.manager.level = OFF
# org.ow2.frascati.assembly.factory.manager.AssemblyFactoryManager.level = OFF
org.ow2.frascati.assembly.factory.processor.level = INFO
# org.ow2.frascati.assembly.factory.processor.ScaBindingProcessor.level = OFF
# org.ow2.frascati.assembly.factory.processor.ScaBindingScaProcessor.level = OFF
# org.ow2.frascati.assembly.factory.processor.ScaComponentProcessor.level = OFF
# org.ow2.frascati.assembly.factory.processor.ScaComponentPropertyProcessor.level = OFF
# org.ow2.frascati.assembly.factory.processor.ScaComponentReferenceProcessor.level = OFF
# org.ow2.frascati.assembly.factory.processor.ScaComponentServiceProcessor.level = OFF
# org.ow2.frascati.assembly.factory.processor.ScaCompositeProcessor.level = OFF
# org.ow2.frascati.assembly.factory.processor.ScaCompositePropertyProcessor.level = OFF
# org.ow2.frascati.assembly.factory.processor.ScaCompositeReferenceProcessor.level = OFF
# org.ow2.frascati.assembly.factory.processor.ScaCompositeServiceProcessor.level = OFF
# org.ow2.frascati.assembly.factory.processor.ScaImplementationCompositeProcessor.level = OFF
# org.ow2.frascati.assembly.factory.processor.ScaImplementationJavaProcessor.level = OFF
# org.ow2.frascati.assembly.factory.processor.ScaImplementationProcessor.level = OFF
# org.ow2.frascati.assembly.factory.processor.ScaInterfaceJavaProcessor.level = OFF
# org.ow2.frascati.assembly.factory.processor.ScaInterfaceProcessor.level = OFF
# org.ow2.frascati.assembly.factory.processor.ScaPropertyTypeJavaProcessor.level = OFF
org.ow2.frascati.component.factory.level = INFO
org.ow2.frascati.component.factory.juliac.level = INFO
org.ow2.frascati.property.jaxb.level = INFO
org.ow2.frascati.binding.level = INFO
org.ow2.frascati.binding.factory.level = INFO
org.ow2.frascati.binding.jms.level = INFO
org.objectweb.fractal.bf.connectors.jms.level = INFO
org.ow2.frascati.implementation.level = INFO
org.ow2.frascati.implementation.bpel.level = INFO
org.ow2.frascati.implementation.bpel.easybpel.level = INFO
org.ow2.frascati.parser.level = INFO
org.ow2.frascati.tinfi.level = INFO
org.ow2.frascati.wsdl.level = INFO
com.ebmwebsourcing.level = INFO
com.sun.level = INFO
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.ow2.frascati.nuxeo</groupId>
<artifactId>parent</artifactId>
<version>1.5-SNAPSHOT</version>
</parent>
<artifactId>frascati-nuxeo-service</artifactId>
<name>OW2 FraSCAti in Nuxeo Service Module</name>
<properties>
<frascati.version>1.5-SNAPSHOT</frascati.version>
<fractal-bf.version>0.10-SNAPSHOT</fractal-bf.version>
</properties>
<dependencies>
<dependency>
<groupId>org.ow2.frascati.nuxeo</groupId>
<artifactId>frascati-nuxeo-service-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.ow2.frascati.osgi</groupId>
<artifactId>frascati-starter</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.ow2.frascati.osgi</groupId>
<artifactId>frascati-osgi-util</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.ow2.frascati</groupId>
<artifactId>frascati-assembly-factory</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<!-- TEST DEPENDENCIES-->
<dependency>
<groupId>org.ow2.frascati.nuxeo</groupId>
<artifactId>frascati-isolated</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.ow2.frascati</groupId>
<artifactId>frascati-runtime-factory</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version><!-- 4.7 minimum version is needed with Nuxeo -->
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.ow2.frascati.mojo</groupId>
<artifactId>frascati-compiler-plugin</artifactId>
<configuration>
<composite>org/ow2/frascati/FraSCAti</composite>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>generate-libraries</id>
<phase>generate-test-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/target/test-classes</outputDirectory>
<stripVersion>false</stripVersion>
<failBuild>false</failBuild>
<failOnMissingClassifierArtifact>true</failOnMissingClassifierArtifact>
<failOnWarning>false</failOnWarning>
<artifactItems>
<artifactItem>
<groupId>org.ow2.frascati.examples</groupId>
<artifactId>helloworld-pojo</artifactId>
<version>${project.version}</version>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
/**
* OW2 FraSCAti Nuxeo
* Copyright (c) 2012 Inria, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: frascati@ow2.org
*
* Author: Christophe Munilla
*
* Contributor(s):
*
*/
package org.ow2.frascati.nuxeo;
import java.lang.reflect.Method;
import java.util.logging.Level;
import javax.xml.namespace.QName;
import org.eclipse.stp.sca.Composite;
import org.oasisopen.sca.ServiceReference;
import org.objectweb.fractal.api.Component;
import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.julia.ComponentInterface;
import org.osoa.sca.annotations.Reference;
import org.ow2.frascati.assembly.factory.api.CompositeManager;
import org.ow2.frascati.parser.api.Parser;
import org.ow2.frascati.parser.api.ParsingContext;
import org.ow2.frascati.starter.api.AbstractInitializable;
import org.ow2.frascati.tinfi.TinfiComponentInterceptor;
import org.ow2.frascati.tinfi.api.IntentHandler;
import org.ow2.frascati.util.reference.ServiceReferenceUtil;
public class FraSCAtiNuxeoInitializer extends AbstractInitializable
{
// --------------------------------------------------------------------------
// Internal state.
// --------------------------------------------------------------------------
//list of service references and intent handlers to weave together
//those object will allow to notice events relative to the processing or
//parsing processes
@Reference(name = "composite-manager")
private CompositeManager compositeManager;
@Reference(name = "composite-parser")
private Parser<Composite> parser;
@Reference(name = "parser-intent")
private IntentHandler parserIntent;
@Reference(name = "processing-intent")
private IntentHandler processingIntent;
// -------------------------------------------------------------------------
// Internal methods.
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
// Public methods.
// -------------------------------------------------------------------------
public void doInitialize()
{
TinfiComponentInterceptor<?> tci = null;
Component component = null;
try
{ //parse method for the Parser
Method parse = Parser.class.getDeclaredMethod("parse",
new Class<?>[] { QName.class, ParsingContext.class });
component = ServiceReferenceUtil.getRootComponent((ServiceReference<?>) parser);
tci = (TinfiComponentInterceptor<?>) ((ComponentInterface) component
.getFcInterface("composite-parser")).getFcItfImpl();
tci.addIntentHandler(parserIntent,parse);
component = ServiceReferenceUtil.getRootComponent((ServiceReference<?>) compositeManager);
tci = (TinfiComponentInterceptor<?>) ((ComponentInterface) component
.getFcInterface("composite-manager")).getFcItfImpl();
tci.addIntentHandler(processingIntent);
} catch (NoSuchInterfaceException e)
{