You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2014/04/10 16:16:21 UTC
[59/59] [abbrv] git commit: [KARAF-2833] Make jndi independent of
blueprint
[KARAF-2833] Make jndi independent of blueprint
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/48ef3aa0
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/48ef3aa0
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/48ef3aa0
Branch: refs/heads/master
Commit: 48ef3aa0146bf891fbefa70172ed5377fb6d4fd9
Parents: 85c65dd
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Thu Apr 10 10:36:46 2014 +0200
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Thu Apr 10 16:03:22 2014 +0200
----------------------------------------------------------------------
.../enterprise/src/main/feature/feature.xml | 3 +-
jndi/pom.xml | 13 ++++-
.../karaf/jndi/internal/osgi/Activator.java | 53 ++++++++++++++++++++
.../resources/OSGI-INF/blueprint/jndi-core.xml | 53 --------------------
4 files changed, 66 insertions(+), 56 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/48ef3aa0/assemblies/features/enterprise/src/main/feature/feature.xml
----------------------------------------------------------------------
diff --git a/assemblies/features/enterprise/src/main/feature/feature.xml b/assemblies/features/enterprise/src/main/feature/feature.xml
index 823d3ba..0a57038 100644
--- a/assemblies/features/enterprise/src/main/feature/feature.xml
+++ b/assemblies/features/enterprise/src/main/feature/feature.xml
@@ -174,14 +174,13 @@
<feature name="jndi" description="OSGi Service Registry JNDI access" version="${project.version}" resolver="(obr)">
<details>JNDI support provided by Apache Aries JNDI ${aries.jndi.version}, including additional service, commands, and MBean.</details>
<feature>aries-proxy</feature>
- <feature>aries-blueprint</feature>
<bundle start-level="30">mvn:org.apache.xbean/xbean-naming/${xbean.version}</bundle>
- <bundle start-level="30">mvn:org.apache.karaf.jndi/org.apache.karaf.jndi.core/${project.version}</bundle>
<bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.api/${aries.jndi.api.version}</bundle>
<bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.core/${aries.jndi.version}</bundle>
<bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.rmi/${aries.jndi.version}</bundle>
<bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.url/${aries.jndi.version}</bundle>
<bundle start-level="30">mvn:org.apache.aries.jndi/org.apache.aries.jndi.legacy.support/${aries.jndi.version}</bundle>
+ <bundle start-level="30">mvn:org.apache.karaf.jndi/org.apache.karaf.jndi.core/${project.version}</bundle>
</feature>
<feature name="jdbc" description="JDBC service and commands" version="${project.version}" resolver="(obr)">
http://git-wip-us.apache.org/repos/asf/karaf/blob/48ef3aa0/jndi/pom.xml
----------------------------------------------------------------------
diff --git a/jndi/pom.xml b/jndi/pom.xml
index f2db373..1b01030 100644
--- a/jndi/pom.xml
+++ b/jndi/pom.xml
@@ -52,6 +52,11 @@
<artifactId>org.apache.aries.proxy.api</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>org.apache.karaf.util</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.core</artifactId>
<optional>true</optional>
@@ -85,9 +90,15 @@
</Export-Package>
<Private-Package>
org.apache.karaf.jndi.command,
- org.apache.karaf.jndi.internal
+ org.apache.karaf.jndi.command.completers,
+ org.apache.karaf.jndi.internal,
+ org.apache.karaf.jndi.internal.osgi,
+ org.apache.karaf.util.tracker
</Private-Package>
<Karaf-Commands>*</Karaf-Commands>
+ <Bundle-Activator>
+ org.apache.karaf.jndi.internal.osgi.Activator
+ </Bundle-Activator>
</instructions>
</configuration>
</plugin>
http://git-wip-us.apache.org/repos/asf/karaf/blob/48ef3aa0/jndi/src/main/java/org/apache/karaf/jndi/internal/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/jndi/src/main/java/org/apache/karaf/jndi/internal/osgi/Activator.java b/jndi/src/main/java/org/apache/karaf/jndi/internal/osgi/Activator.java
new file mode 100644
index 0000000..5470e7e
--- /dev/null
+++ b/jndi/src/main/java/org/apache/karaf/jndi/internal/osgi/Activator.java
@@ -0,0 +1,53 @@
+/*
+ * 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.karaf.jndi.internal.osgi;
+
+import java.util.Hashtable;
+
+import javax.naming.spi.InitialContextFactory;
+
+import org.apache.aries.proxy.ProxyManager;
+import org.apache.karaf.jndi.JndiService;
+import org.apache.karaf.jndi.KarafInitialContextFactory;
+import org.apache.karaf.jndi.internal.JndiMBeanImpl;
+import org.apache.karaf.jndi.internal.JndiServiceImpl;
+import org.apache.karaf.util.tracker.BaseActivator;
+
+public class Activator extends BaseActivator {
+ @Override
+ protected void doOpen() throws Exception {
+ trackService(ProxyManager.class);
+ }
+
+ @Override
+ protected void doStart() throws Exception {
+ ProxyManager proxyManager = getTrackedService(ProxyManager.class);
+
+ register(InitialContextFactory.class, new KarafInitialContextFactory());
+
+ JndiServiceImpl service = new JndiServiceImpl();
+ service.setBundleContext(bundleContext);
+ service.setProxyManager(proxyManager);
+ Hashtable<String, String> props = new Hashtable<String, String>();
+ // bind the JNDI service itself in the JNDI context
+ props.put("osgi.jndi.service.name", "jndi");
+ register(JndiService.class, service, props);
+ JndiMBeanImpl mbean = new JndiMBeanImpl();
+ mbean.setJndiService(service);
+ registerMBean(mbean, "type=jndi");
+ }
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/48ef3aa0/jndi/src/main/resources/OSGI-INF/blueprint/jndi-core.xml
----------------------------------------------------------------------
diff --git a/jndi/src/main/resources/OSGI-INF/blueprint/jndi-core.xml b/jndi/src/main/resources/OSGI-INF/blueprint/jndi-core.xml
deleted file mode 100644
index e6be3b1..0000000
--- a/jndi/src/main/resources/OSGI-INF/blueprint/jndi-core.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
- -->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
- default-activation="lazy">
-
- <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]"/>
-
- <bean id="karafInitialContextFactory" class="org.apache.karaf.jndi.KarafInitialContextFactory"/>
-
- <reference id="proxyManager" interface="org.apache.aries.proxy.ProxyManager"/>
-
- <service ref="karafInitialContextFactory" interface="javax.naming.spi.InitialContextFactory"/>
-
- <bean id="jndiService" class="org.apache.karaf.jndi.internal.JndiServiceImpl">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- <property name="proxyManager" ref="proxyManager"/>
- </bean>
-
- <service ref="jndiService" interface="org.apache.karaf.jndi.JndiService">
- <service-properties>
- <!-- bind the JNDI service itself in the JNDI context -->
- <entry key="osgi.jndi.service.name" value="jndi"/>
- </service-properties>
- </service>
-
- <!-- Management -->
- <bean id="jndiMBeanImpl" class="org.apache.karaf.jndi.internal.JndiMBeanImpl">
- <property name="jndiService" ref="jndiService"/>
- </bean>
-
- <service ref="jndiMBeanImpl" auto-export="interfaces">
- <service-properties>
- <entry key="jmx.objectname" value="org.apache.karaf:type=jndi,name=$[karaf.name]"/>
- </service-properties>
- </service>
-
-</blueprint>
\ No newline at end of file