FELIX-1715: osgi:update can not be used on transformed artifacts
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@825093 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/fileinstall/src/main/java/org/apache/felix/fileinstall/ArtifactUrlTransformer.java b/fileinstall/src/main/java/org/apache/felix/fileinstall/ArtifactUrlTransformer.java
new file mode 100644
index 0000000..16ff5ef
--- /dev/null
+++ b/fileinstall/src/main/java/org/apache/felix/fileinstall/ArtifactUrlTransformer.java
@@ -0,0 +1,37 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.fileinstall;
+
+import java.net.URL;
+
+/**
+ * Objects implementing this interface are able to convert certain
+ * kind of artifacts to OSGi bundles on the fly through an URL handler.
+ *
+ * This kind of artifact listener should be favored over the {@link ArtifactTransformer}
+ * because it allows the use of the OSGi update feature on bundles.
+ */
+public interface ArtifactUrlTransformer extends ArtifactListener {
+
+ /**
+ * Process the given file (canHandle returned true previously)
+ * Can return <null> or a pointer to a transformed file.
+ */
+ URL transform(URL artifact) throws Exception;
+
+}
\ No newline at end of file
diff --git a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/Artifact.java b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/Artifact.java
index 5875a9f..40bcf96 100644
--- a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/Artifact.java
+++ b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/Artifact.java
@@ -19,6 +19,7 @@
package org.apache.felix.fileinstall.internal;
import java.io.File;
+import java.net.URL;
import org.apache.felix.fileinstall.ArtifactListener;
@@ -29,7 +30,9 @@
private File path;
private File jaredDirectory;
+ private URL jaredUrl;
private ArtifactListener listener;
+ private URL transformedUrl;
private File transformed;
private long bundleId = -1;
private long checksum;
@@ -50,6 +53,14 @@
this.jaredDirectory = jaredDirectory;
}
+ public URL getJaredUrl() {
+ return jaredUrl;
+ }
+
+ public void setJaredUrl(URL jaredUrl) {
+ this.jaredUrl = jaredUrl;
+ }
+
public ArtifactListener getListener() {
return listener;
}
@@ -66,6 +77,14 @@
this.transformed = transformed;
}
+ public URL getTransformedUrl() {
+ return transformedUrl;
+ }
+
+ public void setTransformedUrl(URL transformedUrl) {
+ this.transformedUrl = transformedUrl;
+ }
+
public long getBundleId() {
return bundleId;
}
diff --git a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/BundleTransformer.java b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/BundleTransformer.java
index 8e05105..22b0e9a 100644
--- a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/BundleTransformer.java
+++ b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/BundleTransformer.java
@@ -20,16 +20,18 @@
import java.io.File;
import java.io.IOException;
+import java.net.URL;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import java.util.jar.Attributes;
import org.apache.felix.fileinstall.ArtifactTransformer;
+import org.apache.felix.fileinstall.ArtifactUrlTransformer;
/**
- * ArtifactTransformer for plain bundles.
+ * ArtifactUrlTransformer for plain bundles.
*/
-public class BundleTransformer implements ArtifactTransformer
+public class BundleTransformer implements ArtifactUrlTransformer
{
public boolean canHandle(File artifact)
{
@@ -75,7 +77,7 @@
return false;
}
- public File transform(File artifact, File tmpDir) {
+ public URL transform(URL artifact) {
return artifact;
}
diff --git a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java
index 7e409de..d196031 100644
--- a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java
+++ b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java
@@ -23,8 +23,10 @@
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
+import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Dictionary;
@@ -38,6 +40,7 @@
import org.apache.felix.fileinstall.ArtifactInstaller;
import org.apache.felix.fileinstall.ArtifactListener;
import org.apache.felix.fileinstall.ArtifactTransformer;
+import org.apache.felix.fileinstall.ArtifactUrlTransformer;
import org.apache.felix.fileinstall.internal.Util;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -222,6 +225,15 @@
else
{
File jar = file;
+ URL jaredUrl = null;
+ try
+ {
+ jaredUrl = file.toURI().toURL();
+ }
+ catch (MalformedURLException e)
+ {
+ // Ignore, can't happen
+ }
// Jar up the directory if needed
if (file.isDirectory())
{
@@ -230,6 +242,7 @@
{
jar = new File(tmpDir, file.getName() + ".jar");
Util.jarDir(file, jar);
+ jaredUrl = new URL(JarDirUrlHandler.PROTOCOL, null, file.getPath());
}
catch (IOException e)
@@ -268,6 +281,7 @@
{
deleteTransformedFile(artifact);
artifact.setJaredDirectory(jar);
+ artifact.setJaredUrl(jaredUrl);
if (transformArtifact(artifact))
{
modified.add(artifact);
@@ -296,6 +310,7 @@
artifact = new Artifact();
artifact.setPath(file);
artifact.setJaredDirectory(jar);
+ artifact.setJaredUrl(jaredUrl);
artifact.setListener(listener);
artifact.setChecksum(scanner.getChecksum(file));
if (transformArtifact(artifact))
@@ -345,7 +360,8 @@
return null;
}
- boolean transformArtifact(Artifact artifact) {
+ boolean transformArtifact(Artifact artifact)
+ {
if (artifact.getListener() instanceof ArtifactTransformer)
{
prepareDir(tmpDir);
@@ -364,10 +380,29 @@
}
return false;
}
+ else if (artifact.getListener() instanceof ArtifactUrlTransformer)
+ {
+ try
+ {
+ URL url = artifact.getJaredUrl();
+ URL transformed = ((ArtifactUrlTransformer) artifact.getListener()).transform(url);
+ if (transformed != null)
+ {
+ artifact.setTransformedUrl(transformed);
+ return true;
+ }
+ }
+ catch (Exception e)
+ {
+ log("Unable to transform artifact: " + artifact.getPath().getAbsolutePath(), e);
+ }
+ return false;
+ }
return true;
}
- private void deleteTransformedFile(Artifact artifact) {
+ private void deleteTransformedFile(Artifact artifact)
+ {
if (artifact.getTransformed() != null
&& !artifact.getTransformed().equals(artifact.getPath())
&& !artifact.getTransformed().delete())
@@ -673,6 +708,18 @@
{
((ArtifactInstaller) artifact.getListener()).install(path);
}
+ // if the listener is an url transformer
+ else if (artifact.getListener() instanceof ArtifactUrlTransformer)
+ {
+ URL transformed = artifact.getTransformedUrl();
+ Artifact badArtifact = (Artifact) installationFailures.get(artifact.getPath());
+ if (badArtifact != null && badArtifact.getChecksum() == artifact.getChecksum())
+ {
+ return null; // Don't attempt to install it; nothing has changed.
+ }
+ bundle = context.installBundle(transformed.toString());
+ artifact.setBundleId(bundle.getBundleId());
+ }
// else we need to ask for an update on the bundle
else if (artifact.getListener() instanceof ArtifactTransformer)
{
@@ -769,6 +816,20 @@
{
((ArtifactInstaller) artifact.getListener()).update(path);
}
+ // if the listener is an url transformer
+ else if (artifact.getListener() instanceof ArtifactUrlTransformer)
+ {
+ bundle = context.getBundle(artifact.getBundleId());
+ if (bundle == null)
+ {
+ log("Failed to update bundle: "
+ + path + " with ID "
+ + artifact.getBundleId()
+ + ". The bundle has been uninstalled", null);
+ return null;
+ }
+ bundle.update();
+ }
// else we need to ask for an update on the bundle
else if (artifact.getListener() instanceof ArtifactTransformer)
{
diff --git a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/FileInstall.java b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/FileInstall.java
index 84ba378..4318aa7 100644
--- a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/FileInstall.java
+++ b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/FileInstall.java
@@ -26,15 +26,19 @@
import java.util.List;
import java.util.Map;
+import javax.imageio.spi.ServiceRegistry;
+
import org.apache.felix.fileinstall.ArtifactInstaller;
import org.apache.felix.fileinstall.ArtifactListener;
import org.apache.felix.fileinstall.ArtifactTransformer;
+import org.apache.felix.fileinstall.ArtifactUrlTransformer;
import org.apache.felix.fileinstall.internal.Util;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
import org.osgi.service.cm.ConfigurationAdmin;
import org.osgi.service.cm.ConfigurationException;
import org.osgi.service.cm.ManagedServiceFactory;
@@ -65,8 +69,10 @@
addListener(new BundleTransformer());
Hashtable props = new Hashtable();
props.put(Constants.SERVICE_PID, getName());
- context.registerService(ManagedServiceFactory.class.getName(), this,
- props);
+ context.registerService(ManagedServiceFactory.class.getName(), this, props);
+ props = new Hashtable();
+ props.put("url.handler.protocol", JarDirUrlHandler.PROTOCOL);
+ context.registerService(org.osgi.service.url.URLStreamHandlerService.class.getName(), new JarDirUrlHandler(), props);
padmin = new ServiceTracker(context, PackageAdmin.class.getName(), null);
padmin.open();
@@ -90,7 +96,8 @@
};
cmTracker.open();
String flt = "(|(" + Constants.OBJECTCLASS + "=" + ArtifactInstaller.class.getName() + ")"
- + "(" + Constants.OBJECTCLASS + "=" + ArtifactTransformer.class.getName() + "))";
+ + "(" + Constants.OBJECTCLASS + "=" + ArtifactTransformer.class.getName() + ")"
+ + "(" + Constants.OBJECTCLASS + "=" + ArtifactUrlTransformer.class.getName() + "))";
listenersTracker = new ServiceTracker(context, FrameworkUtil.createFilter(flt), null)
{
public Object addingService(ServiceReference serviceReference)
diff --git a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/JarDirUrlHandler.java b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/JarDirUrlHandler.java
new file mode 100644
index 0000000..0d9aa4d
--- /dev/null
+++ b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/JarDirUrlHandler.java
@@ -0,0 +1,107 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.felix.fileinstall.internal;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.osgi.service.url.AbstractURLStreamHandlerService;
+
+/**
+ * A URL handler that can jar a directory on the fly
+ */
+public class JarDirUrlHandler extends AbstractURLStreamHandlerService
+{
+
+ public static final String PROTOCOL = "jardir";
+
+ private static final String SYNTAX = PROTOCOL + ": file";
+
+ /**
+ * Open the connection for the given URL.
+ *
+ * @param url the url from which to open a connection.
+ * @return a connection on the specified URL.
+ * @throws java.io.IOException if an error occurs or if the URL is malformed.
+ */
+ public URLConnection openConnection(URL url) throws IOException
+ {
+ if (url.getPath() == null || url.getPath().trim().length() == 0)
+ {
+ throw new MalformedURLException("Path can not be null or empty. Syntax: " + SYNTAX );
+ }
+ return new Connection(url);
+ }
+
+ public class Connection extends URLConnection
+ {
+
+ public Connection(URL url)
+ {
+ super(url);
+ }
+
+ public void connect() throws IOException
+ {
+ }
+
+ public InputStream getInputStream() throws IOException
+ {
+ try
+ {
+ final PipedOutputStream pos = new PipedOutputStream();
+ final PipedInputStream pis = new PipedInputStream(pos);
+ new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ Util.jarDir(new File(getURL().getPath()), pos);
+ }
+ catch (IOException e)
+ {
+ try
+ {
+ pos.close();
+ }
+ catch (IOException e2)
+ {
+ // Ignore
+ }
+ }
+ }
+ }.start();
+ return pis;
+ }
+ catch (Exception e)
+ {
+ throw (IOException) new IOException("Error opening spring xml url").initCause(e);
+ }
+ }
+ }
+
+}
diff --git a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/Util.java b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/Util.java
index ef5cd49..360cd29 100644
--- a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/Util.java
+++ b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/Util.java
@@ -25,6 +25,7 @@
import java.io.File;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
+import java.io.OutputStream;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.Map;
@@ -281,8 +282,12 @@
* @throws IOException
*/
public static void jarDir(File directory, File zipName) throws IOException {
+ jarDir(directory, new BufferedOutputStream(new FileOutputStream(zipName)));
+ }
+
+ public static void jarDir(File directory, OutputStream os) throws IOException {
// create a ZipOutputStream to zip the data to
- JarOutputStream zos = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(zipName)));
+ JarOutputStream zos = new JarOutputStream(os);
String path = "";
File manFile = new File(directory, JarFile.MANIFEST_NAME);
if (manFile.exists()) {
diff --git a/karaf/deployer/blueprint/src/main/java/org/apache/felix/karaf/deployer/blueprint/BlueprintDeploymentListener.java b/karaf/deployer/blueprint/src/main/java/org/apache/felix/karaf/deployer/blueprint/BlueprintDeploymentListener.java
index 79beba7..e11e958 100644
--- a/karaf/deployer/blueprint/src/main/java/org/apache/felix/karaf/deployer/blueprint/BlueprintDeploymentListener.java
+++ b/karaf/deployer/blueprint/src/main/java/org/apache/felix/karaf/deployer/blueprint/BlueprintDeploymentListener.java
@@ -19,6 +19,7 @@
import java.io.File;
import java.io.FileOutputStream;
+import java.net.URL;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -28,6 +29,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.felix.fileinstall.ArtifactTransformer;
+import org.apache.felix.fileinstall.ArtifactUrlTransformer;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXParseException;
import org.xml.sax.SAXException;
@@ -36,7 +38,7 @@
* A deployment listener that listens for spring xml applications
* and creates bundles for these.
*/
-public class BlueprintDeploymentListener implements ArtifactTransformer {
+public class BlueprintDeploymentListener implements ArtifactUrlTransformer {
private static final Log LOGGER = LogFactory.getLog(BlueprintDeploymentListener.class);
@@ -59,13 +61,9 @@
return false;
}
- public File transform(File artifact, File tmpDir) {
+ public URL transform(URL artifact) {
try {
- File destFile = new File(tmpDir, artifact.getName() + ".jar");
- FileOutputStream os = new FileOutputStream(destFile);
- BlueprintTransformer.transform(artifact.toURL(), os);
- os.close();
- return destFile;
+ return new URL("blueprint", null, artifact.toString());
} catch (Exception e) {
LOGGER.error("Unable to build blueprint application bundle", e);
return null;
diff --git a/karaf/deployer/blueprint/src/main/java/org/apache/felix/karaf/deployer/blueprint/BlueprintURLHandler.java b/karaf/deployer/blueprint/src/main/java/org/apache/felix/karaf/deployer/blueprint/BlueprintURLHandler.java
index 176a380..ca6d344 100644
--- a/karaf/deployer/blueprint/src/main/java/org/apache/felix/karaf/deployer/blueprint/BlueprintURLHandler.java
+++ b/karaf/deployer/blueprint/src/main/java/org/apache/felix/karaf/deployer/blueprint/BlueprintURLHandler.java
@@ -17,6 +17,8 @@
*/
package org.apache.felix.karaf.deployer.blueprint;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -56,7 +58,7 @@
}
blueprintXmlURL = new URL(url.getPath());
- logger.debug("Spring xml URL is: [" + blueprintXmlURL + "]");
+ logger.debug("Blueprint xml URL is: [" + blueprintXmlURL + "]");
return new Connection(url);
}
@@ -77,19 +79,13 @@
@Override
public InputStream getInputStream() throws IOException {
try {
- final File f = File.createTempFile("smx", "xml");
- FileOutputStream os = new FileOutputStream(f);
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
BlueprintTransformer.transform(blueprintXmlURL, os);
os.close();
- return new FileInputStream(f) {
- public void close() throws IOException {
- super.close();
- f.delete();
- }
- };
+ return new ByteArrayInputStream(os.toByteArray());
} catch (Exception e) {
- logger.error("Error opening spring xml url", e);
- throw (IOException) new IOException("Error opening spring xml url").initCause(e);
+ logger.error("Error opening blueprint xml url", e);
+ throw (IOException) new IOException("Error opening blueprint xml url").initCause(e);
}
}
}
diff --git a/karaf/deployer/blueprint/src/main/resources/OSGI-INF/blueprint/blueprint-deployer.xml b/karaf/deployer/blueprint/src/main/resources/OSGI-INF/blueprint/blueprint-deployer.xml
index 77bfcbb..b8d3aac 100644
--- a/karaf/deployer/blueprint/src/main/resources/OSGI-INF/blueprint/blueprint-deployer.xml
+++ b/karaf/deployer/blueprint/src/main/resources/OSGI-INF/blueprint/blueprint-deployer.xml
@@ -17,8 +17,7 @@
limitations under the License.
-->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:cm="http://geronimo.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0">
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<service auto-export="interfaces">
<bean class="org.apache.felix.karaf.deployer.blueprint.BlueprintDeploymentListener"/>
diff --git a/karaf/deployer/spring/src/main/java/org/apache/felix/karaf/deployer/spring/SpringDeploymentListener.java b/karaf/deployer/spring/src/main/java/org/apache/felix/karaf/deployer/spring/SpringDeploymentListener.java
index c3742a7..6cb15f2 100644
--- a/karaf/deployer/spring/src/main/java/org/apache/felix/karaf/deployer/spring/SpringDeploymentListener.java
+++ b/karaf/deployer/spring/src/main/java/org/apache/felix/karaf/deployer/spring/SpringDeploymentListener.java
@@ -19,6 +19,7 @@
import java.io.File;
import java.io.FileOutputStream;
+import java.net.URL;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -28,6 +29,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.felix.fileinstall.ArtifactTransformer;
+import org.apache.felix.fileinstall.ArtifactUrlTransformer;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXParseException;
import org.xml.sax.SAXException;
@@ -36,7 +38,7 @@
* A deployment listener that listens for spring xml applications
* and creates bundles for these.
*/
-public class SpringDeploymentListener implements ArtifactTransformer {
+public class SpringDeploymentListener implements ArtifactUrlTransformer {
private static final Log LOGGER = LogFactory.getLog(SpringDeploymentListener.class);
@@ -58,13 +60,9 @@
return false;
}
- public File transform(File artifact, File tmpDir) {
+ public URL transform(URL artifact) {
try {
- File destFile = new File(tmpDir, artifact.getName() + ".jar");
- FileOutputStream os = new FileOutputStream(destFile);
- SpringTransformer.transform(artifact.toURL(), os);
- os.close();
- return destFile;
+ return new URL("spring", null, artifact.toString());
} catch (Exception e) {
LOGGER.error("Unable to build spring application bundle", e);
return null;
diff --git a/karaf/deployer/spring/src/main/java/org/apache/felix/karaf/deployer/spring/SpringURLHandler.java b/karaf/deployer/spring/src/main/java/org/apache/felix/karaf/deployer/spring/SpringURLHandler.java
index 943f0fe..0124d38 100644
--- a/karaf/deployer/spring/src/main/java/org/apache/felix/karaf/deployer/spring/SpringURLHandler.java
+++ b/karaf/deployer/spring/src/main/java/org/apache/felix/karaf/deployer/spring/SpringURLHandler.java
@@ -17,6 +17,8 @@
*/
package org.apache.felix.karaf.deployer.spring;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -77,16 +79,10 @@
@Override
public InputStream getInputStream() throws IOException {
try {
- final File f = File.createTempFile("smx", "xml");
- FileOutputStream os = new FileOutputStream(f);
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
SpringTransformer.transform(springXmlURL, os);
os.close();
- return new FileInputStream(f) {
- public void close() throws IOException {
- super.close();
- f.delete();
- }
- };
+ return new ByteArrayInputStream(os.toByteArray());
} catch (Exception e) {
logger.error("Error opening spring xml url", e);
throw (IOException) new IOException("Error opening spring xml url").initCause(e);
diff --git a/karaf/deployer/spring/src/main/resources/OSGI-INF/blueprint/spring-deployer.xml b/karaf/deployer/spring/src/main/resources/OSGI-INF/blueprint/spring-deployer.xml
index dcefb2f..3e04d1e 100644
--- a/karaf/deployer/spring/src/main/resources/OSGI-INF/blueprint/spring-deployer.xml
+++ b/karaf/deployer/spring/src/main/resources/OSGI-INF/blueprint/spring-deployer.xml
@@ -17,8 +17,7 @@
limitations under the License.
-->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:cm="http://geronimo.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0">
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<service auto-export="interfaces">
<bean class="org.apache.felix.karaf.deployer.spring.SpringDeploymentListener"/>