sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sseif...@apache.org
Subject svn commit: r1786029 - in /sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport: AbstractFsMountMojo.java FsMountMojo.java FsUnMountMojo.java
Date Wed, 08 Mar 2017 17:09:49 GMT
Author: sseifert
Date: Wed Mar  8 17:09:49 2017
New Revision: 1786029

URL: http://svn.apache.org/viewvc?rev=1786029&view=rev
Log:
SLING-6622 introduce AbstractFsMountMojo

Added:
    sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractFsMountMojo.java
  (with props)
Modified:
    sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/FsMountMojo.java
    sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/FsUnMountMojo.java

Added: sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractFsMountMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractFsMountMojo.java?rev=1786029&view=auto
==============================================================================
--- sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractFsMountMojo.java
(added)
+++ sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractFsMountMojo.java
Wed Mar  8 17:09:49 2017
@@ -0,0 +1,58 @@
+/*
+ * 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.sling.maven.bundlesupport;
+
+import java.io.File;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Manages OSGi configurations for File System Resource provider.
+ */
+abstract class AbstractFsMountMojo extends AbstractBundlePostMojo {
+
+    /**
+     * The name of the generated JAR file.
+     */
+    @Parameter(property = "sling.file", defaultValue = "${project.build.directory}/${project.build.finalName}.jar",
required = true)
+    private String bundleFileName;
+
+    /**
+     * The Maven project.
+     */
+    @Parameter(defaultValue = "${project}", required = true, readonly = true)
+    protected MavenProject project;
+    
+    @Override
+    public void execute() throws MojoExecutionException {
+        
+        // check for Sling-Initial-Content
+        File file = new File(bundleFileName);
+        if (file.exists()) {
+            configureSlingInitialContent(getTargetURL(), file);
+            return;
+        }
+        
+        getLog().info(file + " does not exist, skipping.");
+    }
+    
+    protected abstract void configureSlingInitialContent(final String targetUrl, final File
file) throws MojoExecutionException;
+
+}
\ No newline at end of file

Propchange: sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractFsMountMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractFsMountMojo.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Wed Mar  8 17:09:49 2017
@@ -0,0 +1 @@
+LastChangedDate LastChangedRevision LastChangedBy HeadURL Id Author

Propchange: sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractFsMountMojo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/FsMountMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/FsMountMojo.java?rev=1786029&r1=1786028&r2=1786029&view=diff
==============================================================================
--- sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/FsMountMojo.java
(original)
+++ sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/FsMountMojo.java
Wed Mar  8 17:09:49 2017
@@ -21,37 +21,17 @@ import java.io.File;
 
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.project.MavenProject;
 
 /**
  * Creates OSGi configurations for File System Resource provider.
  */
 @Mojo(name = "fsmount", requiresProject = true)
-public class FsMountMojo extends AbstractBundlePostMojo {
+public class FsMountMojo extends AbstractFsMountMojo {
 
-    /**
-     * The name of the generated JAR file.
-     */
-    @Parameter(property = "sling.file", defaultValue = "${project.build.directory}/${project.build.finalName}.jar",
required = true)
-    private String bundleFileName;
-
-    /**
-     * The Maven project.
-     */
-    @Parameter(defaultValue = "${project}", required = true, readonly = true)
-    protected MavenProject project;
-    
     @Override
-    public void execute() throws MojoExecutionException {
-        File file = new File(bundleFileName);
-        if(!file.exists()) {
-            getLog().info(file + " does not exist, skipping.");
-            return;
-        }
-        
+    protected void configureSlingInitialContent(final String targetUrl, final File file)
throws MojoExecutionException {
         FsMountHelper fsMountHelper = new FsMountHelper(getLog(), getHttpClient(), project);
-        fsMountHelper.configureInstall(getTargetURL(), file);
+        fsMountHelper.configureInstall(targetUrl, file);
     }
 
 }
\ No newline at end of file

Modified: sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/FsUnMountMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/FsUnMountMojo.java?rev=1786029&r1=1786028&r2=1786029&view=diff
==============================================================================
--- sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/FsUnMountMojo.java
(original)
+++ sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/FsUnMountMojo.java
Wed Mar  8 17:09:49 2017
@@ -21,37 +21,17 @@ import java.io.File;
 
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.project.MavenProject;
 
 /**
  * Removes OSGi configurations for File System Resource provider.
  */
 @Mojo(name = "fsunmount", requiresProject = true)
-public class FsUnMountMojo extends AbstractBundlePostMojo {
+public class FsUnMountMojo extends AbstractFsMountMojo {
 
-    /**
-     * The name of the generated JAR file.
-     */
-    @Parameter(property = "sling.file", defaultValue = "${project.build.directory}/${project.build.finalName}.jar",
required = true)
-    private String bundleFileName;
-
-    /**
-     * The Maven project.
-     */
-    @Parameter(defaultValue = "${project}", required = true, readonly = true)
-    protected MavenProject project;
-    
     @Override
-    public void execute() throws MojoExecutionException {
-        File file = new File(bundleFileName);
-        if(!file.exists()) {
-            getLog().info(file + " does not exist, skipping.");
-            return;
-        }
-        
+    protected void configureSlingInitialContent(final String targetUrl, final File file)
throws MojoExecutionException {
         FsMountHelper fsMountHelper = new FsMountHelper(getLog(), getHttpClient(), project);
-        fsMountHelper.configureUninstall(getTargetURL(), file);
+        fsMountHelper.configureUninstall(targetUrl, file);
     }
 
 }
\ No newline at end of file



Mime
View raw message