Commit c2ebcb80 authored by Munilla Christophe's avatar Munilla Christophe
Browse files

-create frascati-nuxeo-api : make frascati-nuxeo-service-api independent from...

-create frascati-nuxeo-api : make frascati-nuxeo-service-api independent from implementation modules
-fix frascati in Jboss error with Windows OS : use '/' character instead of File.separatorChar
-fix FraSCAtiInConciergeTest error for JMX : rename test class, redefine installed bundles file
parent c81a2cfc
......@@ -44,7 +44,7 @@ public class FraSCAtiIsolated
/**
* FraSCAtiIsolated Logger
*/
Logger logger = Logger.getLogger(FraSCAtiIsolated.class.getCanonicalName());
protected Logger logger = Logger.getLogger(FraSCAtiIsolated.class.getCanonicalName());
/**
* Constant used to set the FraSCAti's root path in System's properties
......@@ -120,26 +120,30 @@ public class FraSCAtiIsolated
return false;
}
});
File frascatiConfigDirectory = new File(frascatiRootDirectory,"config");
if(frascatiConfigDirectory.exists())
String bootstrapProperty = System.getProperty("org.ow2.frascati.bootstrap");
if(bootstrapProperty == null)
{
File frascatiConfigFile = new File(frascatiConfigDirectory,
"frascati_boot.properties");
try
File frascatiConfigDirectory = new File(frascatiRootDirectory,"config");
if(frascatiConfigDirectory.exists())
{
Properties props = new Properties();
props.loadFromXML(new FileInputStream(frascatiConfigFile));
Enumeration<Object> keys = props.keys();
while (keys.hasMoreElements())
File frascatiConfigFile = new File(frascatiConfigDirectory,
"frascati_boot.properties");
try
{
String key = (String) keys.nextElement();
String value = props.getProperty(key);
System.setProperty(key, value);
Properties props = new Properties();
props.loadFromXML(new FileInputStream(frascatiConfigFile));
Enumeration<Object> keys = props.keys();
while (keys.hasMoreElements())
{
String key = (String) keys.nextElement();
String value = props.getProperty(key);
System.setProperty(key, value);
}
} catch (Exception e)
{
logger.log(Level.WARNING, e.getMessage(),e);
}
} catch (Exception e)
{
logger.log(Level.WARNING, e.getMessage(),e);
}
}
if(parentClassLoader != null)
......
<?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-api</artifactId>
<name>OW2 FraSCAti In Nuxeo API</name>
<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.nuxeo</groupId>
<artifactId>frascati-nuxeo-service-api</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.nuxeo.runtime</groupId>
<artifactId>nuxeo-runtime-bridge</artifactId>
</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>
......@@ -35,18 +35,18 @@ import java.util.logging.Logger;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import org.nuxeo.runtime.bridge.Application;
import org.ow2.frascati.isolated.FraSCAtiIsolated;
import org.ow2.frascati.nuxeo.exception.FraSCAtiInNuxeoException;
/**
* Abstract implementation of the FraSCAtiServiceProviderItf interface
* AbstractFraSCAtiInNuxeo allow to instantiate an new FraSCAti instance in Nuxeo
*/
public abstract class AbstractFraSCAtiInNuxeo<FraSCAtiInNuxeoService extends FraSCAtiInNuxeoServiceItf>
extends FraSCAtiIsolated implements FraSCAtiInNuxeoServiceProviderItf<FraSCAtiInNuxeoService>
extends FraSCAtiIsolated implements FraSCAtiInNuxeoServiceProviderItf<FraSCAtiInNuxeoService>, Application
{
/**
* Logger
......@@ -84,7 +84,7 @@ extends FraSCAtiIsolated implements FraSCAtiInNuxeoServiceProviderItf<FraSCAtiIn
frascatiService = super.getService(providedType, serviceName,
"org.ow2.frascati.FraSCAti/" + componentName);
} catch (Throwable throwable)
{
throw new FraSCAtiInNuxeoException(
......
......@@ -19,16 +19,6 @@
<name>OW2 FraSCAti SCA Component API for Nuxeo</name>
<dependencies>
<dependency>
<groupId>org.ow2.frascati.nuxeo</groupId>
<artifactId>frascati-isolated</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.nuxeo.runtime</groupId>
<artifactId>nuxeo-runtime-bridge</artifactId>
</dependency>
</dependencies>
<build>
......
......@@ -25,14 +25,11 @@
*/
package org.ow2.frascati.nuxeo.api;
import org.nuxeo.runtime.bridge.Application;
/**
* Provide an access to a FraSCAtiInNuxeoServiceItf implementation instance
* in a Nuxeo Context
*/
public interface FraSCAtiInNuxeoServiceProviderItf<FraSCAtiInNuxeoService extends FraSCAtiInNuxeoServiceItf>
extends Application
{
/**
* FraSCAti output directory property
......@@ -67,5 +64,4 @@ extends Application
* Return a FraSCAtiInNuxeoServiceItf implementation instance
*/
FraSCAtiInNuxeoService getFraSCAtiInNuxeoService();
}
......@@ -27,16 +27,13 @@ package org.ow2.frascati.nuxeo.base;
import org.ow2.frascati.assembly.factory.api.ProcessingContext;
import org.ow2.frascati.assembly.factory.processor.ProcessingContextImpl;
import org.ow2.frascati.nuxeo.api.FraSCAtiInNuxeoServiceBaseItf;
import org.ow2.frascati.nuxeo.base.api.AbstractFraSCAtiInNuxeoService;
/**
* Implementation of the {@link FraSCAtiNuxeoServiceItf}
*/
public class FraSCAtiInNuxeoServiceBase extends
AbstractFraSCAtiInNuxeoService<FraSCAtiInNuxeoServiceBaseItf,ProcessingContext>
public class FraSCAtiInNuxeoServiceBase extends AbstractFraSCAtiInNuxeoService<ProcessingContext>
{
/**
* {@inheritDoc}
*
......
......@@ -44,7 +44,6 @@ import org.ow2.frascati.assembly.factory.api.CompositeManager;
import org.ow2.frascati.assembly.factory.api.ManagerException;
import org.ow2.frascati.assembly.factory.api.ProcessingContext;
import org.ow2.frascati.nuxeo.api.FraSCAtiInNuxeoServiceBaseItf;
import org.ow2.frascati.nuxeo.api.FraSCAtiInNuxeoServiceItf;
import org.ow2.frascati.nuxeo.exception.FraSCAtiInNuxeoServiceException;
import org.ow2.frascati.util.AbstractLoggeable;
import org.ow2.frascati.util.FrascatiClassLoader;
......@@ -52,9 +51,10 @@ import org.ow2.frascati.util.FrascatiClassLoader;
/**
* Implementation of the {@link FraSCAtiNuxeoServiceItf}
*/
@Scope("COMPOSITE")
public abstract class AbstractFraSCAtiInNuxeoService<FraSCAtiInNuxeoService extends FraSCAtiInNuxeoServiceItf,
Context extends ProcessingContext> extends AbstractLoggeable implements FraSCAtiInNuxeoServiceBaseItf
@Scope("COMPOSITE")
public abstract class
AbstractFraSCAtiInNuxeoService<Context extends ProcessingContext> extends AbstractLoggeable
implements FraSCAtiInNuxeoServiceBaseItf
{
// --------------------------------------------------------------------------
// Internal state.
......@@ -64,18 +64,18 @@ Context extends ProcessingContext> extends AbstractLoggeable implements FraSCAti
* The required CompositeManager
*/
@Reference(name = "composite-manager")
private CompositeManager compositeManager;
protected CompositeManager compositeManager;
/**
* The required ClassLoaderManager
*/
@Reference(name = "classloader-manager")
private ClassLoaderManager classLoaderManager;
@Reference(name = "classloader-manager")
protected ClassLoaderManager classLoaderManager;
/**
* Map of components
*/
private Map<String,Component> componentMap;
protected Map<String,Component> componentMap;
// -------------------------------------------------------------------------
// Internal methods.
......@@ -125,13 +125,20 @@ Context extends ProcessingContext> extends AbstractLoggeable implements FraSCAti
try
{
Component[] components = compositeManager.processContribution(contribution, context);
String[] componentNames = new String[components.length];
int index = 0;
for(Component component : components)
String[] componentNames = null;
if(components != null)
{
componentNames = new String[components.length];
int index = 0;
for(Component component : components)
{
String componentName = Fractal.getNameController(component).getFcName();
componentMap.put(componentName, component);
componentNames[index++] = componentName;
}
}else
{
String componentName = Fractal.getNameController(component).getFcName();
componentMap.put(componentName, component);
componentNames[index++] = componentName;
componentNames = new String[0];
}
return componentNames;
......@@ -171,13 +178,17 @@ Context extends ProcessingContext> extends AbstractLoggeable implements FraSCAti
try
{
Component component = compositeManager.processComposite(new QName(composite),context);
String componentName = Fractal.getNameController(component).getFcName();
componentMap.put(componentName, component);
String componentName = null;
if(component != null)
{
componentName = Fractal.getNameController(component).getFcName();
componentMap.put(componentName, component);
}
return componentName;
} catch(Exception e)
{
throw new FraSCAtiInNuxeoServiceException("Enable to process the '"
throw new FraSCAtiInNuxeoServiceException("Unable to process the '"
+ composite + "' composite",e);
}
}
......@@ -295,7 +306,6 @@ Context extends ProcessingContext> extends AbstractLoggeable implements FraSCAti
String serviceName, Class<T> serviceClass)
throws FraSCAtiInNuxeoServiceException
{
Component component = componentMap.get(compositeName);
if(component != null)
{
......
......@@ -50,6 +50,12 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.ow2.frascati.nuxeo</groupId>
<artifactId>frascati-nuxeo-api</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.ow2.frascati.nuxeo</groupId>
<artifactId>frascati-isolated</artifactId>
......
......@@ -32,31 +32,22 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import org.nuxeo.common.utils.FileUtils;
import org.nuxeo.runtime.test.runner.Deploy;
import org.nuxeo.runtime.test.WorkingDirectoryConfigurator;
import org.nuxeo.runtime.test.runner.Features;
import org.nuxeo.runtime.test.runner.FeaturesRunner;
import org.nuxeo.runtime.test.runner.LocalDeploy;
import org.nuxeo.runtime.test.runner.RuntimeFeature;
import org.nuxeo.runtime.test.runner.RuntimeHarness;
import org.nuxeo.runtime.test.runner.SimpleFeature;
import org.nuxeo.runtime.test.WorkingDirectoryConfigurator;
import org.ow2.frascati.nuxeo.api.FraSCAtiInNuxeoServiceProviderItf;
@Features(RuntimeFeature.class)
@Deploy({
"org.nuxeo.runtime.bridge",
"org.ow2.frascati.nuxeo.base"
})
@LocalDeploy(
{
"org.ow2.frascati.nuxeo.base:OSGI-INF/frascati-service.xml"
})
public class FraSCAtiInNuxeoFeature extends SimpleFeature
implements WorkingDirectoryConfigurator
{
public static final String FRASCATI_LIBRARIES_TEST_BASEDIR_PROP = "FRASCATI_LIBRARIES_TEST_BASEDIR";
protected final Logger LOGGER = Logger.getLogger(FraSCAtiInNuxeoFeature.class.getCanonicalName());
public void initialize(FeaturesRunner runner)
{
runner.getFeature(RuntimeFeature.class).getHarness(
......@@ -70,13 +61,17 @@ implements WorkingDirectoryConfigurator
File dot = new File("src");
dot = dot.getAbsoluteFile().getParentFile();
File nuxeoFrascati = searchDirectory(dot, null, "frascati-nuxeo");
String nuxeoFrascatiDirName = System.getProperty(
FRASCATI_LIBRARIES_TEST_BASEDIR_PROP,"frascati-nuxeo");
File nuxeoFrascati = searchDirectory(dot, null, nuxeoFrascatiDirName);
if (!nuxeoFrascati.exists()) {
LOGGER.warning("Unable to retrieve the 'frascati-nuxeo' directory");
if (!nuxeoFrascati.exists())
{
LOGGER.warning("Unable to retrieve the '"+nuxeoFrascatiDirName+"' directory");
return;
}
LOGGER.info("nuxeo-frascati directory found : " + nuxeoFrascati.getAbsolutePath());
LOGGER.info("'"+nuxeoFrascatiDirName+"' directory found : " + nuxeoFrascati.getAbsolutePath());
File frascatiRootDirSrc = new File(nuxeoFrascati, new StringBuilder("resources"
).append(sep).append("frascati").toString());
......
......@@ -38,8 +38,10 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.nuxeo.runtime.api.Framework;
import org.nuxeo.runtime.test.runner.Deploy;
import org.nuxeo.runtime.test.runner.Features;
import org.nuxeo.runtime.test.runner.FeaturesRunner;
import org.nuxeo.runtime.test.runner.LocalDeploy;
import org.ow2.frascati.nuxeo.api.FraSCAtiInNuxeoServiceProviderItf;
import org.ow2.frascati.nuxeo.api.FraSCAtiInNuxeoServiceBaseItf;
import org.ow2.frascati.nuxeo.exception.FraSCAtiInNuxeoException;
......@@ -50,6 +52,14 @@ import org.ow2.frascati.nuxeo.exception.FraSCAtiInNuxeoServiceException;
*/
@RunWith(FeaturesRunner.class)
@Features(FraSCAtiInNuxeoFeature.class)
@Deploy({
"org.nuxeo.runtime.bridge",
"org.ow2.frascati.nuxeo.base"
})
@LocalDeploy(
{
"org.ow2.frascati.nuxeo.base:OSGI-INF/frascati-service.xml"
})
public class TestFraSCAtiInNuxeo
{
private final String resourcePath = "target/test-classes/";
......
......@@ -40,6 +40,7 @@ import org.nuxeo.runtime.api.Framework;
import org.nuxeo.runtime.test.runner.Deploy;
import org.nuxeo.runtime.test.runner.Features;
import org.nuxeo.runtime.test.runner.FeaturesRunner;
import org.nuxeo.runtime.test.runner.LocalDeploy;
import org.ow2.frascati.nuxeo.api.FraSCAtiInNuxeoServiceProviderItf;
import org.ow2.frascati.nuxeo.api.FraSCAtiInNuxeoServiceBaseItf;
import org.ow2.frascati.nuxeo.binding.test.NuxeoBinderItf;
......@@ -52,9 +53,15 @@ import org.ow2.frascati.nuxeo.exporting.test.NuxeoExporterItf;
@RunWith(FeaturesRunner.class)
@Features(FraSCAtiInNuxeoFeature.class)
@Deploy({
"org.nuxeo.runtime.bridge",
"org.ow2.frascati.nuxeo.base",
"frascati.service.bridge",
"org.ow2.frascati.binding.nuxeo.side"
})
@LocalDeploy(
{
"org.ow2.frascati.nuxeo.base:OSGI-INF/frascati-service.xml"
})
public class TestFraSCAtiNuxeoBinding
{
private final String resourcePath = "target/test-classes/";
......
......@@ -26,7 +26,7 @@
package org.ow2.frascati.nuxeo.service.bridge.api;
/**
* FraSCAti exported service signature in Nuxeo
* FraSCAti's exported service signature in Nuxeo
*/
public interface ExportedServiceItf {
......
......@@ -35,7 +35,7 @@ import org.nuxeo.runtime.model.StreamRef;
import org.ow2.frascati.nuxeo.service.bridge.ExportedServiceLoader;
/**
*
* StremRef for a FraSCAti's Exported Service
*/
public class ExportedServiceStreamRef implements StreamRef
{
......
......@@ -333,6 +333,7 @@
<module>frascati-metamodel-nuxeo</module>
<module>frascati-nuxeo-service-api</module>
<module>frascati-isolated</module>
<module>frascati-nuxeo-api</module>
<module>frascati-nuxeo-service</module>
<module>frascati-service-bridge-api</module>
<module>frascati-service-bridge</module>
......
......@@ -36,8 +36,8 @@
<version>1.5-SNAPSHOT</version>
</parent>
<artifactId>frascati-jmx-test-felix</artifactId>
<name>FraSCAti in OSGi - Test JMX Bundle in Apache Felix</name>
<artifactId>frascati-jmx-test-concierge</artifactId>
<name>FraSCAti in OSGi - Test JMX Bundle in Concierge</name>
<dependencies>
<dependency>
......@@ -47,7 +47,7 @@
</dependency>
<dependency>
<groupId>org.ow2.frascati.osgi.fio</groupId>
<artifactId>frascati-osgi-felix</artifactId>
<artifactId>frascati-osgi-concierge</artifactId>
<version>1.5-SNAPSHOT</version>
</dependency>
<dependency>
......
......@@ -27,8 +27,8 @@
package org.ow2.frascati.osgi.test;
/**
* Test in Eclipse Equinox
* Test in Concierge
*/
public class FraSCAtiInEquinoxTest extends FraSCAtiInOSGiBindingJGroupsTest
public class FraSCAtiInConciergeTest extends FraSCAtiInOSGiJMXTest
{
}
\ No newline at end of file
......@@ -2,7 +2,7 @@
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<entry key="y">bundle-frascati-api.jar:true</entry>
<entry key="x">bundle-frascati-osgi-r4.jar:true</entry>
<entry key="x">bundle-frascati-osgi-r3-concierge.jar:true</entry>
<entry key="w">bundle-frascati-util.jar:true</entry>
<entry key="v">bundle-frascati-explorer.jar:false</entry>
<entry key="u">bundle-frascati-eclipse.jar:true</entry>
......
......@@ -48,12 +48,10 @@
<modules>
<module>framework</module>
<module>felix</module>
<!-- test are made using Apache Felix -->
<!-- Uncomment to use another Framework -->
<module>equinox</module>
<module>knopflerfish</module>
<module>jboss</module>
<!-- -->
<module>concierge</module>
</modules>
<dependencies>
......
......@@ -76,19 +76,21 @@
<module>binding-jsonrpc-test</module>
<module>binding-ws-test</module>
<module>binding-upnp-test</module>
<!--
<module>binding-gcs-test</module>
-->
<module>frascati-fscript-test</module>
<module>frascati-native-test</module>
<module>frascati-jmx-test</module>
<!--<module>frascati-explorer-test</module>
<module>implementation-bpel-test</module>-->
<module>implementation-scripts-test</module>
<module>implementation-bpel-test</module>
<module>implementation-scripts-test</module>-->
<module>implementation-xquery-test</module>
<module>implementation-spring-test</module>
<module>implementation-osgi-test</module>
<module>frascati-web-explorer-test</module>
<module>implementation-velocity-test</module>
<module>implementation-widget-test</module>
<!--<module>implementation-velocity-test</module>
<module>implementation-widget-test</module>-->
</modules>
<build>
......
......@@ -137,7 +137,7 @@ public class Resource extends AbstractResource
if(isVirtual)
{
url = new URL("jburl", ""+parentBundle.getBundleId(),
0, jarName + (entry.startsWith("/")?entry:(File.separatorChar + entry)),
0, jarName + (entry.startsWith("/")?entry:('/' + entry)),
new Handler(parentBundle.getBundleContext()));
//even if the "java.protocol.handler.pkgs" System property has been defined
......@@ -146,7 +146,7 @@ public class Resource extends AbstractResource
if(entry.endsWith(".composite") || entry.endsWith(".constrainingType"))
{
String outputPath = jarName.substring(0, jarName.lastIndexOf('.'));
outputPath = outputPath + (entry.startsWith("/")?entry:(File.separatorChar + entry));
outputPath = outputPath + (entry.startsWith("/")?entry:('/' + entry));
int slashIndex = outputPath.lastIndexOf('/');
String composite = outputPath.substring(slashIndex+1);
outputPath = outputPath.substring(0,slashIndex);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment