Commit 0f41646b authored by Munilla Christophe's avatar Munilla Christophe
Browse files

osgi : trial changes to fix bug in windows os

nuxeo : cosmetic changes
parent a112fe4b
......@@ -87,9 +87,7 @@ public class FraSCAtiIsolated
*/
public FraSCAtiIsolated(File frascatiRootDirectory, ClassLoader parentClassLoader)
throws Exception
{
char sep = File.separatorChar;
{
//if the librariesDirectory is null
if (frascatiRootDirectory == null)
{
......@@ -294,6 +292,7 @@ public class FraSCAtiIsolated
Object container = getComponent(component,servicePath);
@SuppressWarnings("unchecked")
T service = (T) frascatiClass.getDeclaredMethod(
"getService", new Class<?>[] { componentClass, String.class, Class.class })
.invoke(frascati, new Object[] { container, serviceName, serviceClass});
......
......@@ -31,7 +31,7 @@ import org.ow2.frascati.nuxeo.api.FraSCAtiInNuxeoServiceBaseItf;
import org.ow2.frascati.nuxeo.exception.FraSCAtiInNuxeoException;
/**
* Base FraSCAtiInNuxeoServiceProviderItf implmentation
* Base FraSCAtiInNuxeoServiceProviderItf implementation
*/
public class FraSCAtiInNuxeoBase extends AbstractFraSCAtiInNuxeo<FraSCAtiInNuxeoServiceBaseItf>
{
......
......@@ -39,6 +39,12 @@ public class FraSCAtiInNuxeoFactoryBase
extends AbstractFraSCAtiInNuxeoFactory<FraSCAtiInNuxeoServiceBaseItf,FraSCAtiInNuxeoBase>
{
/**
* {@inheritDoc}
*
* @see org.ow2.frascati.nuxeo.api.AbstractFraSCAtiInNuxeoFactory#
* getFraSCAtiInNuxeoInstance(java.lang.String, java.lang.ClassLoader)
*/
public FraSCAtiInNuxeoBase getFraSCAtiInNuxeoInstance(String libBaseDir,
ClassLoader parent)
{
......
......@@ -25,19 +25,13 @@
*/
package org.ow2.frascati.util.resource.cobundle;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Enumeration;
import java.util.jar.JarFile;
import java.util.logging.Level;
import java.util.zip.ZipEntry;
import org.objectweb.fractal.juliac.osgi.concierge.Concierge;
import org.objectweb.fractal.juliac.osgi.revision.api.BundleRevisionItf;
import org.ow2.frascati.osgi.util.io.OSGiIOUtils;
import org.ow2.frascati.util.io.IOUtils;
import org.ow2.frascati.util.resource.AbstractResource;
/**
......@@ -64,7 +58,8 @@ public class Resource extends AbstractResource
@Override
protected URL getEntry(String entry)
{
String formatEntry = entry.startsWith("/")?entry.substring(1):entry;
String formatEntry = (entry.startsWith("/") || entry.startsWith("\\"))?
entry.substring(1):entry;
URL entryURL = bundleResource.getEntry(formatEntry);
return entryURL;
}
......
......@@ -351,10 +351,17 @@ public abstract class AbstractResource
String entry = resourceEntries.nextElement();
boolean newList = false;
entry = entry.endsWith("/")?entry.substring(0,entry.length()-1):entry;
entry = entry.startsWith("/")?entry.substring(1):entry;
int index = entry.lastIndexOf('/');
entry = (entry.endsWith("/") || entry.endsWith("\\"))?
entry.substring(0,entry.length()-1):entry;
entry = (entry.startsWith("/") || entry.startsWith("\\"))?
entry.substring(1):entry;
int index = entry.lastIndexOf('/');
if(index == -1 && File.separatorChar!='/')
{
index = entry.lastIndexOf('\\');
}
String packageName = index==-1?
"_root_":entry.substring(0,index).replace('/','.').replace('\\','.');
String resourceName = index==-1?entry:entry.substring(index+1);
......@@ -408,9 +415,12 @@ public abstract class AbstractResource
*/
public URL getResource(String packageName,String resourceName,String searched, boolean exact)
{
String entry = searched.endsWith("/")?searched.substring(0,
searched.length()-1):searched;
entry = entry.startsWith("/")?entry.substring(1):entry;
String entry = (searched.endsWith("/") || searched.endsWith("\\"))?
searched.substring(0,searched.length()-1):searched;
entry = (entry.startsWith("/") || entry.startsWith("\\"))?
entry.substring(1):entry;
if(exact)
{
List<String> list = entries.get(packageName);
......@@ -460,9 +470,11 @@ public abstract class AbstractResource
*/
public void getResources(String packageName,String resourceName,String searched, List<URL> results)
{
String entry = searched.endsWith("/")?searched.substring(0,
searched.length()-1):searched;
entry = entry.startsWith("/")?entry.substring(1):entry;
String entry = (searched.endsWith("/") || searched.endsWith("\\"))?
searched.substring(0,searched.length()-1):searched;
entry = (entry.startsWith("/") || entry.startsWith("\\"))?
entry.substring(1):entry;
for(String packageNameItem : entries.keySet())
{
......@@ -611,8 +623,12 @@ public abstract class AbstractResource
}
try
{
String resourceCopyName = embeddedResourceName
.substring(embeddedResourceName.lastIndexOf('/') + 1);
int index = embeddedResourceName.lastIndexOf('/');
if(index == -1 && File.separatorChar!='/')
{
index = embeddedResourceName.lastIndexOf('\\');
}
String resourceCopyName = embeddedResourceName.substring(index + 1);
String resourceCopyPath = new StringBuilder(cacheDirPath)
.append(File.separatorChar).append(resourceCopyName)
.toString();
......
......@@ -25,6 +25,7 @@
*/
package org.ow2.frascati.util.resource.bundle;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Enumeration;
......@@ -117,14 +118,8 @@ public class Resource extends AbstractResource
String location = bundleResource.getLocation();
try
{
if (!location.startsWith("file:"))
{
resourceURL = new URL("file", "", location);
} else
{
resourceURL = new URL(location);
}
resourceURL = new File(location).getAbsoluteFile().toURI().toURL();
}catch (MalformedURLException e)
{
log.log(Level.CONFIG,e.getMessage(),e);
......
......@@ -25,6 +25,7 @@
*/
package org.ow2.frascati.util.resource.bundler;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Enumeration;
......@@ -113,14 +114,8 @@ public class Resource extends AbstractResource
String location = bundleResource.getLocation();
try
{
if (!location.startsWith("file:"))
{
resourceURL = new URL("file", "", location);
} else
{
resourceURL = new URL(location);
}
resourceURL = new File(location).getAbsoluteFile().toURI().toURL();
}catch (MalformedURLException e)
{
log.log(Level.CONFIG,e.getMessage(),e);
......
......@@ -220,16 +220,17 @@ public class Resource extends AbstractResource
try
{
File tmpDir = IOUtils.getTmpDir();
String simpleResourceName = IOUtils
.pathLastPart(embeddedResourceName);
String simpleResourceName = IOUtils.pathLastPart(embeddedResourceName);
File resourceCopy = new File(new StringBuilder(
tmpDir.getAbsolutePath()).append(File.separatorChar)
.append(simpleResourceName).toString());
tmpDir.getAbsolutePath()).append(File.separatorChar
).append(simpleResourceName).toString());
String resourceCopyPath = resourceCopy.getAbsolutePath();
IOUtils.copyFromStream(resURL.openStream(), resourceCopyPath);
resURL = new URL("jar", "", new StringBuilder("file:")
.append(resourceCopyPath).append("!/").toString());
resURL = new URL("jar", "", new StringBuilder(new File(resourceCopyPath
).toURI().toURL().toExternalForm()).append("!/").toString());
return newResource(this,resURL);
......
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