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

cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git


The following commit(s) were added to refs/heads/master by this push:
     new 7ab6e94  Fix service-based and extender-based sample projects (#114)
7ab6e94 is described below

commit 7ab6e94e8d80b10e15c891325e7a3026e2d930cc
Author: Andrew Swan <git...@andrewswan.com>
AuthorDate: Fri Nov 5 17:30:05 2021 +1100

    Fix service-based and extender-based sample projects (#114)
    
    * Made inner Circle class static in service-based demo project
    
    * Fixed Javadoc errors in sample project
    
    * Removed redundant modifiers from SimpleShape interfaces in sample project
    
    * Added license comment to source file to fix build failure about 
unlicensed files
    
    * Fixed typos in comment and private method name
    
    * Updated version numbers and parent coordinates in demo project to fix 
build errors
---
 examples/extenderbased.host/pom.xml                |  8 ++++----
 .../extenderbased/host/ShapeBundleTracker.java     | 24 +++++++++++++++++++---
 .../extenderbased/host/extension/SimpleShape.java  | 10 +++++----
 examples/extenderbased.square/pom.xml              |  4 ++--
 .../example/servicebased/circle/Activator.java     |  2 +-
 .../example/servicebased/host/DefaultShape.java    |  4 ++--
 .../example/servicebased/host/ShapeTracker.java    |  2 +-
 .../servicebased/host/service/SimpleShape.java     |  9 ++++----
 8 files changed, 42 insertions(+), 21 deletions(-)

diff --git a/examples/extenderbased.host/pom.xml 
b/examples/extenderbased.host/pom.xml
index cfbf057..756a755 100644
--- a/examples/extenderbased.host/pom.xml
+++ b/examples/extenderbased.host/pom.xml
@@ -36,7 +36,7 @@
     <dependency>
       <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.framework</artifactId>
-      <version>4.0.2</version>
+      <version>7.0.1</version>
     </dependency>
   </dependencies>
   <build>
@@ -44,7 +44,7 @@
       <plugin>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
-        <version>1.4.0</version>
+        <version>5.1.2</version>
         <extensions>true</extensions>
         <configuration>
           <instructions>
@@ -63,8 +63,8 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
         <configuration>
-          <source>1.6</source>
-          <target>1.6</target>
+          <source>1.8</source>
+          <target>1.8</target>
         </configuration>
       </plugin>
     </plugins>
diff --git 
a/examples/extenderbased.host/src/main/java/org/apache/felix/example/extenderbased/host/ShapeBundleTracker.java
 
b/examples/extenderbased.host/src/main/java/org/apache/felix/example/extenderbased/host/ShapeBundleTracker.java
index 93b3a09..2858e92 100644
--- 
a/examples/extenderbased.host/src/main/java/org/apache/felix/example/extenderbased/host/ShapeBundleTracker.java
+++ 
b/examples/extenderbased.host/src/main/java/org/apache/felix/example/extenderbased/host/ShapeBundleTracker.java
@@ -1,3 +1,21 @@
+/*
+ * 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.example.extenderbased.host;
 
 import java.util.Dictionary;
@@ -59,7 +77,7 @@ public class ShapeBundleTracker extends 
BundleTracker<SimpleShape>
             return shape;
         }
 
-        // bundle is no ShapeBundle, ingore it
+        // bundle is no ShapeBundle, ignore it
         return null;
     }
 
@@ -107,7 +125,7 @@ public class ShapeBundleTracker extends 
BundleTracker<SimpleShape>
         // if the name is not null, bundle is a ShapeBundle
         if (name != null)
         {
-            prcoessRemove(name);
+            processRemove(name);
         }
     }
 
@@ -116,7 +134,7 @@ public class ShapeBundleTracker extends 
BundleTracker<SimpleShape>
      *
      * @param name the name of the shape that is about to be removed.
      */
-    private void prcoessRemove(final String name)
+    private void processRemove(final String name)
     {
         try
         {
diff --git 
a/examples/extenderbased.host/src/main/java/org/apache/felix/example/extenderbased/host/extension/SimpleShape.java
 
b/examples/extenderbased.host/src/main/java/org/apache/felix/example/extenderbased/host/extension/SimpleShape.java
index ea75de6..0fc37c0 100644
--- 
a/examples/extenderbased.host/src/main/java/org/apache/felix/example/extenderbased/host/extension/SimpleShape.java
+++ 
b/examples/extenderbased.host/src/main/java/org/apache/felix/example/extenderbased/host/extension/SimpleShape.java
@@ -38,20 +38,22 @@ public interface SimpleShape
     /**
      * A property for the name of the shape.
     **/
-    public static final String NAME_PROPERTY = "Extension-Name";
+    String NAME_PROPERTY = "Extension-Name";
+
     /**
      * A property for the icon of the shape.
     **/
-    public static final String ICON_PROPERTY = "Extension-Icon";
+    String ICON_PROPERTY = "Extension-Icon";
+
     /**
      * A property for the class of the shape.
     **/
-    public static final String CLASS_PROPERTY = "Extension-Class";
+    String CLASS_PROPERTY = "Extension-Class";
 
     /**
      * Method to draw the shape of the extension.
      * @param g2 The graphics object used for painting.
      * @param p The position to paint the triangle.
     **/
-    public void draw(Graphics2D g2, Point p);
+    void draw(Graphics2D g2, Point p);
 }
\ No newline at end of file
diff --git a/examples/extenderbased.square/pom.xml 
b/examples/extenderbased.square/pom.xml
index a344355..02723f4 100644
--- a/examples/extenderbased.square/pom.xml
+++ b/examples/extenderbased.square/pom.xml
@@ -20,8 +20,8 @@
 
   <parent>
     <groupId>org.apache.felix</groupId>
-    <artifactId>felix</artifactId>
-    <version>1.0.4</version>
+    <artifactId>felix-parent</artifactId>
+    <version>7</version>
     <relativePath>../../pom/pom.xml</relativePath>
   </parent>
 
diff --git 
a/examples/servicebased.circle/src/main/java/org/apache/felix/example/servicebased/circle/Activator.java
 
b/examples/servicebased.circle/src/main/java/org/apache/felix/example/servicebased/circle/Activator.java
index f1391e3..ccc47a5 100644
--- 
a/examples/servicebased.circle/src/main/java/org/apache/felix/example/servicebased/circle/Activator.java
+++ 
b/examples/servicebased.circle/src/main/java/org/apache/felix/example/servicebased/circle/Activator.java
@@ -70,7 +70,7 @@ public class Activator implements BundleActivator
      * This inner class implements the circle <tt>SimpleShape</tt> service.
      * It simply provides a <tt>draw()</tt> that paints a circle.
     **/
-    public class Circle implements SimpleShape
+    public static class Circle implements SimpleShape
     {
         /**
          * Implements the <tt>SimpleShape.draw()</tt> method for painting
diff --git 
a/examples/servicebased.host/src/main/java/org/apache/felix/example/servicebased/host/DefaultShape.java
 
b/examples/servicebased.host/src/main/java/org/apache/felix/example/servicebased/host/DefaultShape.java
index f9598d2..b81a492 100644
--- 
a/examples/servicebased.host/src/main/java/org/apache/felix/example/servicebased/host/DefaultShape.java
+++ 
b/examples/servicebased.host/src/main/java/org/apache/felix/example/servicebased/host/DefaultShape.java
@@ -36,11 +36,11 @@ import org.osgi.framework.ServiceReference;
  * objects in an effort to improve performance; this level of
  * indirection could be removed if eager creation of objects is not
  * a concern. Since this application uses the service-based extension
- * appraoch, lazy shape creation will only come into effect if
+ * approach, lazy shape creation will only come into effect if
  * service providers register service factories instead of directly
  * registering <tt>SimpleShape</tt> or if they use a technology like
  * Declarative Services or iPOJO to register services. Since the
- * example providers register services instances directly there is
+ * example providers register service instances directly there is
  * no laziness in the example, but the proxy approach is still used
  * to demonstrate how to make laziness possible and to keep it
  * similar to the extender-based approach.
diff --git 
a/examples/servicebased.host/src/main/java/org/apache/felix/example/servicebased/host/ShapeTracker.java
 
b/examples/servicebased.host/src/main/java/org/apache/felix/example/servicebased/host/ShapeTracker.java
index 6ea4bac..00b9670 100644
--- 
a/examples/servicebased.host/src/main/java/org/apache/felix/example/servicebased/host/ShapeTracker.java
+++ 
b/examples/servicebased.host/src/main/java/org/apache/felix/example/servicebased/host/ShapeTracker.java
@@ -28,7 +28,7 @@ import org.osgi.util.tracker.ServiceTracker;
 /**
  * Extends the <tt>ServiceTracker</tt> to create a tracker for
  * <tt>SimpleShape</tt> services. The tracker is responsible for
- * listener for the arrival/departure of <tt>SimpleShape</tt>
+ * listening for the arrival/departure of <tt>SimpleShape</tt>
  * services and informing the application about the availability
  * of shapes. This tracker forces all notifications to be processed
  * on the Swing event thread to avoid synchronization and redraw
diff --git 
a/examples/servicebased.host/src/main/java/org/apache/felix/example/servicebased/host/service/SimpleShape.java
 
b/examples/servicebased.host/src/main/java/org/apache/felix/example/servicebased/host/service/SimpleShape.java
index 72c82af..34cd7d9 100644
--- 
a/examples/servicebased.host/src/main/java/org/apache/felix/example/servicebased/host/service/SimpleShape.java
+++ 
b/examples/servicebased.host/src/main/java/org/apache/felix/example/servicebased/host/service/SimpleShape.java
@@ -36,16 +36,17 @@ public interface SimpleShape
     /**
      * A service property for the name of the shape.
     **/
-    public static final String NAME_PROPERTY = "simple.shape.name";
+    String NAME_PROPERTY = "simple.shape.name";
+
     /**
      * A service property for the icon of the shape.
     **/
-    public static final String ICON_PROPERTY = "simple.shape.icon";
+    String ICON_PROPERTY = "simple.shape.icon";
 
     /**
      * Method to draw the shape of the service.
      * @param g2 The graphics object used for painting.
-     * @param p The position to paint the triangle.
+     * @param p The position to paint the shape.
     **/
-    public void draw(Graphics2D g2, Point p);
+    void draw(Graphics2D g2, Point p);
 }

Reply via email to