You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2018/04/18 17:22:16 UTC
[sling-ide-tooling] branch master updated: SLING-7587 - Create a
CLI-only tool to sync content
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-ide-tooling.git
The following commit(s) were added to refs/heads/master by this push:
new 135ea07 SLING-7587 - Create a CLI-only tool to sync content
135ea07 is described below
commit 135ea07f7d6e510109dba7233b1bc72383f9347a
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Apr 17 15:09:03 2018 +0300
SLING-7587 - Create a CLI-only tool to sync content
cli - make the sync parameters configurable (oops)
---
.../org/apache/sling/ide/cli/impl/ContentSync.java | 19 ++++++++++++++-----
cli/dist/.gitignore | 1 +
...g.apache.sling.ide.cli.impl.ContentSync.cfg-sample | 4 ++++
cli/dist/features/clisync.json | 5 +++++
4 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/cli/cli/src/main/java/org/apache/sling/ide/cli/impl/ContentSync.java b/cli/cli/src/main/java/org/apache/sling/ide/cli/impl/ContentSync.java
index 9924ced..dd33905 100644
--- a/cli/cli/src/main/java/org/apache/sling/ide/cli/impl/ContentSync.java
+++ b/cli/cli/src/main/java/org/apache/sling/ide/cli/impl/ContentSync.java
@@ -16,6 +16,8 @@
*/
package org.apache.sling.ide.cli.impl;
+import static org.osgi.service.component.annotations.ConfigurationPolicy.REQUIRE;
+
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
@@ -36,9 +38,17 @@ import org.apache.sling.ide.transport.RepositoryInfo;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
-@Component(immediate=true)
+@Component(immediate=true, configurationPolicy = REQUIRE)
public class ContentSync {
+ public @interface Config {
+
+ String projectDir();
+ String repositoryUrl();
+ String username();
+ String password();
+ }
+
@Reference
private Logger logger;
@@ -54,17 +64,16 @@ public class ContentSync {
private DirWatcher watcher;
private Thread watcherThread;
-
- protected void activate() throws Exception {
+ protected void activate(Config cfg) throws Exception {
- File projectDir = new File("/home/robert/Documents/workspace/content003");
+ File projectDir = new File(cfg.projectDir());
WorkspaceProject prj = FSResources.create(projectDir, projectDir, filterLocator);
logger.trace("Working on project {0} at {1}", prj.getName(), prj.getOSPath());
- Repository repo = repoFactory.connectRepository(new RepositoryInfo("admin", "admin", "http://localhost:8080"));
+ Repository repo = repoFactory.connectRepository(new RepositoryInfo(cfg.username(), cfg.password(), cfg.repositoryUrl()));
repo.newListChildrenNodeCommand("/").execute();
diff --git a/cli/dist/.gitignore b/cli/dist/.gitignore
index 952774f..36ca32b 100644
--- a/cli/dist/.gitignore
+++ b/cli/dist/.gitignore
@@ -1,3 +1,4 @@
/felix-cache/
/launcher/
/sling.json
+/cfg/*.cfg
diff --git a/cli/dist/cfg/org.apache.sling.ide.cli.impl.ContentSync.cfg-sample b/cli/dist/cfg/org.apache.sling.ide.cli.impl.ContentSync.cfg-sample
new file mode 100644
index 0000000..dcc3a03
--- /dev/null
+++ b/cli/dist/cfg/org.apache.sling.ide.cli.impl.ContentSync.cfg-sample
@@ -0,0 +1,4 @@
+projectDir=/your/path/here
+repositoryUrl=http://localhost:8080
+username=admin
+password=admin
diff --git a/cli/dist/features/clisync.json b/cli/dist/features/clisync.json
index 0fb71fb..bcadb0e 100644
--- a/cli/dist/features/clisync.json
+++ b/cli/dist/features/clisync.json
@@ -1,7 +1,12 @@
{
"id": "org.apache.sling.ide/org.apache.sling.ide.cli-dist/1.0.0",
+ "framework-properties": {
+ "felix.fileinstall.dir": "cfg",
+ },
"bundles": [
"org.apache.felix/org.apache.felix.eventadmin/1.4.10",
+ "org.apache.felix/org.apache.felix.fileinstall/3.6.0",
+ "org.apache.felix/org.apache.felix.configadmin/1.8.16/",
"org.slf4j/slf4j-api/1.7.25",
"org.slf4j/slf4j-simple/1.7.25",
"org.slf4j/jcl-over-slf4j/1.7.25",
--
To stop receiving notification emails like this one, please contact
rombert@apache.org.