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:20 UTC
[58/59] [abbrv] git commit: [KARAF-2852] Merge jndi/core and
jndi/command
[KARAF-2852] Merge jndi/core and jndi/command
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/85c65dd6
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/85c65dd6
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/85c65dd6
Branch: refs/heads/master
Commit: 85c65dd697e437ffc28c9c768090a0b0d8741686
Parents: 1bcdb17
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Thu Apr 10 10:20:22 2014 +0200
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Thu Apr 10 16:03:15 2014 +0200
----------------------------------------------------------------------
.../enterprise/src/main/feature/feature.xml | 1 -
jndi/NOTICE | 71 +++++
jndi/command/NOTICE | 71 -----
jndi/command/pom.xml | 87 ------
.../apache/karaf/jndi/command/AliasCommand.java | 50 ---
.../apache/karaf/jndi/command/BindCommand.java | 50 ---
.../karaf/jndi/command/ContextsCommand.java | 64 ----
.../karaf/jndi/command/CreateCommand.java | 45 ---
.../karaf/jndi/command/DeleteCommand.java | 45 ---
.../apache/karaf/jndi/command/NamesCommand.java | 65 ----
.../karaf/jndi/command/UnbindCommand.java | 45 ---
.../command/completers/ContextsCompleter.java | 60 ----
.../jndi/command/completers/NamesCompleter.java | 59 ----
.../command/completers/ServicesIdCompleter.java | 66 ----
.../src/main/resources/OSGI-INF/bundle.info | 26 --
jndi/core/NOTICE | 71 -----
jndi/core/pom.xml | 89 ------
.../java/org/apache/karaf/jndi/JndiMBean.java | 104 ------
.../java/org/apache/karaf/jndi/JndiService.java | 103 ------
.../karaf/jndi/KarafInitialContextFactory.java | 33 --
.../karaf/jndi/internal/JndiMBeanImpl.java | 122 --------
.../karaf/jndi/internal/JndiServiceImpl.java | 313 -------------------
.../resources/OSGI-INF/blueprint/jndi-core.xml | 53 ----
.../src/main/resources/OSGI-INF/bundle.info | 19 --
jndi/pom.xml | 72 ++++-
.../java/org/apache/karaf/jndi/JndiMBean.java | 104 ++++++
.../java/org/apache/karaf/jndi/JndiService.java | 103 ++++++
.../karaf/jndi/KarafInitialContextFactory.java | 33 ++
.../apache/karaf/jndi/command/AliasCommand.java | 50 +++
.../apache/karaf/jndi/command/BindCommand.java | 50 +++
.../karaf/jndi/command/ContextsCommand.java | 64 ++++
.../karaf/jndi/command/CreateCommand.java | 45 +++
.../karaf/jndi/command/DeleteCommand.java | 45 +++
.../apache/karaf/jndi/command/NamesCommand.java | 65 ++++
.../karaf/jndi/command/UnbindCommand.java | 45 +++
.../command/completers/ContextsCompleter.java | 60 ++++
.../jndi/command/completers/NamesCompleter.java | 59 ++++
.../command/completers/ServicesIdCompleter.java | 66 ++++
.../karaf/jndi/internal/JndiMBeanImpl.java | 122 ++++++++
.../karaf/jndi/internal/JndiServiceImpl.java | 313 +++++++++++++++++++
.../resources/OSGI-INF/blueprint/jndi-core.xml | 53 ++++
jndi/src/main/resources/OSGI-INF/bundle.info | 19 ++
42 files changed, 1431 insertions(+), 1649 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/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 69065ba..823d3ba 100644
--- a/assemblies/features/enterprise/src/main/feature/feature.xml
+++ b/assemblies/features/enterprise/src/main/feature/feature.xml
@@ -182,7 +182,6 @@
<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>mvn:org.apache.karaf.jndi/org.apache.karaf.jndi.command/${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/85c65dd6/jndi/NOTICE
----------------------------------------------------------------------
diff --git a/jndi/NOTICE b/jndi/NOTICE
new file mode 100644
index 0000000..b70f1f9
--- /dev/null
+++ b/jndi/NOTICE
@@ -0,0 +1,71 @@
+Apache Karaf
+Copyright 2010-2014 The Apache Software Foundation
+
+
+I. Included Software
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+The OSGi Alliance (http://www.osgi.org/).
+Copyright (c) OSGi Alliance (2000, 2010).
+Licensed under the Apache License 2.0.
+
+This product includes software developed at
+OW2 (http://www.ow2.org/).
+Licensed under the BSD License.
+
+This product includes software developed at
+OPS4J (http://www.ops4j.org/).
+Licensed under the Apache License 2.0.
+
+This product includes software developed at
+Eclipse Foundation (http://www.eclipse.org/).
+Licensed under the EPL.
+
+This product includes software written by
+Antony Lesuisse.
+Licensed under Public Domain.
+
+
+II. Used Software
+
+This product uses software developed at
+FUSE Source (http://www.fusesource.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+AOP Alliance (http://aopalliance.sourceforge.net/).
+Licensed under the Public Domain.
+
+This product uses software developed at
+Tanuki Software (http://www.tanukisoftware.com/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+Jasypt (http://jasypt.sourceforge.net/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+JLine (http://jline.sourceforge.net).
+Licensed under the BSD License.
+
+This product uses software developed at
+SLF4J (http://www.slf4j.org/).
+Licensed under the MIT License.
+
+This product uses software developed at
+SpringSource (http://www.springsource.org/).
+Licensed under the Apache License 2.0.
+
+This product includes software from http://www.json.org.
+Copyright (c) 2002 JSON.org
+
+
+III. License Summary
+- Apache License 2.0
+- BSD License
+- EPL License
+- MIT License
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/command/NOTICE
----------------------------------------------------------------------
diff --git a/jndi/command/NOTICE b/jndi/command/NOTICE
deleted file mode 100644
index b70f1f9..0000000
--- a/jndi/command/NOTICE
+++ /dev/null
@@ -1,71 +0,0 @@
-Apache Karaf
-Copyright 2010-2014 The Apache Software Foundation
-
-
-I. Included Software
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2010).
-Licensed under the Apache License 2.0.
-
-This product includes software developed at
-OW2 (http://www.ow2.org/).
-Licensed under the BSD License.
-
-This product includes software developed at
-OPS4J (http://www.ops4j.org/).
-Licensed under the Apache License 2.0.
-
-This product includes software developed at
-Eclipse Foundation (http://www.eclipse.org/).
-Licensed under the EPL.
-
-This product includes software written by
-Antony Lesuisse.
-Licensed under Public Domain.
-
-
-II. Used Software
-
-This product uses software developed at
-FUSE Source (http://www.fusesource.org/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-AOP Alliance (http://aopalliance.sourceforge.net/).
-Licensed under the Public Domain.
-
-This product uses software developed at
-Tanuki Software (http://www.tanukisoftware.com/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-Jasypt (http://jasypt.sourceforge.net/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-JLine (http://jline.sourceforge.net).
-Licensed under the BSD License.
-
-This product uses software developed at
-SLF4J (http://www.slf4j.org/).
-Licensed under the MIT License.
-
-This product uses software developed at
-SpringSource (http://www.springsource.org/).
-Licensed under the Apache License 2.0.
-
-This product includes software from http://www.json.org.
-Copyright (c) 2002 JSON.org
-
-
-III. License Summary
-- Apache License 2.0
-- BSD License
-- EPL License
-- MIT License
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/command/pom.xml
----------------------------------------------------------------------
diff --git a/jndi/command/pom.xml b/jndi/command/pom.xml
deleted file mode 100644
index 5dddd2e..0000000
--- a/jndi/command/pom.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <!--
-
- 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.
- -->
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.karaf.jndi</groupId>
- <artifactId>jndi</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>org.apache.karaf.jndi.command</artifactId>
- <packaging>bundle</packaging>
- <name>Apache Karaf :: JNDI :: Command</name>
- <description>This bundle provides a set of commands to manipulate JNDI service.</description>
-
- <properties>
- <appendedResourcesDirectory>${basedir}/../../etc/appended-resources</appendedResourcesDirectory>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.karaf.jndi</groupId>
- <artifactId>org.apache.karaf.jndi.core</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.karaf.shell</groupId>
- <artifactId>org.apache.karaf.shell.core</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <resources>
- <resource>
- <directory>${project.basedir}/src/main/resources</directory>
- <includes>
- <include>**/*</include>
- </includes>
- </resource>
- <resource>
- <directory>${project.basedir}/src/main/resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*.info</include>
- </includes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Export-Package>!*</Export-Package>
- <Karaf-Commands>*</Karaf-Commands>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/command/src/main/java/org/apache/karaf/jndi/command/AliasCommand.java
----------------------------------------------------------------------
diff --git a/jndi/command/src/main/java/org/apache/karaf/jndi/command/AliasCommand.java b/jndi/command/src/main/java/org/apache/karaf/jndi/command/AliasCommand.java
deleted file mode 100644
index 08e3912..0000000
--- a/jndi/command/src/main/java/org/apache/karaf/jndi/command/AliasCommand.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.command;
-
-import org.apache.karaf.jndi.JndiService;
-import org.apache.karaf.jndi.command.completers.ContextsCompleter;
-import org.apache.karaf.jndi.command.completers.NamesCompleter;
-import org.apache.karaf.shell.api.action.Action;
-import org.apache.karaf.shell.api.action.Argument;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.Completion;
-import org.apache.karaf.shell.api.action.lifecycle.Reference;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-
-@Command(scope = "jndi", name = "alias", description = "Create a JNDI alias on a given name.")
-@Service
-public class AliasCommand implements Action {
-
- @Argument(index = 0, name = "name", description = "The JNDI name", required = true, multiValued = false)
- @Completion(NamesCompleter.class)
- String name;
-
- @Argument(index = 1, name = "alias", description = "The JNDI alias", required = true, multiValued = false)
- @Completion(ContextsCompleter.class)
- String alias;
-
- @Reference
- JndiService jndiService;
-
- @Override
- public Object execute() throws Exception {
- jndiService.alias(name, alias);
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/command/src/main/java/org/apache/karaf/jndi/command/BindCommand.java
----------------------------------------------------------------------
diff --git a/jndi/command/src/main/java/org/apache/karaf/jndi/command/BindCommand.java b/jndi/command/src/main/java/org/apache/karaf/jndi/command/BindCommand.java
deleted file mode 100644
index b181762..0000000
--- a/jndi/command/src/main/java/org/apache/karaf/jndi/command/BindCommand.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.command;
-
-import org.apache.karaf.jndi.JndiService;
-import org.apache.karaf.jndi.command.completers.ContextsCompleter;
-import org.apache.karaf.jndi.command.completers.ServicesIdCompleter;
-import org.apache.karaf.shell.api.action.Action;
-import org.apache.karaf.shell.api.action.Argument;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.Completion;
-import org.apache.karaf.shell.api.action.lifecycle.Reference;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-
-@Command(scope = "jndi", name = "bind", description = "Bind an OSGi service in the JNDI context")
-@Service
-public class BindCommand implements Action {
-
- @Argument(index = 0, name = "service", description = "The ID of the OSGi service to bind", required = true, multiValued = false)
- @Completion(ServicesIdCompleter.class)
- Long serviceId;
-
- @Argument(index = 1, name = "name", description = "The JNDI name to bind the OSGi service", required = true, multiValued = false)
- @Completion(ContextsCompleter.class)
- String name;
-
- @Reference
- JndiService jndiService;
-
- @Override
- public Object execute() throws Exception {
- jndiService.bind(serviceId, name);
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/command/src/main/java/org/apache/karaf/jndi/command/ContextsCommand.java
----------------------------------------------------------------------
diff --git a/jndi/command/src/main/java/org/apache/karaf/jndi/command/ContextsCommand.java b/jndi/command/src/main/java/org/apache/karaf/jndi/command/ContextsCommand.java
deleted file mode 100644
index 2209479..0000000
--- a/jndi/command/src/main/java/org/apache/karaf/jndi/command/ContextsCommand.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.command;
-
-import org.apache.karaf.jndi.JndiService;
-import org.apache.karaf.jndi.command.completers.ContextsCompleter;
-import org.apache.karaf.shell.api.action.Action;
-import org.apache.karaf.shell.api.action.Argument;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.Completion;
-import org.apache.karaf.shell.api.action.lifecycle.Reference;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-import org.apache.karaf.shell.support.table.ShellTable;
-
-import java.util.List;
-
-@Command(scope = "jndi", name = "contexts", description = "List the JNDI sub-contexts.")
-@Service
-public class ContextsCommand implements Action {
-
- @Argument(index = 0, name = "context", description = "The base JNDI context", required = false, multiValued = false)
- @Completion(ContextsCompleter.class)
- String context;
-
- @Reference
- JndiService jndiService;
-
- @Override
- public Object execute() throws Exception {
- ShellTable table = new ShellTable();
-
- table.column("JNDI Sub-Context");
-
- List<String> contexts;
- if (context == null) {
- contexts = jndiService.contexts();
- } else {
- contexts = jndiService.contexts(context);
- }
-
- for (String c : contexts) {
- table.addRow().addContent(c);
- }
-
- table.print(System.out);
-
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/command/src/main/java/org/apache/karaf/jndi/command/CreateCommand.java
----------------------------------------------------------------------
diff --git a/jndi/command/src/main/java/org/apache/karaf/jndi/command/CreateCommand.java b/jndi/command/src/main/java/org/apache/karaf/jndi/command/CreateCommand.java
deleted file mode 100644
index 86663bf..0000000
--- a/jndi/command/src/main/java/org/apache/karaf/jndi/command/CreateCommand.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.command;
-
-import org.apache.karaf.jndi.JndiService;
-import org.apache.karaf.jndi.command.completers.ContextsCompleter;
-import org.apache.karaf.shell.api.action.Action;
-import org.apache.karaf.shell.api.action.Argument;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.Completion;
-import org.apache.karaf.shell.api.action.lifecycle.Reference;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-
-@Command(scope = "jndi", name = "create", description = "Create a new JNDI sub-context.")
-@Service
-public class CreateCommand implements Action {
-
- @Argument(index = 0, name = "context", description = "The JNDI sub-context name", required = true, multiValued = false)
- @Completion(ContextsCompleter.class)
- String context;
-
- @Reference
- JndiService jndiService;
-
- @Override
- public Object execute() throws Exception {
- jndiService.create(context);
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/command/src/main/java/org/apache/karaf/jndi/command/DeleteCommand.java
----------------------------------------------------------------------
diff --git a/jndi/command/src/main/java/org/apache/karaf/jndi/command/DeleteCommand.java b/jndi/command/src/main/java/org/apache/karaf/jndi/command/DeleteCommand.java
deleted file mode 100644
index 3cd3a40..0000000
--- a/jndi/command/src/main/java/org/apache/karaf/jndi/command/DeleteCommand.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.command;
-
-import org.apache.karaf.jndi.JndiService;
-import org.apache.karaf.jndi.command.completers.ContextsCompleter;
-import org.apache.karaf.shell.api.action.Action;
-import org.apache.karaf.shell.api.action.Argument;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.Completion;
-import org.apache.karaf.shell.api.action.lifecycle.Reference;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-
-@Command(scope = "jndi", name = "delete", description = "Delete a JNDI sub-context.")
-@Service
-public class DeleteCommand implements Action {
-
- @Argument(index = 0, name = "context", description = "The JNDI sub-context name", required = true, multiValued = false)
- @Completion(ContextsCompleter.class)
- String context;
-
- @Reference
- JndiService jndiService;
-
- @Override
- public Object execute() throws Exception {
- jndiService.delete(context);
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/command/src/main/java/org/apache/karaf/jndi/command/NamesCommand.java
----------------------------------------------------------------------
diff --git a/jndi/command/src/main/java/org/apache/karaf/jndi/command/NamesCommand.java b/jndi/command/src/main/java/org/apache/karaf/jndi/command/NamesCommand.java
deleted file mode 100644
index 0345f11..0000000
--- a/jndi/command/src/main/java/org/apache/karaf/jndi/command/NamesCommand.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.command;
-
-import org.apache.karaf.jndi.JndiService;
-import org.apache.karaf.jndi.command.completers.ContextsCompleter;
-import org.apache.karaf.shell.api.action.Action;
-import org.apache.karaf.shell.api.action.Argument;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.Completion;
-import org.apache.karaf.shell.api.action.lifecycle.Reference;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-import org.apache.karaf.shell.support.table.ShellTable;
-
-import java.util.Map;
-
-@Command(scope = "jndi", name = "names", description = "List the JNDI names.")
-@Service
-public class NamesCommand implements Action {
-
- @Argument(index = 0, name = "context", description = "The JNDI context to display the names", required = false, multiValued = false)
- @Completion(ContextsCompleter.class)
- String context;
-
- @Reference
- JndiService jndiService;
-
- @Override
- public Object execute() throws Exception {
- ShellTable table = new ShellTable();
-
- table.column("JNDI Name");
- table.column("Class Name");
-
- Map<String, String> names;
- if (context == null) {
- names = jndiService.names();
- } else {
- names = jndiService.names(context);
- }
-
- for (String name : names.keySet()) {
- table.addRow().addContent(name, names.get(name));
- }
-
- table.print(System.out);
-
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/command/src/main/java/org/apache/karaf/jndi/command/UnbindCommand.java
----------------------------------------------------------------------
diff --git a/jndi/command/src/main/java/org/apache/karaf/jndi/command/UnbindCommand.java b/jndi/command/src/main/java/org/apache/karaf/jndi/command/UnbindCommand.java
deleted file mode 100644
index b93c7b9..0000000
--- a/jndi/command/src/main/java/org/apache/karaf/jndi/command/UnbindCommand.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.command;
-
-import org.apache.karaf.jndi.JndiService;
-import org.apache.karaf.jndi.command.completers.NamesCompleter;
-import org.apache.karaf.shell.api.action.Action;
-import org.apache.karaf.shell.api.action.Argument;
-import org.apache.karaf.shell.api.action.Command;
-import org.apache.karaf.shell.api.action.Completion;
-import org.apache.karaf.shell.api.action.lifecycle.Reference;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-
-@Command(scope = "jndi", name = "unbind", description = "Unbind a JNDI name.")
-@Service
-public class UnbindCommand implements Action {
-
- @Argument(index = 0, name = "name", description = "The JNDI name to unbind", required = true, multiValued = false)
- @Completion(NamesCompleter.class)
- String name;
-
- @Reference
- JndiService jndiService;
-
- @Override
- public Object execute() throws Exception {
- jndiService.unbind(name);
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/command/src/main/java/org/apache/karaf/jndi/command/completers/ContextsCompleter.java
----------------------------------------------------------------------
diff --git a/jndi/command/src/main/java/org/apache/karaf/jndi/command/completers/ContextsCompleter.java b/jndi/command/src/main/java/org/apache/karaf/jndi/command/completers/ContextsCompleter.java
deleted file mode 100644
index 8f2ac29..0000000
--- a/jndi/command/src/main/java/org/apache/karaf/jndi/command/completers/ContextsCompleter.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.command.completers;
-
-import org.apache.karaf.jndi.JndiService;
-import org.apache.karaf.shell.api.action.lifecycle.Reference;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-import org.apache.karaf.shell.api.console.CommandLine;
-import org.apache.karaf.shell.api.console.Completer;
-import org.apache.karaf.shell.api.console.Session;
-import org.apache.karaf.shell.support.completers.StringsCompleter;
-
-import java.util.List;
-
-/**
- * Completers on the JNDI contexts.
- */
-@Service
-public class ContextsCompleter implements Completer {
-
- @Reference
- private JndiService jndiService;
-
- @Override
- public int complete(Session session, CommandLine commandLine, List<String> candidates) {
- StringsCompleter delegate = new StringsCompleter();
- try {
- List<String> contexts = jndiService.contexts();
- for (String context : contexts) {
- delegate.getStrings().add(context);
- }
- } catch (Exception e) {
- // nothing to do
- }
- return delegate.complete(session, commandLine, candidates);
- }
-
- public JndiService getJndiService() {
- return jndiService;
- }
-
- public void setJndiService(JndiService jndiService) {
- this.jndiService = jndiService;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/command/src/main/java/org/apache/karaf/jndi/command/completers/NamesCompleter.java
----------------------------------------------------------------------
diff --git a/jndi/command/src/main/java/org/apache/karaf/jndi/command/completers/NamesCompleter.java b/jndi/command/src/main/java/org/apache/karaf/jndi/command/completers/NamesCompleter.java
deleted file mode 100644
index d94e3f4..0000000
--- a/jndi/command/src/main/java/org/apache/karaf/jndi/command/completers/NamesCompleter.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.command.completers;
-
-import org.apache.karaf.jndi.JndiService;
-import org.apache.karaf.shell.api.action.lifecycle.Reference;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-import org.apache.karaf.shell.api.console.CommandLine;
-import org.apache.karaf.shell.api.console.Completer;
-import org.apache.karaf.shell.api.console.Session;
-import org.apache.karaf.shell.support.completers.StringsCompleter;
-
-import java.util.List;
-
-/**
- * Completer to the JNDI names.
- */
-@Service
-public class NamesCompleter implements Completer {
-
- @Reference
- private JndiService jndiService;
-
- @Override
- public int complete(Session session, CommandLine commandLine, List<String> candidates) {
- StringsCompleter delegate = new StringsCompleter();
- try {
- for (String name : jndiService.names().keySet()) {
- delegate.getStrings().add(name);
- }
- } catch (Exception e) {
- // nothing to do
- }
- return delegate.complete(session, commandLine, candidates);
- }
-
- public JndiService getJndiService() {
- return jndiService;
- }
-
- public void setJndiService(JndiService jndiService) {
- this.jndiService = jndiService;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/command/src/main/java/org/apache/karaf/jndi/command/completers/ServicesIdCompleter.java
----------------------------------------------------------------------
diff --git a/jndi/command/src/main/java/org/apache/karaf/jndi/command/completers/ServicesIdCompleter.java b/jndi/command/src/main/java/org/apache/karaf/jndi/command/completers/ServicesIdCompleter.java
deleted file mode 100644
index c7cdb80..0000000
--- a/jndi/command/src/main/java/org/apache/karaf/jndi/command/completers/ServicesIdCompleter.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.command.completers;
-
-import org.apache.karaf.shell.api.action.lifecycle.Reference;
-import org.apache.karaf.shell.api.action.lifecycle.Service;
-import org.apache.karaf.shell.api.console.CommandLine;
-import org.apache.karaf.shell.api.console.Completer;
-import org.apache.karaf.shell.api.console.Session;
-import org.apache.karaf.shell.support.completers.StringsCompleter;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-
-import java.util.List;
-
-/**
- * Completer on the OSGi services ID.
- */
-@Service
-public class ServicesIdCompleter implements Completer {
-
- @Reference
- private BundleContext bundleContext;
-
- @Override
- public int complete(Session session, CommandLine commandLine, List<String> candidates) {
- StringsCompleter delegate = new StringsCompleter();
- Bundle[] bundles = bundleContext.getBundles();
- for (Bundle bundle : bundles) {
- ServiceReference[] references = bundle.getRegisteredServices();
- if (references != null) {
- for (ServiceReference reference : references) {
- if (reference.getProperty(Constants.SERVICE_ID) != null) {
- delegate.getStrings().add(reference.getProperty(Constants.SERVICE_ID).toString());
- }
- }
- }
- }
- return delegate.complete(session, commandLine, candidates);
- }
-
- public BundleContext getBundleContext() {
- return bundleContext;
- }
-
- public void setBundleContext(BundleContext bundleContext) {
- this.bundleContext = bundleContext;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/command/src/main/resources/OSGI-INF/bundle.info
----------------------------------------------------------------------
diff --git a/jndi/command/src/main/resources/OSGI-INF/bundle.info b/jndi/command/src/main/resources/OSGI-INF/bundle.info
deleted file mode 100644
index d97d132..0000000
--- a/jndi/command/src/main/resources/OSGI-INF/bundle.info
+++ /dev/null
@@ -1,26 +0,0 @@
-h1. Synopsis
-
-${project.name}
-
-${project.description}
-
-Maven URL:
-[mvn:${project.groupId}/${project.artifactId}/${project.version}]
-
-h1. Description
-
-This bundle provides the shell commands to manipulate the JNDI service.
-
-The following commands are available:
-
-* jndi:alias
-* jndi:bind
-* jndi:create
-* jndi:contexts
-* jndi:delete
-* jndi:names
-* jndi:unbind
-
-h1. See also
-
-JNDI - section of the Karaf User Guide
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/core/NOTICE
----------------------------------------------------------------------
diff --git a/jndi/core/NOTICE b/jndi/core/NOTICE
deleted file mode 100644
index b70f1f9..0000000
--- a/jndi/core/NOTICE
+++ /dev/null
@@ -1,71 +0,0 @@
-Apache Karaf
-Copyright 2010-2014 The Apache Software Foundation
-
-
-I. Included Software
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2010).
-Licensed under the Apache License 2.0.
-
-This product includes software developed at
-OW2 (http://www.ow2.org/).
-Licensed under the BSD License.
-
-This product includes software developed at
-OPS4J (http://www.ops4j.org/).
-Licensed under the Apache License 2.0.
-
-This product includes software developed at
-Eclipse Foundation (http://www.eclipse.org/).
-Licensed under the EPL.
-
-This product includes software written by
-Antony Lesuisse.
-Licensed under Public Domain.
-
-
-II. Used Software
-
-This product uses software developed at
-FUSE Source (http://www.fusesource.org/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-AOP Alliance (http://aopalliance.sourceforge.net/).
-Licensed under the Public Domain.
-
-This product uses software developed at
-Tanuki Software (http://www.tanukisoftware.com/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-Jasypt (http://jasypt.sourceforge.net/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-JLine (http://jline.sourceforge.net).
-Licensed under the BSD License.
-
-This product uses software developed at
-SLF4J (http://www.slf4j.org/).
-Licensed under the MIT License.
-
-This product uses software developed at
-SpringSource (http://www.springsource.org/).
-Licensed under the Apache License 2.0.
-
-This product includes software from http://www.json.org.
-Copyright (c) 2002 JSON.org
-
-
-III. License Summary
-- Apache License 2.0
-- BSD License
-- EPL License
-- MIT License
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/core/pom.xml
----------------------------------------------------------------------
diff --git a/jndi/core/pom.xml b/jndi/core/pom.xml
deleted file mode 100644
index bf1f75c..0000000
--- a/jndi/core/pom.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <!--
-
- 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.
- -->
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.karaf.jndi</groupId>
- <artifactId>jndi</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>org.apache.karaf.jndi.core</artifactId>
- <packaging>bundle</packaging>
- <name>Apache Karaf :: JNDI :: Core</name>
- <description>This bundle provides core implementation of the JNDI management service.</description>
-
- <properties>
- <appendedResourcesDirectory>${basedir}/../../etc/appended-resources</appendedResourcesDirectory>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-naming</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.aries.proxy</groupId>
- <artifactId>org.apache.aries.proxy.api</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <resources>
- <resource>
- <directory>${project.basedir}/src/main/resources</directory>
- <includes>
- <include>**/*</include>
- </includes>
- </resource>
- <resource>
- <directory>${project.basedir}/src/main/resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*.info</include>
- </includes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Export-Package>
- org.apache.karaf.jndi
- </Export-Package>
- <Private-Package>
- org.apache.karaf.jndi.internal
- </Private-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/core/src/main/java/org/apache/karaf/jndi/JndiMBean.java
----------------------------------------------------------------------
diff --git a/jndi/core/src/main/java/org/apache/karaf/jndi/JndiMBean.java b/jndi/core/src/main/java/org/apache/karaf/jndi/JndiMBean.java
deleted file mode 100644
index 0b2be41..0000000
--- a/jndi/core/src/main/java/org/apache/karaf/jndi/JndiMBean.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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;
-
-import javax.management.MBeanException;
-import java.util.List;
-import java.util.Map;
-
-/**
- * JNDI Service MBean
- */
-public interface JndiMBean {
-
- /**
- * Get a map of JNDI names/class names (as attribute).
- *
- * @return the MBean attribute containing the map of names/class names.
- * @throws MBeanException
- */
- public Map<String, String> getNames() throws MBeanException;
-
- /**
- * Get a list of JNDI sub-contexts (as attribute).
- *
- * @return the MBean attribute containing the list of sub-contexts.
- * @throws MBeanException
- */
- public List<String> getContexts() throws MBeanException;
-
- /**
- * Get a map of JNDI names/class names children of a given base context.
- *
- * @param context the base context.
- * @return the map of names/class names.
- * @throws MBeanException
- */
- public Map<String, String> getNames(String context) throws MBeanException;
-
- /**
- * Get a list of JNDI sub-contexts children of a given base context.
- *
- * @param context the base context.
- * @return the list of sub-contexts.
- * @throws MBeanException
- */
- public List<String> getContexts(String context) throws MBeanException;
-
- /**
- * Create a JNDI sub-context.
- *
- * @param context the JNDI sub-context name.
- * @throws MBeanException
- */
- public void create(String context) throws MBeanException;
-
- /**
- * Delete a JNDI sub-context.
- *
- * @param context the JNDI sub-context name.
- * @throws MBeanException
- */
- public void delete(String context) throws MBeanException;
-
- /**
- * Create another JNDI name (alias) for a given one.
- *
- * @param name the "source" JNDI name.
- * @param alias the JNDI alias name.
- * @throws MBeanException
- */
- public void alias(String name, String alias) throws MBeanException;
-
- /**
- * Bind an OSGi service with a JNDI name.
- *
- * @param serviceId the OSGi service id (service.id property on the service, created by the framework).
- * @param name the JNDI name.
- * @throws MBeanException
- */
- public void bind(Long serviceId, String name) throws MBeanException;
-
- /**
- * Unbind a given JNDI name.
- *
- * @param name the JNDI name.
- * @throws MBeanException
- */
- public void unbind(String name) throws MBeanException;
-
-}
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/core/src/main/java/org/apache/karaf/jndi/JndiService.java
----------------------------------------------------------------------
diff --git a/jndi/core/src/main/java/org/apache/karaf/jndi/JndiService.java b/jndi/core/src/main/java/org/apache/karaf/jndi/JndiService.java
deleted file mode 100644
index c9f9c57..0000000
--- a/jndi/core/src/main/java/org/apache/karaf/jndi/JndiService.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * JNDI Service.
- */
-public interface JndiService {
-
- /**
- * List the current JNDI names (with the bound class name).
- *
- * @return the JNDI names.
- * @throws Exception
- */
- Map<String, String> names() throws Exception;
-
- /**
- * List the current JNDI names in the given context.
- *
- * @param context the JNDI context.
- * @return the JNDI names in the context.
- * @throws Exception
- */
- Map<String, String> names(String context) throws Exception;
-
- /**
- * List all JNDI sub-contexts.
- *
- * @return a list containing the sub-context names.
- * @throws Exception
- */
- List<String> contexts() throws Exception;
-
- /**
- * List the JNDI sub-context from a given context.
- *
- * @param context the base JNDI context.
- * @return a list containing the sub-context names.
- * @throws Exception
- */
- List<String> contexts(String context) throws Exception;
-
- /**
- * Create a sub-context.
- *
- * @param context the new sub-context name to create.
- * @throws Exception
- */
- void create(String context) throws Exception;
-
- /**
- * Delete a sub-context.
- *
- * @param context the sub-context name to delete.
- * @throws Exception
- */
- void delete(String context) throws Exception;
-
- /**
- * Create an alias on a given JNDI name.
- *
- * @param name the JNDI name.
- * @param alias the alias.
- * @throws Exception
- */
- void alias(String name, String alias) throws Exception;
-
- /**
- * Bind a given OSGi service to a JNDI name.
- *
- * @param serviceId the OSGi service ID.
- * @param name the JNDI name.
- * @throws Exception
- */
- void bind(long serviceId, String name) throws Exception;
-
- /**
- * Unbind an existing name.
- *
- * @param name the JNDI name to unbind.
- * @throws Exception
- */
- void unbind(String name) throws Exception;
-
-}
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/core/src/main/java/org/apache/karaf/jndi/KarafInitialContextFactory.java
----------------------------------------------------------------------
diff --git a/jndi/core/src/main/java/org/apache/karaf/jndi/KarafInitialContextFactory.java b/jndi/core/src/main/java/org/apache/karaf/jndi/KarafInitialContextFactory.java
deleted file mode 100644
index a540556..0000000
--- a/jndi/core/src/main/java/org/apache/karaf/jndi/KarafInitialContextFactory.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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;
-
-import org.apache.xbean.naming.context.WritableContext;
-import org.apache.xbean.naming.global.GlobalContextManager;
-
-/**
- * A very simple writable initial context factory.
- * @see org.apache.xbean.naming.context.WritableContext for details.
- */
-public class KarafInitialContextFactory extends GlobalContextManager {
-
- public KarafInitialContextFactory() throws Exception {
- super();
- setGlobalContext(new WritableContext());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/core/src/main/java/org/apache/karaf/jndi/internal/JndiMBeanImpl.java
----------------------------------------------------------------------
diff --git a/jndi/core/src/main/java/org/apache/karaf/jndi/internal/JndiMBeanImpl.java b/jndi/core/src/main/java/org/apache/karaf/jndi/internal/JndiMBeanImpl.java
deleted file mode 100644
index 2433618..0000000
--- a/jndi/core/src/main/java/org/apache/karaf/jndi/internal/JndiMBeanImpl.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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;
-
-import org.apache.karaf.jndi.JndiService;
-import org.apache.karaf.jndi.JndiMBean;
-
-import javax.management.MBeanException;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Implementation of the JndiMBean
- */
-public class JndiMBeanImpl implements JndiMBean {
-
- private JndiService jndiService;
-
- @Override
- public Map<String, String> getNames() throws MBeanException {
- try {
- return this.jndiService.names();
- } catch (Throwable t) {
- throw new MBeanException(null, t.getMessage());
- }
- }
-
- @Override
- public List<String> getContexts() throws MBeanException {
- try {
- return this.jndiService.contexts();
- } catch (Throwable t) {
- throw new MBeanException(null, t.getMessage());
- }
- }
-
- @Override
- public Map<String, String> getNames(String context) throws MBeanException {
- try {
- return this.jndiService.names(context);
- } catch (Throwable t) {
- throw new MBeanException(null, t.getMessage());
- }
- }
-
- @Override
- public List<String> getContexts(String context) throws MBeanException {
- try {
- return this.jndiService.contexts(context);
- } catch (Throwable t) {
- throw new MBeanException(null, t.getMessage());
- }
- }
-
- @Override
- public void alias(String name, String alias) throws MBeanException {
- try {
- this.jndiService.alias(name, alias);
- } catch (Throwable t) {
- throw new MBeanException(null, t.getMessage());
- }
- }
-
- @Override
- public void bind(Long serviceId, String name) throws MBeanException {
- try {
- this.jndiService.bind(serviceId, name);
- } catch (Throwable t) {
- throw new MBeanException(null, t.getMessage());
- }
- }
-
- @Override
- public void unbind(String name) throws MBeanException {
- try {
- this.jndiService.unbind(name);
- } catch (Throwable t) {
- throw new MBeanException(null, t.getMessage());
- }
- }
-
- @Override
- public void create(String context) throws MBeanException {
- try {
- this.jndiService.create(context);
- } catch (Throwable t) {
- throw new MBeanException(null, t.getMessage());
- }
- }
-
- @Override
- public void delete(String context) throws MBeanException {
- try {
- this.jndiService.delete(context);
- } catch (Throwable t) {
- throw new MBeanException(null, t.getMessage());
- }
- }
-
- public JndiService getJndiService() {
- return jndiService;
- }
-
- public void setJndiService(JndiService jndiService) {
- this.jndiService = jndiService;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/core/src/main/java/org/apache/karaf/jndi/internal/JndiServiceImpl.java
----------------------------------------------------------------------
diff --git a/jndi/core/src/main/java/org/apache/karaf/jndi/internal/JndiServiceImpl.java b/jndi/core/src/main/java/org/apache/karaf/jndi/internal/JndiServiceImpl.java
deleted file mode 100644
index 68d6b94..0000000
--- a/jndi/core/src/main/java/org/apache/karaf/jndi/internal/JndiServiceImpl.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * 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;
-
-import org.apache.aries.proxy.ProxyManager;
-import org.apache.karaf.jndi.JndiService;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-
-import javax.naming.*;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Implementation of the JNDI Service.
- */
-public class JndiServiceImpl implements JndiService {
-
- private BundleContext bundleContext;
- private ProxyManager proxyManager;
-
- private final static String OSGI_JNDI_CONTEXT_PREFIX = "osgi:service/";
- private final static String OSGI_JNDI_SERVICE_PROPERTY = "osgi.jndi.service.name";
-
- @Override
- public Map<String, String> names() throws Exception {
- Map<String, String> result = names("/");
- result.putAll(names(OSGI_JNDI_CONTEXT_PREFIX));
- return result;
- }
-
- @Override
- public Map<String, String> names(String name) throws Exception {
- Map<String, String> map = new HashMap<String, String>();
- if (name.startsWith(OSGI_JNDI_CONTEXT_PREFIX)) {
- // OSGi service binding
- // make a lookup using directly the OSGi service
- Bundle[] bundles = bundleContext.getBundles();
- for (Bundle bundle : bundles) {
- ServiceReference<?>[] services = bundle.getRegisteredServices();
- if (services != null) {
- for (ServiceReference service : services) {
- if (service.getProperty(OSGI_JNDI_SERVICE_PROPERTY) != null) {
- Object actualService = bundleContext.getService(service);
- if (proxyManager.isProxy(actualService)) {
- actualService = proxyManager.unwrap(actualService).call();
- }
- map.put(OSGI_JNDI_CONTEXT_PREFIX + service.getProperty(OSGI_JNDI_SERVICE_PROPERTY), actualService.getClass().getName());
- bundleContext.ungetService(service);
- }
- }
- }
- }
- } else {
- // "real" JNDI lookup
- Context context = new InitialContext();
- NamingEnumeration<NameClassPair> pairs = context.list(name);
- while (pairs.hasMoreElements()) {
- NameClassPair pair = pairs.nextElement();
- Object o;
- if (name != null) {
- o = context.lookup(name + "/" + pair.getName());
- } else {
- o = context.lookup(pair.getName());
- }
- if (o instanceof Context) {
- StringBuilder sb = new StringBuilder();
- sb.append("/" + pair.getName());
- names((Context) o, sb, map);
- } else {
- map.put("/" + pair.getName(), pair.getClassName());
- }
- }
- }
- return map;
- }
-
- public List<String> contexts() throws Exception {
- return contexts("/");
- }
-
- public List<String> contexts(String name) throws Exception {
- List<String> contexts = new ArrayList<String>();
- Context context = new InitialContext();
- NamingEnumeration<NameClassPair> pairs = context.list(name);
- while (pairs.hasMoreElements()) {
- NameClassPair pair = pairs.nextElement();
- Object o;
- if (name != null) {
- o = context.lookup(name + "/" + pair.getName());
- } else {
- o = context.lookup(pair.getName());
- }
- if (o instanceof Context) {
- StringBuilder sb = new StringBuilder();
- sb.append("/" + pair.getName());
- contexts((Context) o, sb, contexts);
- }
- }
- return contexts;
- }
-
- private void contexts(Context context, StringBuilder sb, List<String> contexts) throws Exception {
- NamingEnumeration list = context.listBindings("");
- while (list.hasMore()) {
- Binding item = (Binding) list.next();
- String name = item.getName();
- Object o = item.getObject();
- if (o instanceof Context) {
- if (((Context) o).list("").hasMoreElements()) {
- sb.append("/").append(name);
- contexts((Context) o, sb, contexts);
- } else {
- contexts.add(sb.toString() + "/" + name);
- }
- }
- }
- }
-
- /**
- * Recursively list a context/names
- *
- * @param ctx the startup context.
- * @param sb the string builder where to construct the full qualified name.
- * @param map the final map containing name/class name pairs.
- * @throws Exception
- */
- private static final void names(Context ctx, StringBuilder sb, Map<String, String> map) throws Exception {
- NamingEnumeration list = ctx.listBindings("");
- while (list.hasMore()) {
- Binding item = (Binding) list.next();
- String className = item.getClassName();
- String name = item.getName();
- Object o = item.getObject();
- if (o instanceof Context) {
- sb.append("/").append(name);
- names((Context) o, sb, map);
- } else {
- map.put(sb.toString() + "/" + name, className);
- }
- }
- }
-
- @Override
- public void create(String name) throws Exception {
- Context context = new InitialContext();
- String[] splitted = name.split("/");
- if (splitted.length > 0) {
- for (int i = 0; i < splitted.length; i++) {
- try {
- Object o = context.lookup(splitted[i]);
- if (!(o instanceof Context)) {
- throw new NamingException("Name " + splitted[i] + " already exists");
- }
- } catch (NameNotFoundException e) {
- context.createSubcontext(splitted[i]);
- }
- context = (Context) context.lookup(splitted[i]);
- }
- } else {
- context.createSubcontext(name);
- }
- }
-
- @Override
- public void delete(String name) throws Exception {
- Context context = new InitialContext();
- context.destroySubcontext(name);
- }
-
- @Override
- public void bind(long serviceId, String name) throws Exception {
- Context context = new InitialContext();
- Bundle[] bundles = bundleContext.getBundles();
- for (Bundle bundle : bundles) {
- ServiceReference<?>[] services = bundle.getRegisteredServices();
- if (services != null) {
- for (ServiceReference service : services) {
- if (service.getProperty(Constants.SERVICE_ID) != null && ((Long) service.getProperty(Constants.SERVICE_ID)) == serviceId) {
- Object actualService = bundleContext.getService(service);
- if (proxyManager.isProxy(actualService)) {
- actualService = proxyManager.unwrap(actualService).call();
- }
- try {
- String[] splitted = name.split("/");
- if (splitted.length > 0) {
- for (int i = 0; i < splitted.length - 1; i++) {
- try {
- Object o = context.lookup(splitted[i]);
- if (!(o instanceof Context)) {
- throw new NamingException("Name " + splitted[i] + " already exists");
- }
- } catch (NameNotFoundException nnfe) {
- context.createSubcontext(splitted[i]);
- }
- context = (Context) context.lookup(splitted[i]);
- }
- name = splitted[splitted.length - 1];
- }
- context.bind(name, actualService);
- } finally {
- bundleContext.ungetService(service);
- }
- }
- }
- }
- }
- }
-
- @Override
- public void alias(String name, String alias) throws Exception {
- Context context = new InitialContext();
- if (name.startsWith(OSGI_JNDI_CONTEXT_PREFIX)) {
- // get the object
- Bundle[] bundles = bundleContext.getBundles();
- for (Bundle bundle : bundles) {
- ServiceReference<?>[] services = bundle.getRegisteredServices();
- if (services != null) {
- for (ServiceReference service : services) {
- if (service.getProperty(OSGI_JNDI_SERVICE_PROPERTY) != null && ((String) service.getProperty(OSGI_JNDI_SERVICE_PROPERTY)).equals(name.substring(OSGI_JNDI_CONTEXT_PREFIX.length()))) {
- Object actualService = bundleContext.getService(service);
- try {
- if (proxyManager.isProxy(actualService)) {
- actualService = proxyManager.unwrap(actualService).call();
- }
- String[] splitted = alias.split("/");
- if (splitted.length > 0) {
- for (int i = 0; i < splitted.length - 1; i++) {
- try {
- Object o = context.lookup(splitted[i]);
- if (!(o instanceof Context)) {
- throw new NamingException("Name " + splitted[i] + " already exists");
- }
- } catch (NameNotFoundException nnfe) {
- context.createSubcontext(splitted[i]);
- }
- context = (Context) context.lookup(splitted[i]);
- }
- alias = splitted[splitted.length -1];
- }
- context.bind(alias, actualService);
- } finally {
- bundleContext.ungetService(service);
- }
- }
- }
- }
- }
- } else {
- Object object = context.lookup(name);
- String[] splitted = alias.split("/");
- if (splitted.length > 0) {
- for (int i = 0; i < splitted.length - 1; i++) {
- try {
- Object o = context.lookup(splitted[i]);
- if (!(o instanceof Context)) {
- throw new NamingException("Name " + splitted[i] + " already exists");
- }
- } catch (NameNotFoundException nnfe) {
- context.createSubcontext(splitted[i]);
- }
- context = (Context) context.lookup(splitted[i]);
- }
- alias = splitted[splitted.length - 1];
- }
- context.bind(alias, object);
- }
- }
-
- @Override
- public void unbind(String name) throws Exception {
- InitialContext context = new InitialContext();
- if (name.startsWith(OSGI_JNDI_CONTEXT_PREFIX)) {
- throw new IllegalArgumentException("You can't unbind a name from the " + OSGI_JNDI_CONTEXT_PREFIX + " JNDI context.");
- }
- context.unbind(name);
- }
-
- public BundleContext getBundleContext() {
- return bundleContext;
- }
-
- public void setBundleContext(BundleContext bundleContext) {
- this.bundleContext = bundleContext;
- }
-
- public ProxyManager getProxyManager() {
- return proxyManager;
- }
-
- public void setProxyManager(ProxyManager proxyManager) {
- this.proxyManager = proxyManager;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/core/src/main/resources/OSGI-INF/blueprint/jndi-core.xml
----------------------------------------------------------------------
diff --git a/jndi/core/src/main/resources/OSGI-INF/blueprint/jndi-core.xml b/jndi/core/src/main/resources/OSGI-INF/blueprint/jndi-core.xml
deleted file mode 100644
index e6be3b1..0000000
--- a/jndi/core/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
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/core/src/main/resources/OSGI-INF/bundle.info
----------------------------------------------------------------------
diff --git a/jndi/core/src/main/resources/OSGI-INF/bundle.info b/jndi/core/src/main/resources/OSGI-INF/bundle.info
deleted file mode 100644
index 4a7a606..0000000
--- a/jndi/core/src/main/resources/OSGI-INF/bundle.info
+++ /dev/null
@@ -1,19 +0,0 @@
-h1. Synopsis
-
-${project.name}
-
-${project.description}
-
-Maven URL:
-[mvn:${project.groupId}/${project.artifactId}/${project.version}]
-
-h1. Description
-
-This bundle is the core implementation of the JNDI service support.
-
-JNDI allows to expose any OSGi services as JNDI names. Karaf JNDI also provides a set of commands and a MBean to list
-the current JNDI names, create JNDI aliases, ...
-
-h1. See also
-
-JNDI - section of the Karaf User Guide
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/pom.xml
----------------------------------------------------------------------
diff --git a/jndi/pom.xml b/jndi/pom.xml
index eb3a43e..f2db373 100644
--- a/jndi/pom.xml
+++ b/jndi/pom.xml
@@ -29,13 +29,69 @@
</parent>
<groupId>org.apache.karaf.jndi</groupId>
- <artifactId>jndi</artifactId>
- <packaging>pom</packaging>
- <name>Apache Karaf :: JNDI</name>
-
- <modules>
- <module>core</module>
- <module>command</module>
- </modules>
+ <artifactId>org.apache.karaf.jndi.core</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Karaf :: JNDI :: Core</name>
+ <description>This bundle provides core implementation of the JNDI management service.</description>
+
+ <properties>
+ <appendedResourcesDirectory>${basedir}/../../etc/appended-resources</appendedResourcesDirectory>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-naming</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.proxy</groupId>
+ <artifactId>org.apache.aries.proxy.api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.core</artifactId>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${project.basedir}/src/main/resources</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>${project.basedir}/src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.info</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Export-Package>
+ org.apache.karaf.jndi
+ </Export-Package>
+ <Private-Package>
+ org.apache.karaf.jndi.command,
+ org.apache.karaf.jndi.internal
+ </Private-Package>
+ <Karaf-Commands>*</Karaf-Commands>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/src/main/java/org/apache/karaf/jndi/JndiMBean.java
----------------------------------------------------------------------
diff --git a/jndi/src/main/java/org/apache/karaf/jndi/JndiMBean.java b/jndi/src/main/java/org/apache/karaf/jndi/JndiMBean.java
new file mode 100644
index 0000000..0b2be41
--- /dev/null
+++ b/jndi/src/main/java/org/apache/karaf/jndi/JndiMBean.java
@@ -0,0 +1,104 @@
+/*
+ * 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;
+
+import javax.management.MBeanException;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * JNDI Service MBean
+ */
+public interface JndiMBean {
+
+ /**
+ * Get a map of JNDI names/class names (as attribute).
+ *
+ * @return the MBean attribute containing the map of names/class names.
+ * @throws MBeanException
+ */
+ public Map<String, String> getNames() throws MBeanException;
+
+ /**
+ * Get a list of JNDI sub-contexts (as attribute).
+ *
+ * @return the MBean attribute containing the list of sub-contexts.
+ * @throws MBeanException
+ */
+ public List<String> getContexts() throws MBeanException;
+
+ /**
+ * Get a map of JNDI names/class names children of a given base context.
+ *
+ * @param context the base context.
+ * @return the map of names/class names.
+ * @throws MBeanException
+ */
+ public Map<String, String> getNames(String context) throws MBeanException;
+
+ /**
+ * Get a list of JNDI sub-contexts children of a given base context.
+ *
+ * @param context the base context.
+ * @return the list of sub-contexts.
+ * @throws MBeanException
+ */
+ public List<String> getContexts(String context) throws MBeanException;
+
+ /**
+ * Create a JNDI sub-context.
+ *
+ * @param context the JNDI sub-context name.
+ * @throws MBeanException
+ */
+ public void create(String context) throws MBeanException;
+
+ /**
+ * Delete a JNDI sub-context.
+ *
+ * @param context the JNDI sub-context name.
+ * @throws MBeanException
+ */
+ public void delete(String context) throws MBeanException;
+
+ /**
+ * Create another JNDI name (alias) for a given one.
+ *
+ * @param name the "source" JNDI name.
+ * @param alias the JNDI alias name.
+ * @throws MBeanException
+ */
+ public void alias(String name, String alias) throws MBeanException;
+
+ /**
+ * Bind an OSGi service with a JNDI name.
+ *
+ * @param serviceId the OSGi service id (service.id property on the service, created by the framework).
+ * @param name the JNDI name.
+ * @throws MBeanException
+ */
+ public void bind(Long serviceId, String name) throws MBeanException;
+
+ /**
+ * Unbind a given JNDI name.
+ *
+ * @param name the JNDI name.
+ * @throws MBeanException
+ */
+ public void unbind(String name) throws MBeanException;
+
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/src/main/java/org/apache/karaf/jndi/JndiService.java
----------------------------------------------------------------------
diff --git a/jndi/src/main/java/org/apache/karaf/jndi/JndiService.java b/jndi/src/main/java/org/apache/karaf/jndi/JndiService.java
new file mode 100644
index 0000000..c9f9c57
--- /dev/null
+++ b/jndi/src/main/java/org/apache/karaf/jndi/JndiService.java
@@ -0,0 +1,103 @@
+/*
+ * 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;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * JNDI Service.
+ */
+public interface JndiService {
+
+ /**
+ * List the current JNDI names (with the bound class name).
+ *
+ * @return the JNDI names.
+ * @throws Exception
+ */
+ Map<String, String> names() throws Exception;
+
+ /**
+ * List the current JNDI names in the given context.
+ *
+ * @param context the JNDI context.
+ * @return the JNDI names in the context.
+ * @throws Exception
+ */
+ Map<String, String> names(String context) throws Exception;
+
+ /**
+ * List all JNDI sub-contexts.
+ *
+ * @return a list containing the sub-context names.
+ * @throws Exception
+ */
+ List<String> contexts() throws Exception;
+
+ /**
+ * List the JNDI sub-context from a given context.
+ *
+ * @param context the base JNDI context.
+ * @return a list containing the sub-context names.
+ * @throws Exception
+ */
+ List<String> contexts(String context) throws Exception;
+
+ /**
+ * Create a sub-context.
+ *
+ * @param context the new sub-context name to create.
+ * @throws Exception
+ */
+ void create(String context) throws Exception;
+
+ /**
+ * Delete a sub-context.
+ *
+ * @param context the sub-context name to delete.
+ * @throws Exception
+ */
+ void delete(String context) throws Exception;
+
+ /**
+ * Create an alias on a given JNDI name.
+ *
+ * @param name the JNDI name.
+ * @param alias the alias.
+ * @throws Exception
+ */
+ void alias(String name, String alias) throws Exception;
+
+ /**
+ * Bind a given OSGi service to a JNDI name.
+ *
+ * @param serviceId the OSGi service ID.
+ * @param name the JNDI name.
+ * @throws Exception
+ */
+ void bind(long serviceId, String name) throws Exception;
+
+ /**
+ * Unbind an existing name.
+ *
+ * @param name the JNDI name to unbind.
+ * @throws Exception
+ */
+ void unbind(String name) throws Exception;
+
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/85c65dd6/jndi/src/main/java/org/apache/karaf/jndi/KarafInitialContextFactory.java
----------------------------------------------------------------------
diff --git a/jndi/src/main/java/org/apache/karaf/jndi/KarafInitialContextFactory.java b/jndi/src/main/java/org/apache/karaf/jndi/KarafInitialContextFactory.java
new file mode 100644
index 0000000..a540556
--- /dev/null
+++ b/jndi/src/main/java/org/apache/karaf/jndi/KarafInitialContextFactory.java
@@ -0,0 +1,33 @@
+/*
+ * 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;
+
+import org.apache.xbean.naming.context.WritableContext;
+import org.apache.xbean.naming.global.GlobalContextManager;
+
+/**
+ * A very simple writable initial context factory.
+ * @see org.apache.xbean.naming.context.WritableContext for details.
+ */
+public class KarafInitialContextFactory extends GlobalContextManager {
+
+ public KarafInitialContextFactory() throws Exception {
+ super();
+ setGlobalContext(new WritableContext());
+ }
+
+}