sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1393358 - in /sis/trunk: ide-project/NetBeans/nbproject/project.properties pom.xml sis-utility/pom.xml sis-utility/src/main/java/org/apache/sis/internal/util/OSGiActivator.java
Date Wed, 03 Oct 2012 09:06:34 GMT
Author: desruisseaux
Date: Wed Oct  3 09:06:33 2012
New Revision: 1393358

URL: http://svn.apache.org/viewvc?rev=1393358&view=rev
Log:
Added OSGi BundleActivator.

Added:
    sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/OSGiActivator.java  
(with props)
Modified:
    sis/trunk/ide-project/NetBeans/nbproject/project.properties
    sis/trunk/pom.xml
    sis/trunk/sis-utility/pom.xml

Modified: sis/trunk/ide-project/NetBeans/nbproject/project.properties
URL: http://svn.apache.org/viewvc/sis/trunk/ide-project/NetBeans/nbproject/project.properties?rev=1393358&r1=1393357&r2=1393358&view=diff
==============================================================================
--- sis/trunk/ide-project/NetBeans/nbproject/project.properties (original)
+++ sis/trunk/ide-project/NetBeans/nbproject/project.properties Wed Oct  3 09:06:33 2012
@@ -46,6 +46,7 @@ rome.version         = 0.9
 jdom.version         = 1.0
 servlet.version      = 2.4
 jcip.version         = 1.0
+osgi.version         = 5.0.0
 junit.version        = 4.8.2
 
 #
@@ -63,11 +64,12 @@ javac.classpath=\
     ${maven.repository}/jdom/jdom/${jdom.version}/jdom-${jdom.version}.jar:\
     ${maven.repository}/javax/servlet/servlet-api/${servlet.version}/servlet-api-${servlet.version}.jar:\
     ${maven.repository}/net/jcip/jcip-annotations/${jcip.version}/jcip-annotations-${jcip.version}.jar:\
-    ${maven.repository}/junit/junit/${junit.version}/junit-${junit.version}.jar
+    ${maven.repository}/org/osgi/org.osgi.core/${osgi.version}/org.osgi.core-${osgi.version}.jar
 javac.processorpath=\
     ${javac.classpath}
 javac.test.classpath=\
     ${javac.classpath}:\
+    ${maven.repository}/junit/junit/${junit.version}/junit-${junit.version}.jar:\
     ${maven.repository}/org/opengis/geoapi-conformance/${geoapi.version}/geoapi-conformance-${geoapi.version}.jar:\
     ${build.classes.dir}
 javac.test.processorpath=\

Modified: sis/trunk/pom.xml
URL: http://svn.apache.org/viewvc/sis/trunk/pom.xml?rev=1393358&r1=1393357&r2=1393358&view=diff
==============================================================================
--- sis/trunk/pom.xml (original)
+++ sis/trunk/pom.xml Wed Oct  3 09:06:33 2012
@@ -231,6 +231,8 @@ Apache SIS is a toolkit for describing l
         <version>${geoapi.version}</version>
         <scope>test</scope>
       </dependency>
+
+      <!-- Libraries (language, XML, network) -->
       <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>servlet-api</artifactId>
@@ -241,13 +243,19 @@ Apache SIS is a toolkit for describing l
         <artifactId>georss-rome</artifactId>
         <version>0.9.8</version>
       </dependency>
-
-      <!-- Libraries (language, XML, network) -->
       <dependency>
         <groupId>net.jcip</groupId>
         <artifactId>jcip-annotations</artifactId>
         <version>1.0</version>
       </dependency>
+
+      <!-- Optional dependencies -->
+      <dependency>
+        <groupId>org.osgi</groupId>
+        <artifactId>org.osgi.core</artifactId>
+        <version>5.0.0</version>
+        <scope>provided</scope>
+      </dependency>
     </dependencies>
   </dependencyManagement>
 

Modified: sis/trunk/sis-utility/pom.xml
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/pom.xml?rev=1393358&r1=1393357&r2=1393358&view=diff
==============================================================================
--- sis/trunk/sis-utility/pom.xml (original)
+++ sis/trunk/sis-utility/pom.xml Wed Oct  3 09:06:33 2012
@@ -110,6 +110,17 @@ Miscellaneous utilities.
           </execution>
         </executions>
       </plugin>
+
+      <!-- Package as OSGi bundle -->
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <configuration>
+          <instructions>
+            <Bundle-Activator>org.apache.sis.internal.util.OSGiActivator</Bundle-Activator>
+          </instructions>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 
@@ -130,6 +141,13 @@ Miscellaneous utilities.
       <groupId>net.jcip</groupId>
       <artifactId>jcip-annotations</artifactId>
     </dependency>
+
+    <!-- Optional dependencies -->
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <scope>provided</scope>
+    </dependency>
   </dependencies>
 
 </project>

Added: sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/OSGiActivator.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/OSGiActivator.java?rev=1393358&view=auto
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/OSGiActivator.java (added)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/OSGiActivator.java Wed
Oct  3 09:06:33 2012
@@ -0,0 +1,60 @@
+/*
+ * 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.sis.internal.util;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleActivator;
+
+
+/**
+ * Bundle activator for OSGi environment.
+ * This class should not be used directly.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.3
+ * @version 0.3
+ * @module
+ */
+public final class OSGiActivator implements BundleActivator {
+    /**
+     * Creates a new bundle activator.
+     */
+    public OSGiActivator() {
+    }
+
+    /**
+     * Invoked when this bundle is started.
+     *
+     * @param context The execution context of the bundle being started.
+     */
+    @Override
+    public void start(final BundleContext context) {
+    }
+
+    /**
+     * Invoked when this bundle is stopped.
+     * This method shutdowns the {@code sis-utility} threads.
+     *
+     * @param  context The execution context of the bundle being stopped.
+     * @throws InterruptedException If an other thread invoked {@link #interrupt()} while
+     *         we were waiting for the {@code sis-utility} threads to die.
+     */
+    @Override
+    public void stop(final BundleContext context) throws InterruptedException {
+        Threads.shutdown(4000);
+    }
+}

Propchange: sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/OSGiActivator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/OSGiActivator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message