X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.repo%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Frepo%2Fosgi%2FUriWrapper.java;h=7d717381da7df253dcd9a94d94c434db724becb1;hb=9814c20dc9d73ec1626e099f60229decc4ea0ab6;hp=45456ad31abb4d525a9b34f1c53636628682913a;hpb=fa099b50351a61638bdb1e3becc45ace640c15f2;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/osgi/UriWrapper.java b/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/osgi/UriWrapper.java index 45456ad31..7d717381d 100644 --- a/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/osgi/UriWrapper.java +++ b/runtime/org.argeo.slc.repo/src/main/java/org/argeo/slc/repo/osgi/UriWrapper.java @@ -5,7 +5,6 @@ import java.io.InputStream; import javax.jcr.Node; import javax.jcr.Property; -import javax.jcr.RepositoryException; import javax.jcr.Session; import org.apache.commons.logging.Log; @@ -25,11 +24,18 @@ public class UriWrapper extends BndWrapper implements Runnable { private OsgiFactory osgiFactory; + // private SourcesProvider sourcesProvider; + + public UriWrapper() { + setFactory(this); + } + public void run() { Session distSession = null; Session javaSession = null; InputStream in; ByteArrayOutputStream out; + // Jar jar = null; try { distSession = osgiFactory.openDistSession(); javaSession = osgiFactory.openJavaSession(); @@ -51,11 +57,41 @@ public class UriWrapper extends BndWrapper implements Runnable { newJarNode.getSession().save(); if (log.isDebugEnabled()) log.debug("Wrapped " + uri + " to " + newJarNode.getPath()); - } catch (RepositoryException e) { - throw new SlcException("Cannot wrap Maven " + uri, e); + + // sources + // if (sourcesProvider != null) { + // IOUtils.closeQuietly(in); + // in = new ByteArrayInputStream(out.toByteArray()); + // jar = new Jar(null, in); + // List packages = jar.getPackages(); + // + // IOUtils.closeQuietly(out); + // out = new ByteArrayOutputStream(); + // sourcesProvider + // .writeSources(packages, new ZipOutputStream(out)); + // + // IOUtils.closeQuietly(in); + // in = new ByteArrayInputStream(out.toByteArray()); + // byte[] sourcesJar = RepoUtils.packageAsPdeSource(in, + // new DefaultNameVersion(this)); + // Artifact sourcesArtifact = new DefaultArtifact(getArtifact() + // .getGroupId(), getArtifact().getArtifactId() + // + ".source", "jar", getArtifact().getVersion()); + // Node sourcesJarNode = RepoUtils.copyBytesAsArtifact( + // javaSession.getRootNode(), sourcesArtifact, sourcesJar); + // sourcesJarNode.getSession().save(); + // + // if (log.isDebugEnabled()) + // log.debug("Added sources " + sourcesArtifact + // + " for bundle " + getArtifact()); + // } + } catch (Exception e) { + throw new SlcException("Cannot wrap URI " + uri, e); } finally { JcrUtils.logoutQuietly(distSession); JcrUtils.logoutQuietly(javaSession); + // if (jar != null) + // jar.close(); } }