You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by da...@apache.org on 2016/04/21 15:33:17 UTC

svn commit: r1740308 - in /felix/trunk/converter: pom.xml src/main/java/org/apache/felix/converter/impl/Activator.java

Author: davidb
Date: Thu Apr 21 13:33:17 2016
New Revision: 1740308

URL: http://svn.apache.org/viewvc?rev=1740308&view=rev
Log:
Register Converter as a Service.

Added:
    felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/Activator.java
Modified:
    felix/trunk/converter/pom.xml

Modified: felix/trunk/converter/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/converter/pom.xml?rev=1740308&r1=1740307&r2=1740308&view=diff
==============================================================================
--- felix/trunk/converter/pom.xml (original)
+++ felix/trunk/converter/pom.xml Thu Apr 21 13:33:17 2016
@@ -65,13 +65,10 @@
                 </executions>
                 <configuration>
                     <instructions>
-                        <Private-Package>
-                            org.apache.felix.converter.*
-                        </Private-Package>
+                        <Bundle-Activator>org.apache.felix.converter.impl.Activator</Bundle-Activator>
+                        <Private-Package>org.apache.felix.converter.*</Private-Package>
                         <Export-Package>org.osgi.service.converter</Export-Package>
-                        <Import-Package>
-                            *
-                        </Import-Package>
+                        <Import-Package>*</Import-Package>
                     </instructions>
                 </configuration>
             </plugin>
@@ -86,6 +83,12 @@
         </dependency>
         
         <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi.core</artifactId>
+            <version>6.0.0</version>
+        </dependency>
+
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>

Added: felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/Activator.java
URL: http://svn.apache.org/viewvc/felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/Activator.java?rev=1740308&view=auto
==============================================================================
--- felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/Activator.java (added)
+++ felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/Activator.java Thu Apr 21 13:33:17 2016
@@ -0,0 +1,36 @@
+/*
+ * 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.converter.impl;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.converter.Converter;
+
+public class Activator implements BundleActivator {
+    private ServiceRegistration<Converter> reg;
+
+    @Override
+    public void start(BundleContext context) throws Exception {
+        reg = context.registerService(Converter.class, new ConverterService(), null);
+    }
+
+    @Override
+    public void stop(BundleContext context) throws Exception {
+        reg.unregister();
+    }
+}