You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2017/06/01 11:25:50 UTC
svn commit: r1797193 - in /sling/whiteboard/cziegeler/feature-launcher: ./
src/main/java/org/apache/sling/feature/launcher/api/
src/main/java/org/apache/sling/feature/launcher/impl/
src/main/java/org/apache/sling/feature/launcher/impl/artifacts/ src/ma...
Author: cziegeler
Date: Thu Jun 1 11:25:50 2017
New Revision: 1797193
URL: http://svn.apache.org/viewvc?rev=1797193&view=rev
Log:
Use feature support module
Removed:
sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/api/
sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/artifacts/
sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/spi/ArtifactProvider.java
sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/spi/ArtifactProviderContext.java
sling/whiteboard/cziegeler/feature-launcher/src/test/
Modified:
sling/whiteboard/cziegeler/feature-launcher/pom.xml
sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/FeatureProcessor.java
sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/LauncherConfig.java
sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/Main.java
sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/launchers/AbstractRunner.java
Modified: sling/whiteboard/cziegeler/feature-launcher/pom.xml
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/feature-launcher/pom.xml?rev=1797193&r1=1797192&r2=1797193&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/feature-launcher/pom.xml (original)
+++ sling/whiteboard/cziegeler/feature-launcher/pom.xml Thu Jun 1 11:25:50 2017
@@ -34,8 +34,8 @@
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/tooling/support/feature-launcher</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/tooling/support/featurelauncher</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/trunk/tooling/support/featurelauncher</url>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/tooling/support/feature-launcher</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/trunk/tooling/support/feature-launcher</url>
</scm>
<build>
@@ -55,7 +55,7 @@
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
- <includeArtifactIds>org.apache.sling.feature,org.apache.sling.commons.johnzon,commons-cli</includeArtifactIds>
+ <includeArtifactIds>org.apache.sling.feature,org.apache.sling.feature.support,org.apache.sling.commons.johnzon,commons-cli</includeArtifactIds>
</configuration>
</execution>
</executions>
@@ -83,7 +83,11 @@
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.feature</artifactId>
<version>0.0.1-SNAPSHOT</version>
- <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.feature.support</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
Modified: sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/FeatureProcessor.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/FeatureProcessor.java?rev=1797193&r1=1797192&r2=1797193&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/FeatureProcessor.java (original)
+++ sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/FeatureProcessor.java Thu Jun 1 11:25:50 2017
@@ -33,12 +33,12 @@ import org.apache.sling.feature.Extensio
import org.apache.sling.feature.Feature;
import org.apache.sling.feature.json.ApplicationJSONWriter;
import org.apache.sling.feature.json.FeatureJSONReader;
-import org.apache.sling.feature.launcher.api.Logger;
import org.apache.sling.feature.launcher.impl.LauncherConfig.StartupMode;
-import org.apache.sling.feature.launcher.impl.artifacts.ArtifactHandler;
-import org.apache.sling.feature.launcher.impl.artifacts.ArtifactManager;
import org.apache.sling.feature.process.ApplicationBuilder;
import org.apache.sling.feature.process.FeatureProvider;
+import org.apache.sling.feature.support.ArtifactHandler;
+import org.apache.sling.feature.support.ArtifactManager;
+import org.apache.sling.feature.support.Logger;
public class FeatureProcessor {
@@ -80,8 +80,8 @@ public class FeatureProcessor {
public Feature provide(final ArtifactId id) {
try {
final ArtifactHandler handler = artifactManager.getArtifactHandler("mvn:" + id.toMvnPath());
- try (final FileReader r = new FileReader(handler.getArtifact())) {
- final Feature f = FeatureJSONReader.read(r, handler.getArtifactUrl());
+ try (final FileReader r = new FileReader(handler.getFile())) {
+ final Feature f = FeatureJSONReader.read(r, handler.getUrl());
return f;
}
@@ -150,10 +150,10 @@ public class FeatureProcessor {
Logger.LOG.debug("Exception while getting artifact " + file, use);
System.exit(1);
}
- Logger.LOG.log("- reading feature {0}", featureArtifact.getArtifactUrl());
+ Logger.LOG.log("- reading feature {0}", featureArtifact.getUrl());
- try (final FileReader r = new FileReader(featureArtifact.getArtifact())) {
- final Feature f = FeatureJSONReader.read(r, featureArtifact.getArtifactUrl());
+ try (final FileReader r = new FileReader(featureArtifact.getFile())) {
+ final Feature f = FeatureJSONReader.read(r, featureArtifact.getUrl());
return f;
}
}
@@ -170,7 +170,7 @@ public class FeatureProcessor {
for(final Map.Entry<Integer, List<Artifact>> entry : app.getBundles().getBundlesByStartLevel().entrySet()) {
for(final Artifact a : entry.getValue()) {
final ArtifactHandler handler = artifactManager.getArtifactHandler(":" + a.getId().toMvnPath());
- final File artifactFile = handler.getArtifact();
+ final File artifactFile = handler.getFile();
config.getInstallation().addBundle(entry.getKey(), artifactFile);
}
@@ -182,7 +182,7 @@ public class FeatureProcessor {
throw new Exception("Artifacts other than bundle are not supported by framework launcher.");
}
final ArtifactHandler handler = artifactManager.getArtifactHandler(":" + a.getId().toMvnPath());
- config.getInstallation().addInstallableArtifact(handler.getArtifact());
+ config.getInstallation().addInstallableArtifact(handler.getFile());
}
}
}
Modified: sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/LauncherConfig.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/LauncherConfig.java?rev=1797193&r1=1797192&r2=1797193&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/LauncherConfig.java (original)
+++ sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/LauncherConfig.java Thu Jun 1 11:25:50 2017
@@ -24,12 +24,15 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
-import org.apache.sling.feature.launcher.spi.ArtifactProviderContext;
+import org.apache.sling.feature.support.ArtifactManagerConfig;
+import org.apache.sling.feature.support.spi.ArtifactProviderContext;
/**
* This class holds the configuration of the launcher.
*/
-public class LauncherConfig implements ArtifactProviderContext {
+public class LauncherConfig
+ extends ArtifactManagerConfig
+ implements ArtifactProviderContext {
public static final Comparator<String> FEATURE_PATH_COMP = new Comparator<String>() {
@@ -67,20 +70,11 @@ public class LauncherConfig implements A
private static final String CACHE_DIR = "cache";
- /** The repository urls. */
- private volatile String[] repositoryUrls;
-
/** The feature files or directories. */
private volatile String[] featureFiles;
private volatile StartupMode startupMode = StartupMode.PURE;
- private volatile long cachedArtifacts;
-
- private volatile long downloadedArtifacts;
-
- private volatile long localArtifacts;
-
private final Installation installation = new Installation();
/**
@@ -88,29 +82,7 @@ public class LauncherConfig implements A
* Set the default values
*/
public LauncherConfig() {
- // set defaults
- this.repositoryUrls = new String[] {
- "file://" + System.getProperty("user.home") + "/.m2/repository",
- "https://repo.maven.apache.org/maven2/"
- };
- }
-
- /**
- * Set the repository urls
- * @param repositoryUrl The repository urls
- */
- public void setRepositoryUrls(final String[] urls) {
- if ( urls == null || urls.length == 0 ) {
- this.repositoryUrls = null;
- } else {
- this.repositoryUrls = new String[urls.length];
- System.arraycopy(urls, 0, this.repositoryUrls, 0, urls.length);
- for(int i=0; i<this.repositoryUrls.length; i++) {
- if ( this.repositoryUrls[i].endsWith("/") ) {
- this.repositoryUrls[i] = this.repositoryUrls[i].substring(0, this.repositoryUrls[i].length() - 1);
- }
- }
- }
+ this.setCacheDirectory(new File(getHomeDirectory(), CACHE_DIR));
}
/**
@@ -124,15 +96,6 @@ public class LauncherConfig implements A
}
}
- /**
- * Get the repository urls.
- * A repository url does not end with a slash.
- * @return The repository urls.
- */
- public String[] getRepositoryUrls() {
- return repositoryUrls;
- }
-
private void processDir(final List<String> paths, final File dir)
throws IOException {
for(final File f : dir.listFiles()) {
@@ -228,19 +191,6 @@ public class LauncherConfig implements A
}
/**
- * Get the cache directory
- * @return The cache directory.
- */
- @Override
- public File getCacheDirectory() {
- final File dir = new File(CACHE_DIR);
- if ( dir.isAbsolute() ) {
- return dir;
- }
- return new File(getHomeDirectory(), CACHE_DIR);
- }
-
- /**
* Get the startup mode.
*
* @return The current startup mode.
@@ -266,31 +216,4 @@ public class LauncherConfig implements A
public void clear() {
this.installation.clear();
}
-
- @Override
- public void incCachedArtifacts() {
- this.cachedArtifacts++;
- }
-
- @Override
- public void incDownloadedArtifacts() {
- this.downloadedArtifacts++;
- }
-
- @Override
- public void incLocalArtifacts() {
- this.localArtifacts++;
- }
-
- public long getCachedArtifacts() {
- return this.cachedArtifacts;
- }
-
- public long getDownloadedArtifacts() {
- return this.downloadedArtifacts;
- }
-
- public long getLocalArtifacts() {
- return this.localArtifacts;
- }
}
Modified: sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/Main.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/Main.java?rev=1797193&r1=1797192&r2=1797193&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/Main.java (original)
+++ sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/Main.java Thu Jun 1 11:25:50 2017
@@ -33,12 +33,12 @@ import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.sling.feature.Application;
import org.apache.sling.feature.ArtifactId;
-import org.apache.sling.feature.launcher.api.Logger;
-import org.apache.sling.feature.launcher.impl.artifacts.ArtifactHandler;
-import org.apache.sling.feature.launcher.impl.artifacts.ArtifactManager;
import org.apache.sling.feature.launcher.impl.launchers.FrameworkLauncher;
import org.apache.sling.feature.launcher.spi.Launcher;
import org.apache.sling.feature.launcher.spi.LauncherPrepareContext;
+import org.apache.sling.feature.support.ArtifactHandler;
+import org.apache.sling.feature.support.ArtifactManager;
+import org.apache.sling.feature.support.Logger;
/**
* This is the launcher main class.
@@ -143,7 +143,7 @@ public class Main {
@Override
public File getArtifactFile(final ArtifactId artifact) throws IOException {
final ArtifactHandler handler = aMgr.getArtifactHandler(":" + artifact.toMvnPath());
- return handler.getArtifact();
+ return handler.getFile();
}
@Override
Modified: sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/launchers/AbstractRunner.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/launchers/AbstractRunner.java?rev=1797193&r1=1797192&r2=1797193&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/launchers/AbstractRunner.java (original)
+++ sling/whiteboard/cziegeler/feature-launcher/src/main/java/org/apache/sling/feature/launcher/impl/launchers/AbstractRunner.java Thu Jun 1 11:25:50 2017
@@ -31,7 +31,7 @@ import java.util.Hashtable;
import java.util.List;
import java.util.Map;
-import org.apache.sling.feature.launcher.api.Logger;
+import org.apache.sling.feature.support.Logger;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;