This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit ed3a37d2b41f168d40483451fa866a0c5e454249
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Jan 16 13:38:43 2023 +0100

    init no longer in use
---
 init/camel-bundle-plugin/pom.xml                   |  82 ----
 .../org/apache/camel/maven/bundle/CamelPlugin.java |  65 ---
 .../apache/felix/bundleplugin/ManifestPlugin.java  | 493 ---------------------
 .../org/apache/felix/bundleplugin/PatchedLog.java  | 116 -----
 .../felix/bundleplugin/VersionCleanerPlugin.java   |  67 ---
 .../src/main/resources/META-INF/LICENSE.txt        | 203 ---------
 .../src/main/resources/META-INF/MANIFEST.MF        |   0
 .../src/main/resources/META-INF/NOTICE.txt         |  14 -
 init/pom.xml                                       |  61 ---
 9 files changed, 1101 deletions(-)

diff --git a/init/camel-bundle-plugin/pom.xml b/init/camel-bundle-plugin/pom.xml
deleted file mode 100644
index ccc9f0261a1..00000000000
--- a/init/camel-bundle-plugin/pom.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    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.
-
--->
-<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/xsd/maven-4.0.0.xsd";>
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.camel</groupId>
-        <artifactId>init</artifactId>
-        <version>4.0.0-SNAPSHOT</version>
-        <relativePath>..</relativePath>
-    </parent>
-
-    <artifactId>camel-bundle-plugin</artifactId>
-    <packaging>maven-plugin</packaging>
-
-    <name>Camel :: Maven Plugins :: Enhanced Bundle Plugin</name>
-    <description>OSGi Bundle plugin detecting stale input</description>
-
-    <properties>
-        <sourcecheckExcludesComma>
-            **/*.java,
-        </sourcecheckExcludesComma>
-        <maven-version>3.3.9</maven-version>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.felix</groupId>
-            <artifactId>maven-bundle-plugin</artifactId>
-            <version>${maven-bundle-plugin-version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.maven</groupId>
-            <artifactId>maven-core</artifactId>
-            <version>${maven-version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.maven</groupId>
-            <artifactId>maven-compat</artifactId>
-            <version>${maven-version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.maven</groupId>
-            <artifactId>maven-model</artifactId>
-            <version>${maven-version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.maven</groupId>
-            <artifactId>maven-artifact</artifactId>
-            <version>${maven-version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.maven.plugin-tools</groupId>
-            <artifactId>maven-plugin-annotations</artifactId>
-            <version>3.4</version>
-            <scope>provided</scope>
-        </dependency>
-    </dependencies>
-
-</project>
diff --git 
a/init/camel-bundle-plugin/src/main/java/org/apache/camel/maven/bundle/CamelPlugin.java
 
b/init/camel-bundle-plugin/src/main/java/org/apache/camel/maven/bundle/CamelPlugin.java
deleted file mode 100644
index 38ca8f54134..00000000000
--- 
a/init/camel-bundle-plugin/src/main/java/org/apache/camel/maven/bundle/CamelPlugin.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.camel.maven.bundle;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import aQute.bnd.annotation.plugin.BndPlugin;
-import aQute.bnd.osgi.Analyzer;
-import aQute.bnd.osgi.Jar;
-import aQute.bnd.osgi.Resource;
-import aQute.bnd.service.AnalyzerPlugin;
-
-@BndPlugin(name = "camel")
-public class CamelPlugin implements AnalyzerPlugin {
-
-    @Override
-    public boolean analyzeJar(Analyzer analyzer) {
-        Jar jar = analyzer.getJar();
-        Map<String, Map<String, Resource>> dir = jar.getDirectories();
-
-        Stream<String> components = dir
-                .getOrDefault("META-INF/services/org/apache/camel/component", 
Collections.emptyMap()).keySet().stream()
-                .map(s -> s.substring(s.lastIndexOf('/') + 1))
-                .map(s -> 
"osgi.service;effective:=active;objectClass=\"org.apache.camel.spi.ComponentResolver\";component="
-                        + s);
-        Stream<String> languages = dir
-                .getOrDefault("META-INF/services/org/apache/camel/language", 
Collections.emptyMap()).keySet().stream()
-                .map(s -> s.substring(s.lastIndexOf('/') + 1))
-                .map(s -> 
"osgi.service;effective:=active;objectClass=\"org.apache.camel.spi.LanguageResolver\";language="
-                        + s);
-        Stream<String> dataformats = dir
-                .getOrDefault("META-INF/services/org/apache/camel/dataformat", 
Collections.emptyMap()).keySet().stream()
-                .map(s -> s.substring(s.lastIndexOf('/') + 1))
-                .map(s -> 
"osgi.service;effective:=active;objectClass=\"org.apache.camel.spi.DataformatResolver\";dataformat="
-                        + s);
-        String header = analyzer.getProperty("Provide-Capability");
-
-        header = Stream
-                .concat(header != null && !header.isEmpty() ? 
Stream.of(header) : Stream.empty(),
-                        Stream.concat(components, Stream.concat(languages, 
dataformats)))
-                .collect(Collectors.joining(","));
-
-        analyzer.setProperty("Provide-Capability", header);
-
-        return false;
-    }
-
-}
diff --git 
a/init/camel-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
 
b/init/camel-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
deleted file mode 100644
index 366ae994c9b..00000000000
--- 
a/init/camel-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
+++ /dev/null
@@ -1,493 +0,0 @@
-/*
- * 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.bundleplugin;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOError;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Writer;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardOpenOption;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.Set;
-import java.util.jar.Manifest;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import java.util.zip.ZipFile;
-
-import aQute.bnd.osgi.Analyzer;
-import aQute.bnd.osgi.Builder;
-import aQute.bnd.osgi.Instructions;
-import aQute.bnd.osgi.Jar;
-import aQute.bnd.osgi.Resource;
-import aQute.lib.collections.ExtList;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.plugins.annotations.Component;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.util.Scanner;
-import org.osgi.service.metatype.MetaTypeService;
-import org.sonatype.plexus.build.incremental.BuildContext;
-
-/**
- * Generate an OSGi manifest for this project
- */
-@Mojo(name = "manifest", requiresDependencyResolution = ResolutionScope.TEST, 
threadSafe = true, defaultPhase = LifecyclePhase.PROCESS_CLASSES)
-public class ManifestPlugin extends BundlePlugin {
-    /**
-     * When true, generate the manifest by rebuilding the full bundle in memory
-     */
-    @Parameter(property = "rebuildBundle")
-    protected boolean rebuildBundle;
-
-    /**
-     * When true, manifest generation on incremental builds is supported in 
IDEs like Eclipse. Please note that the
-     * underlying BND library does not support incremental build, which means 
always the whole manifest and SCR metadata
-     * is generated.
-     */
-    @Parameter(property = "supportIncrementalBuild")
-    private boolean supportIncrementalBuild;
-
-    @Component
-    private BuildContext buildContext;
-
-    @Parameter(defaultValue = "${showStaleFiles}")
-    private boolean showStaleFiles;
-
-    @Override
-    protected void execute(Map<String, String> instructions, ClassPathItem[] 
classpath) throws MojoExecutionException {
-
-        if (supportIncrementalBuild && isUpToDate(project)) {
-            return;
-        }
-        // in incremental build execute manifest generation only when 
explicitly
-        // activated
-        // and when any java file was touched since last build
-        if (buildContext.isIncremental() && !(supportIncrementalBuild && 
anyJavaSourceFileTouchedSinceLastBuild())) {
-            getLog().debug(
-                    "Skipping manifest generation because no java source file 
was added, updated or removed since last build.");
-            return;
-        }
-
-        // avoid noisy logging
-        PatchedLog plog = new PatchedLog(getLog());
-        setLog(plog);
-
-        try (Analyzer analyzer= getAnalyzer(project, instructions, classpath)) 
{
-            File outputFile = new File(manifestLocation, "MANIFEST.MF");
-
-            writeManifest(analyzer, outputFile, niceManifest, exportScr, 
scrLocation, buildContext, getLog());
-
-            if (supportIncrementalBuild) {
-                writeIncrementalInfo(project);
-            }
-        } catch (FileNotFoundException e) {
-            throw new MojoExecutionException(
-                    "Cannot find " + e.getMessage() + " (manifest goal must be 
run after compile phase)", e);
-        } catch (IOException e) {
-            throw new MojoExecutionException("Error trying to generate 
Manifest", e);
-        } catch (MojoFailureException e) {
-            getLog().error(e.getLocalizedMessage());
-            throw new MojoExecutionException("Error(s) found in manifest 
configuration", e);
-        } catch (Exception e) {
-            getLog().error("An internal error occurred", e);
-            throw new MojoExecutionException("Internal error in 
maven-bundle-plugin", e);
-        }
-    }
-
-    /**
-     * Checks if any *.java file was added, updated or removed since last 
build in any source directory.
-     */
-    private boolean anyJavaSourceFileTouchedSinceLastBuild() {
-        @SuppressWarnings("unchecked")
-        List<String> sourceDirectories = project.getCompileSourceRoots();
-        for (String sourceDirectory : sourceDirectories) {
-            File directory = new File(sourceDirectory);
-            Scanner scanner = buildContext.newScanner(directory);
-            Scanner deleteScanner = buildContext.newDeleteScanner(directory);
-            if (containsJavaFile(scanner) || containsJavaFile(deleteScanner)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private boolean containsJavaFile(Scanner scanner) {
-        String[] includes = new String[] { "**/*.java" };
-        scanner.setIncludes(includes);
-        scanner.scan();
-        return scanner.getIncludedFiles().length > 0;
-    }
-
-
-    private static void exportScr(Analyzer analyzer, Jar jar, File 
scrLocation, BuildContext buildContext, Log log)
-            throws Exception {
-        log.debug("Export SCR metadata to: " + scrLocation.getPath());
-        scrLocation.mkdirs();
-
-        // export SCR metadata files from OSGI-INF/
-        Map<String, Resource> scrDir = jar.getDirectories().get("OSGI-INF");
-        if (scrDir != null) {
-            for (Map.Entry<String, Resource> entry : scrDir.entrySet()) {
-                String path = entry.getKey();
-                Resource resource = entry.getValue();
-                writeSCR(resource, new File(scrLocation, path), buildContext, 
log);
-            }
-        }
-
-        // export metatype files from OSGI-INF/metatype
-        Map<String, Resource> metatypeDir = 
jar.getDirectories().get(MetaTypeService.METATYPE_DOCUMENTS_LOCATION);
-        if (metatypeDir != null) {
-            for (Map.Entry<String, Resource> entry : metatypeDir.entrySet()) {
-                String path = entry.getKey();
-                Resource resource = entry.getValue();
-                writeSCR(resource, new File(scrLocation, path), buildContext, 
log);
-            }
-        }
-
-    }
-
-    private static void writeSCR(Resource resource, File destination, 
BuildContext buildContext, Log log)
-            throws Exception {
-        log.debug("Write SCR file: " + destination.getPath());
-        destination.getParentFile().mkdirs();
-        OutputStream os = buildContext.newFileOutputStream(destination);
-        try {
-            resource.write(os);
-        } finally {
-            os.close();
-        }
-    }
-
-    protected Analyzer getAnalyzer(MavenProject project, Map<String, String> 
instructions, ClassPathItem[] classpath)
-            throws Exception {
-        if (rebuildBundle && 
supportedProjectTypes.contains(project.getArtifact().getType())) {
-            return buildOSGiBundle(project, instructions, classpath);
-        }
-
-        File file = getOutputDirectory();
-        if (file == null) {
-            file = project.getArtifact().getFile();
-        }
-
-        if (!file.exists()) {
-            if (file.equals(getOutputDirectory())) {
-                file.mkdirs();
-            } else {
-                throw new FileNotFoundException(file.getPath());
-            }
-        }
-
-        Builder analyzer = getOSGiBuilder(project, instructions, classpath);
-
-        analyzer.setJar(file);
-
-        // calculateExportsFromContents when we have no explicit instructions
-        // defining
-        // the contents of the bundle *and* we are not analyzing the output
-        // directory,
-        // otherwise fall-back to addMavenInstructions approach
-
-        boolean isOutputDirectory = file.equals(getOutputDirectory());
-
-        if (analyzer.getProperty(Analyzer.EXPORT_PACKAGE) == null
-                && analyzer.getProperty(Analyzer.EXPORT_CONTENTS) == null
-                && analyzer.getProperty(Analyzer.PRIVATE_PACKAGE) == null && 
!isOutputDirectory) {
-            String export = calculateExportsFromContents(analyzer.getJar());
-            analyzer.setProperty(Analyzer.EXPORT_PACKAGE, export);
-        }
-
-        addMavenInstructions(project, analyzer);
-
-        // if we spot Embed-Dependency and the bundle is "target/classes",
-        // assume we need to rebuild
-        if (analyzer.getProperty(DependencyEmbedder.EMBED_DEPENDENCY) != null 
&& isOutputDirectory) {
-            analyzer.build();
-        } else {
-            analyzer.mergeManifest(analyzer.getJar().getManifest());
-            analyzer.getJar().setManifest(analyzer.calcManifest());
-        }
-
-        mergeMavenManifest(project, analyzer);
-
-        boolean hasErrors = reportErrors("Manifest " + project.getArtifact(), 
analyzer);
-        if (hasErrors) {
-            String failok = analyzer.getProperty("-failok");
-            if (null == failok || "false".equalsIgnoreCase(failok)) {
-                throw new MojoFailureException("Error(s) found in manifest 
configuration");
-            }
-        }
-
-        Jar jar = analyzer.getJar();
-
-        if (unpackBundle) {
-            File outputFile = getOutputDirectory();
-            for (Entry<String, Resource> entry : 
jar.getResources().entrySet()) {
-                File entryFile = new File(outputFile, entry.getKey());
-                if (!entryFile.exists() || entry.getValue().lastModified() == 
0) {
-                    entryFile.getParentFile().mkdirs();
-                    OutputStream os = 
buildContext.newFileOutputStream(entryFile);
-                    entry.getValue().write(os);
-                    os.close();
-                }
-            }
-        }
-
-        return analyzer;
-    }
-
-    private void writeIncrementalInfo(MavenProject project) throws 
MojoExecutionException {
-        try {
-            Path cacheData = getIncrementalDataPath(project);
-            String curdata = getIncrementalData();
-            Files.createDirectories(cacheData.getParent());
-            try (Writer w = Files.newBufferedWriter(cacheData)) {
-                w.append(curdata);
-            }
-        } catch (IOException e) {
-            throw new MojoExecutionException("Error checking manifest uptodate 
status", e);
-        }
-    }
-
-    private boolean isUpToDate(MavenProject project) throws 
MojoExecutionException {
-        try {
-            Path cacheData = getIncrementalDataPath(project);
-            final String prvdata = getPreviousRunData(cacheData);
-            final String curdata = getIncrementalData();
-            if (curdata.equals(prvdata)) {
-                long lastmod = Files.getLastModifiedTime(cacheData).toMillis();
-                Set<String> stale = Stream
-                        .concat(Stream.of(new 
File(project.getBuild().getOutputDirectory())),
-                                
project.getArtifacts().stream().map(Artifact::getFile))
-                        .flatMap(f -> newer(lastmod, 
f)).collect(Collectors.toSet());
-                if (!stale.isEmpty()) {
-                    getLog().info("Stale files detected, re-generating 
manifest.");
-                    if (showStaleFiles) {
-                        getLog().info("Stale files: " + 
stale.stream().collect(Collectors.joining(", ")));
-                    } else if (getLog().isDebugEnabled()) {
-                        getLog().debug("Stale files: " + 
stale.stream().collect(Collectors.joining(", ")));
-                    }
-                } else {
-                    // everything is in order, skip
-                    getLog().info("Skipping manifest generation, everything is 
up to date.");
-                    return true;
-                }
-            } else {
-                if (prvdata == null) {
-                    getLog().info("No previous run data found, generating 
manifest.");
-                } else {
-                    getLog().info("Configuration changed, re-generating 
manifest.");
-                }
-            }
-        } catch (IOException e) {
-            throw new MojoExecutionException("Error checking manifest uptodate 
status", e);
-        }
-        return false;
-    }
-
-    private String getPreviousRunData(Path cacheData) throws IOException {
-        String prvdata;
-        if (Files.isRegularFile(cacheData)) {
-            prvdata = new String(Files.readAllBytes(cacheData), 
StandardCharsets.UTF_8);
-        } else {
-            prvdata = null;
-        }
-        return prvdata;
-    }
-
-    private String getIncrementalData() {
-        return getInstructions().entrySet().stream().map(e -> e.getKey() + "=" 
+ e.getValue())
-                .collect(Collectors.joining("\n", "", "\n"));
-    }
-
-    private Path getIncrementalDataPath(MavenProject project) {
-        return Paths.get(project.getBuild().getDirectory(), 
"maven-bundle-plugin",
-                "org.apache.felix_maven-bundle-plugin_manifest_xx");
-    }
-
-    private long lastmod(Path p) {
-        try {
-            return Files.getLastModifiedTime(p).toMillis();
-        } catch (IOException e) {
-            return 0;
-        }
-    }
-
-    private Stream<String> newer(long lastmod, File file) {
-        try {
-            if (file.isDirectory()) {
-                return 
Files.walk(file.toPath()).filter(Files::isRegularFile).filter(p -> lastmod(p) > 
lastmod)
-                        .map(Path::toString);
-            } else if (file.isFile()) {
-                if (lastmod(file.toPath()) > lastmod) {
-                    if (file.getName().endsWith(".jar")) {
-                        try (ZipFile zf = new ZipFile(file)) {
-                            return zf.stream().filter(ze -> !ze.isDirectory())
-                                    .filter(ze -> 
ze.getLastModifiedTime().toMillis() > lastmod)
-                                    .map(ze -> file + "!" + 
ze.getName()).collect(Collectors.toList())
-                                    .stream();
-                        }
-                    } else {
-                        return Stream.of(file.toString());
-                    }
-                } else {
-                    return Stream.empty();
-                }
-            } else {
-                return Stream.empty();
-            }
-        } catch (IOException e) {
-            throw new IOError(e);
-        }
-    }
-
-    public static void writeManifest(Analyzer analyzer, File outputFile, 
boolean niceManifest, boolean exportScr,
-            File scrLocation, BuildContext buildContext, Log log) throws 
Exception {
-        Properties properties = analyzer.getProperties();
-        Jar jar = analyzer.getJar();
-        Manifest manifest = jar.getManifest();
-        if (outputFile.exists() && properties.containsKey("Merge-Headers")) {
-            Manifest analyzerManifest = manifest;
-            manifest = new Manifest();
-
-            try(InputStream inputStream = new FileInputStream(outputFile)) {
-                manifest.read(inputStream);
-            }
-
-            Instructions instructions = new 
Instructions(ExtList.from(analyzer.getProperty("Merge-Headers")));
-            mergeManifest(instructions, manifest, analyzerManifest);
-        } else {
-            File parentFile = outputFile.getParentFile();
-            parentFile.mkdirs();
-        }
-        writeManifest(manifest, outputFile, niceManifest, buildContext, log);
-
-        if (exportScr) {
-            exportScr(analyzer, jar, scrLocation, buildContext, log);
-        }
-    }
-
-    public static void writeManifest(Manifest manifest, File outputFile, 
boolean niceManifest,
-            BuildContext buildContext, Log log) throws IOException {
-
-        try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
-            ManifestWriter.outputManifest(manifest, baos, niceManifest);
-
-            if (log.isDebugEnabled()) {
-                log.debug("Write manifest to " + outputFile.getPath());
-            }
-
-            if (updateFile(outputFile.toPath(), baos.toByteArray())) {
-                buildContext.refresh(outputFile);
-            }
-        }
-    }
-
-    /**
-     * Update a file with the given binary content if neeed. The file won't be 
modified if the content is already the
-     * same.
-     *
-     * @param path
-     *            the path of the file to update
-     * @param newdata
-     *            the new binary data, <code>null</code> to delete the file
-     * 
-     * @return <code>true</code> if the file was modified, <code>false</code> 
otherwise
-     * 
-     * @throws IOException
-     *             if an exception occurs
-     */
-    public static boolean updateFile(Path path, byte[] newdata) throws 
IOException {
-        if (newdata == null) {
-            if (!Files.exists(path)) {
-                return false;
-            }
-            Files.delete(path);
-            return true;
-        } else {
-            byte[] olddata = new byte[0];
-            if (Files.exists(path) && Files.isReadable(path)) {
-                olddata = Files.readAllBytes(path);
-            }
-            if (Arrays.equals(olddata, newdata)) {
-                return false;
-            }
-            Files.createDirectories(path.getParent());
-            Files.write(path, newdata, StandardOpenOption.WRITE, 
StandardOpenOption.CREATE,
-                    StandardOpenOption.TRUNCATE_EXISTING);
-            return true;
-        }
-    }
-
-    /*
-     * Patched version of bnd's Analyzer.calculateExportsFromContents
-     */
-    public static String calculateExportsFromContents(Jar bundle) {
-        String ddel = "";
-        StringBuffer sb = new StringBuffer();
-        Map<String, Map<String, Resource>> map = bundle.getDirectories();
-        for (Iterator<Entry<String, Map<String, Resource>>> i = 
map.entrySet().iterator(); i.hasNext();) {
-            // ----------------------------------------------------
-            // should also ignore directories with no resources
-            // ----------------------------------------------------
-            Entry<String, Map<String, Resource>> entry = i.next();
-            if (entry.getValue() == null || entry.getValue().isEmpty()) {
-                continue;
-            }
-            // ----------------------------------------------------
-            String directory = entry.getKey();
-            if (directory.equals("META-INF") || 
directory.startsWith("META-INF/")) {
-                continue;
-            }
-            if (directory.equals("OSGI-OPT") || 
directory.startsWith("OSGI-OPT/")) {
-                continue;
-            }
-            if (directory.equals("/")) {
-                continue;
-            }
-
-            if (directory.endsWith("/")) {
-                directory = directory.substring(0, directory.length() - 1);
-            }
-
-            directory = directory.replace('/', '.');
-            sb.append(ddel);
-            sb.append(directory);
-            ddel = ",";
-        }
-        return sb.toString();
-    }
-}
diff --git 
a/init/camel-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/PatchedLog.java
 
b/init/camel-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/PatchedLog.java
deleted file mode 100644
index 86895b8c0f8..00000000000
--- 
a/init/camel-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/PatchedLog.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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.bundleplugin;
-
-import org.apache.maven.plugin.logging.Log;
-
-/**
- * Patched logger that is not noisy.
- */
-public class PatchedLog implements Log {
-
-    private final Log delegate;
-
-    public PatchedLog(Log delegate) {
-        this.delegate = delegate;
-    }
-
-    @Override
-    public boolean isDebugEnabled() {
-        return delegate.isDebugEnabled();
-    }
-
-    @Override
-    public void debug(CharSequence charSequence) {
-        delegate.debug(charSequence);
-    }
-
-    @Override
-    public void debug(CharSequence charSequence, Throwable throwable) {
-        delegate.debug(charSequence, throwable);
-    }
-
-    @Override
-    public void debug(Throwable throwable) {
-        delegate.debug(throwable);
-    }
-
-    @Override
-    public boolean isInfoEnabled() {
-        return delegate.isInfoEnabled();
-    }
-
-    @Override
-    public void info(CharSequence charSequence) {
-        delegate.info(charSequence);
-    }
-
-    @Override
-    public void info(CharSequence charSequence, Throwable throwable) {
-        delegate.info(charSequence, throwable);
-    }
-
-    @Override
-    public void info(Throwable throwable) {
-        delegate.info(throwable);
-    }
-
-    @Override
-    public boolean isWarnEnabled() {
-        return delegate.isWarnEnabled();
-    }
-
-    @Override
-    public void warn(CharSequence charSequence) {
-        // skip some unwanted WARN logging
-        String s = charSequence.toString();
-        if (s.startsWith("Include-Resource: overriding")) {
-            return;
-        }
-        delegate.warn(charSequence);
-    }
-
-    @Override
-    public void warn(CharSequence charSequence, Throwable throwable) {
-        delegate.warn(charSequence, throwable);
-    }
-
-    @Override
-    public void warn(Throwable throwable) {
-        delegate.warn(throwable);
-    }
-
-    @Override
-    public boolean isErrorEnabled() {
-        return delegate.isErrorEnabled();
-    }
-
-    @Override
-    public void error(CharSequence charSequence) {
-        delegate.error(charSequence);
-    }
-
-    @Override
-    public void error(CharSequence charSequence, Throwable throwable) {
-        delegate.error(charSequence, throwable);
-    }
-
-    @Override
-    public void error(Throwable throwable) {
-        delegate.error(throwable);
-    }
-}
diff --git 
a/init/camel-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/VersionCleanerPlugin.java
 
b/init/camel-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/VersionCleanerPlugin.java
deleted file mode 100644
index 733e567e243..00000000000
--- 
a/init/camel-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/VersionCleanerPlugin.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.bundleplugin;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
-import org.apache.maven.shared.osgi.Maven2OsgiConverter;
-
-/**
- * Clean OSGi versions, ie convert a group of versions to OSGi format.
- */
-@Mojo(name = "cleanVersions", threadSafe = true)
-public class VersionCleanerPlugin extends AbstractMojo {
-
-    /**
-     * The BND instructions for the bundle.
-     */
-    @Parameter
-    private Map<String, String> versions = new LinkedHashMap<String, String>();
-
-    /**
-     * The Maven project.
-     */
-    @Parameter(defaultValue = "${project}", readonly = true, required = true)
-    private MavenProject project;
-
-    private Maven2OsgiConverter maven2OsgiConverter = new 
DefaultMaven2OsgiConverter();
-
-    public Maven2OsgiConverter getMaven2OsgiConverter() {
-        return maven2OsgiConverter;
-    }
-
-    public void setMaven2OsgiConverter(Maven2OsgiConverter 
maven2OsgiConverter) {
-        this.maven2OsgiConverter = maven2OsgiConverter;
-    }
-
-    public void execute() throws MojoExecutionException, MojoFailureException {
-        for (Map.Entry<String, String> entry : versions.entrySet()) {
-            String name = entry.getKey();
-            String version = entry.getValue();
-            String osgi = maven2OsgiConverter.getVersion(version);
-            project.getProperties().put(name, osgi);
-        }
-    }
-}
diff --git a/init/camel-bundle-plugin/src/main/resources/META-INF/LICENSE.txt 
b/init/camel-bundle-plugin/src/main/resources/META-INF/LICENSE.txt
deleted file mode 100644
index 6b0b1270ff0..00000000000
--- a/init/camel-bundle-plugin/src/main/resources/META-INF/LICENSE.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed 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.
-
diff --git a/init/camel-bundle-plugin/src/main/resources/META-INF/MANIFEST.MF 
b/init/camel-bundle-plugin/src/main/resources/META-INF/MANIFEST.MF
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/init/camel-bundle-plugin/src/main/resources/META-INF/NOTICE.txt 
b/init/camel-bundle-plugin/src/main/resources/META-INF/NOTICE.txt
deleted file mode 100644
index 0291ff5ba9e..00000000000
--- a/init/camel-bundle-plugin/src/main/resources/META-INF/NOTICE.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-   =========================================================================
-   ==  NOTICE file corresponding to the section 4 d of                    ==
-   ==  the Apache License, Version 2.0,                                   ==
-   ==  in this case for the Apache Camel distribution.                    ==
-   =========================================================================
-
-   This product includes software developed by
-   The Apache Software Foundation (http://www.apache.org/).
-
-   This product includes software developed by
-   Clifton Labs (https://github.com/cliftonlabs/json-simple).
-
-   Please read the different LICENSE files present in the licenses directory of
-   this distribution.
diff --git a/init/pom.xml b/init/pom.xml
deleted file mode 100644
index ca3e805457d..00000000000
--- a/init/pom.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    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.
-
--->
-<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/xsd/maven-4.0.0.xsd";>
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.camel</groupId>
-        <artifactId>camel</artifactId>
-        <version>4.0.0-SNAPSHOT</version>
-        <relativePath>..</relativePath>
-    </parent>
-
-    <artifactId>init</artifactId>
-    <packaging>pom</packaging>
-
-    <name>Camel :: Init</name>
-    <description>Camel Init</description>
-
-    <modules>
-        <module>camel-bundle-plugin</module>
-    </modules>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>${maven-compiler-plugin-version}</version>
-                <configuration>
-                    <release>${jdk.version}</release>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-surefire-plugin</artifactId>
-                    <version>${maven-surefire-plugin-version}</version>
-                    <configuration>
-                        <failIfNoTests>false</failIfNoTests>
-                    </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>

Reply via email to