FELIX-3111 : Separate OBR Plugin
FELIX-3107 : Separate Shell Plugin
FELIX-3099 : Separate Deployment Admin plugin
FELIX-3100 : Separate SCR plugin

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1169777 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole-plugins/deppack/LICENSE b/webconsole-plugins/deppack/LICENSE
new file mode 100644
index 0000000..75b5248
--- /dev/null
+++ b/webconsole-plugins/deppack/LICENSE
@@ -0,0 +1,202 @@
+

+                                 Apache License

+                           Version 2.0, January 2004

+                        http://www.apache.org/licenses/

+

+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

+

+   1. Definitions.

+

+      "License" shall mean the terms and conditions for use, reproduction,

+      and distribution as defined by Sections 1 through 9 of this document.

+

+      "Licensor" shall mean the copyright owner or entity authorized by

+      the copyright owner that is granting the License.

+

+      "Legal Entity" shall mean the union of the acting entity and all

+      other entities that control, are controlled by, or are under common

+      control with that entity. For the purposes of this definition,

+      "control" means (i) the power, direct or indirect, to cause the

+      direction or management of such entity, whether by contract or

+      otherwise, or (ii) ownership of fifty percent (50%) or more of the

+      outstanding shares, or (iii) beneficial ownership of such entity.

+

+      "You" (or "Your") shall mean an individual or Legal Entity

+      exercising permissions granted by this License.

+

+      "Source" form shall mean the preferred form for making modifications,

+      including but not limited to software source code, documentation

+      source, and configuration files.

+

+      "Object" form shall mean any form resulting from mechanical

+      transformation or translation of a Source form, including but

+      not limited to compiled object code, generated documentation,

+      and conversions to other media types.

+

+      "Work" shall mean the work of authorship, whether in Source or

+      Object form, made available under the License, as indicated by a

+      copyright notice that is included in or attached to the work

+      (an example is provided in the Appendix below).

+

+      "Derivative Works" shall mean any work, whether in Source or Object

+      form, that is based on (or derived from) the Work and for which the

+      editorial revisions, annotations, elaborations, or other modifications

+      represent, as a whole, an original work of authorship. For the purposes

+      of this License, Derivative Works shall not include works that remain

+      separable from, or merely link (or bind by name) to the interfaces of,

+      the Work and Derivative Works thereof.

+

+      "Contribution" shall mean any work of authorship, including

+      the original version of the Work and any modifications or additions

+      to that Work or Derivative Works thereof, that is intentionally

+      submitted to Licensor for inclusion in the Work by the copyright owner

+      or by an individual or Legal Entity authorized to submit on behalf of

+      the copyright owner. For the purposes of this definition, "submitted"

+      means any form of electronic, verbal, or written communication sent

+      to the Licensor or its representatives, including but not limited to

+      communication on electronic mailing lists, source code control systems,

+      and issue tracking systems that are managed by, or on behalf of, the

+      Licensor for the purpose of discussing and improving the Work, but

+      excluding communication that is conspicuously marked or otherwise

+      designated in writing by the copyright owner as "Not a Contribution."

+

+      "Contributor" shall mean Licensor and any individual or Legal Entity

+      on behalf of whom a Contribution has been received by Licensor and

+      subsequently incorporated within the Work.

+

+   2. Grant of Copyright License. Subject to the terms and conditions of

+      this License, each Contributor hereby grants to You a perpetual,

+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable

+      copyright license to reproduce, prepare Derivative Works of,

+      publicly display, publicly perform, sublicense, and distribute the

+      Work and such Derivative Works in Source or Object form.

+

+   3. Grant of Patent License. Subject to the terms and conditions of

+      this License, each Contributor hereby grants to You a perpetual,

+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable

+      (except as stated in this section) patent license to make, have made,

+      use, offer to sell, sell, import, and otherwise transfer the Work,

+      where such license applies only to those patent claims licensable

+      by such Contributor that are necessarily infringed by their

+      Contribution(s) alone or by combination of their Contribution(s)

+      with the Work to which such Contribution(s) was submitted. If You

+      institute patent litigation against any entity (including a

+      cross-claim or counterclaim in a lawsuit) alleging that the Work

+      or a Contribution incorporated within the Work constitutes direct

+      or contributory patent infringement, then any patent licenses

+      granted to You under this License for that Work shall terminate

+      as of the date such litigation is filed.

+

+   4. Redistribution. You may reproduce and distribute copies of the

+      Work or Derivative Works thereof in any medium, with or without

+      modifications, and in Source or Object form, provided that You

+      meet the following conditions:

+

+      (a) You must give any other recipients of the Work or

+          Derivative Works a copy of this License; and

+

+      (b) You must cause any modified files to carry prominent notices

+          stating that You changed the files; and

+

+      (c) You must retain, in the Source form of any Derivative Works

+          that You distribute, all copyright, patent, trademark, and

+          attribution notices from the Source form of the Work,

+          excluding those notices that do not pertain to any part of

+          the Derivative Works; and

+

+      (d) If the Work includes a "NOTICE" text file as part of its

+          distribution, then any Derivative Works that You distribute must

+          include a readable copy of the attribution notices contained

+          within such NOTICE file, excluding those notices that do not

+          pertain to any part of the Derivative Works, in at least one

+          of the following places: within a NOTICE text file distributed

+          as part of the Derivative Works; within the Source form or

+          documentation, if provided along with the Derivative Works; or,

+          within a display generated by the Derivative Works, if and

+          wherever such third-party notices normally appear. The contents

+          of the NOTICE file are for informational purposes only and

+          do not modify the License. You may add Your own attribution

+          notices within Derivative Works that You distribute, alongside

+          or as an addendum to the NOTICE text from the Work, provided

+          that such additional attribution notices cannot be construed

+          as modifying the License.

+

+      You may add Your own copyright statement to Your modifications and

+      may provide additional or different license terms and conditions

+      for use, reproduction, or distribution of Your modifications, or

+      for any such Derivative Works as a whole, provided Your use,

+      reproduction, and distribution of the Work otherwise complies with

+      the conditions stated in this License.

+

+   5. Submission of Contributions. Unless You explicitly state otherwise,

+      any Contribution intentionally submitted for inclusion in the Work

+      by You to the Licensor shall be under the terms and conditions of

+      this License, without any additional terms or conditions.

+      Notwithstanding the above, nothing herein shall supersede or modify

+      the terms of any separate license agreement you may have executed

+      with Licensor regarding such Contributions.

+

+   6. Trademarks. This License does not grant permission to use the trade

+      names, trademarks, service marks, or product names of the Licensor,

+      except as required for reasonable and customary use in describing the

+      origin of the Work and reproducing the content of the NOTICE file.

+

+   7. Disclaimer of Warranty. Unless required by applicable law or

+      agreed to in writing, Licensor provides the Work (and each

+      Contributor provides its Contributions) on an "AS IS" BASIS,

+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or

+      implied, including, without limitation, any warranties or conditions

+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A

+      PARTICULAR PURPOSE. You are solely responsible for determining the

+      appropriateness of using or redistributing the Work and assume any

+      risks associated with Your exercise of permissions under this License.

+

+   8. Limitation of Liability. In no event and under no legal theory,

+      whether in tort (including negligence), contract, or otherwise,

+      unless required by applicable law (such as deliberate and grossly

+      negligent acts) or agreed to in writing, shall any Contributor be

+      liable to You for damages, including any direct, indirect, special,

+      incidental, or consequential damages of any character arising as a

+      result of this License or out of the use or inability to use the

+      Work (including but not limited to damages for loss of goodwill,

+      work stoppage, computer failure or malfunction, or any and all

+      other commercial damages or losses), even if such Contributor

+      has been advised of the possibility of such damages.

+

+   9. Accepting Warranty or Additional Liability. While redistributing

+      the Work or Derivative Works thereof, You may choose to offer,

+      and charge a fee for, acceptance of support, warranty, indemnity,

+      or other liability obligations and/or rights consistent with this

+      License. However, in accepting such obligations, You may act only

+      on Your own behalf and on Your sole responsibility, not on behalf

+      of any other Contributor, and only if You agree to indemnify,

+      defend, and hold each Contributor harmless for any liability

+      incurred by, or claims asserted against, such Contributor by reason

+      of your accepting any such warranty or additional liability.

+

+   END OF TERMS AND CONDITIONS

+

+   APPENDIX: How to apply the Apache License to your work.

+

+      To apply the Apache License to your work, attach the following

+      boilerplate notice, with the fields enclosed by brackets "[]"

+      replaced with your own identifying information. (Don't include

+      the brackets!)  The text should be enclosed in the appropriate

+      comment syntax for the file format. We also recommend that a

+      file or class name and description of purpose be included on the

+      same "printed page" as the copyright notice for easier

+      identification within third-party archives.

+

+   Copyright [yyyy] [name of copyright owner]

+

+   Licensed 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.

diff --git a/webconsole-plugins/deppack/NOTICE b/webconsole-plugins/deppack/NOTICE
new file mode 100644
index 0000000..3a3923a
--- /dev/null
+++ b/webconsole-plugins/deppack/NOTICE
@@ -0,0 +1,21 @@
+Apache Felix OSGi Web Console Event Plugin

+Copyright 2007-2010 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.

+

+

+II. Used Software

+

+This product uses software developed at

+The OSGi Alliance (http://www.osgi.org/).

+Copyright (c) OSGi Alliance (2000, 2009).

+Licensed under the Apache License 2.0.

+

+

+III. License Summary

+- Apache License 2.0

diff --git a/webconsole-plugins/deppack/pom.xml b/webconsole-plugins/deppack/pom.xml
new file mode 100644
index 0000000..0c764e6
--- /dev/null
+++ b/webconsole-plugins/deppack/pom.xml
@@ -0,0 +1,115 @@
+<!-- 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. -->

+<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/maven-v4_0_0.xsd">

+

+	<modelVersion>4.0.0</modelVersion>

+	<parent>

+		<groupId>org.apache.felix</groupId>

+		<artifactId>felix-parent</artifactId>

+		<version>1.2.0</version>

+		<relativePath>../../../pom/pom.xml</relativePath>

+	</parent>

+

+	<artifactId>org.apache.felix.webconsole.plugins.deppack</artifactId>

+	<packaging>bundle</packaging>

+	<version>1.0.0-SNAPSHOT</version>

+

+	<name>Apache Felix Web Console Deployment Packages Plugin</name>

+	<description>

+        This is a plugin for the Apache Felix OSGi web console for displaying Deployment Packages.

+    </description>

+

+	<scm>

+		<connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/webconsole-plugins/deppack</connection>

+		<developerConnection>scm:svn:https://svn.apache.org/repos/asf/felix/trunk/webconsole-plugins/deppack</developerConnection>

+		<url>http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/deppack</url>

+	</scm>

+

+	<build>

+		<plugins>

+			<!-- translate UTF-8 encoded properties files to ISO-8859-1 -->

+			<plugin>

+				<groupId>org.codehaus.mojo</groupId>

+				<artifactId>native2ascii-maven-plugin</artifactId>

+				<version>1.0-alpha-1</version>

+				<executions>

+					<execution>

+						<goals>

+							<goal>native2ascii</goal>

+						</goals>

+						<configuration>

+							<encoding>UTF-8</encoding>

+						</configuration>

+					</execution>

+				</executions>

+			</plugin>

+

+			<plugin>

+				<groupId>org.apache.felix</groupId>

+				<artifactId>maven-bundle-plugin</artifactId>

+				<version>2.0.1</version>

+				<extensions>true</extensions>

+				<configuration>

+					<instructions>

+						<Bundle-SymbolicName>

+							${artifactId}

+                        </Bundle-SymbolicName>

+						<Bundle-Activator>

+							org.apache.felix.webconsole.plugins.deppack.internal.Activator

+                        </Bundle-Activator>

+					</instructions>

+				</configuration>

+			</plugin>

+		</plugins>

+	</build>

+

+	<dependencies>

+		<dependency>

+			<groupId>javax.servlet</groupId>

+			<artifactId>servlet-api</artifactId>

+			<version>2.4</version>

+			<scope>provided</scope>

+		</dependency>

+		<dependency>

+			<groupId>commons-fileupload</groupId>

+			<artifactId>commons-fileupload</artifactId>

+			<version>1.1.1</version>

+			<scope>provided</scope>

+			<optional>true</optional>

+		</dependency>

+		<dependency>

+			<groupId>org.osgi</groupId>

+			<artifactId>org.osgi.core</artifactId>

+			<version>4.0.0</version>

+			<scope>provided</scope>

+		</dependency>

+		<dependency>

+			<groupId>org.osgi</groupId>

+			<artifactId>org.osgi.compendium</artifactId>

+			<version>4.1.0</version>

+			<scope>provided</scope>

+		</dependency>

+		<dependency>

+			<groupId>org.apache.felix</groupId>

+			<artifactId>org.apache.felix.webconsole</artifactId>

+			<version>3.0.0</version>

+			<scope>provided</scope>

+		</dependency>

+		<dependency>

+			<groupId>org.json</groupId>

+			<artifactId>json</artifactId>

+			<version>20070829</version>

+			<scope>compile</scope>

+			<optional>true</optional>

+		</dependency>

+	</dependencies>

+</project>

diff --git a/webconsole-plugins/deppack/src/main/java/org/apache/felix/webconsole/plugins/deppack/internal/Activator.java b/webconsole-plugins/deppack/src/main/java/org/apache/felix/webconsole/plugins/deppack/internal/Activator.java
new file mode 100644
index 0000000..5bf71d4
--- /dev/null
+++ b/webconsole-plugins/deppack/src/main/java/org/apache/felix/webconsole/plugins/deppack/internal/Activator.java
@@ -0,0 +1,98 @@
+/*

+ * 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.webconsole.plugins.deppack.internal;

+

+import org.apache.felix.webconsole.SimpleWebConsolePlugin;

+import org.osgi.framework.BundleActivator;

+import org.osgi.framework.BundleContext;

+import org.osgi.framework.ServiceReference;

+import org.osgi.service.deploymentadmin.DeploymentAdmin;

+import org.osgi.util.tracker.ServiceTracker;

+import org.osgi.util.tracker.ServiceTrackerCustomizer;

+

+/**

+ * Activator is the main starting class.

+ */

+public class Activator implements BundleActivator, ServiceTrackerCustomizer

+{

+

+    private ServiceTracker tracker;

+    private BundleContext context;

+

+    private SimpleWebConsolePlugin plugin;

+

+    /**

+     * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)

+     */

+    public final void start(BundleContext context) throws Exception

+    {

+        this.context = context;

+        this.tracker = new ServiceTracker(context, DeploymentAdmin.class.getName(), this);

+        this.tracker.open();

+    }

+

+    /**

+     * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)

+     */

+    public final void stop(BundleContext context) throws Exception

+    {

+        if (tracker != null)

+        {

+            tracker.close();

+            tracker = null;

+        }

+    }

+

+    // - begin tracker

+    /**

+     * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference,

+     *      java.lang.Object)

+     */

+    public final void modifiedService(ServiceReference reference, Object service)

+    {/* unused */

+    }

+

+    /**

+     * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference)

+     */

+    public final Object addingService(ServiceReference reference)

+    {

+        SimpleWebConsolePlugin plugin = this.plugin;

+        if (plugin == null)

+        {

+            this.plugin = plugin = new WebConsolePlugin(tracker).register(context);

+        }

+

+        return context.getService(reference);

+    }

+

+    /**

+     * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference,

+     *      java.lang.Object)

+     */

+    public final void removedService(ServiceReference reference, Object service)

+    {

+        SimpleWebConsolePlugin plugin = this.plugin;

+

+        if (tracker.getTrackingCount() == 0 && plugin != null)

+        {

+            plugin.unregister();

+            this.plugin = null;

+        }

+

+    }

+}

diff --git a/webconsole-plugins/deppack/src/main/java/org/apache/felix/webconsole/plugins/deppack/internal/WebConsolePlugin.java b/webconsole-plugins/deppack/src/main/java/org/apache/felix/webconsole/plugins/deppack/internal/WebConsolePlugin.java
new file mode 100644
index 0000000..b47f071
--- /dev/null
+++ b/webconsole-plugins/deppack/src/main/java/org/apache/felix/webconsole/plugins/deppack/internal/WebConsolePlugin.java
@@ -0,0 +1,248 @@
+/*

+ * 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.webconsole.plugins.deppack.internal;

+

+import java.io.IOException;

+import java.io.PrintWriter;

+import java.io.StringWriter;

+import java.util.Map;

+

+import javax.servlet.ServletException;

+import javax.servlet.http.HttpServletRequest;

+import javax.servlet.http.HttpServletResponse;

+

+import org.apache.commons.fileupload.FileItem;

+import org.apache.felix.webconsole.AbstractWebConsolePlugin;

+import org.apache.felix.webconsole.DefaultVariableResolver;

+import org.apache.felix.webconsole.SimpleWebConsolePlugin;

+import org.apache.felix.webconsole.WebConsoleUtil;

+import org.apache.felix.webconsole.internal.Util;

+import org.json.JSONException;

+import org.json.JSONWriter;

+import org.osgi.service.deploymentadmin.DeploymentAdmin;

+import org.osgi.service.deploymentadmin.DeploymentPackage;

+import org.osgi.util.tracker.ServiceTracker;

+

+/**

+ * DepPackServlet provides a plugin for managing deployment admin packages.

+ */

+class WebConsolePlugin extends SimpleWebConsolePlugin

+{

+

+    private static final String LABEL = "deppack"; //$NON-NLS-1$

+    private static final String TITLE = "%deppack.pluginTitle"; //$NON-NLS-1$

+    private static final String CSS[] = { "/" + LABEL + "/res/plugin.css" }; //$NON-NLS-1$ //$NON-NLS-2$

+

+    //

+    private static final String ACTION_DEPLOY = "deploydp"; //$NON-NLS-1$

+    private static final String ACTION_UNINSTALL = "uninstalldp"; //$NON-NLS-1$

+    private static final String PARAMETER_PCK_FILE = "pckfile"; //$NON-NLS-1$

+

+    private static final String DEPL_SERVICE = "org.osgi.service.deploymentadmin.DeploymentAdmin"; //$NON-NLS-1$

+

+    // templates

+    private final String TEMPLATE;

+

+    private final ServiceTracker adminTracker;

+

+    /** Default constructor */

+    WebConsolePlugin(ServiceTracker adminTracker)

+    {

+        super(LABEL, TITLE, CSS);

+

+        // load templates

+        TEMPLATE = readTemplateFile("/res/plugin.html"); //$NON-NLS-1$

+        this.adminTracker = adminTracker;

+    }

+

+    /**

+     * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

+     */

+    protected void doPost(HttpServletRequest req, HttpServletResponse resp)

+        throws ServletException, IOException

+    {

+        // get the uploaded data

+        final String action = WebConsoleUtil.getParameter(req, Util.PARAM_ACTION);

+        if (ACTION_DEPLOY.equals(action))

+        {

+            Map params = (Map) req.getAttribute(AbstractWebConsolePlugin.ATTR_FILEUPLOAD);

+            if (params != null)

+            {

+                final FileItem pck = getFileItem(params, PARAMETER_PCK_FILE, false);

+                final DeploymentAdmin admin = (DeploymentAdmin) adminTracker.getService();

+                if (admin != null)

+                {

+                    try

+                    {

+                        admin.installDeploymentPackage(pck.getInputStream());

+

+                        final String uri = req.getRequestURI();

+                        resp.sendRedirect(uri);

+                        return;

+                    }

+                    catch ( /*Deployment*/Exception e)

+                    {

+                        throw new ServletException("Unable to deploy package.", e);

+                    }

+                }

+            }

+            throw new ServletException("Upload file or deployment admin missing.");

+        }

+        else if (ACTION_UNINSTALL.equals(action))

+        {

+            final String pckId = req.getPathInfo().substring(

+                req.getPathInfo().lastIndexOf('/') + 1);

+            if (pckId != null && pckId.length() > 0)

+            {

+                final DeploymentAdmin admin = (DeploymentAdmin) this.getService(DEPL_SERVICE);

+                if (admin != null)

+                {

+                    try

+                    {

+                        final DeploymentPackage pck = admin.getDeploymentPackage(pckId);

+                        if (pck != null)

+                        {

+                            pck.uninstall();

+                        }

+                    }

+                    catch ( /*Deployment*/Exception e)

+                    {

+                        throw new ServletException("Unable to undeploy package.", e);

+                    }

+                }

+

+            }

+

+            final PrintWriter pw = resp.getWriter();

+            pw.println("{ \"reload\":true }");

+            return;

+        }

+        throw new ServletException("Unknown action: " + action);

+    }

+

+    private static final FileItem getFileItem(Map params, String name, boolean isFormField)

+    {

+        FileItem[] items = (FileItem[]) params.get(name);

+        if (items != null)

+        {

+            for (int i = 0; i < items.length; i++)

+            {

+                if (items[i].isFormField() == isFormField)

+                {

+                    return items[i];

+                }

+            }

+        }

+

+        // nothing found, fail

+        return null;

+    }

+

+    /**

+     * @see org.apache.felix.webconsole.AbstractWebConsolePlugin#renderContent(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

+     */

+    protected void renderContent(HttpServletRequest request, HttpServletResponse response)

+        throws ServletException, IOException

+    {

+

+        final DeploymentAdmin admin = (DeploymentAdmin) this.getService(DEPL_SERVICE);

+

+        StringWriter w = new StringWriter();

+        PrintWriter w2 = new PrintWriter(w);

+        JSONWriter jw = new JSONWriter(w2);

+        try

+        {

+            jw.object();

+            if (null == admin)

+            {

+                jw.key("error"); //$NON-NLS-1$

+                jw.value(true);

+            }

+            else

+            {

+                final DeploymentPackage[] packages = admin.listDeploymentPackages();

+                jw.key("data"); //$NON-NLS-1$

+

+                jw.array();

+                for (int i = 0; i < packages.length; i++)

+                {

+                    packageInfoJson(jw, packages[i]);

+                }

+                jw.endArray();

+

+            }

+            jw.endObject();

+

+        }

+        catch (JSONException je)

+        {

+            throw new IOException(je.toString());

+        }

+

+        // prepare variables

+        DefaultVariableResolver vars = ((DefaultVariableResolver) WebConsoleUtil.getVariableResolver(request));

+        vars.put("__data__", w.toString()); //$NON-NLS-1$

+

+        response.getWriter().print(TEMPLATE);

+    }

+

+    private static final void packageInfoJson(JSONWriter jw, DeploymentPackage pack)

+        throws JSONException

+    {

+        jw.object();

+        jw.key("id"); //$NON-NLS-1$

+        jw.value(pack.getName());

+        jw.key("name"); //$NON-NLS-1$

+        jw.value(pack.getName());

+        jw.key("state"); //$NON-NLS-1$

+        jw.value(pack.getVersion());

+

+        jw.key("actions"); //$NON-NLS-1$

+        jw.array();

+

+        jw.object();

+        jw.key("enabled"); //$NON-NLS-1$

+        jw.value(true);

+        jw.key("name"); //$NON-NLS-1$

+        jw.value("Uninstall");

+        jw.key("link"); //$NON-NLS-1$

+        jw.value(ACTION_UNINSTALL);

+        jw.endObject();

+

+        jw.endArray();

+

+        jw.key("props"); //$NON-NLS-1$

+        jw.array();

+        WebConsoleUtil.keyVal(jw, "Package Name", pack.getName());

+        WebConsoleUtil.keyVal(jw, "Version", pack.getVersion());

+

+        final StringBuffer buffer = new StringBuffer();

+        for (int i = 0; i < pack.getBundleInfos().length; i++)

+        {

+            buffer.append(pack.getBundleInfos()[i].getSymbolicName());

+            buffer.append(" - "); //$NON-NLS-1$

+            buffer.append(pack.getBundleInfos()[i].getVersion());

+            buffer.append("<br/>"); //$NON-NLS-1$

+        }

+        WebConsoleUtil.keyVal(jw, "Bundles", buffer.toString());

+

+        jw.endArray();

+

+        jw.endObject();

+    }

+

+}

diff --git a/webconsole-plugins/deppack/src/main/native2ascii/OSGI-INF/l10n/bundle_bg.properties b/webconsole-plugins/deppack/src/main/native2ascii/OSGI-INF/l10n/bundle_bg.properties
new file mode 100644
index 0000000..89c20a2
--- /dev/null
+++ b/webconsole-plugins/deppack/src/main/native2ascii/OSGI-INF/l10n/bundle_bg.properties
@@ -0,0 +1,40 @@
+#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.

+

+#

+# Web Console strings for reference all strings here are commented.

+# This file may be used to produce a translation of the strings

+#

+# Note that properties files are ISO-8859-1 encoded. To provide translations

+# for languages requiring different character encodings, you may use the

+# native2ascii Maven Plugin from http://mojo.codehaus.org/native2ascii-maven-plugin/

+# to translate the natively encoded files to ISO-8859-1 during bundle build

+#

+# Translations requiring non-ISO-8859-1 encoding are placed in the

+# src/main/native2ascii/OSGI-INF/l10n folder and are converted using said

+# plugin while building the bundle

+# native2ascii -encoding utf-8 bundle_bg.raw_properties bundle_bg.properties

+

+# Deployment Admin plugin

+deppack.pluginTitle=Управление на пакети

+deppack.status.no_data=Няма инсталирани пакети!

+deppack.status.no_service=Услугата Deployment Admin не е налична в момента!

+deppack.status.ok=Deployment Admin е наличен и по-долу е показан списъка с пакет

+deppack.details=Детайли

+deppack.actions=Действия

+deppack.install_update=Инсталиране/обновяване

+deppack.package.name=Име на пакет

+deppack.bundles=Бъндъли

+deppack.uninstall=Премахване

diff --git a/webconsole-plugins/deppack/src/main/native2ascii/OSGI-INF/l10n/bundle_de.properties b/webconsole-plugins/deppack/src/main/native2ascii/OSGI-INF/l10n/bundle_de.properties
new file mode 100644
index 0000000..864181f
--- /dev/null
+++ b/webconsole-plugins/deppack/src/main/native2ascii/OSGI-INF/l10n/bundle_de.properties
@@ -0,0 +1,40 @@
+#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.

+

+#

+# Web Console strings for reference all strings here are commented.

+# This file may be used to produce a translation of the strings

+#

+# Note that properties files are ISO-8859-1 encoded. To provide translations

+# for languages requiring different character encodings, you may use the

+# native2ascii Maven Plugin from http://mojo.codehaus.org/native2ascii-maven-plugin/

+# to translate the natively encoded files to ISO-8859-1 during bundle build

+#

+# Translations requiring non-ISO-8859-1 encoding are placed in the

+# src/main/native2ascii/OSGI-INF/l10n folder and are converted using said

+# plugin while building the bundle

+#

+

+# Deployment Admin plugin

+deppack.pluginTitle=Deployment Packages

+deppack.status.no_data=Kein Deployment Package ist installiert!

+deppack.status.no_service=Deployment Admin Dienst ist nicht instaliert/aktiv!

+deppack.status.ok=Deployment Admin Dienst ist aktiv

+deppack.details=Details

+deppack.actions=Aktionen

+deppack.install_update=Installieren oder Aktualisieren

+deppack.package.name=Package Name

+deppack.bundles=Bundles

+deppack.uninstall=Deinstallieren

diff --git a/webconsole-plugins/deppack/src/main/native2ascii/OSGI-INF/l10n/bundle_ru.properties b/webconsole-plugins/deppack/src/main/native2ascii/OSGI-INF/l10n/bundle_ru.properties
new file mode 100644
index 0000000..6895031
--- /dev/null
+++ b/webconsole-plugins/deppack/src/main/native2ascii/OSGI-INF/l10n/bundle_ru.properties
@@ -0,0 +1,40 @@
+#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.
+
+#
+# Web Console strings for reference all strings here are commented.
+# This file may be used to produce a translation of the strings
+#
+# Note that properties files are ISO-8859-1 encoded. To provide translations
+# for languages requiring different character encodings, you may use the
+# native2ascii Maven Plugin from http://mojo.codehaus.org/native2ascii-maven-plugin/
+# to translate the natively encoded files to ISO-8859-1 during bundle build
+#
+# Translations requiring non-ISO-8859-1 encoding are placed in the
+# src/main/native2ascii/OSGI-INF/l10n folder and are converted using said
+# plugin while building the bundle
+#
+
+# Deployment Admin plugin
+deppack.pluginTitle=Управление пакетами
+deppack.status.no_data=Нет установочных пакетов!
+deppack.status.no_service=Сервис Deployment Admin не установлен или не запущен.
+deppack.status.ok=Сервис Deployment Admin работает
+deppack.details=Подробно
+deppack.actions=Действия
+deppack.install_update=Установить/обновить
+deppack.package.name=Имя пакета
+deppack.bundles=Модули
+deppack.uninstall=Удалить
diff --git a/webconsole-plugins/deppack/src/main/resources/OSGI-INF/l10n/bundle.properties b/webconsole-plugins/deppack/src/main/resources/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 0000000..1a0f302
--- /dev/null
+++ b/webconsole-plugins/deppack/src/main/resources/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,40 @@
+#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.

+

+#

+# Web Console strings for reference all strings here are commented.

+# This file may be used to produce a translation of the strings

+#

+# Note that properties files are ISO-8859-1 encoded. To provide translations

+# for languages requiring different character encodings, you may use the

+# native2ascii Maven Plugin from http://mojo.codehaus.org/native2ascii-maven-plugin/

+# to translate the natively encoded files to ISO-8859-1 during bundle build

+#

+# Translations requiring non-ISO-8859-1 encoding are placed in the

+# src/main/native2ascii/OSGI-INF/l10n folder and are converted using said

+# plugin while building the bundle

+#

+

+# Deployment Admin plugin

+deppack.pluginTitle=Deployment Packages

+deppack.status.no_data=No deployment packages installed!

+deppack.status.no_service=Deployment Admin is not installed/running!

+deppack.status.ok=Deployment Admin service is running

+deppack.details=Details

+deppack.actions=Actions

+deppack.install_update=Install or Update

+deppack.package.name=Package Name

+deppack.bundles=Bundles

+deppack.uninstall=Uninstall

diff --git a/webconsole-plugins/deppack/src/main/resources/res/plugin.css b/webconsole-plugins/deppack/src/main/resources/res/plugin.css
new file mode 100644
index 0000000..c767846
--- /dev/null
+++ b/webconsole-plugins/deppack/src/main/resources/res/plugin.css
@@ -0,0 +1,19 @@
+/*

+ * 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.

+ */

+

+.pkgname { cursor:pointer }

+.pkgname span { float:left }

diff --git a/webconsole-plugins/deppack/src/main/resources/res/plugin.html b/webconsole-plugins/deppack/src/main/resources/res/plugin.html
new file mode 100644
index 0000000..ba16fcd
--- /dev/null
+++ b/webconsole-plugins/deppack/src/main/resources/res/plugin.html
@@ -0,0 +1,55 @@
+<script type="text/javascript" src="${pluginRoot}/res/plugin.js"></script>

+<script type="text/javascript">

+// <![CDATA[

+var i18n = {

+	status_no_data : "${deppack.status.no_data}",

+	status_no_serv : "${deppack.status.no_service}",

+	status_ok      : "${deppack.status.ok}",

+	package_name   : "${deppack.package.name}",

+	version        : "${version}",

+	bundles        : "${deppack.bundles}",

+	uninstall      : "${deppack.uninstall}"

+}

+var packageListData = ${__data__};

+// ]]>

+</script>

+

+<p class="statline">&nbsp;</p>

+

+<div id="dps1"> <!-- will be hidden if no DP service available -->

+<!-- top header -->

+<form method="post" enctype="multipart/form-data" action="${pluginRoot}">

+	<div class="ui-widget-header ui-corner-top buttonGroup" style="text-align: right">

+		<input name="action"  type="hidden" value="deploydp" />

+		<input name="pckfile" type="file" size="50" />

+		<input type="submit" value="${deppack.install_update}" />

+	</div>

+</form>

+

+<div id="dps2"> <!-- will be hidden if no data available -->

+	<table id="plugin_table" class="nicetable">

+	<thead>

+		<tr>

+			<th>${id}</th>

+			<th style="width:100%">${deppack.details}</th>

+			<th>${version}</th>

+			<th colspan="1">${deppack.actions}</th>

+		</tr>

+	</thead>

+	<tbody>

+		<tr>

+			<td colspan="5">&nbsp;</td>

+		</tr>

+	</tbody>

+	</table>

+

+	<!-- bottom header -->

+	<form method="post" enctype="multipart/form-data" action="${pluginRoot}">

+		<div class="ui-widget-header ui-corner-bottom buttonGroup" style="text-align: right">

+			<input name="action"  type="hidden" value="deploydp" />

+			<input name="pckfile" type="file" size="50" />

+			<input type="submit" value="${deppack.install_update}" />

+		</div>

+	</form>

+</div><!--dps2-->

+</div><!--dps1-->

diff --git a/webconsole-plugins/deppack/src/main/resources/res/plugin.js b/webconsole-plugins/deppack/src/main/resources/res/plugin.js
new file mode 100644
index 0000000..149590e
--- /dev/null
+++ b/webconsole-plugins/deppack/src/main/resources/res/plugin.js
@@ -0,0 +1,172 @@
+/*

+ * 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.

+ */

+

+function fixId(id) { return id.replace('.', '_'); }

+

+function data( /* Array of Object */ dataArray ) { // render components

+	plugin_table.find('tbody').empty();

+	if (dataArray.length == 1) {

+		entry( dataArray[0], true );

+	} else {

+		for ( var idx in dataArray ) {

+			entry( dataArray[idx] );

+		}

+	}

+}

+

+function entry( /* Object */ dataEntry, /* boolean */ singleEntry ) {

+	var id = fixId(dataEntry.id);

+	var trElement = tr( 'ui-state-active', { 'id': 'entry' + id });

+

+	// entry brief

+	entryInternal( trElement,  dataEntry, singleEntry );

+	plugin_table.append(trElement);

+

+	// dataEntry detailed properties

+	trElement = tr( 'ui-helper-hidden', { 

+		'id'   : 'entry' + id + '_details'

+	});

+	if (dataEntry.props) {

+		getDataEntryDetails( trElement, dataEntry.props );

+	}

+	plugin_table.append(trElement);

+}

+

+function entryInternal( /* Element */ parent, /* Object */ dataEntry, /* boolean */ singleEntry ) {

+	var id = dataEntry.id;

+	var _id = fixId(id);

+

+	parent.appendChild( td( null, null, [ text( id ) ] ) );

+	parent.appendChild( td( null, 

+			{

+				'onclick': 'toggleDetails("#entry' + _id + '")',

+				'class': 'pkgname'

+			}, 

+			[

+				createElement( 'span', 'ui-icon ui-icon-triangle-1-e', { id: 'entry' + _id + '_icon'} ),

+				text(dataEntry.name)

+			]

+		)

+	);

+	parent.appendChild( td( null, null, [ text( dataEntry.state ) ] ) );

+

+	for ( var aidx in dataEntry.actions ) {

+		var action = dataEntry.actions[aidx];

+		parent.appendChild( actionButton( action.enabled, id, action.link, action.name ) );

+	}

+}

+

+

+/* Element */ function actionButton( /* boolean */ enabled, /* long */ id, /* String */ op, /* String */ opLabel ) {

+	var buttonTd = td( "content", { align: "right" } );

+	if ( op ) {

+		switch (opLabel) {

+			case "Uninstall" : opLabel = i18n.uninstall; break;

+		}

+		var input = createElement( "input", null, {

+				type: 'button',

+				value: opLabel,

+				onclick: 'changeDataEntryState("' + id + '", "' + op + '");'

+			});

+		if (!enabled) {

+			input.setAttribute( "disabled", true );

+			$(input).addClass('ui-state-disabled');

+		}

+		buttonTd.appendChild( input );

+	} else {

+		addText( buttonTd, "\u00a0" );

+	}

+	return buttonTd;

+}

+

+

+function getDataEntryDetails( /* Element */ parent, /* Array of Object */ details )

+{

+	parent.appendChild( addText( td( "content"), "\u00a0" ) );

+	

+	var tdEl = td( null, { colspan: 4 } );

+	parent.appendChild( tdEl );

+	

+	var tableEl = createElement( "table", null, { border: 0 } );

+	tdEl.appendChild( tableEl );

+	

+	var tbody = createElement( "tbody" );

+	tableEl.appendChild( tbody );

+	for (var idx in details) {

+		var prop = details[idx];

+		var trEl = tr();

+		var key = prop.key;

+		switch (key) {

+			case 'Package Name': key = i18n.package_name; break;

+			case 'Version'     : key = i18n.version; break;

+			case 'Bundles'     : key = i18n.bundles; break;

+		}

+		trEl.appendChild( addText( td( null, { noWrap: true } ), key ) );

+

+		var proptd = td();

+		trEl.appendChild( proptd );

+		$(proptd).html( prop.value ? prop.value : "\u00a0");

+

+		tbody.appendChild( trEl );

+	}

+ }

+

+

+function changeDataEntryState(/* long */ id, /* String */ action) {

+	var parm = pluginRoot + "/" + id + "?action=" + action;

+	$.post(parm, null, function() { // always reload

+		document.location.reload();

+	}, "text");

+}

+

+

+function toggleDetails(name) {

+	var icon = $(name + '_icon');

+	var details = $(name + '_details');

+	var show = icon.attr('show');

+	if (typeof show == 'undefined') show = '';

+	icon.attr('show', show ? '' : 'true');

+

+	if (show == 'true') {

+		icon.removeClass('ui-icon-triangle-1-s').addClass('ui-icon-triangle-1-e');

+		details.addClass('ui-helper-hidden');

+	} else {

+		icon.removeClass('ui-icon-triangle-1-e').addClass('ui-icon-triangle-1-s');

+		details.removeClass('ui-helper-hidden');

+	}

+}

+

+var plugin_table = false;

+$(document).ready(function() {

+	plugin_table = $('#plugin_table');

+	var /* Array of Data Objects */ bundleData = packageListData;

+	if (bundleData.error) {

+		$('.statline').text(i18n.status_no_serv);

+		$('#dps1').addClass('ui-helper-hidden');

+	} else if (!bundleData.data || bundleData.data.length == 0) {

+		$('.statline').text(i18n.status_no_data);

+		$('#dps1').removeClass('ui-helper-hidden');

+		$('#dps2').addClass('ui-helper-hidden');

+	} else {

+		data( bundleData.data );

+		$('.statline').text(i18n.status_ok);

+		$('#dps1').removeClass('ui-helper-hidden');

+		$('#dps2').removeClass('ui-helper-hidden');

+		initStaticWidgets(plugin_table);

+	}

+});

+

diff --git a/webconsole-plugins/ds/LICENSE b/webconsole-plugins/ds/LICENSE
new file mode 100644
index 0000000..75b5248
--- /dev/null
+++ b/webconsole-plugins/ds/LICENSE
@@ -0,0 +1,202 @@
+

+                                 Apache License

+                           Version 2.0, January 2004

+                        http://www.apache.org/licenses/

+

+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

+

+   1. Definitions.

+

+      "License" shall mean the terms and conditions for use, reproduction,

+      and distribution as defined by Sections 1 through 9 of this document.

+

+      "Licensor" shall mean the copyright owner or entity authorized by

+      the copyright owner that is granting the License.

+

+      "Legal Entity" shall mean the union of the acting entity and all

+      other entities that control, are controlled by, or are under common

+      control with that entity. For the purposes of this definition,

+      "control" means (i) the power, direct or indirect, to cause the

+      direction or management of such entity, whether by contract or

+      otherwise, or (ii) ownership of fifty percent (50%) or more of the

+      outstanding shares, or (iii) beneficial ownership of such entity.

+

+      "You" (or "Your") shall mean an individual or Legal Entity

+      exercising permissions granted by this License.

+

+      "Source" form shall mean the preferred form for making modifications,

+      including but not limited to software source code, documentation

+      source, and configuration files.

+

+      "Object" form shall mean any form resulting from mechanical

+      transformation or translation of a Source form, including but

+      not limited to compiled object code, generated documentation,

+      and conversions to other media types.

+

+      "Work" shall mean the work of authorship, whether in Source or

+      Object form, made available under the License, as indicated by a

+      copyright notice that is included in or attached to the work

+      (an example is provided in the Appendix below).

+

+      "Derivative Works" shall mean any work, whether in Source or Object

+      form, that is based on (or derived from) the Work and for which the

+      editorial revisions, annotations, elaborations, or other modifications

+      represent, as a whole, an original work of authorship. For the purposes

+      of this License, Derivative Works shall not include works that remain

+      separable from, or merely link (or bind by name) to the interfaces of,

+      the Work and Derivative Works thereof.

+

+      "Contribution" shall mean any work of authorship, including

+      the original version of the Work and any modifications or additions

+      to that Work or Derivative Works thereof, that is intentionally

+      submitted to Licensor for inclusion in the Work by the copyright owner

+      or by an individual or Legal Entity authorized to submit on behalf of

+      the copyright owner. For the purposes of this definition, "submitted"

+      means any form of electronic, verbal, or written communication sent

+      to the Licensor or its representatives, including but not limited to

+      communication on electronic mailing lists, source code control systems,

+      and issue tracking systems that are managed by, or on behalf of, the

+      Licensor for the purpose of discussing and improving the Work, but

+      excluding communication that is conspicuously marked or otherwise

+      designated in writing by the copyright owner as "Not a Contribution."

+

+      "Contributor" shall mean Licensor and any individual or Legal Entity

+      on behalf of whom a Contribution has been received by Licensor and

+      subsequently incorporated within the Work.

+

+   2. Grant of Copyright License. Subject to the terms and conditions of

+      this License, each Contributor hereby grants to You a perpetual,

+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable

+      copyright license to reproduce, prepare Derivative Works of,

+      publicly display, publicly perform, sublicense, and distribute the

+      Work and such Derivative Works in Source or Object form.

+

+   3. Grant of Patent License. Subject to the terms and conditions of

+      this License, each Contributor hereby grants to You a perpetual,

+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable

+      (except as stated in this section) patent license to make, have made,

+      use, offer to sell, sell, import, and otherwise transfer the Work,

+      where such license applies only to those patent claims licensable

+      by such Contributor that are necessarily infringed by their

+      Contribution(s) alone or by combination of their Contribution(s)

+      with the Work to which such Contribution(s) was submitted. If You

+      institute patent litigation against any entity (including a

+      cross-claim or counterclaim in a lawsuit) alleging that the Work

+      or a Contribution incorporated within the Work constitutes direct

+      or contributory patent infringement, then any patent licenses

+      granted to You under this License for that Work shall terminate

+      as of the date such litigation is filed.

+

+   4. Redistribution. You may reproduce and distribute copies of the

+      Work or Derivative Works thereof in any medium, with or without

+      modifications, and in Source or Object form, provided that You

+      meet the following conditions:

+

+      (a) You must give any other recipients of the Work or

+          Derivative Works a copy of this License; and

+

+      (b) You must cause any modified files to carry prominent notices

+          stating that You changed the files; and

+

+      (c) You must retain, in the Source form of any Derivative Works

+          that You distribute, all copyright, patent, trademark, and

+          attribution notices from the Source form of the Work,

+          excluding those notices that do not pertain to any part of

+          the Derivative Works; and

+

+      (d) If the Work includes a "NOTICE" text file as part of its

+          distribution, then any Derivative Works that You distribute must

+          include a readable copy of the attribution notices contained

+          within such NOTICE file, excluding those notices that do not

+          pertain to any part of the Derivative Works, in at least one

+          of the following places: within a NOTICE text file distributed

+          as part of the Derivative Works; within the Source form or

+          documentation, if provided along with the Derivative Works; or,

+          within a display generated by the Derivative Works, if and

+          wherever such third-party notices normally appear. The contents

+          of the NOTICE file are for informational purposes only and

+          do not modify the License. You may add Your own attribution

+          notices within Derivative Works that You distribute, alongside

+          or as an addendum to the NOTICE text from the Work, provided

+          that such additional attribution notices cannot be construed

+          as modifying the License.

+

+      You may add Your own copyright statement to Your modifications and

+      may provide additional or different license terms and conditions

+      for use, reproduction, or distribution of Your modifications, or

+      for any such Derivative Works as a whole, provided Your use,

+      reproduction, and distribution of the Work otherwise complies with

+      the conditions stated in this License.

+

+   5. Submission of Contributions. Unless You explicitly state otherwise,

+      any Contribution intentionally submitted for inclusion in the Work

+      by You to the Licensor shall be under the terms and conditions of

+      this License, without any additional terms or conditions.

+      Notwithstanding the above, nothing herein shall supersede or modify

+      the terms of any separate license agreement you may have executed

+      with Licensor regarding such Contributions.

+

+   6. Trademarks. This License does not grant permission to use the trade

+      names, trademarks, service marks, or product names of the Licensor,

+      except as required for reasonable and customary use in describing the

+      origin of the Work and reproducing the content of the NOTICE file.

+

+   7. Disclaimer of Warranty. Unless required by applicable law or

+      agreed to in writing, Licensor provides the Work (and each

+      Contributor provides its Contributions) on an "AS IS" BASIS,

+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or

+      implied, including, without limitation, any warranties or conditions

+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A

+      PARTICULAR PURPOSE. You are solely responsible for determining the

+      appropriateness of using or redistributing the Work and assume any

+      risks associated with Your exercise of permissions under this License.

+

+   8. Limitation of Liability. In no event and under no legal theory,

+      whether in tort (including negligence), contract, or otherwise,

+      unless required by applicable law (such as deliberate and grossly

+      negligent acts) or agreed to in writing, shall any Contributor be

+      liable to You for damages, including any direct, indirect, special,

+      incidental, or consequential damages of any character arising as a

+      result of this License or out of the use or inability to use the

+      Work (including but not limited to damages for loss of goodwill,

+      work stoppage, computer failure or malfunction, or any and all

+      other commercial damages or losses), even if such Contributor

+      has been advised of the possibility of such damages.

+

+   9. Accepting Warranty or Additional Liability. While redistributing

+      the Work or Derivative Works thereof, You may choose to offer,

+      and charge a fee for, acceptance of support, warranty, indemnity,

+      or other liability obligations and/or rights consistent with this

+      License. However, in accepting such obligations, You may act only

+      on Your own behalf and on Your sole responsibility, not on behalf

+      of any other Contributor, and only if You agree to indemnify,

+      defend, and hold each Contributor harmless for any liability

+      incurred by, or claims asserted against, such Contributor by reason

+      of your accepting any such warranty or additional liability.

+

+   END OF TERMS AND CONDITIONS

+

+   APPENDIX: How to apply the Apache License to your work.

+

+      To apply the Apache License to your work, attach the following

+      boilerplate notice, with the fields enclosed by brackets "[]"

+      replaced with your own identifying information. (Don't include

+      the brackets!)  The text should be enclosed in the appropriate

+      comment syntax for the file format. We also recommend that a

+      file or class name and description of purpose be included on the

+      same "printed page" as the copyright notice for easier

+      identification within third-party archives.

+

+   Copyright [yyyy] [name of copyright owner]

+

+   Licensed 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.

diff --git a/webconsole-plugins/ds/NOTICE b/webconsole-plugins/ds/NOTICE
new file mode 100644
index 0000000..3a3923a
--- /dev/null
+++ b/webconsole-plugins/ds/NOTICE
@@ -0,0 +1,21 @@
+Apache Felix OSGi Web Console Event Plugin

+Copyright 2007-2010 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.

+

+

+II. Used Software

+

+This product uses software developed at

+The OSGi Alliance (http://www.osgi.org/).

+Copyright (c) OSGi Alliance (2000, 2009).

+Licensed under the Apache License 2.0.

+

+

+III. License Summary

+- Apache License 2.0

diff --git a/webconsole-plugins/ds/pom.xml b/webconsole-plugins/ds/pom.xml
new file mode 100644
index 0000000..f407162
--- /dev/null
+++ b/webconsole-plugins/ds/pom.xml
@@ -0,0 +1,114 @@
+<!-- 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. -->

+<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/maven-v4_0_0.xsd">

+

+	<modelVersion>4.0.0</modelVersion>

+	<parent>

+		<groupId>org.apache.felix</groupId>

+		<artifactId>felix-parent</artifactId>

+		<version>1.2.0</version>

+		<relativePath>../../../pom/pom.xml</relativePath>

+	</parent>

+

+	<artifactId>org.apache.felix.webconsole.plugins.ds</artifactId>

+	<packaging>bundle</packaging>

+	<version>1.0.0-SNAPSHOT</version>

+

+	<name>Apache Felix Web Console Service Component Runtime/Declarative Services Plugin</name>

+	<description>

+        This is a plugin for the Apache Felix OSGi web console for displaying Service Components/Declarative Services.

+    </description>

+

+	<scm>

+		<connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/webconsole-plugins/ds</connection>

+		<developerConnection>scm:svn:https://svn.apache.org/repos/asf/felix/trunk/webconsole-plugins/ds</developerConnection>

+		<url>http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/ds</url>

+	</scm>

+

+	<build>

+		<plugins>

+			<!-- translate UTF-8 encoded properties files to ISO-8859-1 -->

+			<plugin>

+				<groupId>org.codehaus.mojo</groupId>

+				<artifactId>native2ascii-maven-plugin</artifactId>

+				<version>1.0-alpha-1</version>

+				<executions>

+					<execution>

+						<goals>

+							<goal>native2ascii</goal>

+						</goals>

+						<configuration>

+							<encoding>UTF-8</encoding>

+						</configuration>

+					</execution>

+				</executions>

+			</plugin>

+

+			<plugin>

+				<groupId>org.apache.felix</groupId>

+				<artifactId>maven-bundle-plugin</artifactId>

+				<version>2.0.1</version>

+				<extensions>true</extensions>

+				<configuration>

+					<instructions>

+						<Bundle-SymbolicName>

+							${artifactId}

+                        </Bundle-SymbolicName>

+						<Bundle-Activator>

+							org.apache.felix.webconsole.plugins.ds.internal.Activator

+                        </Bundle-Activator>

+					</instructions>

+				</configuration>

+			</plugin>

+		</plugins>

+	</build>

+

+	<dependencies>

+		<dependency>

+			<groupId>javax.servlet</groupId>

+			<artifactId>servlet-api</artifactId>

+			<version>2.4</version>

+			<scope>provided</scope>

+		</dependency>

+		<dependency>

+			<groupId>org.osgi</groupId>

+			<artifactId>org.osgi.core</artifactId>

+			<version>4.0.0</version>

+			<scope>provided</scope>

+		</dependency>

+		<dependency>

+			<groupId>org.osgi</groupId>

+			<artifactId>org.osgi.compendium</artifactId>

+			<version>4.1.0</version>

+			<scope>provided</scope>

+		</dependency>

+		<dependency>

+			<groupId>org.apache.felix</groupId>

+			<artifactId>org.apache.felix.webconsole</artifactId>

+			<version>3.1.0</version>

+			<scope>provided</scope>

+		</dependency>

+		<dependency>

+			<groupId>org.json</groupId>

+			<artifactId>json</artifactId>

+			<version>20070829</version>

+			<scope>compile</scope>

+			<optional>true</optional>

+		</dependency>

+		<dependency>

+			<groupId>org.apache.felix</groupId>

+			<artifactId>org.apache.felix.scr</artifactId>

+			<version>1.6.0</version>

+			<scope>provided</scope>

+		</dependency>

+	</dependencies>

+</project>

diff --git a/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/Activator.java b/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/Activator.java
new file mode 100644
index 0000000..ae665c9
--- /dev/null
+++ b/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/Activator.java
@@ -0,0 +1,110 @@
+/*

+ * 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.webconsole.plugins.ds.internal;

+

+import org.apache.felix.webconsole.ConfigurationPrinter;

+import org.apache.felix.webconsole.SimpleWebConsolePlugin;

+import org.osgi.framework.BundleActivator;

+import org.osgi.framework.BundleContext;

+import org.osgi.framework.ServiceReference;

+import org.osgi.framework.ServiceRegistration;

+import org.osgi.util.tracker.ServiceTracker;

+import org.osgi.util.tracker.ServiceTrackerCustomizer;

+

+/**

+ * Activator is the main starting class.

+ */

+public class Activator implements BundleActivator, ServiceTrackerCustomizer

+{

+

+    private ServiceTracker tracker;

+    private BundleContext context;

+

+    private SimpleWebConsolePlugin plugin;

+    private ServiceRegistration printerRegistration;

+

+    /**

+     * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)

+     */

+    public final void start(BundleContext context) throws Exception

+    {

+        this.context = context;

+        this.tracker = new ServiceTracker(context, WebConsolePlugin.SCR_SERVICE, this);

+        this.tracker.open();

+    }

+

+    /**

+     * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)

+     */

+    public final void stop(BundleContext context) throws Exception

+    {

+        if (tracker != null)

+        {

+            tracker.close();

+            tracker = null;

+        }

+    }

+

+    // - begin tracker

+    /**

+     * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference,

+     *      java.lang.Object)

+     */

+    public final void modifiedService(ServiceReference reference, Object service)

+    {/* unused */

+    }

+

+    /**

+     * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference)

+     */

+    public final Object addingService(ServiceReference reference)

+    {

+        SimpleWebConsolePlugin plugin = this.plugin;

+        if (plugin == null)

+        {

+            this.plugin = plugin = new WebConsolePlugin().register(context);

+            printerRegistration = context.registerService(ConfigurationPrinter.SERVICE,

+                new ComponentConfigurationPrinter(context.getService(reference)), null);

+        }

+

+        return context.getService(reference);

+    }

+

+    /**

+     * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference,

+     *      java.lang.Object)

+     */

+    public final void removedService(ServiceReference reference, Object service)

+    {

+        SimpleWebConsolePlugin plugin = this.plugin;

+

+        if (tracker.getTrackingCount() == 0 && plugin != null)

+        {

+            // remove service

+            plugin.unregister();

+            this.plugin = null;

+            // unregister configuration printer too

+            ServiceRegistration reg = printerRegistration;

+            if (reg != null)

+            {

+                reg.unregister();

+                printerRegistration = null;

+            }

+        }

+

+    }

+}

diff --git a/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ComponentConfigurationPrinter.java b/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ComponentConfigurationPrinter.java
new file mode 100644
index 0000000..8c85813
--- /dev/null
+++ b/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ComponentConfigurationPrinter.java
@@ -0,0 +1,245 @@
+/*
+ * 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.webconsole.plugins.ds.internal;
+
+import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.Dictionary;
+import java.util.Iterator;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import org.apache.felix.scr.Component;
+import org.apache.felix.scr.Reference;
+import org.apache.felix.scr.ScrService;
+import org.apache.felix.webconsole.ConfigurationPrinter;
+import org.apache.felix.webconsole.WebConsoleUtil;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.component.ComponentConstants;
+
+/**
+ * ComponentConfigurationPrinter prints the available SCR services. 
+ */
+class ComponentConfigurationPrinter implements ConfigurationPrinter
+{
+
+    private final ScrService scrService;
+
+    ComponentConfigurationPrinter(Object scrService)
+    {
+        this.scrService = (ScrService)scrService;
+    }
+
+    /**
+     * @see org.apache.felix.webconsole.ConfigurationPrinter#getTitle()
+     */
+    public String getTitle()
+    {
+        return "Declarative Services Components";
+    }
+
+    /**
+     * @see org.apache.felix.webconsole.ConfigurationPrinter#printConfiguration(java.io.PrintWriter)
+     */
+    public void printConfiguration(PrintWriter pw)
+    {
+        printComponents(pw, scrService.getComponents());
+    }
+
+    private static final void printComponents(final PrintWriter pw,
+        final Component[] components)
+    {
+        if (components == null || components.length == 0)
+        {
+            pw.println("  No Components Registered");
+        }
+        else
+        {
+            // order components by id
+            TreeMap componentMap = new TreeMap();
+            for (int i = 0; i < components.length; i++)
+            {
+                Component component = components[i];
+                componentMap.put(new Long(component.getId()), component);
+            }
+
+            // render components
+            for (Iterator ci = componentMap.values().iterator(); ci.hasNext();)
+            {
+                Component component = (Component) ci.next();
+                component(pw, component);
+            }
+        }
+    }
+
+    private static final void component(PrintWriter pw, Component component)
+    {
+
+        pw.print(component.getId());
+        pw.print("=[");
+        pw.print(component.getName());
+        pw.println("]");
+
+        pw.println("  Bundle" + component.getBundle().getSymbolicName() + " ("
+            + component.getBundle().getBundleId() + ")");
+        pw.println("  State=" + toStateString(component.getState()));
+        pw.println("  DefaultState="
+            + (component.isDefaultEnabled() ? "enabled" : "disabled"));
+        pw.println("  Activation=" + (component.isImmediate() ? "immediate" : "delayed"));
+
+        listServices(pw, component);
+        listReferences(pw, component);
+        listProperties(pw, component);
+
+        pw.println();
+    }
+
+    private static void listServices(PrintWriter pw, Component component)
+    {
+        String[] services = component.getServices();
+        if (services == null)
+        {
+            return;
+        }
+
+        pw.println("  ServiceType="
+            + (component.isServiceFactory() ? "service factory" : "service"));
+
+        StringBuffer buf = new StringBuffer();
+        for (int i = 0; i < services.length; i++)
+        {
+            if (i > 0)
+            {
+                buf.append(", ");
+            }
+            buf.append(services[i]);
+        }
+
+        pw.println("  Services=" + buf);
+    }
+
+    private static final void listReferences(PrintWriter pw, Component component)
+    {
+        Reference[] refs = component.getReferences();
+        if (refs != null)
+        {
+            for (int i = 0; i < refs.length; i++)
+            {
+
+                pw.println("  Reference=" + refs[i].getName() + ", "
+                    + (refs[i].isSatisfied() ? "Satisfied" : "Unsatisfied"));
+
+                pw.println("    Service Name: " + refs[i].getServiceName());
+
+                if (refs[i].getTarget() != null)
+                {
+                    pw.println("  Target Filter: " + refs[i].getTarget());
+                }
+
+                pw.println("    Multiple: "
+                    + (refs[i].isMultiple() ? "multiple" : "single"));
+                pw.println("    Optional: "
+                    + (refs[i].isOptional() ? "optional" : "mandatory"));
+                pw.println("    Policy: " + (refs[i].isStatic() ? "static" : "dynamic"));
+
+                // list bound services
+                ServiceReference[] boundRefs = refs[i].getServiceReferences();
+                if (boundRefs != null && boundRefs.length > 0)
+                {
+                    for (int j = 0; j < boundRefs.length; j++)
+                    {
+                        pw.print("    Bound Service: ID ");
+                        pw.print(boundRefs[j].getProperty(Constants.SERVICE_ID));
+
+                        String name = (String) boundRefs[j].getProperty(ComponentConstants.COMPONENT_NAME);
+                        if (name == null)
+                        {
+                            name = (String) boundRefs[j].getProperty(Constants.SERVICE_PID);
+                            if (name == null)
+                            {
+                                name = (String) boundRefs[j].getProperty(Constants.SERVICE_DESCRIPTION);
+                            }
+                        }
+                        if (name != null)
+                        {
+                            pw.print(" (");
+                            pw.print(name);
+                            pw.print(")");
+                        }
+                        pw.println();
+                    }
+                }
+                else
+                {
+                    pw.println("    No Services bound");
+                }
+            }
+        }
+    }
+
+    private static final void listProperties(PrintWriter pw, Component component)
+    {
+        Dictionary props = component.getProperties();
+        if (props != null)
+        {
+
+            pw.println("  Properties=");
+            TreeSet keys = new TreeSet(Util.list(props.keys()));
+            for (Iterator ki = keys.iterator(); ki.hasNext();)
+            {
+                String key = (String) ki.next();
+                Object value = props.get(key);
+                value = WebConsoleUtil.toString(value);
+                if (value.getClass().isArray())
+                {
+                    value = Arrays.asList((Object[]) value);
+                }
+                pw.println("    " + key + "=" + value);
+            }
+        }
+    }
+
+    static final String toStateString(int state)
+    {
+        switch (state)
+        {
+            case Component.STATE_DISABLED:
+                return "disabled";
+            case Component.STATE_ENABLED:
+                return "enabled";
+            case Component.STATE_UNSATISFIED:
+                return "unsatisfied";
+            case Component.STATE_ACTIVATING:
+                return "activating";
+            case Component.STATE_ACTIVE:
+                return "active";
+            case Component.STATE_REGISTERED:
+                return "registered";
+            case Component.STATE_FACTORY:
+                return "factory";
+            case Component.STATE_DEACTIVATING:
+                return "deactivating";
+            case Component.STATE_DESTROYED:
+                return "destroyed";
+            default:
+                return String.valueOf(state);
+        }
+    }
+}
diff --git a/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/Util.java b/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/Util.java
new file mode 100644
index 0000000..8e96845
--- /dev/null
+++ b/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/Util.java
@@ -0,0 +1,66 @@
+/*

+ * 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.webconsole.plugins.ds.internal;

+

+import java.util.ArrayList;

+import java.util.Comparator;

+import java.util.Enumeration;

+

+import org.apache.felix.scr.Component;

+

+class Util

+{

+

+    static final Comparator COMPONENT_COMPARATOR = new Comparator()

+    {

+        public int compare(Object o0, Object o1)

+        {

+            final Component c0 = (Component) o0;

+            final Component c1 = (Component) o1;

+            final int nameCmp = c0.getName().compareTo(c1.getName());

+            if (nameCmp != 0)

+            {

+                return nameCmp;

+            }

+            return (c0.getId() < c1.getId()) ? -1 : ((c0.getId() > c1.getId()) ? 1 : 0);

+        }

+    };

+

+    private Util()

+    {

+        // prevent instantiation

+    }

+

+    /**

+     * This method is the same as Collections#list(Enumeration). The reason to

+     * duplicate it here, is that it is missing in OSGi/Minimum execution

+     * environment.

+     *

+     * @param e the enumeration which to convert

+     * @return the list containing all enumeration entries.

+     */

+    public static final ArrayList list(Enumeration e)

+    {

+        ArrayList l = new ArrayList();

+        while (e.hasMoreElements())

+        {

+            l.add(e.nextElement());

+        }

+        return l;

+    }

+

+}

diff --git a/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/WebConsolePlugin.java b/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/WebConsolePlugin.java
new file mode 100644
index 0000000..4af5c48
--- /dev/null
+++ b/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/WebConsolePlugin.java
@@ -0,0 +1,620 @@
+/*
+ * 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.webconsole.plugins.ds.internal;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Arrays;
+import java.util.Dictionary;
+import java.util.Iterator;
+import java.util.TreeSet;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.felix.scr.Component;
+import org.apache.felix.scr.Reference;
+import org.apache.felix.scr.ScrService;
+import org.apache.felix.webconsole.DefaultVariableResolver;
+import org.apache.felix.webconsole.SimpleWebConsolePlugin;
+import org.apache.felix.webconsole.WebConsoleUtil;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.Configuration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.component.ComponentConstants;
+import org.osgi.service.metatype.MetaTypeInformation;
+import org.osgi.service.metatype.MetaTypeService;
+
+/**
+ * ComponentsServlet provides a plugin for managing Service Components Runtime.
+ */
+class WebConsolePlugin extends SimpleWebConsolePlugin
+{
+
+    private static final long serialVersionUID = 1L;
+
+    private static final String LABEL = "components"; //$NON-NLS-1$
+    private static final String TITLE = "%components.pluginTitle"; //$NON-NLS-1$
+    private static final String CSS[] = { "/res/ui/bundles.css" }; // yes, it's correct! //$NON-NLS-1$
+    private static final String RES = "/" + LABEL + "/res/"; //$NON-NLS-1$ //$NON-NLS-2$
+
+    // actions
+    private static final String OPERATION = "action"; //$NON-NLS-1$
+    private static final String OPERATION_ENABLE = "enable"; //$NON-NLS-1$
+    private static final String OPERATION_DISABLE = "disable"; //$NON-NLS-1$
+    //private static final String OPERATION_CONFIGURE = "configure";
+
+    // needed services
+    static final String SCR_SERVICE = "org.apache.felix.scr.ScrService"; //$NON-NLS-1$
+    private static final String META_TYPE_NAME = "org.osgi.service.metatype.MetaTypeService"; //$NON-NLS-1$
+    private static final String CONFIGURATION_ADMIN_NAME = "org.osgi.service.cm.ConfigurationAdmin"; //$NON-NLS-1$
+
+    // templates
+    private final String TEMPLATE;
+
+    /** Default constructor */
+    WebConsolePlugin()
+    {
+        super(LABEL, TITLE, CSS);
+
+        // load templates
+        TEMPLATE = readTemplateFile("/res/plugin.html"); //$NON-NLS-1$
+    }
+
+    /**
+     * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+     */
+    protected void doPost(HttpServletRequest request, HttpServletResponse response)
+        throws IOException
+    {
+        final RequestInfo reqInfo = new RequestInfo(request);
+        if (reqInfo.component == null && reqInfo.componentRequested)
+        {
+            response.sendError(404);
+            return;
+        }
+        if (!reqInfo.componentRequested)
+        {
+            response.sendError(500);
+            return;
+        }
+        String op = request.getParameter(OPERATION);
+        if (OPERATION_ENABLE.equals(op))
+        {
+            reqInfo.component.enable();
+        }
+        else if (OPERATION_DISABLE.equals(op))
+        {
+            reqInfo.component.disable();
+        }
+
+        final PrintWriter pw = response.getWriter();
+        response.setContentType("application/json"); //$NON-NLS-1$
+        response.setCharacterEncoding("UTF-8"); //$NON-NLS-1$
+        renderResult(pw, null);
+    }
+
+    /**
+     * @see org.apache.felix.webconsole.AbstractWebConsolePlugin#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+     */
+    protected void doGet(HttpServletRequest request, HttpServletResponse response)
+        throws ServletException, IOException
+    {
+        String path = request.getPathInfo();
+        // don't process if this is request to load a resource
+        if (!path.startsWith(RES))
+        {
+            final RequestInfo reqInfo = new RequestInfo(request);
+            if (reqInfo.component == null && reqInfo.componentRequested)
+            {
+                response.sendError(404);
+                return;
+            }
+            if (reqInfo.extension.equals("json")) //$NON-NLS-1$
+            {
+                response.setContentType("application/json"); //$NON-NLS-1$
+                response.setCharacterEncoding("UTF-8"); //$NON-NLS-1$
+
+                this.renderResult(response.getWriter(), reqInfo.component);
+
+                // nothing more to do
+                return;
+            }
+        }
+        super.doGet(request, response);
+    }
+
+    /**
+     * @see org.apache.felix.webconsole.AbstractWebConsolePlugin#renderContent(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+     */
+    protected void renderContent(HttpServletRequest request, HttpServletResponse response)
+        throws IOException
+    {
+        // get request info from request attribute
+        final RequestInfo reqInfo = getRequestInfo(request);
+
+        StringWriter w = new StringWriter();
+        PrintWriter w2 = new PrintWriter(w);
+        renderResult(w2, reqInfo.component);
+
+        // prepare variables
+        DefaultVariableResolver vars = ((DefaultVariableResolver) WebConsoleUtil.getVariableResolver(request));
+        vars.put("__drawDetails__", reqInfo.componentRequested ? Boolean.TRUE : Boolean.FALSE); //$NON-NLS-1$
+        vars.put("__data__", w.toString()); //$NON-NLS-1$
+
+        response.getWriter().print(TEMPLATE);
+
+    }
+
+    private void renderResult(final PrintWriter pw, final Component component)
+        throws IOException
+    {
+        final JSONWriter jw = new JSONWriter(pw);
+        try
+        {
+            jw.object();
+
+            final ScrService scrService = getScrService();
+            if (scrService == null)
+            {
+                jw.key("status"); //$NON-NLS-1$
+                jw.value(-1);
+            }
+            else
+            {
+                final Component[] components = scrService.getComponents();
+
+                if (components == null || components.length == 0)
+                {
+                    jw.key("status"); //$NON-NLS-1$
+                    jw.value(0);
+                }
+                else
+                {
+                    // order components by name
+                    sortComponents(components);
+
+                    final StringBuffer buffer = new StringBuffer();
+                    buffer.append(components.length);
+                    buffer.append(" component"); //$NON-NLS-1$
+                    if (components.length != 1)
+                    {
+                        buffer.append('s');
+                    }
+                    buffer.append(" installed."); //$NON-NLS-1$
+                    jw.key("status"); //$NON-NLS-1$
+                    jw.value(components.length);
+
+                    // render components
+                    jw.key("data"); //$NON-NLS-1$
+                    jw.array();
+                    if (component != null)
+                    {
+                        component(jw, component, true);
+                    }
+                    else
+                    {
+                        for (int i = 0; i < components.length; i++)
+                        {
+                            component(jw, components[i], false);
+                        }
+                    }
+                    jw.endArray();
+                }
+            }
+
+            jw.endObject();
+        }
+        catch (JSONException je)
+        {
+            throw new IOException(je.toString());
+        }
+    }
+
+    private void sortComponents(Component[] components)
+    {
+        Arrays.sort(components, Util.COMPONENT_COMPARATOR);
+    }
+
+    private void component(JSONWriter jw, Component component, boolean details)
+        throws JSONException
+    {
+        String id = String.valueOf(component.getId());
+        String name = component.getName();
+        int state = component.getState();
+
+        jw.object();
+
+        // component information
+        jw.key("id"); //$NON-NLS-1$
+        jw.value(id);
+        jw.key("name"); //$NON-NLS-1$
+        jw.value(name);
+        jw.key("state"); //$NON-NLS-1$
+        jw.value(ComponentConfigurationPrinter.toStateString(state));
+        jw.key("stateRaw"); //$NON-NLS-1$
+        jw.value(state);
+
+        final Dictionary props = component.getProperties();
+
+        final String pid = (String) (props != null ? props.get(Constants.SERVICE_PID)
+            : null);
+        if (pid != null)
+        {
+            jw.key("pid"); //$NON-NLS-1$
+            jw.value(pid);
+            if (isConfigurable(component.getBundle(), pid))
+            {
+                jw.key("configurable"); //$NON-NLS-1$
+                jw.value(pid);
+            }
+        }
+
+        // component details
+        if (details)
+        {
+            gatherComponentDetails(jw, component);
+        }
+
+        jw.endObject();
+    }
+
+    private void gatherComponentDetails(JSONWriter jw, Component component)
+        throws JSONException
+    {
+        jw.key("props"); //$NON-NLS-1$
+        jw.array();
+
+        keyVal(jw, "Bundle", component.getBundle().getSymbolicName() + " ("
+            + component.getBundle().getBundleId() + ")");
+        keyVal(jw, "Implementation Class", component.getClassName());
+        if (component.getFactory() != null)
+        {
+            keyVal(jw, "Component Factory Name", component.getFactory());
+        }
+        keyVal(jw, "Default State", component.isDefaultEnabled() ? "enabled" : "disabled");
+        keyVal(jw, "Activation", component.isImmediate() ? "immediate" : "delayed");
+
+        try
+        {
+            keyVal(jw, "Configuration Policy", component.getConfigurationPolicy());
+        }
+        catch (Throwable t)
+        {
+            // missing implementation of said method in the actually bound API
+            // ignore this and just don't display the information
+        }
+
+        listServices(jw, component);
+        listReferences(jw, component);
+        listProperties(jw, component);
+
+        jw.endArray();
+    }
+
+    private void listServices(JSONWriter jw, Component component)
+    {
+        String[] services = component.getServices();
+        if (services == null)
+        {
+            return;
+        }
+
+        keyVal(jw, "Service Type", component.isServiceFactory() ? "service factory"
+            : "service");
+
+        JSONArray buf = new JSONArray();
+        for (int i = 0; i < services.length; i++)
+        {
+            buf.put(services[i]);
+        }
+
+        keyVal(jw, "Services", buf);
+    }
+
+    private void listReferences(JSONWriter jw, Component component)
+    {
+        Reference[] refs = component.getReferences();
+        if (refs != null)
+        {
+            for (int i = 0; i < refs.length; i++)
+            {
+                JSONArray buf = new JSONArray();
+                buf.put(refs[i].isSatisfied() ? "Satisfied" : "Unsatisfied");
+                buf.put("Service Name: " + refs[i].getServiceName());
+                if (refs[i].getTarget() != null)
+                {
+                    buf.put("Target Filter: " + refs[i].getTarget());
+                }
+                buf.put("Multiple: " + (refs[i].isMultiple() ? "multiple" : "single"));
+                buf.put("Optional: " + (refs[i].isOptional() ? "optional" : "mandatory"));
+                buf.put("Policy: " + (refs[i].isStatic() ? "static" : "dynamic"));
+
+                // list bound services
+                ServiceReference[] boundRefs = refs[i].getServiceReferences();
+                if (boundRefs != null && boundRefs.length > 0)
+                {
+                    for (int j = 0; j < boundRefs.length; j++)
+                    {
+                        final StringBuffer b = new StringBuffer();
+                        b.append("Bound Service ID ");
+                        b.append(boundRefs[j].getProperty(Constants.SERVICE_ID));
+
+                        String name = (String) boundRefs[j].getProperty(ComponentConstants.COMPONENT_NAME);
+                        if (name == null)
+                        {
+                            name = (String) boundRefs[j].getProperty(Constants.SERVICE_PID);
+                            if (name == null)
+                            {
+                                name = (String) boundRefs[j].getProperty(Constants.SERVICE_DESCRIPTION);
+                            }
+                        }
+                        if (name != null)
+                        {
+                            b.append(" (");
+                            b.append(name);
+                            b.append(")");
+                        }
+                        buf.put(b.toString());
+                    }
+                }
+                else
+                {
+                    buf.put("No Services bound");
+                }
+
+                keyVal(jw, "Reference " + refs[i].getName(), buf.toString());
+            }
+        }
+    }
+
+    private void listProperties(JSONWriter jw, Component component)
+    {
+        Dictionary props = component.getProperties();
+        if (props != null)
+        {
+            JSONArray buf = new JSONArray();
+            TreeSet keys = new TreeSet(Util.list(props.keys()));
+            for (Iterator ki = keys.iterator(); ki.hasNext();)
+            {
+                final String key = (String) ki.next();
+                final StringBuffer b = new StringBuffer();
+                b.append(key).append(" = ");
+
+                Object prop = props.get(key);
+                prop = WebConsoleUtil.toString(prop);
+                b.append(prop);
+                buf.put(b.toString());
+            }
+
+            keyVal(jw, "Properties", buf);
+        }
+
+    }
+
+    private void keyVal(JSONWriter jw, String key, Object value)
+    {
+        try
+        {
+            WebConsoleUtil.keyVal(jw, key, value);
+        }
+        catch (JSONException je)
+        {
+            // don't care
+        }
+    }
+
+    /**
+     * Check if the component with the specified pid is
+     * configurable
+     * @param providingBundle The Bundle providing the component. This may be
+     *      theoretically be <code>null</code>.
+     * @param pid A non null pid
+     * @return <code>true</code> if the component is configurable.
+     */
+    private boolean isConfigurable(final Bundle providingBundle, final String pid)
+    {
+        // we first check if the config admin has something for this pid
+        final ConfigurationAdmin ca = this.getConfigurationAdmin();
+        if (ca != null)
+        {
+            try
+            {
+                // we use listConfigurations to not create configuration
+                // objects persistently without the user providing actual
+                // configuration
+                String filter = '(' + Constants.SERVICE_PID + '=' + pid + ')';
+                Configuration[] configs = ca.listConfigurations(filter);
+                if (configs != null && configs.length > 0)
+                {
+                    return true;
+                }
+            }
+            catch (InvalidSyntaxException ise)
+            {
+                // should print message
+            }
+            catch (IOException ioe)
+            {
+                // should print message
+            }
+        }
+        // second check is using the meta type service
+        if (providingBundle != null)
+        {
+            final MetaTypeService mts = this.getMetaTypeService();
+            if (mts != null)
+            {
+                final MetaTypeInformation mti = mts.getMetaTypeInformation(providingBundle);
+                if (mti != null)
+                {
+                    return mti.getObjectClassDefinition(pid, null) != null;
+                }
+            }
+        }
+        return false;
+    }
+
+    private final ConfigurationAdmin getConfigurationAdmin()
+    {
+        return (ConfigurationAdmin) getService(CONFIGURATION_ADMIN_NAME);
+    }
+
+    final ScrService getScrService()
+    {
+        return (ScrService) getService(SCR_SERVICE);
+    }
+
+    private final MetaTypeService getMetaTypeService()
+    {
+        return (MetaTypeService) getService(META_TYPE_NAME);
+    }
+
+    private final class RequestInfo
+    {
+        public final String extension;
+        public final Component component;
+        public final boolean componentRequested;
+
+        protected RequestInfo(final HttpServletRequest request)
+        {
+            String info = request.getPathInfo();
+            // remove label and starting slash
+            info = info.substring(getLabel().length() + 1);
+
+            // get extension
+            if (info.endsWith(".json")) //$NON-NLS-1$
+            {
+                extension = "json"; //$NON-NLS-1$
+                info = info.substring(0, info.length() - 5);
+            }
+            else
+            {
+                extension = "html"; //$NON-NLS-1$
+            }
+
+            if (info.length() > 1 && info.startsWith("/")) //$NON-NLS-1$
+            {
+                this.componentRequested = true;
+                info = info.substring(1);
+                Component component = getComponentId(info);
+                if (component == null)
+                {
+                    component = getComponentByName(info);
+                }
+                this.component = component;
+            }
+            else
+            {
+                this.componentRequested = false;
+                this.component = null;
+            }
+
+            request.setAttribute(WebConsolePlugin.this.getClass().getName(), this);
+        }
+
+        protected Component getComponentId(final String componentIdPar)
+        {
+            final ScrService scrService = getScrService();
+            if (scrService != null)
+            {
+                try
+                {
+                    final long componentId = Long.parseLong(componentIdPar);
+                    return scrService.getComponent(componentId);
+                }
+                catch (NumberFormatException nfe)
+                {
+                    // don't care
+                }
+            }
+
+            return null;
+        }
+
+        protected Component getComponentByName(final String names)
+        {
+            if (names.length() > 0)
+            {
+                final ScrService scrService = getScrService();
+                if (scrService != null)
+                {
+
+                    final int slash = names.lastIndexOf('/');
+                    final String componentName;
+                    final String pid;
+                    if (slash > 0)
+                    {
+                        componentName = names.substring(0, slash);
+                        pid = names.substring(slash + 1);
+                    }
+                    else
+                    {
+                        componentName = names;
+                        pid = null;
+                    }
+
+                    Component[] components;
+                    try
+                    {
+                        components = scrService.getComponents(componentName);
+                    }
+                    catch (Throwable t)
+                    {
+                        // not implemented in the used API version
+                        components = null;
+                    }
+
+                    if (components != null)
+                    {
+                        if (pid != null)
+                        {
+                            for (int i = 0; i < components.length; i++)
+                            {
+                                Component component = components[i];
+                                if (pid.equals(component.getProperties().get(
+                                    Constants.SERVICE_PID)))
+                                {
+                                    return component;
+                                }
+                            }
+                        }
+                        else if (components.length > 0)
+                        {
+                            return components[0];
+                        }
+                    }
+                }
+            }
+
+            return null;
+        }
+    }
+
+    static RequestInfo getRequestInfo(final HttpServletRequest request)
+    {
+        return (RequestInfo) request.getAttribute(WebConsolePlugin.class.getName());
+    }
+}
diff --git a/webconsole-plugins/ds/src/main/native2ascii/OSGI-INF/l10n/bundle_bg.properties b/webconsole-plugins/ds/src/main/native2ascii/OSGI-INF/l10n/bundle_bg.properties
new file mode 100644
index 0000000..33732de
--- /dev/null
+++ b/webconsole-plugins/ds/src/main/native2ascii/OSGI-INF/l10n/bundle_bg.properties
@@ -0,0 +1,49 @@
+#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.

+

+#

+# Web Console strings for reference all strings here are commented.

+# This file may be used to produce a translation of the strings

+#

+# Note that properties files are ISO-8859-1 encoded. To provide translations

+# for languages requiring different character encodings, you may use the

+# native2ascii Maven Plugin from http://mojo.codehaus.org/native2ascii-maven-plugin/

+# to translate the natively encoded files to ISO-8859-1 during bundle build

+#

+# Translations requiring non-ISO-8859-1 encoding are placed in the

+# src/main/native2ascii/OSGI-INF/l10n folder and are converted using said

+# plugin while building the bundle

+# native2ascii -encoding utf-8 bundle_bg.raw_properties bundle_bg.properties

+

+# Components plugin

+components.pluginTitle=Компоненти

+scr.status.no_service=Declarative Service не е наличен!

+scr.status.no_components=Няма инсталирани компонент в момента!

+scr.status.ok=Брой инсталирани компоненти: {0}

+scr.action.enable=Enable

+scr.action.disable=Disable

+scr.action.configure=Конфигуриране

+scr.prop.bundle=Бъндъл

+scr.prop.defstate=Статус по подразбиране

+scr.prop.activation=Активация

+scr.prop.properties=Конфигурации

+scr.prop.class=Implementation Class

+scr.prop.componentfactory=Component Factory име

+scr.prop.configurationpolicy=Конфигурационна политика

+scr.serv.type=Тип на услугата

+scr.serv=Услуги

+scr.title.actions=Действия

+scr.title.status=Статус

+scr.title.name=Име

diff --git a/webconsole-plugins/ds/src/main/native2ascii/OSGI-INF/l10n/bundle_de.properties b/webconsole-plugins/ds/src/main/native2ascii/OSGI-INF/l10n/bundle_de.properties
new file mode 100644
index 0000000..4165c7a
--- /dev/null
+++ b/webconsole-plugins/ds/src/main/native2ascii/OSGI-INF/l10n/bundle_de.properties
@@ -0,0 +1,49 @@
+#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.

+

+#

+# Web Console strings for reference all strings here are commented.

+# This file may be used to produce a translation of the strings

+#

+# Note that properties files are ISO-8859-1 encoded. To provide translations

+# for languages requiring different character encodings, you may use the

+# native2ascii Maven Plugin from http://mojo.codehaus.org/native2ascii-maven-plugin/

+# to translate the natively encoded files to ISO-8859-1 during bundle build

+#

+# Translations requiring non-ISO-8859-1 encoding are placed in the

+# src/main/native2ascii/OSGI-INF/l10n folder and are converted using said

+# plugin while building the bundle

+#

+

+# Components plugin

+components.pluginTitle=Komponenten

+scr.status.no_service=Declarative Service ist Voraussetzung für diese Funktionalität!

+scr.status.no_components=Zur Zeit sind keine Komponenten installiert!

+scr.status.ok=Anzahl installierter Komponenten: {0}

+scr.action.enable=Aktivieren

+scr.action.disable=Deaktivieren

+scr.action.configure=Konfigurieren

+scr.prop.bundle=Bundle

+scr.prop.defstate=Default Status

+scr.prop.activation=Aktivierung

+scr.prop.properties=Eigenschaften

+scr.prop.class=Implementationsklasse

+scr.prop.componentfactory=Komponenten Factory Name

+scr.prop.configurationpolicy=Konfigurations Policy

+scr.serv.type=Dienst Typ

+scr.serv=Dienste

+scr.title.actions=Aktionen

+scr.title.status=Status

+scr.title.name=Name

diff --git a/webconsole-plugins/ds/src/main/native2ascii/OSGI-INF/l10n/bundle_ru.properties b/webconsole-plugins/ds/src/main/native2ascii/OSGI-INF/l10n/bundle_ru.properties
new file mode 100644
index 0000000..d10d52e
--- /dev/null
+++ b/webconsole-plugins/ds/src/main/native2ascii/OSGI-INF/l10n/bundle_ru.properties
@@ -0,0 +1,49 @@
+#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.
+
+#
+# Web Console strings for reference all strings here are commented.
+# This file may be used to produce a translation of the strings
+#
+# Note that properties files are ISO-8859-1 encoded. To provide translations
+# for languages requiring different character encodings, you may use the
+# native2ascii Maven Plugin from http://mojo.codehaus.org/native2ascii-maven-plugin/
+# to translate the natively encoded files to ISO-8859-1 during bundle build
+#
+# Translations requiring non-ISO-8859-1 encoding are placed in the
+# src/main/native2ascii/OSGI-INF/l10n folder and are converted using said
+# plugin while building the bundle
+#
+
+# Components plugin
+components.pluginTitle=Компоненты
+scr.status.no_service=Сервис Declarative Service не найден!
+scr.status.no_components=Нет установленных компонентов!
+scr.status.ok=Количество установленных компонентов: {0}
+scr.action.enable=Включить
+scr.action.disable=Выключить
+scr.action.configure=Конфигурировать
+scr.prop.bundle=Модуль
+scr.prop.defstate=Состояние по умолчанию
+scr.prop.activation=Активация
+scr.prop.properties=Конфигурации
+scr.prop.class=Класс реализации
+scr.prop.componentfactory=Имя фабрики компонентов
+scr.prop.configurationpolicy=Политика конфигурирования
+scr.serv.type=Тип сервиса
+scr.serv=Сервисы
+scr.title.actions=Действия
+scr.title.status=Состояние
+scr.title.name=Имя
diff --git a/webconsole-plugins/ds/src/main/resources/OSGI-INF/l10n/bundle.properties b/webconsole-plugins/ds/src/main/resources/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 0000000..d6518c6
--- /dev/null
+++ b/webconsole-plugins/ds/src/main/resources/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,49 @@
+#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.

+

+#

+# Web Console strings for reference all strings here are commented.

+# This file may be used to produce a translation of the strings

+#

+# Note that properties files are ISO-8859-1 encoded. To provide translations

+# for languages requiring different character encodings, you may use the

+# native2ascii Maven Plugin from http://mojo.codehaus.org/native2ascii-maven-plugin/

+# to translate the natively encoded files to ISO-8859-1 during bundle build

+#

+# Translations requiring non-ISO-8859-1 encoding are placed in the

+# src/main/native2ascii/OSGI-INF/l10n folder and are converted using said

+# plugin while building the bundle

+#

+

+# Components plugin

+components.pluginTitle=Components

+scr.status.no_service=Declarative Service required for this function!

+scr.status.no_components=No components installed currently!

+scr.status.ok=Number of installed components: {0}

+scr.action.enable=Enable

+scr.action.disable=Disable

+scr.action.configure=Configure

+scr.prop.bundle=Bundle

+scr.prop.defstate=Default State

+scr.prop.activation=Activation

+scr.prop.properties=Properties

+scr.prop.class=Implementation Class

+scr.prop.componentfactory=Component Factory Name

+scr.prop.configurationpolicy=Configuration Policy

+scr.serv.type=Service Type

+scr.serv=Services

+scr.title.actions=Actions

+scr.title.status=Status

+scr.title.name=Name

diff --git a/webconsole-plugins/ds/src/main/resources/res/plugin.html b/webconsole-plugins/ds/src/main/resources/res/plugin.html
new file mode 100644
index 0000000..fa0f8c1
--- /dev/null
+++ b/webconsole-plugins/ds/src/main/resources/res/plugin.html
@@ -0,0 +1,67 @@
+<script type="text/javascript" src="${pluginRoot}/res/plugin.js"></script>

+<script type="text/javascript">

+// <![CDATA[

+var drawDetails = ${__drawDetails__};

+var scrData = ${__data__};

+// i18n

+var i18n = {

+	'Bundle'                 : '${scr.prop.bundle}',

+	'Default State'          : '${scr.prop.defstate}',

+	'Activation'             : '${scr.prop.activation}',

+	'Service Type'           : '${scr.serv.type}',

+	'Services'               : '${scr.serv}',

+	'Properties'             : '${scr.prop.properties}',

+	'Implementation Class'   : '${scr.prop.class}',

+	'Component Factory Name' : '${scr.prop.componentfactory}',

+	'Configuration Policy'   : '${scr.prop.configurationpolicy}',

+	stat_no_service          : "${scr.status.no_service}",

+	stat_no_components       : "${scr.status.no_components}",

+	stat_ok                  : "${scr.status.ok}"

+}

+// ]]>

+</script>

+<p class="statline">&nbsp;</p>

+

+

+<div id="scr"> <!-- data available -->

+	<!-- top header -->

+	<form method='post' enctype='multipart/form-data' action="${pluginRoot}">

+		<div class="ui-widget-header ui-corner-top buttonGroup">

+			<button class='reloadButton' type='button' name='reload'>${reload}</button>

+		</div>

+	</form>

+	

+	<table id="plugin_table" class="tablesorter nicetable noauto">

+	<thead>

+		<tr>

+			<th class="col_Id">${id}</th>

+			<th class="col_Name">${scr.title.name}</th>

+			<th class="col_Status">${scr.title.status}</th>

+			<th class="col_Actions">${scr.title.actions}</th>

+		</tr>

+	</thead>

+	<tbody>

+		<tr>

+			<td>&nbsp;</td> <!-- id -->

+			<td> <!-- name with arrow -->

+				<div class="bIcon ui-icon ui-icon-triangle-1-e" style="float:left" title="${scr.details.tip}">&nbsp;</div>

+			</td> 

+			<td>&nbsp;</td> <!-- status -->

+			<td>

+				<ul class="icons">

+					<li class="dynhover ui-helper-hidden" title="${scr.action.enable}"><span class="ui-icon ui-icon-play">&nbsp;</span></li>

+					<li class="dynhover ui-helper-hidden" title="${scr.action.disable}"><span class="ui-icon ui-icon-stop">&nbsp;</span></li>

+					<li class="dynhover ui-helper-hidden" title="${scr.action.configure}"><span class="ui-icon ui-icon-wrench">&nbsp;</span></li>

+				</ul>

+			</td>

+		</tr>

+	</tbody>

+	</table>

+</div> <!-- end data available -->

+

+<!-- bottom header -->

+<form method='post' enctype='multipart/form-data' action="${pluginRoot}">

+	<div class="ui-widget-header ui-corner-bottom buttonGroup">

+		<button class='reloadButton' type='button' name='reload'>${reload}</button>

+	</div>

+</form>

diff --git a/webconsole-plugins/ds/src/main/resources/res/plugin.js b/webconsole-plugins/ds/src/main/resources/res/plugin.js
new file mode 100644
index 0000000..d1fa357
--- /dev/null
+++ b/webconsole-plugins/ds/src/main/resources/res/plugin.js
@@ -0,0 +1,183 @@
+/*
+ * 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.
+ */
+function renderData( eventData )  {
+	switch(eventData.status) {
+		case -1: // no event admin
+			$('.statline').html(i18n.stat_no_service);
+			$('#scr').addClass('ui-helper-hidden');
+			break;
+		case  0: // no components
+			$('.statline').html(i18n.stat_no_components);
+			$('#scr').addClass('ui-helper-hidden');
+			break;
+		default:
+			$('.statline').html(i18n.stat_ok.msgFormat(eventData.status));
+			$('#scr').removeClass('ui-helper-hidden');
+
+			tableBody.empty();
+			for ( var idx in eventData.data ) {
+				entry( eventData.data[idx] );
+			}
+			if ( drawDetails ) renderDetails(eventData);
+			initStaticWidgets();
+	}
+}
+
+function getEntryId(/* Object */ dataEntry) {
+    var id = dataEntry.id;
+    if (id < 0) {
+        id = dataEntry.name;
+        if (dataEntry.pid) {
+            id += '/' + dataEntry.pid;
+        }
+    }
+    return id;
+}
+
+function entry( /* Object */ dataEntry ) {
+	var idPath = getEntryId(dataEntry);
+	var id = idPath.replace(/[./-]/g, '_');
+	var name = dataEntry.name;
+	var _ = tableEntryTemplate.clone().appendTo(tableBody).attr('id', 'entry' + id);
+
+	_.find('.bIcon').attr('id', 'img' + id).click(function() {
+		showDetails(idPath);
+	}).after(drawDetails ? name : ('<a href="' + pluginRoot + '/' + idPath + '">' + name + '</a>'));
+
+	_.find('td:eq(0)').text( dataEntry.id );
+	_.find('td:eq(2)').text( dataEntry.state );
+
+	// setup buttons
+	if ( dataEntry.stateRaw == 1 || dataEntry.stateRaw == 1024 ) { // disabled or disabling
+		_.find('li:eq(0)').removeClass('ui-helper-hidden').click(function() { changeDataEntryState(idPath, 'enable') });
+	} else {
+		_.find('li:eq(1)').removeClass('ui-helper-hidden').click(function() { changeDataEntryState(idPath, 'disable') });
+	}
+	if ( dataEntry.configurable ) _.find('li:eq(2)').removeClass('ui-helper-hidden').click(function() { // configure
+		changeDataEntryState(dataEntry.pid, 'configure');
+	});	
+}
+
+function changeDataEntryState(/* long */ id, /* String */ action) {
+	if ( action == 'configure') {
+		window.location = appRoot + '/configMgr/' + id;
+		return;
+	}
+	$.post(pluginRoot + '/' + id, {'action':action}, function(data) {
+		renderData(data);
+	}, 'json');	
+}
+
+function showDetails( id ) {
+	$.get(pluginRoot + '/' + id + '.json', null, function(data) {
+		renderDetails(data);
+	}, 'json');
+}
+
+function hideDetails( id ) {
+	var __test__ = $('#img' + id);
+	$('#img' + id).each(function() {
+		$('#pluginInlineDetails').remove();
+		$(this).
+			removeClass('ui-icon-triangle-1-w').//left
+			removeClass('ui-icon-triangle-1-s').//down
+			addClass('ui-icon-triangle-1-e').//right
+		    attr('title', 'Details').
+			unbind('click').click(function() {showDetails(id)});
+	});
+}
+
+function renderDetails( data ) {
+	data = data.data[0];
+	var id = getEntryId(data).replace(/[./-]/g, '_');
+	$('#pluginInlineDetails').remove();
+	var __test__ = $('#entry' + id);
+	$('#entry' + id + ' > td').eq(1).append('<div id="pluginInlineDetails"/>');
+	$('#img' + id).each(function() {
+		if ( drawDetails ) {
+			var ref = window.location.pathname;
+			ref = ref.substring(0, ref.lastIndexOf('/'));
+			$(this).
+				removeClass('ui-icon-triangle-1-e').//right
+				removeClass('ui-icon-triangle-1-s').//down
+				addClass('ui-icon-triangle-1-w').//left
+				attr('title', 'Back').
+				unbind('click').click(function() {window.location = ref});
+		} else {
+			$(this).
+				removeClass('ui-icon-triangle-1-w').//left
+				removeClass('ui-icon-triangle-1-e').//right
+				addClass('ui-icon-triangle-1-s').//down
+				attr('title', 'Hide Details').
+				unbind('click').click(function() {hideDetails(id)});
+		}
+	});
+	$('#pluginInlineDetails').append('<table border="0"><tbody></tbody></table>');
+	var details = data.props;
+	for (var idx in details) {
+		var prop = details[idx];
+		var key = i18n[prop.key] ? i18n[prop.key] : prop.key; // i18n
+
+		var txt = '<tr><td class="aligntop" noWrap="true" style="border:0px none">' + key + '</td><td class="aligntop" style="border:0px none">';
+		if (prop.value) {
+			if ( $.isArray(prop.value) ) {
+				var i = 0;
+				for(var pi in prop.value) {
+					var value = prop.value[pi];
+					if (i > 0) { txt = txt + '<br/>'; }
+					var span;
+					if (value.substring(0, 2) == '!!') {
+						txt = txt + '<span style="color: red;'> + value + '</span>';
+					} else {
+						txt = txt + value;
+					}
+					i++;
+				}
+			} else {
+				txt = txt + prop.value;
+			}
+		} else {
+			txt = txt + '\u00a0';
+		}
+		txt = txt + '</td></tr>';
+		$('#pluginInlineDetails > table > tbody').append(txt);
+	}
+}
+
+var tableBody = false;
+var tableEntryTemplate = false;
+var pluginTable = false;
+
+$(document).ready(function(){
+	pluginTable = $('#plugin_table');
+	tableBody = pluginTable.find('tbody');
+	tableEntryTemplate = tableBody.find('tr').clone();
+
+	renderData(scrData);
+
+	$('.reloadButton').click(document.location.reload);
+
+	pluginTable.tablesorter({
+		headers: {
+			0: { sorter:'digit'},
+			3: { sorter: false }
+		},
+		sortList: [[1,0]],
+		textExtraction:mixedLinksExtraction
+	});
+});
+
diff --git a/webconsole-plugins/obr/LICENSE b/webconsole-plugins/obr/LICENSE
new file mode 100644
index 0000000..75b5248
--- /dev/null
+++ b/webconsole-plugins/obr/LICENSE
@@ -0,0 +1,202 @@
+

+                                 Apache License

+                           Version 2.0, January 2004

+                        http://www.apache.org/licenses/

+

+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

+

+   1. Definitions.

+

+      "License" shall mean the terms and conditions for use, reproduction,

+      and distribution as defined by Sections 1 through 9 of this document.

+

+      "Licensor" shall mean the copyright owner or entity authorized by

+      the copyright owner that is granting the License.

+

+      "Legal Entity" shall mean the union of the acting entity and all

+      other entities that control, are controlled by, or are under common

+      control with that entity. For the purposes of this definition,

+      "control" means (i) the power, direct or indirect, to cause the

+      direction or management of such entity, whether by contract or

+      otherwise, or (ii) ownership of fifty percent (50%) or more of the

+      outstanding shares, or (iii) beneficial ownership of such entity.

+

+      "You" (or "Your") shall mean an individual or Legal Entity

+      exercising permissions granted by this License.

+

+      "Source" form shall mean the preferred form for making modifications,

+      including but not limited to software source code, documentation

+      source, and configuration files.

+

+      "Object" form shall mean any form resulting from mechanical

+      transformation or translation of a Source form, including but

+      not limited to compiled object code, generated documentation,

+      and conversions to other media types.

+

+      "Work" shall mean the work of authorship, whether in Source or

+      Object form, made available under the License, as indicated by a

+      copyright notice that is included in or attached to the work

+      (an example is provided in the Appendix below).

+

+      "Derivative Works" shall mean any work, whether in Source or Object

+      form, that is based on (or derived from) the Work and for which the

+      editorial revisions, annotations, elaborations, or other modifications

+      represent, as a whole, an original work of authorship. For the purposes

+      of this License, Derivative Works shall not include works that remain

+      separable from, or merely link (or bind by name) to the interfaces of,

+      the Work and Derivative Works thereof.

+

+      "Contribution" shall mean any work of authorship, including

+      the original version of the Work and any modifications or additions

+      to that Work or Derivative Works thereof, that is intentionally

+      submitted to Licensor for inclusion in the Work by the copyright owner

+      or by an individual or Legal Entity authorized to submit on behalf of

+      the copyright owner. For the purposes of this definition, "submitted"

+      means any form of electronic, verbal, or written communication sent

+      to the Licensor or its representatives, including but not limited to

+      communication on electronic mailing lists, source code control systems,

+      and issue tracking systems that are managed by, or on behalf of, the

+      Licensor for the purpose of discussing and improving the Work, but

+      excluding communication that is conspicuously marked or otherwise

+      designated in writing by the copyright owner as "Not a Contribution."

+

+      "Contributor" shall mean Licensor and any individual or Legal Entity

+      on behalf of whom a Contribution has been received by Licensor and

+      subsequently incorporated within the Work.

+

+   2. Grant of Copyright License. Subject to the terms and conditions of

+      this License, each Contributor hereby grants to You a perpetual,

+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable

+      copyright license to reproduce, prepare Derivative Works of,

+      publicly display, publicly perform, sublicense, and distribute the

+      Work and such Derivative Works in Source or Object form.

+

+   3. Grant of Patent License. Subject to the terms and conditions of

+      this License, each Contributor hereby grants to You a perpetual,

+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable

+      (except as stated in this section) patent license to make, have made,

+      use, offer to sell, sell, import, and otherwise transfer the Work,

+      where such license applies only to those patent claims licensable

+      by such Contributor that are necessarily infringed by their

+      Contribution(s) alone or by combination of their Contribution(s)

+      with the Work to which such Contribution(s) was submitted. If You

+      institute patent litigation against any entity (including a

+      cross-claim or counterclaim in a lawsuit) alleging that the Work

+      or a Contribution incorporated within the Work constitutes direct

+      or contributory patent infringement, then any patent licenses

+      granted to You under this License for that Work shall terminate

+      as of the date such litigation is filed.

+

+   4. Redistribution. You may reproduce and distribute copies of the

+      Work or Derivative Works thereof in any medium, with or without

+      modifications, and in Source or Object form, provided that You

+      meet the following conditions:

+

+      (a) You must give any other recipients of the Work or

+          Derivative Works a copy of this License; and

+

+      (b) You must cause any modified files to carry prominent notices

+          stating that You changed the files; and

+

+      (c) You must retain, in the Source form of any Derivative Works

+          that You distribute, all copyright, patent, trademark, and

+          attribution notices from the Source form of the Work,

+          excluding those notices that do not pertain to any part of

+          the Derivative Works; and

+

+      (d) If the Work includes a "NOTICE" text file as part of its

+          distribution, then any Derivative Works that You distribute must

+          include a readable copy of the attribution notices contained

+          within such NOTICE file, excluding those notices that do not

+          pertain to any part of the Derivative Works, in at least one

+          of the following places: within a NOTICE text file distributed

+          as part of the Derivative Works; within the Source form or

+          documentation, if provided along with the Derivative Works; or,

+          within a display generated by the Derivative Works, if and

+          wherever such third-party notices normally appear. The contents

+          of the NOTICE file are for informational purposes only and

+          do not modify the License. You may add Your own attribution

+          notices within Derivative Works that You distribute, alongside

+          or as an addendum to the NOTICE text from the Work, provided

+          that such additional attribution notices cannot be construed

+          as modifying the License.

+

+      You may add Your own copyright statement to Your modifications and

+      may provide additional or different license terms and conditions

+      for use, reproduction, or distribution of Your modifications, or

+      for any such Derivative Works as a whole, provided Your use,

+      reproduction, and distribution of the Work otherwise complies with

+      the conditions stated in this License.

+

+   5. Submission of Contributions. Unless You explicitly state otherwise,

+      any Contribution intentionally submitted for inclusion in the Work

+      by You to the Licensor shall be under the terms and conditions of

+      this License, without any additional terms or conditions.

+      Notwithstanding the above, nothing herein shall supersede or modify

+      the terms of any separate license agreement you may have executed

+      with Licensor regarding such Contributions.

+

+   6. Trademarks. This License does not grant permission to use the trade

+      names, trademarks, service marks, or product names of the Licensor,

+      except as required for reasonable and customary use in describing the

+      origin of the Work and reproducing the content of the NOTICE file.

+

+   7. Disclaimer of Warranty. Unless required by applicable law or

+      agreed to in writing, Licensor provides the Work (and each

+      Contributor provides its Contributions) on an "AS IS" BASIS,

+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or

+      implied, including, without limitation, any warranties or conditions

+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A

+      PARTICULAR PURPOSE. You are solely responsible for determining the

+      appropriateness of using or redistributing the Work and assume any

+      risks associated with Your exercise of permissions under this License.

+

+   8. Limitation of Liability. In no event and under no legal theory,

+      whether in tort (including negligence), contract, or otherwise,

+      unless required by applicable law (such as deliberate and grossly

+      negligent acts) or agreed to in writing, shall any Contributor be

+      liable to You for damages, including any direct, indirect, special,

+      incidental, or consequential damages of any character arising as a

+      result of this License or out of the use or inability to use the

+      Work (including but not limited to damages for loss of goodwill,

+      work stoppage, computer failure or malfunction, or any and all

+      other commercial damages or losses), even if such Contributor

+      has been advised of the possibility of such damages.

+

+   9. Accepting Warranty or Additional Liability. While redistributing

+      the Work or Derivative Works thereof, You may choose to offer,

+      and charge a fee for, acceptance of support, warranty, indemnity,

+      or other liability obligations and/or rights consistent with this

+      License. However, in accepting such obligations, You may act only

+      on Your own behalf and on Your sole responsibility, not on behalf

+      of any other Contributor, and only if You agree to indemnify,

+      defend, and hold each Contributor harmless for any liability

+      incurred by, or claims asserted against, such Contributor by reason

+      of your accepting any such warranty or additional liability.

+

+   END OF TERMS AND CONDITIONS

+

+   APPENDIX: How to apply the Apache License to your work.

+

+      To apply the Apache License to your work, attach the following

+      boilerplate notice, with the fields enclosed by brackets "[]"

+      replaced with your own identifying information. (Don't include

+      the brackets!)  The text should be enclosed in the appropriate

+      comment syntax for the file format. We also recommend that a

+      file or class name and description of purpose be included on the

+      same "printed page" as the copyright notice for easier

+      identification within third-party archives.

+

+   Copyright [yyyy] [name of copyright owner]

+

+   Licensed 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.

diff --git a/webconsole-plugins/obr/NOTICE b/webconsole-plugins/obr/NOTICE
new file mode 100644
index 0000000..3a3923a
--- /dev/null
+++ b/webconsole-plugins/obr/NOTICE
@@ -0,0 +1,21 @@
+Apache Felix OSGi Web Console Event Plugin

+Copyright 2007-2010 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.

+

+

+II. Used Software

+

+This product uses software developed at

+The OSGi Alliance (http://www.osgi.org/).

+Copyright (c) OSGi Alliance (2000, 2009).

+Licensed under the Apache License 2.0.

+

+

+III. License Summary

+- Apache License 2.0

diff --git a/webconsole-plugins/obr/pom.xml b/webconsole-plugins/obr/pom.xml
new file mode 100644
index 0000000..c4a88f2
--- /dev/null
+++ b/webconsole-plugins/obr/pom.xml
@@ -0,0 +1,127 @@
+<!-- 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. -->

+<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/maven-v4_0_0.xsd">

+

+	<modelVersion>4.0.0</modelVersion>

+	<parent>

+		<groupId>org.apache.felix</groupId>

+		<artifactId>felix-parent</artifactId>

+		<version>1.2.0</version>

+		<relativePath>../../../pom/pom.xml</relativePath>

+	</parent>

+

+	<artifactId>org.apache.felix.webconsole.plugins.obr</artifactId>

+	<packaging>bundle</packaging>

+	<version>1.0.0-SNAPSHOT</version>

+

+	<name>Apache Felix Web Console OBR Plugin</name>

+	<description>

+        This Apache Felix OSGi web console plugin provides method to install bundles from a bundle repository.

+    </description>

+

+	<scm>

+		<connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/webconsole-plugins/obr</connection>

+		<developerConnection>scm:svn:https://svn.apache.org/repos/asf/felix/trunk/webconsole-plugins/obr</developerConnection>

+		<url>http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/obr</url>

+	</scm>

+

+	<build>

+		<plugins>

+			<!-- translate UTF-8 encoded properties files to ISO-8859-1 -->

+			<plugin>

+				<groupId>org.codehaus.mojo</groupId>

+				<artifactId>native2ascii-maven-plugin</artifactId>

+				<version>1.0-alpha-1</version>

+				<executions>

+					<execution>

+						<goals>

+							<goal>native2ascii</goal>

+						</goals>

+						<configuration>

+							<encoding>UTF-8</encoding>

+						</configuration>

+					</execution>

+				</executions>

+			</plugin>

+

+			<plugin>

+				<groupId>org.apache.felix</groupId>

+				<artifactId>maven-bundle-plugin</artifactId>

+				<version>2.0.1</version>

+				<extensions>true</extensions>

+				<configuration>

+					<instructions>

+						<Bundle-SymbolicName>

+							${artifactId}

+                        </Bundle-SymbolicName>

+						<Bundle-Activator>

+							org.apache.felix.webconsole.plugins.obr.internal.Activator

+                        </Bundle-Activator>

+						<DynamicImport-Package>

+                            org.apache.felix.bundlerepository,

+                            org.osgi.service.obr

+                        </DynamicImport-Package>

+					</instructions>

+				</configuration>

+			</plugin>

+		</plugins>

+	</build>

+

+	<dependencies>

+		<dependency>

+			<groupId>javax.servlet</groupId>

+			<artifactId>servlet-api</artifactId>

+			<version>2.4</version>

+			<scope>provided</scope>

+		</dependency>

+		<dependency>

+			<groupId>org.osgi</groupId>

+			<artifactId>org.osgi.core</artifactId>

+			<version>4.0.0</version>

+			<scope>provided</scope>

+		</dependency>

+		<dependency>

+			<groupId>org.osgi</groupId>

+			<artifactId>org.osgi.compendium</artifactId>

+			<version>4.1.0</version>

+			<scope>provided</scope>

+		</dependency>

+		<dependency>

+			<groupId>org.json</groupId>

+			<artifactId>json</artifactId>

+			<version>20070829</version>

+			<scope>compile</scope>

+			<optional>true</optional>

+		</dependency>

+		<dependency>

+			<groupId>org.apache.felix</groupId>

+			<artifactId>org.apache.felix.webconsole</artifactId>

+			<version>3.0.0</version>

+			<scope>provided</scope>

+		</dependency>

+

+        <!-- OSGi and Apache Felix OBR API -->

+        <dependency>

+            <groupId>org.apache.felix</groupId>

+            <artifactId>org.osgi.service.obr</artifactId>

+            <version>1.0.2</version>

+            <scope>provided</scope>

+        </dependency>

+        <dependency>

+            <groupId>org.apache.felix</groupId>

+            <artifactId>org.apache.felix.bundlerepository</artifactId>

+            <version>1.6.0</version>

+            <scope>provided</scope>

+            <optional>true</optional>

+        </dependency>

+	</dependencies>

+</project>

diff --git a/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/AbstractBundleRepositoryRenderHelper.java b/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/AbstractBundleRepositoryRenderHelper.java
new file mode 100644
index 0000000..9e0b5f2
--- /dev/null
+++ b/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/AbstractBundleRepositoryRenderHelper.java
@@ -0,0 +1,74 @@
+/*

+ * 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.webconsole.plugins.obr.internal;

+

+

+import java.io.IOException;

+

+import javax.servlet.ServletException;

+import org.apache.felix.webconsole.AbstractWebConsolePlugin;

+import org.osgi.framework.Bundle;

+import org.osgi.framework.BundleContext;

+import org.osgi.util.tracker.ServiceTracker;

+

+

+abstract class AbstractBundleRepositoryRenderHelper

+{

+

+    protected final AbstractWebConsolePlugin logger;

+

+    private final ServiceTracker repositoryAdmin;

+

+

+    protected AbstractBundleRepositoryRenderHelper( final AbstractWebConsolePlugin logger,

+        final BundleContext bundleContext, final String serviceName )

+    {

+        this.logger = logger;

+        this.repositoryAdmin = new ServiceTracker( bundleContext, serviceName, null );

+        this.repositoryAdmin.open();

+    }

+

+

+    void dispose()

+    {

+        repositoryAdmin.close();

+    }

+

+

+    boolean hasRepositoryAdmin()

+    {

+        return getRepositoryAdmin() != null;

+    }

+

+

+    protected final Object getRepositoryAdmin()

+    {

+        return repositoryAdmin.getService();

+    }

+

+

+    abstract void doDeploy( String[] bundles, boolean start, boolean optional );

+

+

+    abstract void doAction( String action, String urlParam ) throws IOException, ServletException;

+

+

+    abstract String getData( final String filter, final boolean details, final Bundle[] bundles );

+

+}
\ No newline at end of file
diff --git a/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/Activator.java b/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/Activator.java
new file mode 100644
index 0000000..0a53380
--- /dev/null
+++ b/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/Activator.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.felix.webconsole.plugins.obr.internal;

+

+import org.apache.felix.webconsole.SimpleWebConsolePlugin;

+import org.osgi.framework.BundleActivator;

+import org.osgi.framework.BundleContext;

+import org.osgi.framework.Constants;

+import org.osgi.framework.Filter;

+import org.osgi.framework.ServiceReference;

+import org.osgi.util.tracker.ServiceTracker;

+import org.osgi.util.tracker.ServiceTrackerCustomizer;

+

+/**

+ * Activator is the main starting class.

+ */

+public class Activator implements BundleActivator, ServiceTrackerCustomizer, Constants

+{

+

+    private ServiceTracker tracker;

+    private BundleContext context;

+

+    private SimpleWebConsolePlugin plugin;

+

+    /**

+     * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)

+     */

+    public final void start(BundleContext context) throws Exception

+    {

+        this.context = context;

+        Filter filter = context.createFilter("(|" //$NON-NLS-1$

+            + '(' + OBJECTCLASS + "=org.osgi.service.obr.RepositoryAdmin)" //$NON-NLS-1$

+            + '(' + OBJECTCLASS + "=org.apache.felix.bundlerepository.RepositoryAdmin)" //$NON-NLS-1$

+            + ')');

+        this.tracker = new ServiceTracker(context, filter, this);

+        this.tracker.open();

+    }

+

+    /**

+     * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)

+     */

+    public final void stop(BundleContext context) throws Exception

+    {

+        if (tracker != null)

+        {

+            tracker.close();

+            tracker = null;

+        }

+    }

+

+    // - begin tracker

+    /**

+     * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference,

+     *      java.lang.Object)

+     */

+    public final void modifiedService(ServiceReference reference, Object service)

+    {/* unused */

+    }

+

+    /**

+     * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference)

+     */

+    public final Object addingService(ServiceReference reference)

+    {

+        SimpleWebConsolePlugin plugin = this.plugin;

+        if (plugin == null)

+        {

+            this.plugin = plugin = new WebConsolePlugin().register(context);

+        }

+

+        return context.getService(reference);

+    }

+

+    /**

+     * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference,

+     *      java.lang.Object)

+     */

+    public final void removedService(ServiceReference reference, Object service)

+    {

+        SimpleWebConsolePlugin plugin = this.plugin;

+

+        if (tracker.getTrackingCount() == 0 && plugin != null)

+        {

+            plugin.unregister();

+            this.plugin = null;

+        }

+

+    }

+}

diff --git a/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/FelixBundleRepositoryRenderHelper.java b/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/FelixBundleRepositoryRenderHelper.java
new file mode 100644
index 0000000..9858577
--- /dev/null
+++ b/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/FelixBundleRepositoryRenderHelper.java
@@ -0,0 +1,276 @@
+/*

+ * 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.webconsole.plugins.obr.internal;

+

+

+import java.io.IOException;

+import javax.servlet.ServletException;

+import org.apache.felix.bundlerepository.Capability;

+import org.apache.felix.bundlerepository.Property;

+import org.apache.felix.bundlerepository.Reason;

+import org.apache.felix.bundlerepository.Repository;

+import org.apache.felix.bundlerepository.RepositoryAdmin;

+import org.apache.felix.bundlerepository.Requirement;

+import org.apache.felix.bundlerepository.Resolver;

+import org.apache.felix.bundlerepository.Resource;

+import org.apache.felix.webconsole.AbstractWebConsolePlugin;

+import org.json.JSONException;

+import org.json.JSONObject;

+import org.osgi.framework.Bundle;

+import org.osgi.framework.BundleContext;

+import org.osgi.framework.Constants;

+import org.osgi.framework.InvalidSyntaxException;

+

+

+/**

+ * This class provides a plugin for rendering the available OSGi Bundle Repositories

+ * and the resources they provide.

+ */

+class FelixBundleRepositoryRenderHelper extends AbstractBundleRepositoryRenderHelper

+{

+

+    FelixBundleRepositoryRenderHelper( AbstractWebConsolePlugin logger, BundleContext bundleContext )

+    {

+        super( logger, bundleContext, RepositoryAdmin.class.getName() );

+    }

+

+

+    String getData( final String filter, final boolean details, Bundle[] bundles )

+    {

+        RepositoryAdmin admin = ( RepositoryAdmin ) getRepositoryAdmin();

+        if ( admin != null )

+        {

+            JSONObject json = new JSONObject();

+            try

+            {

+                json.put( "status", true ); //$NON-NLS-1$

+                json.put( "details", details ); //$NON-NLS-1$

+

+                final Repository repositories[] = admin.listRepositories();

+                for ( int i = 0; repositories != null && i < repositories.length; i++ )

+                {

+                    json.append( "repositories", new JSONObject() //$NON-NLS-1$

+                        .put( "lastModified", repositories[i].getLastModified() ) //$NON-NLS-1$

+                        .put( "name", repositories[i].getName() ) //$NON-NLS-1$

+                        .put( "url", repositories[i].getURI() ) ); //$NON-NLS-1$

+                }

+

+                Resource[] resources = admin.discoverResources( filter );

+                for ( int i = 0; resources != null && i < resources.length; i++ )

+                {

+                    json.append( "resources", toJSON( resources[i], bundles, details ) ); //$NON-NLS-1$

+                }

+

+            }

+            catch ( JSONException e )

+            {

+                logger.log( "Failed to serialize repository to JSON object.", e );

+            }

+            catch ( Exception e )

+            {

+                logger.log( "Failed to parse filter '" + filter + "'", e );

+                try

+                {

+                    String reason = "filter=" + filter;

+                    if ( e.getMessage() != null )

+                    {

+                        reason = e.getMessage() + "(" + reason + ")";

+                    }

+                    json.put( "error", reason ); //$NON-NLS-1$

+                }

+                catch ( JSONException je )

+                {

+                    // ignore

+                }

+            }

+            return json.toString();

+        }

+

+        // fall back to no data

+        return "{}"; //$NON-NLS-1$

+    }

+

+

+    final void doAction( String action, String urlParam ) throws IOException, ServletException

+    {

+        RepositoryAdmin admin = ( RepositoryAdmin ) getRepositoryAdmin();

+        Repository[] repos = admin.listRepositories();

+        Repository repo = getRepository( repos, urlParam );

+

+        String uri = repo != null ? repo.getURI() : urlParam;

+

+        if ( "delete".equals( action ) ) //$NON-NLS-1$

+        {

+            if ( !admin.removeRepository( uri ) )

+            {

+                throw new ServletException( "Failed to remove repository with URL " + uri );

+            }

+        }

+        else if ( "add".equals( action ) || "refresh".equals( action ) ) //$NON-NLS-1$ //$NON-NLS-2$

+        {

+            try

+            {

+                admin.addRepository( uri );

+            }

+            catch ( IOException e )

+            {

+                throw e;

+            }

+            catch ( Exception e )

+            {

+                throw new ServletException( "Failed to " + action + " repository " + uri + ": " + e.toString() );

+            }

+

+        }

+    }

+

+

+    final void doDeploy( String[] bundles, boolean start, boolean optional )

+    {

+        try

+        {

+            // check whether we have to do something

+            if ( bundles == null || bundles.length == 0 )

+            {

+                logger.log( "No resources to deploy" );

+                return;

+            }

+

+            RepositoryAdmin repoAdmin = ( RepositoryAdmin ) getRepositoryAdmin();

+            Resolver resolver = repoAdmin.resolver();

+

+            // prepare the deployment

+            for ( int i = 0; i < bundles.length; i++ )

+            {

+                String bundle = bundles[i];

+                if ( bundle == null || bundle.equals( "-" ) ) //$NON-NLS-1$

+                {

+                    continue;

+                }

+

+                String filter = "(id=" + bundle + ")";

+                Resource[] resources = repoAdmin.discoverResources( filter );

+                if ( resources != null && resources.length > 0 )

+                {

+                    resolver.add( resources[0] );

+                }

+            }

+

+            FelixDeployer.deploy( resolver, logger, start, optional );

+        }

+        catch ( InvalidSyntaxException e )

+        {

+            throw new IllegalStateException( e );

+        }

+    }

+

+

+    private final Repository getRepository( Repository[] repos, String repositoryUrl )

+    {

+        if ( repositoryUrl == null || repositoryUrl.length() == 0 )

+        {

+            return null;

+        }

+

+        for ( int i = 0; i < repos.length; i++ )

+        {

+            if ( repositoryUrl.equals( repos[i].getURI() ) )

+            {

+                return repos[i];

+            }

+        }

+

+        return null;

+    }

+

+

+    private final JSONObject toJSON( Resource resource, Bundle[] bundles, boolean details ) throws JSONException

+    {

+        final String symbolicName = resource.getSymbolicName();

+        final String version = resource.getVersion().toString();

+        boolean installed = false;

+        for ( int i = 0; symbolicName != null && !installed && bundles != null && i < bundles.length; i++ )

+        {

+            final String ver = ( String ) bundles[i].getHeaders( "" ).get( Constants.BUNDLE_VERSION ); //$NON-NLS-1$

+            installed = symbolicName.equals( bundles[i].getSymbolicName() ) && version.equals( ver );

+        }

+        JSONObject json = new JSONObject( resource.getProperties() ) //

+            .put( "id", resource.getId() ) // //$NON-NLS-1$

+            .put( "presentationname", resource.getPresentationName() ) // //$NON-NLS-1$

+            .put( "symbolicname", symbolicName ) // //$NON-NLS-1$

+            .put( "url", resource.getURI() ) // //$NON-NLS-1$

+            .put( "version", version ) // //$NON-NLS-1$

+            .put( "categories", resource.getCategories() ) // //$NON-NLS-1$

+            .put( "installed", installed ); //$NON-NLS-1$

+

+        if ( details )

+        {

+            Capability[] caps = resource.getCapabilities();

+            for ( int i = 0; caps != null && i < caps.length; i++ )

+            {

+                json.append( "capabilities", new JSONObject() //$NON-NLS-1$

+                    .put( "name", caps[i].getName() ) //$NON-NLS-1$

+                    .put( "properties", toJSON( caps[i].getProperties() ) ) ); //$NON-NLS-1$

+            }

+            Requirement[] reqs = resource.getRequirements();

+            for ( int i = 0; reqs != null && i < reqs.length; i++ )

+            {

+                json.append( "requirements", new JSONObject() //$NON-NLS-1$

+                    .put( "name", reqs[i].getName() ) //$NON-NLS-1$

+                    .put( "filter", reqs[i].getFilter() ) //$NON-NLS-1$

+                    .put( "optional", reqs[i].isOptional() ) ); //$NON-NLS-1$

+            }

+

+            final RepositoryAdmin admin = ( RepositoryAdmin ) getRepositoryAdmin();

+            Resolver resolver = admin.resolver();

+            resolver.add( resource );

+            resolver.resolve( Resolver.NO_OPTIONAL_RESOURCES );

+            Resource[] required = resolver.getRequiredResources();

+            for ( int i = 0; required != null && i < required.length; i++ )

+            {

+                json.append( "required", toJSON( required[i], bundles, false ) ); //$NON-NLS-1$

+            }

+            Resource[] optional = resolver.getOptionalResources();

+            for ( int i = 0; optional != null && i < optional.length; i++ )

+            {

+                json.append( "optional", toJSON( optional[i], bundles, false ) ); //$NON-NLS-1$

+            }

+            Reason[] unsatisfied = resolver.getUnsatisfiedRequirements();

+            for ( int i = 0; unsatisfied != null && i < unsatisfied.length; i++ )

+            {

+                json.append( "unsatisfied", new JSONObject() //$NON-NLS-1$

+                    .put( "name", unsatisfied[i].getRequirement().getName() ) //$NON-NLS-1$

+                    .put( "filter", unsatisfied[i].getRequirement().getFilter() ) //$NON-NLS-1$

+                    .put( "optional", unsatisfied[i].getRequirement().isOptional() ) ); //$NON-NLS-1$

+            }

+        }

+        return json;

+    }

+

+

+    private JSONObject toJSON( final Property[] props ) throws JSONException

+    {

+        JSONObject json = new JSONObject();

+        for ( int i = 0; props != null && i < props.length; i++ )

+        {

+            json.put( props[i].getName(), props[i].getValue() );

+        }

+        return json;

+    }

+}

diff --git a/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/FelixDeployer.java b/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/FelixDeployer.java
new file mode 100644
index 0000000..bfed872
--- /dev/null
+++ b/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/FelixDeployer.java
@@ -0,0 +1,114 @@
+/*

+ * 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.webconsole.plugins.obr.internal;

+

+

+import org.apache.felix.bundlerepository.Reason;

+import org.apache.felix.bundlerepository.Resolver;

+import org.apache.felix.bundlerepository.Resource;

+import org.apache.felix.webconsole.AbstractWebConsolePlugin;

+import org.osgi.service.log.LogService;

+

+

+class FelixDeployer implements Runnable

+{

+

+    private final Resolver obrResolver;

+

+    private final AbstractWebConsolePlugin logger;

+

+    private final boolean startBundles;

+

+    private final boolean optionalDependencies;

+

+    static void deploy(Resolver obrResolver, AbstractWebConsolePlugin logger, boolean startBundles,

+        boolean optionalDependencies)

+    {

+        final FelixDeployer d = new FelixDeployer(obrResolver, logger, startBundles, optionalDependencies);

+        final Thread t = new Thread(d, "OBR Bundle Deployer (Apache Felix API)");

+        t.start();

+    }

+

+    private FelixDeployer(Resolver obrResolver, AbstractWebConsolePlugin logger, boolean startBundles,

+        boolean optionalDependencies)

+    {

+        this.obrResolver = obrResolver;

+        this.logger = logger;

+        this.startBundles = startBundles;

+        this.optionalDependencies = optionalDependencies;

+    }

+

+    public void run()

+    {

+        int flags = 0;

+        flags += (startBundles ? Resolver.START : 0);

+        flags += (optionalDependencies ? 0 : Resolver.NO_OPTIONAL_RESOURCES);

+        try

+        {

+            if ( obrResolver.resolve( flags ) )

+            {

+

+                logResource( "Installing Requested Resources", obrResolver.getAddedResources() );

+                logResource( "Installing Required Resources", obrResolver.getRequiredResources() );

+                logResource( "Installing Optional Resources", obrResolver.getOptionalResources() );

+

+                obrResolver.deploy( flags );

+            }

+            else

+            {

+                logRequirements( "Cannot Install requested bundles due to unsatisfied requirements",

+                    obrResolver.getUnsatisfiedRequirements() );

+            }

+        }

+        catch ( Exception ie )

+        {

+            logger.log( LogService.LOG_ERROR, "Cannot install bundles", ie );

+        }

+    }

+

+

+    private void logResource( String message, Resource[] res )

+    {

+        if ( res != null && res.length > 0 )

+        {

+            logger.log( LogService.LOG_INFO, message );

+            for ( int i = 0; i < res.length; i++ )

+            {

+                logger.log( LogService.LOG_INFO, "  " + i + ": " + res[i].getSymbolicName() + ", "

+                    + res[i].getVersion() );

+            }

+        }

+    }

+

+

+    private void logRequirements( String message, Reason[] reasons )

+    {

+        logger.log( LogService.LOG_ERROR, message );

+        for ( int i = 0; reasons != null && i < reasons.length; i++ )

+        {

+            String moreInfo = reasons[i].getRequirement().getComment();

+            if ( moreInfo == null )

+            {

+                moreInfo = reasons[i].getRequirement().getFilter().toString();

+            }

+            logger.log( LogService.LOG_ERROR, "  " + i + ": " + reasons[i].getRequirement().getName() + " (" + moreInfo + ")" );

+        }

+    }

+

+}

diff --git a/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/OsgiBundleRepositoryRenderHelper.java b/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/OsgiBundleRepositoryRenderHelper.java
new file mode 100644
index 0000000..fb22b5b
--- /dev/null
+++ b/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/OsgiBundleRepositoryRenderHelper.java
@@ -0,0 +1,256 @@
+/*

+ * 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.webconsole.plugins.obr.internal;

+

+

+import java.io.IOException;

+import java.net.URL;

+import javax.servlet.ServletException;

+import org.apache.felix.webconsole.AbstractWebConsolePlugin;

+import org.json.JSONException;

+import org.json.JSONObject;

+import org.osgi.framework.Bundle;

+import org.osgi.framework.BundleContext;

+import org.osgi.framework.Constants;

+import org.osgi.service.obr.Capability;

+import org.osgi.service.obr.Repository;

+import org.osgi.service.obr.RepositoryAdmin;

+import org.osgi.service.obr.Requirement;

+import org.osgi.service.obr.Resolver;

+import org.osgi.service.obr.Resource;

+

+

+/**

+ * This class provides a plugin for rendering the available OSGi Bundle Repositories

+ * and the resources they provide.

+ */

+class OsgiBundleRepositoryRenderHelper extends AbstractBundleRepositoryRenderHelper

+{

+

+    OsgiBundleRepositoryRenderHelper( final AbstractWebConsolePlugin logger, final BundleContext bundleContext )

+    {

+        super( logger, bundleContext, RepositoryAdmin.class.getName() );

+    }

+

+

+    String getData( final String filter, final boolean details, Bundle[] bundles )

+    {

+        RepositoryAdmin admin = ( RepositoryAdmin ) getRepositoryAdmin();

+        if ( admin != null )

+        {

+            JSONObject json = new JSONObject();

+            try

+            {

+                json.put( "status", true ); //$NON-NLS-1$

+                json.put( "details", details ); //$NON-NLS-1$

+

+                final Repository repositories[] = admin.listRepositories();

+                for ( int i = 0; repositories != null && i < repositories.length; i++ )

+                {

+                    json.append( "repositories", new JSONObject() //$NON-NLS-1$

+                        .put( "lastModified", repositories[i].getLastModified() ) //$NON-NLS-1$

+                        .put( "name", repositories[i].getName() ) //$NON-NLS-1$

+                        .put( "url", repositories[i].getURL() ) ); //$NON-NLS-1$

+                }

+

+                Resource[] resources = admin.discoverResources( filter );

+                for ( int i = 0; resources != null && i < resources.length; i++ )

+                {

+                    json.append( "resources", toJSON( resources[i], bundles, details ) ); //$NON-NLS-1$

+                }

+            }

+            catch ( JSONException e )

+            {

+                logger.log( "Failed to serialize repository to JSON object.", e );

+            }

+            catch ( Exception e )

+            {

+                logger.log( "Failed to parse filter '" + filter + "'", e );

+                try

+                {

+                    String reason = "filter=" + filter;

+                    if ( e.getMessage() != null )

+                    {

+                        reason = e.getMessage() + "(" + reason + ")";

+                    }

+                    json.put( "error", reason ); //$NON-NLS-1$

+                }

+                catch ( JSONException je )

+                {

+                    // ignore

+                }

+            }

+

+            return json.toString();

+        }

+

+        // fall back to no data

+        return "{}"; //$NON-NLS-1$

+    }

+

+    void doAction( String action, String urlParam ) throws IOException, ServletException

+    {

+        RepositoryAdmin admin = ( RepositoryAdmin ) getRepositoryAdmin();

+        Repository[] repos = admin.listRepositories();

+        Repository repo = getRepository( repos, urlParam );

+

+        URL uri = repo != null ? repo.getURL() : new URL( urlParam );

+

+        if ( "delete".equals( action ) ) //$NON-NLS-1$

+        {

+            if ( !admin.removeRepository( uri ) )

+            {

+                throw new ServletException( "Failed to remove repository with URL " + uri );

+            }

+        }

+        else if ( "add".equals( action ) || "refresh".equals( action ) ) //$NON-NLS-1$ //$NON-NLS-2$

+        {

+            try

+            {

+                admin.addRepository( uri );

+            }

+            catch ( IOException e )

+            {

+                throw e;

+            }

+            catch ( Exception e )

+            {

+                throw new ServletException( "Failed to " + action + " repository " + uri + ": " + e.toString() );

+            }

+

+        }

+    }

+

+

+    final void doDeploy( String[] bundles, boolean start, boolean optional )

+    {

+        // check whether we have to do something

+        if ( bundles == null || bundles.length == 0 )

+        {

+            logger.log( "No resources to deploy" );

+            return;

+        }

+

+        RepositoryAdmin repoAdmin = ( RepositoryAdmin ) getRepositoryAdmin();

+        Resolver resolver = repoAdmin.resolver();

+

+        // prepare the deployment

+        for ( int i = 0; i < bundles.length; i++ )

+        {

+            String bundle = bundles[i];

+            if ( bundle == null || bundle.equals( "-" ) )

+            {

+                continue;

+            }

+

+            String filter = "(id=" + bundle + ")";

+            Resource[] resources = repoAdmin.discoverResources( filter );

+            if ( resources != null && resources.length > 0 )

+            {

+                resolver.add( resources[0] );

+            }

+        }

+

+        OsgiDeployer.deploy( resolver, logger, start );

+    }

+

+

+    private final Repository getRepository( Repository[] repos, String repositoryUrl )

+    {

+        if ( repositoryUrl == null || repositoryUrl.length() == 0 )

+        {

+            return null;

+        }

+

+        for ( int i = 0; i < repos.length; i++ )

+        {

+            if ( repositoryUrl.equals( repos[i].getURL().toString() ) )

+            {

+                return repos[i];

+            }

+        }

+

+        return null;

+    }

+

+

+    private final JSONObject toJSON( Resource resource, Bundle[] bundles, boolean details ) throws JSONException

+    {

+        final String symbolicName = resource.getSymbolicName();

+        final String version = resource.getVersion().toString();

+        boolean installed = false;

+        for ( int i = 0; symbolicName != null && !installed && bundles != null && i < bundles.length; i++ )

+        {

+            final String ver = ( String ) bundles[i].getHeaders( "" ).get( Constants.BUNDLE_VERSION ); //$NON-NLS-1$

+            installed = symbolicName.equals( bundles[i].getSymbolicName() ) && version.equals( ver );

+        }

+        JSONObject json = new JSONObject( resource.getProperties() ) //

+            .put( "id", resource.getId() ) // //$NON-NLS-1$

+            .put( "presentationname", resource.getPresentationName() ) // //$NON-NLS-1$

+            .put( "symbolicname", symbolicName ) // //$NON-NLS-1$

+            .put( "url", resource.getURL() ) // //$NON-NLS-1$

+            .put( "version", version ) // //$NON-NLS-1$

+            .put( "categories", resource.getCategories() ) // //$NON-NLS-1$

+            .put( "installed", installed ); //$NON-NLS-1$

+

+        if ( details )

+        {

+            Capability[] caps = resource.getCapabilities();

+            for ( int i = 0; caps != null && i < caps.length; i++ )

+            {

+                json.append( "capabilities", new JSONObject() //$NON-NLS-1$

+                    .put( "name", caps[i].getName() ) //$NON-NLS-1$

+                    .put( "properties", new JSONObject( caps[i].getProperties() ) ) ); //$NON-NLS-1$

+            }

+            Requirement[] reqs = resource.getRequirements();

+            for ( int i = 0; reqs != null && i < reqs.length; i++ )

+            {

+                json.append( "requirements", new JSONObject() //$NON-NLS-1$

+                    .put( "name", reqs[i].getName() ) //$NON-NLS-1$

+                    .put( "filter", reqs[i].getFilter() ) //$NON-NLS-1$

+                    .put( "optional", reqs[i].isOptional() ) ); //$NON-NLS-1$

+            }

+

+            final RepositoryAdmin admin = ( RepositoryAdmin ) getRepositoryAdmin();

+            Resolver resolver = admin.resolver();

+            resolver.add( resource );

+            resolver.resolve(); // (Resolver.NO_OPTIONAL_RESOURCES);

+            Resource[] required = resolver.getRequiredResources();

+            for ( int i = 0; required != null && i < required.length; i++ )

+            {

+                json.append( "required", toJSON( required[i], bundles, false ) ); //$NON-NLS-1$

+            }

+            Resource[] optional = resolver.getOptionalResources();

+            for ( int i = 0; optional != null && i < optional.length; i++ )

+            {

+                json.append( "optional", toJSON( optional[i], bundles, false ) ); //$NON-NLS-1$

+            }

+            Requirement/*Reason*/[] unsatisfied = resolver.getUnsatisfiedRequirements();

+            for ( int i = 0; unsatisfied != null && i < unsatisfied.length; i++ )

+            {

+                json.append( "unsatisfied", new JSONObject() //$NON-NLS-1$

+                    .put( "name", unsatisfied[i].getName() ) //$NON-NLS-1$

+                    .put( "filter", unsatisfied[i].getFilter() ) //$NON-NLS-1$

+                    .put( "optional", unsatisfied[i].isOptional() ) ); //$NON-NLS-1$

+            }

+        }

+        return json;

+    }

+

+}

diff --git a/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/OsgiDeployer.java b/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/OsgiDeployer.java
new file mode 100644
index 0000000..e20da6f
--- /dev/null
+++ b/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/OsgiDeployer.java
@@ -0,0 +1,110 @@
+/*
+ * 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.webconsole.plugins.obr.internal;
+
+
+import org.apache.felix.webconsole.AbstractWebConsolePlugin;
+import org.osgi.service.log.LogService;
+import org.osgi.service.obr.Requirement;
+import org.osgi.service.obr.Resolver;
+import org.osgi.service.obr.Resource;
+
+
+class OsgiDeployer implements Runnable
+{
+
+    private final Resolver obrResolver;
+
+    private final AbstractWebConsolePlugin logger;
+
+    private final boolean startBundles;
+
+
+    OsgiDeployer( Resolver obrResolver, AbstractWebConsolePlugin logger, boolean startBundles )
+    {
+        this.obrResolver = obrResolver;
+        this.logger = logger;
+        this.startBundles = startBundles;
+    }
+
+    static void deploy( Resolver obrResolver, AbstractWebConsolePlugin logger, boolean startBundles )
+    {
+        final OsgiDeployer d = new OsgiDeployer( obrResolver, logger, startBundles );
+        final Thread t = new Thread( d, "OBR Bundle Deployer (OSGi API)" );
+        t.start();
+    }
+
+    /**
+     * @see java.lang.Runnable#run()
+     */
+    public void run()
+    {
+        try
+        {
+            if ( obrResolver.resolve() )
+            {
+
+                logResource( logger, "Installing Requested Resources", obrResolver.getAddedResources() );
+                logResource( logger, "Installing Required Resources", obrResolver.getRequiredResources() );
+                logResource( logger, "Installing Optional Resources", obrResolver.getOptionalResources() );
+
+                obrResolver.deploy( startBundles );
+            }
+            else
+            {
+                logRequirements( logger, "Cannot Install requested bundles due to unsatisfied requirements",
+                    obrResolver.getUnsatisfiedRequirements() );
+            }
+        }
+        catch ( Exception ie )
+        {
+            logger.log( LogService.LOG_ERROR, "Cannot install bundles", ie );
+        }
+    }
+
+
+    public static void logResource( AbstractWebConsolePlugin logger, String message, Resource[] res )
+    {
+        if ( res != null && res.length > 0 )
+        {
+            logger.log( LogService.LOG_INFO, message );
+            for ( int i = 0; i < res.length; i++ )
+            {
+                logger.log( LogService.LOG_INFO, "  " + i + ": " + res[i].getSymbolicName() + ", "
+                    + res[i].getVersion() );
+            }
+        }
+    }
+
+
+    public static void logRequirements( AbstractWebConsolePlugin logger, String message, Requirement[] reasons )
+    {
+        logger.log( LogService.LOG_ERROR, message );
+        for ( int i = 0; reasons != null && i < reasons.length; i++ )
+        {
+            String moreInfo = reasons[i].getComment();
+            if ( moreInfo == null )
+            {
+                moreInfo = reasons[i].getFilter().toString();
+            }
+            logger.log( LogService.LOG_ERROR, "  " + i + ": " + reasons[i].getName() + " (" + moreInfo + ")" );
+        }
+    }
+
+}
diff --git a/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/WebConsolePlugin.java b/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/WebConsolePlugin.java
new file mode 100644
index 0000000..c80a88c
--- /dev/null
+++ b/webconsole-plugins/obr/src/main/java/org/apache/felix/webconsole/plugins/obr/internal/WebConsolePlugin.java
@@ -0,0 +1,323 @@
+/*

+ * 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.webconsole.plugins.obr.internal;

+

+

+import java.io.IOException;

+import java.util.Enumeration;

+

+import javax.servlet.ServletException;

+import javax.servlet.http.HttpServletRequest;

+import javax.servlet.http.HttpServletResponse;

+

+import org.apache.felix.webconsole.DefaultVariableResolver;

+import org.apache.felix.webconsole.SimpleWebConsolePlugin;

+import org.apache.felix.webconsole.WebConsoleUtil;

+

+

+/**

+ * This class provides a plugin for rendering the available OSGi Bundle Repositories

+ * and the resources they provide.

+ */

+class WebConsolePlugin extends SimpleWebConsolePlugin 

+{

+    private static final String LABEL = "obr"; //$NON-NLS-1$

+    private static final String TITLE = "%obr.pluginTitle"; //$NON-NLS-1$

+    private static final String CSS[] = { "/" + LABEL + "/res/plugin.css" }; //$NON-NLS-1$ //$NON-NLS-2$

+

+    // templates

+    private final String TEMPLATE;

+

+    private AbstractBundleRepositoryRenderHelper helper;

+

+

+    /**

+     *

+     */

+    public WebConsolePlugin()

+    {

+        super( LABEL, TITLE, CSS );

+

+        // load templates

+        TEMPLATE = readTemplateFile("/res/plugin.html"); //$NON-NLS-1$

+    }

+

+

+    /**

+     * @see org.apache.felix.webconsole.SimpleWebConsolePlugin#deactivate()

+     */

+    public void deactivate()

+    {

+        if ( helper != null )

+        {

+            helper.dispose();

+            helper = null;

+        }

+

+        super.deactivate();

+    }

+

+

+    /**

+     * @see org.apache.felix.webconsole.AbstractWebConsolePlugin#renderContent(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

+     */

+    protected void renderContent( HttpServletRequest request, HttpServletResponse response ) throws IOException

+    {

+        // prepare variables

+        DefaultVariableResolver vars = ( ( DefaultVariableResolver ) WebConsoleUtil.getVariableResolver( request ) );

+        vars.put( "__data__", getData( request ) ); //$NON-NLS-1$

+

+        response.getWriter().print( TEMPLATE );

+    }

+

+

+    /**

+     * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

+     */

+    protected void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException,

+        IOException

+    {

+        if ( !hasRepositoryAdmin() )

+        {

+            response.sendError( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "RepositoryAdmin service is missing" );

+            return;

+        }

+

+        final String action = request.getParameter( "action" ); //$NON-NLS-1$

+        final String deploy = request.getParameter( "deploy" ); //$NON-NLS-1$

+        final String deploystart = request.getParameter( "deploystart" ); //$NON-NLS-1$

+        final String optional = request.getParameter( "optional" ); //$NON-NLS-1$

+

+        if ( action != null )

+        {

+            doAction( action, request.getParameter( "url" ) ); //$NON-NLS-1$

+            response.getWriter().print( getData( request ) );

+            return;

+        }

+

+        if ( deploy != null || deploystart != null )

+        {

+            doDeploy( request.getParameterValues( "bundle" ), deploystart != null, optional != null ); //$NON-NLS-1$

+            doGet( request, response );

+            return;

+        }

+

+        super.doPost( request, response );

+    }

+

+

+    AbstractBundleRepositoryRenderHelper getHelper()

+    {

+        if ( helper == null )

+        {

+            try

+            {

+                helper = new FelixBundleRepositoryRenderHelper( this, getBundleContext() );

+            }

+            catch ( Throwable felixt )

+            {

+                // ClassNotFoundException, ClassDefNotFoundError

+

+                try

+                {

+                    helper = new OsgiBundleRepositoryRenderHelper( this, getBundleContext() );

+                }

+                catch ( Throwable osgit )

+                {

+                    // ClassNotFoundException, ClassDefNotFoundError

+                }

+            }

+        }

+

+        return helper;

+    }

+

+

+    private boolean hasRepositoryAdmin()

+    {

+        AbstractBundleRepositoryRenderHelper helper = getHelper();

+        return helper != null && helper.hasRepositoryAdmin();

+    }

+

+

+    private String getData( final HttpServletRequest request )

+    {

+        AbstractBundleRepositoryRenderHelper helper = getHelper();

+        if ( helper == null || !helper.hasRepositoryAdmin() )

+        {

+            return "{}"; //$NON-NLS-1$

+        }

+

+        RequestInfo info = new RequestInfo( request );

+

+        final String filter;

+        String list = info.getList();

+        if ( list != null )

+        {

+            if ( "-".equals( list ) ) //$NON-NLS-1$

+            {

+                StringBuffer sb = new StringBuffer( "(!(|" ); //$NON-NLS-1$

+                for ( int c = 0; c < 26; c++ )

+                {

+                    sb.append( "(presentationname=" ).append( ( char ) ( 'a' + c ) ) //$NON-NLS-1$

+                      .append( "*)(presentationname=" ).append( ( char ) ( 'A' + c ) ) //$NON-NLS-1$

+                      .append( "*)" ); //$NON-NLS-1$

+                }

+                sb.append( "))" ); //$NON-NLS-1$

+                filter = sb.toString();

+            }

+            else

+            {

+                filter = "(|(presentationname=" + list.toLowerCase() //$NON-NLS-1$

+                    + "*)(presentationname=" + list.toUpperCase() + "*))"; //$NON-NLS-1$ //$NON-NLS-2$

+            }

+        }

+        else

+        {

+            String query = info.getQuery();

+            if ( query != null )

+            {

+                if ( query.indexOf( '=' ) > 0 )

+                {

+                    if ( query.startsWith( "(" ) ) //$NON-NLS-1$

+                    {

+                        filter = query;

+                    }

+                    else

+                    {

+                        filter = "(" + query + ")"; //$NON-NLS-1$ //$NON-NLS-2$

+                    }

+                }

+                else

+                {

+                    filter = "(|(presentationame=*" + query + "*)(symbolicname=*" + query + "*))"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

+                }

+            }

+            else

+            {

+                StringBuffer sb = new StringBuffer( "(&" ); //$NON-NLS-1$

+                for ( Enumeration e = request.getParameterNames(); e.hasMoreElements(); )

+                {

+                    String k = ( String ) e.nextElement();

+                    String v = request.getParameter( k );

+                    if ( v != null && v.length() > 0 

+                        && !"details".equals( k )  //$NON-NLS-1$

+                        && !"deploy".equals( k ) //$NON-NLS-1$

+                        && !"deploystart".equals( k )  //$NON-NLS-1$

+                        && !"bundle".equals( k )  //$NON-NLS-1$

+                        && !"optional".equals( k ) ) //$NON-NLS-1$

+                    {

+                        sb.append( '(' ).append( k ).append( '=' ).append( v ).append( ')' );

+                    }

+                }

+                sb.append( ')' );

+                filter = (sb.length() > 3) ? sb.toString() : null;

+            }

+        }

+

+        return helper.getData( filter, info.showDetails(), getBundleContext().getBundles() );

+    }

+

+

+    private void doAction( String action, String urlParam ) throws IOException, ServletException

+    {

+        AbstractBundleRepositoryRenderHelper helper = getHelper();

+        if ( helper != null )

+        {

+            helper.doAction( action, urlParam );

+        }

+    }

+

+

+    private void doDeploy( String[] bundles, boolean start, boolean optional )

+    {

+        AbstractBundleRepositoryRenderHelper helper = getHelper();

+        if ( helper != null )

+        {

+            helper.doDeploy( bundles, start, optional );

+        }

+    }

+

+    private static class RequestInfo {

+

+        private final HttpServletRequest request;

+

+        private boolean details;

+        private String query;

+        private String list;

+

+

+        RequestInfo( final HttpServletRequest request )

+        {

+            this.request = request;

+        }

+

+

+        boolean showDetails()

+        {

+            getQuery();

+            return details;

+        }

+

+

+        String getQuery()

+        {

+            if ( query == null )

+            {

+                String query = WebConsoleUtil.urlDecode( request.getParameter( "query" ) ); //$NON-NLS-1$

+                boolean details = false;

+                if ( query == null && request.getPathInfo().length() > 5 )

+                {

+                    // cut off "/obr/" prefix (might want to use getTitle ??)

+                    String path = request.getPathInfo().substring( 5 );

+                    int slash = path.indexOf( '/' );

+                    if ( slash < 0 )

+                    {

+                        // symbolic name only, version ??

+                        query = "(symbolicname=" + path + ")"; //$NON-NLS-1$ //$NON-NLS-2$

+                    }

+                    else

+                    {

+                        query = "(&(symbolicname=" + path.substring( 0, slash )  //$NON-NLS-1$

+                            + ")(version=" + path.substring( slash + 1 ) + "))"; //$NON-NLS-1$ //$NON-NLS-2$

+                        details = true;

+                    }

+                }

+

+                this.query = query;

+                this.details = details;

+            }

+            return query;

+        }

+

+

+        String getList()

+        {

+            if ( list == null )

+            {

+                list = WebConsoleUtil.urlDecode( request.getParameter( "list" ) ); //$NON-NLS-1$

+                if ( list == null && !request.getParameterNames().hasMoreElements() && getQuery() == null )

+                {

+                    list = "a"; //$NON-NLS-1$

+                }

+            }

+            return list;

+        }

+    }

+}

diff --git a/webconsole-plugins/obr/src/main/native2ascii/OSGI-INF/l10n/bundle_bg.properties b/webconsole-plugins/obr/src/main/native2ascii/OSGI-INF/l10n/bundle_bg.properties
new file mode 100644
index 0000000..89b6aae
--- /dev/null
+++ b/webconsole-plugins/obr/src/main/native2ascii/OSGI-INF/l10n/bundle_bg.properties
@@ -0,0 +1,49 @@
+#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.

+

+#

+# Web Console strings for reference all strings here are commented.

+# This file may be used to produce a translation of the strings

+#

+# Note that properties files are ISO-8859-1 encoded. To provide translations

+# for languages requiring different character encodings, you may use the

+# native2ascii Maven Plugin from http://mojo.codehaus.org/native2ascii-maven-plugin/

+# to translate the natively encoded files to ISO-8859-1 during bundle build

+#

+# Translations requiring non-ISO-8859-1 encoding are placed in the

+# src/main/native2ascii/OSGI-INF/l10n folder and are converted using said

+# plugin while building the bundle

+# native2ascii -encoding utf-8 bundle_bg.raw_properties bundle_bg.properties

+

+# OBR Plugin

+obr.pluginTitle=OSGi Хранилище

+obr.status.ok=Apache Bundle Repository услъгата е достъпна.

+obr.status.no=Нуждаете се от Apache Bundle Repository услугата за да се възползвате от тази функционалност!

+obr.version.select=Изберете версия...

+obr.repo.title=Бъндъл хранилище

+obr.action.add=Добавяне

+obr.action.search=Търсене

+obr.action.search.description=Въведе част от презентацията на бъндъла (име, описание, версия ...), \

+ или валиден OSGi филтър

+obr.action.deploy=Инсталиране на избраните

+obr.action.deploystart=Инсталиране и стартиране на избраните

+obr.repo.name=Име

+obr.repo.url=Адрес

+obr.repo.lastModified=Последна промяна

+obr.repo.actions=Действия

+obr.res.title=Достъпни ресурси

+obr.res.name=Име на ресурса

+obr.res.installedVer=Инсталирана версия

+obr.error=Грешка при филтриране на ресурсите

diff --git a/webconsole-plugins/obr/src/main/native2ascii/OSGI-INF/l10n/bundle_de.properties b/webconsole-plugins/obr/src/main/native2ascii/OSGI-INF/l10n/bundle_de.properties
new file mode 100644
index 0000000..e99dfb5
--- /dev/null
+++ b/webconsole-plugins/obr/src/main/native2ascii/OSGI-INF/l10n/bundle_de.properties
@@ -0,0 +1,50 @@
+#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.

+

+#

+# Web Console strings for reference all strings here are commented.

+# This file may be used to produce a translation of the strings

+#

+# Note that properties files are ISO-8859-1 encoded. To provide translations

+# for languages requiring different character encodings, you may use the

+# native2ascii Maven Plugin from http://mojo.codehaus.org/native2ascii-maven-plugin/

+# to translate the natively encoded files to ISO-8859-1 during bundle build

+#

+# Translations requiring non-ISO-8859-1 encoding are placed in the

+# src/main/native2ascii/OSGI-INF/l10n folder and are converted using said

+# plugin while building the bundle

+#

+

+# OBR Plugin

+obr.pluginTitle=OSGi Repository

+obr.status.ok=Der Apache Bundle Repository Service ist aktiv und bereit.

+obr.status.no=Der Apache Bundle Repository Service ist nicht aktiv!

+obr.version.select=Wähle Version...

+obr.repo.title=Bundle Repositories

+obr.action.add=Hinzufügen

+obr.action.search=Suchen

+obr.action.search.description=Geben Sie einen Teil des Präsentations- oder \

+ symoblischen Namens der gesuchten Bundles oder einen gültigen OSGi \

+ Filter Ausdruck

+obr.action.deploy=Ausgewählte Installieren

+obr.action.deploystart=Ausgewählte Installieren und Starten

+obr.repo.name=Name

+obr.repo.url=URL

+obr.repo.lastModified=Letzte Änderung

+obr.repo.actions=Aktionen

+obr.res.title=Verfügbare Resourcen

+obr.res.name=Resource Name

+obr.res.installedVer=Installierte Version

+obr.error=Fehler bei der Auswahl der Resourcen

diff --git a/webconsole-plugins/obr/src/main/native2ascii/OSGI-INF/l10n/bundle_ru.properties b/webconsole-plugins/obr/src/main/native2ascii/OSGI-INF/l10n/bundle_ru.properties
new file mode 100644
index 0000000..f3cebef
--- /dev/null
+++ b/webconsole-plugins/obr/src/main/native2ascii/OSGI-INF/l10n/bundle_ru.properties
@@ -0,0 +1,49 @@
+#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.
+
+#
+# Web Console strings for reference all strings here are commented.
+# This file may be used to produce a translation of the strings
+#
+# Note that properties files are ISO-8859-1 encoded. To provide translations
+# for languages requiring different character encodings, you may use the
+# native2ascii Maven Plugin from http://mojo.codehaus.org/native2ascii-maven-plugin/
+# to translate the natively encoded files to ISO-8859-1 during bundle build
+#
+# Translations requiring non-ISO-8859-1 encoding are placed in the
+# src/main/native2ascii/OSGI-INF/l10n folder and are converted using said
+# plugin while building the bundle
+#
+
+# OBR Plugin
+obr.pluginTitle=Хранилище OSGi
+obr.status.ok=Сервис Apache Bundle Repository запущен и работает.
+obr.status.no=Сервис Apache Bundle Repository не найден!
+obr.version.select=Выберите версию...
+obr.repo.title=Хранилище модулей
+obr.action.add=Добавить
+obr.action.search=Поиск
+obr.action.search.description=Введите слово, содержащееся в описании модуля (или в имени, версии и т. д.) \
+ или правильный OSGi фильтр
+obr.action.deploy=Установить выбранное
+obr.action.deploystart=Установить и запустить выбранное
+obr.repo.name=Имя
+obr.repo.url=Адрес
+obr.repo.lastModified=Последнее изменение
+obr.repo.actions=Действия
+obr.res.title=Доступные ресурсы
+obr.res.name=Имя ресурса
+obr.res.installedVer=Установленная версия
+obr.error=Ошибка фильтрации ресурсов
diff --git a/webconsole-plugins/obr/src/main/resources/OSGI-INF/l10n/bundle.properties b/webconsole-plugins/obr/src/main/resources/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 0000000..78812a5
--- /dev/null
+++ b/webconsole-plugins/obr/src/main/resources/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,49 @@
+#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.

+

+#

+# Web Console strings for reference all strings here are commented.

+# This file may be used to produce a translation of the strings

+#

+# Note that properties files are ISO-8859-1 encoded. To provide translations

+# for languages requiring different character encodings, you may use the

+# native2ascii Maven Plugin from http://mojo.codehaus.org/native2ascii-maven-plugin/

+# to translate the natively encoded files to ISO-8859-1 during bundle build

+#

+# Translations requiring non-ISO-8859-1 encoding are placed in the

+# src/main/native2ascii/OSGI-INF/l10n folder and are converted using said

+# plugin while building the bundle

+#

+

+# OBR Plugin

+obr.pluginTitle=OSGi Repository

+obr.status.ok=The Apache Bundle Repository service is up and running.

+obr.status.no=The Apache Bundle Repository service is not available!

+obr.version.select=Select Version...

+obr.repo.title=Bundle Repositories

+obr.action.add=Add

+obr.action.search=Search

+obr.action.search.description=Enter word contained in bundle presentation \

+ and/or symbolic name or a valid OSGi Filter Expression

+obr.action.deploy=Deploy Selected

+obr.action.deploystart=Deploy and Start Selected

+obr.repo.name=Name

+obr.repo.url=URL

+obr.repo.lastModified=Last Modified

+obr.repo.actions=Actions

+obr.res.title=Available Resources

+obr.res.name=Resource Name

+obr.res.installedVer=Installed Version

+obr.error=Error Filtering Resources

diff --git a/webconsole-plugins/obr/src/main/resources/res/plugin.css b/webconsole-plugins/obr/src/main/resources/res/plugin.css
new file mode 100644
index 0000000..a6ef84c
--- /dev/null
+++ b/webconsole-plugins/obr/src/main/resources/res/plugin.css
@@ -0,0 +1,6 @@
+label {
+    font-family: Verdana, Arial, sans-serif;
+    font-size: 1em;
+    font-style: normal;
+    font-weight: normal;
+}
\ No newline at end of file
diff --git a/webconsole-plugins/obr/src/main/resources/res/plugin.html b/webconsole-plugins/obr/src/main/resources/res/plugin.html
new file mode 100644
index 0000000..4037a24
--- /dev/null
+++ b/webconsole-plugins/obr/src/main/resources/res/plugin.html
@@ -0,0 +1,102 @@
+<script type="text/javascript" src="${pluginRoot}/res/plugin.js"></script>

+<script type="text/javascript">

+var i18n = {

+	status_ok : '${obr.status.ok}',

+	status_no : '${obr.status.no}',

+	selectVersion : '${obr.version.select}',

+	error : '${obr.error}'

+}

+var obrData = ${__data__};

+</script>

+

+<p class="statline">${obr.status.ok}</p>

+

+<div id="ifStatusOK" class="ui-helper-hidden">

+

+<div class="ui-widget-header ui-corner-top buttonGroup">

+	<span style="float: left; margin-left: 1em">${obr.repo.title}</span>

+	<input style="width: 50%" type="text" id="addRepoUri" />

+	<button id="addRepoBtn">${obr.action.add}</button>

+</div>

+

+<table id="repoTable" class="nicetable">

+	<thead>

+		<tr>

+			<th class="col_Name">${obr.repo.name}</th>

+			<th class="col_URL">${obr.repo.url}</th>

+			<th class="col_lastMod">${obr.repo.lastModified}</th>

+			<th class="col_Actions">${obr.repo.actions}</th>

+		</tr>

+	</thead>

+	<tbody> <!-- template: will be replaced dynamically by JS -->

+		<tr>

+			<td>name</td>

+			<td>url</td>

+			<td>date</td>

+			<td>

+				<ul class="icons ui-widget">

+					<li class="dynhover" title="${refresh}"><span class="ui-icon ui-icon-refresh">&nbsp;</span></li>

+					<li class="dynhover" title="${delete}"><span class="ui-icon ui-icon-trash">&nbsp;</span></li>

+				</ul>

+			</td>

+		</tr>

+	</tbody>

+</table>

+

+<br/>

+

+<div class="ui-widget-header ui-corner-top buttonGroup">

+    <span style="float: left; margin-left: 1em">${obr.res.title}</span>

+    <span>

+        <a href="${pluginRoot}?list=a">A</a>

+        <a href="${pluginRoot}?list=b">B</a>

+        <a href="${pluginRoot}?list=c">C</a>

+        <a href="${pluginRoot}?list=d">D</a>

+        <a href="${pluginRoot}?list=e">E</a>

+        <a href="${pluginRoot}?list=f">F</a>

+        <a href="${pluginRoot}?list=g">G</a>

+        <a href="${pluginRoot}?list=h">H</a>

+        <a href="${pluginRoot}?list=i">I</a>

+        <a href="${pluginRoot}?list=j">J</a>

+        <a href="${pluginRoot}?list=k">K</a>

+        <a href="${pluginRoot}?list=l">L</a>

+        <a href="${pluginRoot}?list=m">M</a>

+        <a href="${pluginRoot}?list=n">N</a>

+        <a href="${pluginRoot}?list=o">O</a>

+        <a href="${pluginRoot}?list=p">P</a>

+        <a href="${pluginRoot}?list=q">Q</a>

+        <a href="${pluginRoot}?list=r">R</a>

+        <a href="${pluginRoot}?list=s">S</a>

+        <a href="${pluginRoot}?list=t">T</a>

+        <a href="${pluginRoot}?list=u">U</a>

+        <a href="${pluginRoot}?list=v">V</a>

+        <a href="${pluginRoot}?list=w">W</a>

+        <a href="${pluginRoot}?list=x">X</a>

+        <a href="${pluginRoot}?list=y">Y</a>

+        <a href="${pluginRoot}?list=z">Z</a>

+        <a href="${pluginRoot}?list=-">?</a>

+    </span>

+    <input type="text" id="searchField" title="${obr.action.search.description}"/>

+    <button id="searchBtn">${obr.action.search}</button>

+</div>

+

+<table id="resTable" class="nicetable">

+    <thead>

+        <tr>

+            <th class="col_ResName">${obr.res.name}</th>

+            <th class="col_VersionInst">${obr.res.installedVer}</th>

+        </tr>

+    </thead>

+    <tbody>

+        <tr><td colspan="2">dummy</td></tr>

+    </tbody>

+</table>

+

+<table id="detailsTable" class="nicetable ui-helper-hidden">

+    <tbody id="detailsTableBody">

+    </tbody>

+</table>

+

+<br/>

+

+</div> <!-- ifStatusOK -->
\ No newline at end of file
diff --git a/webconsole-plugins/obr/src/main/resources/res/plugin.js b/webconsole-plugins/obr/src/main/resources/res/plugin.js
new file mode 100644
index 0000000..159ccfa
--- /dev/null
+++ b/webconsole-plugins/obr/src/main/resources/res/plugin.js
@@ -0,0 +1,510 @@
+/*

+ * 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.

+ */

+ 

+var repoTable = false;

+var repoTableTemplate = false;

+var addRepoUri = false;

+var resTable = false;

+var searchField = false;

+var ifStatusOK = false;

+

+//This prototype is provided by the Mozilla foundation and

+//is distributed under the MIT license.

+//http://www.ibiblio.org/pub/Linux/LICENSES/mit.license

+if (!Array.prototype.map)

+{

+  Array.prototype.map = function(fun /*, thisp*/)

+  {

+    var len = this.length;

+    if (typeof fun != "function")

+      throw new TypeError();

+

+    var res = new Array(len);

+    var thisp = arguments[1];

+    for (var i = 0; i < len; i++)

+    {

+      if (i in this)

+        res[i] = fun.call(thisp, this[i], i, this);

+    }

+

+    return res;

+  };

+}

+

+var uid = 0;

+function guid() {

+   uid = uid + 1;

+   return (0x10000 + uid).toString(16).substring(1) + (((1+Math.random())*0x10000)|0).toString(16).substring(1);

+}

+

+/* displays a date in the user's local timezone */

+function localTm(time) {

+    return (time ? new Date(time) : new Date()).toLocaleString();

+}

+

+function doRepoAction(action, url) {

+    if ( !url ) {

+        Xalert('Invalid URI: ' + url, 'Error');

+    } else {

+        $.post(pluginRoot, {

+            'action' : action,

+            'url'    : url

+        }, renderData, 'json');

+    }

+}

+

+function showDetails( symbolicname, version ) {

+    window.location.href = pluginRoot + '/' + symbolicname + '/' + version;

+}

+

+function showVersions( symbolicname ) {

+    var _id = symbolicname.replace(/\./g, '_');

+    $("#block" + _id).append("<div id='pluginInlineVersions" + _id + "' style='margin-left: 4em'><ul/></div>");

+    $("#img" + _id).each(function() {

+        $(this).

+            removeClass('ui-icon-triangle-1-e').//right

+            addClass('ui-icon-triangle-1-s');//down

+    });

+    $("#entry" + _id).each(function() {

+        $(this).

+            unbind('click').

+            click(function() {hideVersions(symbolicname)}).

+            attr("title", "Hide Versions");

+    });

+    var versions = [];

+    for (var i in obrData.resources ) {

+        if (obrData.resources[i].symbolicname == symbolicname) {

+            versions.push(obrData.resources[i].version);

+        }

+    }

+    versions.sort();

+    for (var i in versions) {

+        var txt = "<li><a href='javascript: showDetails(\"" + symbolicname + "\",\"" + versions[i] + "\")'>" + versions[i] + "</a></li>";

+        $("#pluginInlineVersions" + _id + " > ul").append(txt);

+    }

+}

+

+function hideVersions( symbolicname ) {

+    var _id = symbolicname.replace(/\./g, '_');

+    $("#img" + _id).each(function() {

+        $(this).

+            removeClass('ui-icon-triangle-1-s').//down

+            addClass('ui-icon-triangle-1-e');//right

+    });

+    $("#pluginInlineVersions" + _id).each(function() {

+        $(this).

+            remove();

+    });

+    $("#entry" + _id).each(function() {

+        $(this).

+            unbind('click').

+            click(function() {showVersions(symbolicname)}).

+            attr("title", "Show Versions");

+    });

+}

+

+function renderResource(res) {

+    // proceed with resource

+    var _id = res.symbolicname.replace(/\./g, '_');

+    var _tr = resTable.find('#row' + _id);

+

+    if (_tr.length == 0) { // not created yet, create it

+        var blockElement = createElement('span', '', {

+            id: 'block' + _id

+        });

+        var titleElement = createElement('span', '', {

+            id: 'entry' + _id,

+            title: "Show Versions"

+        });

+        var inputElement = createElement('span', 'ui-icon ui-icon-triangle-1-e', {

+            id: 'img' + _id,

+            style: {display: "inline-block"}

+        });

+        blockElement.appendChild(titleElement);

+        titleElement.appendChild(inputElement);

+        titleElement.appendChild(text(" "));

+        if (res.presentationname) {

+	    titleElement.appendChild(text(res.presentationname));

+	    titleElement.appendChild(text(" ("));

+	    titleElement.appendChild(text(res.symbolicname));

+	    titleElement.appendChild(text(")"));

+	} else {

+	    titleElement.appendChild(text(res.symbolicname));

+	}

+        $(titleElement).click(function() {showVersions(res.symbolicname)});

+

+        _tr = tr( null, { 'id' : 'row' + _id } , [

+            td( null, null, [ blockElement ] ),

+            td( null, null, [ text(res.installed ? res.version : '') ] )

+        ]);

+        resTable.append( _tr );

+    }

+}

+

+function getCapabilitiesByName(res, name) {

+    var caps = [];

+    for (var v in res.capabilities) {

+        if (res.capabilities[v].name == name) {

+            caps.push(res.capabilities[v]);

+        }

+    }

+    return caps;

+}

+

+function getRequirementsByName(res, name) {

+    var caps = [];

+    for (var v in res.requirements) {

+        if (res.requirements[v].name == name) {

+            caps.push(res.requirements[v]);

+        }

+    }

+    return caps;

+}

+

+function createDetailedTable(enclosing, name, headers, rows, callback) {

+    if (rows && rows.length > 0) {

+        var uuid = guid();

+        var title = createElement('span', null, null, [

+                                createElement('span', 'ui-icon ui-icon-triangle-1-e', { id: "img"+uuid, style: {display: "inline-block"} }),

+                                text(" "),

+                                text(name)

+                             ]);

+        enclosing.append(tr(null, null, [

+            td(null, null, [ title ]),

+            td(null, null, [ createElement('table', 'nicetable ui-widget ui-helper-hidden', { id: "alt1"+uuid }, [

+                                createElement('thead', null, null, [

+                                    tr(null, null, headers.map(function(x) {

+                                        return th('ui-widget-header', null, [text(x)]);

+                                    }))

+                                ]),

+                                createElement('tbody', null, null,

+                                    rows.map(function(x) {

+                                        var values = callback(x);

+                                        var tds = values.map(function(x) {

+                                            return td(null, null, [x]);

+                                        });

+                                        return tr(null, null, tds);

+                                    })

+                                )

+                             ]),

+                             createElement('span', null, { id: "alt2"+uuid }, [

+                                text(rows.length)

+                             ])

+            ])

+        ]));

+        $(title).

+                unbind('click').

+                click(function(event) {

+                    event.preventDefault();

+                    $("#img"+uuid).toggleClass('ui-icon-triangle-1-s').//down

+                                   toggleClass('ui-icon-triangle-1-e');//right

+                    $("#alt1"+uuid).toggle();

+                    $("#alt2"+uuid).toggle();

+                });

+    }

+}

+

+function trim(stringToTrim) {

+    return stringToTrim.replace(/^\s+|\s+$/g,"");

+}

+

+function parseSimpleFilter(filter) {

+    filter = filter.substring(1, filter.length-1);

+    var start = 0;

+    var pos = 0;

+    var c = filter.charAt(pos);

+    while (c != '~' && c != '<' && c != '>' && c != '=' && c != '(' && c != ')') {

+        if (c == '<' && filterChars[pos+1] == '*') {

+            break;

+        }

+        if (c == '*' && filterChars[pos+1] == '>') {

+            break;

+        }

+        pos++;

+        c = filter.charAt(pos);

+    }

+    if (pos == start) {

+        throw ("Missing attr: " + filter.substring(pos));

+    }

+

+    var attr = trim(filter.substring(start, pos));

+    var oper = filter.substring(pos, pos+2);

+    var value;

+    if (oper == '*>' || oper == '~=' || oper == '>=' || oper == '<=' || oper == '<*') {

+        value = trim(filter.substring(pos+2));

+        if (value == '') {

+            throw ("Missing value: " + filter.substring(pos));

+        }

+

+        return { operator: oper, operands: [ attr, value ]};

+    } else {

+        if (c != '=') {

+            throw ("Invalid operator: " + filter.substring(pos));

+        }

+        oper = '=';

+        value = filter.substring(pos+1);

+        if (value == '*' ) {

+            return { operator: '=*', operands: [ attr ]};

+        }

+        return { operator: '=', operands: [ attr, value ]};

+    }

+}

+

+function parseFilter(filter) {

+    if (filter.charAt(0) != "(" || filter.charAt(filter.length-1) != ")") {

+        throw "Wrong parenthesis: " + filter;

+    }

+    if (filter.charAt(1) == "!") {

+        return { operator: filter.charAt(1), operands: [ parseFilter(filter.substring(2, filter.length-1)) ] };

+    }

+    if (filter.charAt(1) == "|" || filter.charAt(1) == "&") {

+        var inner = filter.substring(2, filter.length-1);

+        var flts = inner.match(/\([^\(\)]*(\([^\(\)]*(\([^\(\)]*(\([^\(\)]*\))*[^\(\)]*\))*[^\(\)]*\))*[^\(\)]*\)/g);

+        return { operator: filter.charAt(1), operands: flts.map(function(x) { return parseFilter(x); }) };

+    }

+    return parseSimpleFilter(filter);

+}

+

+function simplify(filter) {

+    if (filter.operator == '&' || filter.operator == '|') {

+        filter.operands = filter.operands.map(function(x) { return simplify(x); });

+    } else if (filter.operator == '!') {

+        if (filter.operands[0].operator == '<=') {

+            filter.operator = '>';

+            filter.operands = filter.operands[0].operands;

+        } else if (filter.operands[0].operator == '>=') {

+            filter.operator = '<';

+            filter.operands = filter.operands[0].operands;

+        }

+    }

+    return filter;

+}

+

+function addRow(tbody, key, value) {

+    if (value) {

+        tbody.append( tr(null, null, [

+            td(null, null, [ text(key) ]),

+            td(null, null, [ text(value) ])

+        ]));

+    }

+}

+

+function renderDetailedResource(res) {

+    var tbody = $('#detailsTableBody');

+

+    tbody.append( tr(null, null, [

+        th('ui-widget-header', null, [

+            text("Resource")

+        ]),

+        th('ui-widget-header', null, [

+            createElement('form', 'button-group', { method: "post"}, [

+                createElement('input', null, { type: "hidden", name: "bundle", value: res.id}),

+                createElement('input', 'ui-state-default ui-corner-all', { type: "submit", name: "deploy", value: "Deploy" }, [ text("dummy")]),

+                createElement('input', 'ui-state-default ui-corner-all', { type: "submit", name: "deploystart", value: "Deploy and Start" }, [ text("dummy")]),

+                text(" "),

+                createElement('input', 'ui-state-default ui-corner-all', { id: "optional", type: "checkbox", name: "optional" }),

+                text(" "),

+                createElement('label', 'ui-widget', { 'for': "optional" }, [ text("deploy optional dependencies") ])

+            ])

+        ])

+    ]));

+

+    addRow(tbody, "Name", res.presentationname);

+    addRow(tbody, "Description", res.description);

+    addRow(tbody, "Symbolic name", res.symbolicname);

+    addRow(tbody, "Version", res.version);

+    addRow(tbody, "URI", res.uri);

+    addRow(tbody, "Documentation", res.documentation);

+    addRow(tbody, "Javadoc", res.javadoc);

+    addRow(tbody, "Source", res.source);

+    addRow(tbody, "License", res.license);

+    addRow(tbody, "Copyright", res.copyright);

+    addRow(tbody, "Size", res.size);

+

+    // Exported packages

+    createDetailedTable(tbody, "Exported packages", ["Package", "Version"],

+                        getCapabilitiesByName(res, "package").sort(function(a,b) {

+                            var pa = a.properties['package'], pb = b.properties['package']; return pa == pb ? 0 : pa < pb ? -1 : +1;

+                        }),

+                        function(p) {

+                            return [ text(p.properties['package']), text(p.properties['version']) ];

+                        });

+    // Exported services

+    createDetailedTable(tbody, "Exported services", ["Service"], getCapabilitiesByName(res, "service"), function(p) {

+                            return [ text(p.properties['service']) ];

+                        });

+    // Imported packages

+    createDetailedTable(tbody, "Imported packages", ["Package", "Version", "Optional"], getRequirementsByName(res, "package"), function(p) {

+                            var f = parseFilter(p.filter);

+                            simplify(f);

+                            var n, vmin = "[0.0.0", vmax = "infinity)";

+                            if (f.operator == '&') {

+                                for (var i in f.operands) {

+                                    var fi = f.operands[i];

+                                    if (fi.operands[0] == 'package' && fi.operator == '=') {

+                                        n = fi.operands[1];

+                                    }

+                                    if (fi.operands[0] == 'version') {

+                                        if (fi.operator == '>=') {

+                                            vmin = '[' + fi.operands[1];

+                                        }

+                                        if (fi.operator == '>') {

+                                            vmin = '(' + fi.operands[1];

+                                        }

+                                        if (fi.operator == '<=') {

+                                            vmax = fi.operands[1] + "]";

+                                        }

+                                        if (fi.operator == '<') {

+                                            vmax = fi.operands[1] + ")";

+                                        }

+                                    }

+                                }

+                            }

+                            return [ text(n ? n : p.filter), text(vmin + ", " + vmax), text(p.optional) ];

+                        });

+    // Imported bundles

+    createDetailedTable(tbody, "Imported bundles", ["Bundle", "Version", "Optional"], getRequirementsByName(res, "bundle"), function(p) {

+                            return [ text(p.filter), text(""), text(p.optional) ];

+                        });

+    // Imported services

+    createDetailedTable(tbody, "Imported services", ["Service", "Optional"], getRequirementsByName(res, "service"), function(p) {

+                            return [ text(p.filter), text(p.optional) ];

+                        });

+    // Required dependencies

+    createDetailedTable(tbody, "Dependencies", ["Name", "Version"], res.required, function(p) {

+                            var a = createElement('a', null, { href: (pluginRoot + '/' + p.symbolicname + '/' + p.version) });

+                            a.appendChild(text(p.presentationname ? p.presentationname : p.symbolicname));

+                            return [ a, text(p.version) ];

+                        });

+    // Optional dependencies

+    createDetailedTable(tbody, "Optional Dependencies", ["Name", "Version"], res.optional, function(p) {

+                            var a = createElement('a', null, { href: (pluginRoot + '/' + p.symbolicname + '/' + p.version) });

+                            a.appendChild(text(p.presentationname ? p.presentationname : p.symbolicname));

+                            return [ a, text(p.version) ];

+                        });

+    // Unsatisfied requirements

+    createDetailedTable(tbody, "Unsatisfied Requirements", ["Requirement", "Optional"], res.unsatisfied, function(p) {

+                            return [ text(p.filter), text(p.optional) ];

+                        });

+

+//    $('#detailsTableBody').append( tr(null, null, [ th('ui-widget-header', { colspan: 2 }, [ text("Resource") ]) ]) );

+//    $('#detailsTableBody').append( tbody );

+}

+

+function renderRepository(repo) {

+    var _tr = repoTableTemplate.clone();

+    _tr.find('td:eq(0)').text( repo.name );

+    _tr.find('td:eq(1)').text( repo.url );

+    _tr.find('td:eq(2)').text( localTm(repo.lastModified) );

+    _tr.find('li:eq(0)').click(function() {

+        doRepoAction('refresh', repo.url);

+    });

+    _tr.find('li:eq(1)').click(function() {

+        doRepoAction('delete', repo.url);

+    });

+    repoTable.append(_tr);

+}

+

+function renderData() {

+    repoTable.empty();

+    resTable.empty();

+    if ( obrData.status ) {

+        $('.statline').html(i18n.status_ok);

+        ifStatusOK.removeClass('ui-helper-hidden');

+        for (var i in obrData.repositories ) {

+            renderRepository( obrData.repositories[i] );

+        }

+        if (obrData.details) {

+            $('#resTable').addClass('ui-helper-hidden');

+            $('#detailsTable').removeClass('ui-helper-hidden');

+            for (var i in obrData.resources ) {

+                renderDetailedResource( obrData.resources[i] );

+            }

+        } else if (obrData.resources) {

+            for (var i in obrData.resources ) {

+                renderResource( obrData.resources[i] );

+            }

+        } else if (obrData.error) {

+            _tr = tr( "ui-state-error", null , [

+                      td( "ui-state-error-text", { 'colspan': '2' }, 

+                	  [ text(i18n.error + ": " + obrData.error) ] )

+                  ]);

+            resTable.append( _tr );

+        }

+    } else {

+        $('.statline').html(i18n.status_no);

+        ifStatusOK.addClass('ui-helper-hidden');

+    }

+}

+

+

+$.extend({

+  getUrlVars: function(){

+    var vars = [], hash;

+    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');

+    for(var i = 0; i < hashes.length; i++)

+    {

+      var j = hashes[i].indexOf('=');

+      if (j > 0) {

+        var k = hashes[i].slice(0, j);

+        var v = hashes[i].slice(j + 1);

+        vars.push(k);

+        vars[k] = v;

+      } else {

+        vars.push(hashes[i]);

+        vars[hashes[i]] = true;

+      }

+    }

+    return vars;

+  },

+  getUrlVar: function(name){

+    return $.getUrlVars()[name];

+  }

+});

+

+$(document).ready( function() {

+    repoTable = $('#repoTable tbody');

+    repoTableTemplate = repoTable.find('tr').clone();

+    addRepoUri = $('#addRepoUri');

+    resTable = $('#resTable tbody').empty();

+    searchField = $('#searchField');

+    ifStatusOK = $('#ifStatusOK');

+    

+    var query = $.getUrlVar('query');

+    if (query) {

+        searchField.val(decodeURIComponent(query));

+    }

+

+    $('#addRepoBtn').click(function(event) {

+        event.preventDefault();

+        doRepoAction('add', addRepoUri.val());

+    });

+    $('#searchBtn').click(function(event) {

+        event.preventDefault();

+        window.location.href = pluginRoot + '?query=' + encodeURIComponent(searchField.val());

+    });

+    searchField.keypress(function(event) {

+        if (event.keyCode == 13) {

+            event.preventDefault();

+            $('#searchBtn').click();

+        }

+    });

+

+    renderData();

+    initStaticWidgets();

+});

+

diff --git a/webconsole-plugins/shell/LICENSE b/webconsole-plugins/shell/LICENSE
new file mode 100644
index 0000000..75b5248
--- /dev/null
+++ b/webconsole-plugins/shell/LICENSE
@@ -0,0 +1,202 @@
+

+                                 Apache License

+                           Version 2.0, January 2004

+                        http://www.apache.org/licenses/

+

+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

+

+   1. Definitions.

+

+      "License" shall mean the terms and conditions for use, reproduction,

+      and distribution as defined by Sections 1 through 9 of this document.

+

+      "Licensor" shall mean the copyright owner or entity authorized by

+      the copyright owner that is granting the License.

+

+      "Legal Entity" shall mean the union of the acting entity and all

+      other entities that control, are controlled by, or are under common

+      control with that entity. For the purposes of this definition,

+      "control" means (i) the power, direct or indirect, to cause the

+      direction or management of such entity, whether by contract or

+      otherwise, or (ii) ownership of fifty percent (50%) or more of the

+      outstanding shares, or (iii) beneficial ownership of such entity.

+

+      "You" (or "Your") shall mean an individual or Legal Entity

+      exercising permissions granted by this License.

+

+      "Source" form shall mean the preferred form for making modifications,

+      including but not limited to software source code, documentation

+      source, and configuration files.

+

+      "Object" form shall mean any form resulting from mechanical

+      transformation or translation of a Source form, including but

+      not limited to compiled object code, generated documentation,

+      and conversions to other media types.

+

+      "Work" shall mean the work of authorship, whether in Source or

+      Object form, made available under the License, as indicated by a

+      copyright notice that is included in or attached to the work

+      (an example is provided in the Appendix below).

+

+      "Derivative Works" shall mean any work, whether in Source or Object

+      form, that is based on (or derived from) the Work and for which the

+      editorial revisions, annotations, elaborations, or other modifications

+      represent, as a whole, an original work of authorship. For the purposes

+      of this License, Derivative Works shall not include works that remain

+      separable from, or merely link (or bind by name) to the interfaces of,

+      the Work and Derivative Works thereof.

+

+      "Contribution" shall mean any work of authorship, including

+      the original version of the Work and any modifications or additions

+      to that Work or Derivative Works thereof, that is intentionally

+      submitted to Licensor for inclusion in the Work by the copyright owner

+      or by an individual or Legal Entity authorized to submit on behalf of

+      the copyright owner. For the purposes of this definition, "submitted"

+      means any form of electronic, verbal, or written communication sent

+      to the Licensor or its representatives, including but not limited to

+      communication on electronic mailing lists, source code control systems,

+      and issue tracking systems that are managed by, or on behalf of, the

+      Licensor for the purpose of discussing and improving the Work, but

+      excluding communication that is conspicuously marked or otherwise

+      designated in writing by the copyright owner as "Not a Contribution."

+

+      "Contributor" shall mean Licensor and any individual or Legal Entity

+      on behalf of whom a Contribution has been received by Licensor and

+      subsequently incorporated within the Work.

+

+   2. Grant of Copyright License. Subject to the terms and conditions of

+      this License, each Contributor hereby grants to You a perpetual,

+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable

+      copyright license to reproduce, prepare Derivative Works of,

+      publicly display, publicly perform, sublicense, and distribute the

+      Work and such Derivative Works in Source or Object form.

+

+   3. Grant of Patent License. Subject to the terms and conditions of

+      this License, each Contributor hereby grants to You a perpetual,

+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable

+      (except as stated in this section) patent license to make, have made,

+      use, offer to sell, sell, import, and otherwise transfer the Work,

+      where such license applies only to those patent claims licensable

+      by such Contributor that are necessarily infringed by their

+      Contribution(s) alone or by combination of their Contribution(s)

+      with the Work to which such Contribution(s) was submitted. If You

+      institute patent litigation against any entity (including a

+      cross-claim or counterclaim in a lawsuit) alleging that the Work

+      or a Contribution incorporated within the Work constitutes direct

+      or contributory patent infringement, then any patent licenses

+      granted to You under this License for that Work shall terminate

+      as of the date such litigation is filed.

+

+   4. Redistribution. You may reproduce and distribute copies of the

+      Work or Derivative Works thereof in any medium, with or without

+      modifications, and in Source or Object form, provided that You

+      meet the following conditions:

+

+      (a) You must give any other recipients of the Work or

+          Derivative Works a copy of this License; and

+

+      (b) You must cause any modified files to carry prominent notices

+          stating that You changed the files; and

+

+      (c) You must retain, in the Source form of any Derivative Works

+          that You distribute, all copyright, patent, trademark, and

+          attribution notices from the Source form of the Work,

+          excluding those notices that do not pertain to any part of

+          the Derivative Works; and

+

+      (d) If the Work includes a "NOTICE" text file as part of its

+          distribution, then any Derivative Works that You distribute must

+          include a readable copy of the attribution notices contained

+          within such NOTICE file, excluding those notices that do not

+          pertain to any part of the Derivative Works, in at least one

+          of the following places: within a NOTICE text file distributed

+          as part of the Derivative Works; within the Source form or

+          documentation, if provided along with the Derivative Works; or,

+          within a display generated by the Derivative Works, if and

+          wherever such third-party notices normally appear. The contents

+          of the NOTICE file are for informational purposes only and

+          do not modify the License. You may add Your own attribution

+          notices within Derivative Works that You distribute, alongside

+          or as an addendum to the NOTICE text from the Work, provided

+          that such additional attribution notices cannot be construed

+          as modifying the License.

+

+      You may add Your own copyright statement to Your modifications and

+      may provide additional or different license terms and conditions

+      for use, reproduction, or distribution of Your modifications, or

+      for any such Derivative Works as a whole, provided Your use,

+      reproduction, and distribution of the Work otherwise complies with

+      the conditions stated in this License.

+

+   5. Submission of Contributions. Unless You explicitly state otherwise,

+      any Contribution intentionally submitted for inclusion in the Work

+      by You to the Licensor shall be under the terms and conditions of

+      this License, without any additional terms or conditions.

+      Notwithstanding the above, nothing herein shall supersede or modify

+      the terms of any separate license agreement you may have executed

+      with Licensor regarding such Contributions.

+

+   6. Trademarks. This License does not grant permission to use the trade

+      names, trademarks, service marks, or product names of the Licensor,

+      except as required for reasonable and customary use in describing the

+      origin of the Work and reproducing the content of the NOTICE file.

+

+   7. Disclaimer of Warranty. Unless required by applicable law or

+      agreed to in writing, Licensor provides the Work (and each

+      Contributor provides its Contributions) on an "AS IS" BASIS,

+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or

+      implied, including, without limitation, any warranties or conditions

+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A

+      PARTICULAR PURPOSE. You are solely responsible for determining the

+      appropriateness of using or redistributing the Work and assume any

+      risks associated with Your exercise of permissions under this License.

+

+   8. Limitation of Liability. In no event and under no legal theory,

+      whether in tort (including negligence), contract, or otherwise,

+      unless required by applicable law (such as deliberate and grossly

+      negligent acts) or agreed to in writing, shall any Contributor be

+      liable to You for damages, including any direct, indirect, special,

+      incidental, or consequential damages of any character arising as a

+      result of this License or out of the use or inability to use the

+      Work (including but not limited to damages for loss of goodwill,

+      work stoppage, computer failure or malfunction, or any and all

+      other commercial damages or losses), even if such Contributor

+      has been advised of the possibility of such damages.

+

+   9. Accepting Warranty or Additional Liability. While redistributing

+      the Work or Derivative Works thereof, You may choose to offer,

+      and charge a fee for, acceptance of support, warranty, indemnity,

+      or other liability obligations and/or rights consistent with this

+      License. However, in accepting such obligations, You may act only

+      on Your own behalf and on Your sole responsibility, not on behalf

+      of any other Contributor, and only if You agree to indemnify,

+      defend, and hold each Contributor harmless for any liability

+      incurred by, or claims asserted against, such Contributor by reason

+      of your accepting any such warranty or additional liability.

+

+   END OF TERMS AND CONDITIONS

+

+   APPENDIX: How to apply the Apache License to your work.

+

+      To apply the Apache License to your work, attach the following

+      boilerplate notice, with the fields enclosed by brackets "[]"

+      replaced with your own identifying information. (Don't include

+      the brackets!)  The text should be enclosed in the appropriate

+      comment syntax for the file format. We also recommend that a

+      file or class name and description of purpose be included on the

+      same "printed page" as the copyright notice for easier

+      identification within third-party archives.

+

+   Copyright [yyyy] [name of copyright owner]

+

+   Licensed 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.

diff --git a/webconsole-plugins/shell/NOTICE b/webconsole-plugins/shell/NOTICE
new file mode 100644
index 0000000..3a3923a
--- /dev/null
+++ b/webconsole-plugins/shell/NOTICE
@@ -0,0 +1,21 @@
+Apache Felix OSGi Web Console Event Plugin

+Copyright 2007-2010 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.

+

+

+II. Used Software

+

+This product uses software developed at

+The OSGi Alliance (http://www.osgi.org/).

+Copyright (c) OSGi Alliance (2000, 2009).

+Licensed under the Apache License 2.0.

+

+

+III. License Summary

+- Apache License 2.0

diff --git a/webconsole-plugins/shell/pom.xml b/webconsole-plugins/shell/pom.xml
new file mode 100644
index 0000000..661d3cd
--- /dev/null
+++ b/webconsole-plugins/shell/pom.xml
@@ -0,0 +1,114 @@
+<!-- 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. -->

+<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/maven-v4_0_0.xsd">

+

+	<modelVersion>4.0.0</modelVersion>

+	<parent>

+		<groupId>org.apache.felix</groupId>

+		<artifactId>felix-parent</artifactId>

+		<version>1.2.0</version>

+		<relativePath>../../../pom/pom.xml</relativePath>

+	</parent>

+

+	<artifactId>org.apache.felix.webconsole.plugins.shell</artifactId>

+	<packaging>bundle</packaging>

+	<version>1.0.0-SNAPSHOT</version>

+

+	<name>Apache Felix Web Console Shell Plugin</name>

+	<description>

+        This is a plugin for the Apache Felix OSGi web console that provides access to shell/console commands.

+    </description>

+

+	<scm>

+		<connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/webconsole-plugins/shell</connection>

+		<developerConnection>scm:svn:https://svn.apache.org/repos/asf/felix/trunk/webconsole-plugins/shell</developerConnection>

+		<url>http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/shell</url>

+	</scm>

+

+	<build>

+		<plugins>

+			<!-- translate UTF-8 encoded properties files to ISO-8859-1 -->

+			<plugin>

+				<groupId>org.codehaus.mojo</groupId>

+				<artifactId>native2ascii-maven-plugin</artifactId>

+				<version>1.0-alpha-1</version>

+				<executions>

+					<execution>

+						<goals>

+							<goal>native2ascii</goal>

+						</goals>

+						<configuration>

+							<encoding>UTF-8</encoding>

+						</configuration>

+					</execution>

+				</executions>

+			</plugin>

+

+			<plugin>

+				<groupId>org.apache.felix</groupId>

+				<artifactId>maven-bundle-plugin</artifactId>

+				<version>2.0.1</version>

+				<extensions>true</extensions>

+				<configuration>

+					<instructions>

+						<Bundle-SymbolicName>

+							${artifactId}

+                        </Bundle-SymbolicName>

+						<Bundle-Activator>

+							org.apache.felix.webconsole.plugins.shell.internal.Activator

+                        </Bundle-Activator>

+					</instructions>

+				</configuration>

+			</plugin>

+		</plugins>

+	</build>

+

+	<dependencies>

+		<dependency>

+			<groupId>javax.servlet</groupId>

+			<artifactId>servlet-api</artifactId>

+			<version>2.4</version>

+			<scope>provided</scope>

+		</dependency>

+		<dependency>

+			<groupId>org.osgi</groupId>

+			<artifactId>org.osgi.core</artifactId>

+			<version>4.0.0</version>

+			<scope>provided</scope>

+		</dependency>

+		<dependency>

+			<groupId>org.osgi</groupId>

+			<artifactId>org.osgi.compendium</artifactId>

+			<version>4.1.0</version>

+			<scope>provided</scope>

+		</dependency>

+		<dependency>

+			<groupId>org.json</groupId>

+			<artifactId>json</artifactId>

+			<version>20070829</version>

+			<scope>compile</scope>

+			<optional>true</optional>

+		</dependency>

+		<dependency>

+			<groupId>org.apache.felix</groupId>

+			<artifactId>org.apache.felix.webconsole</artifactId>

+			<version>3.0.0</version>

+			<scope>provided</scope>

+		</dependency>

+        <dependency>

+            <groupId>org.apache.felix</groupId>

+            <artifactId>org.apache.felix.shell</artifactId>

+            <version>1.0.0</version>

+            <scope>provided</scope>

+        </dependency>

+	</dependencies>

+</project>

diff --git a/webconsole-plugins/shell/src/main/java/org/apache/felix/webconsole/plugins/shell/internal/Activator.java b/webconsole-plugins/shell/src/main/java/org/apache/felix/webconsole/plugins/shell/internal/Activator.java
new file mode 100644
index 0000000..c26abac
--- /dev/null
+++ b/webconsole-plugins/shell/src/main/java/org/apache/felix/webconsole/plugins/shell/internal/Activator.java
@@ -0,0 +1,98 @@
+/*

+ * 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.webconsole.plugins.shell.internal;

+

+import org.apache.felix.shell.ShellService;

+import org.apache.felix.webconsole.SimpleWebConsolePlugin;

+import org.osgi.framework.BundleActivator;

+import org.osgi.framework.BundleContext;

+import org.osgi.framework.ServiceReference;

+import org.osgi.util.tracker.ServiceTracker;

+import org.osgi.util.tracker.ServiceTrackerCustomizer;

+

+/**

+ * Activator is the main starting class.

+ */

+public class Activator implements BundleActivator, ServiceTrackerCustomizer

+{

+

+    private ServiceTracker tracker;

+    private BundleContext context;

+

+    private SimpleWebConsolePlugin plugin;

+

+    /**

+     * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)

+     */

+    public final void start(BundleContext context) throws Exception

+    {

+        this.context = context;

+        this.tracker = new ServiceTracker(context, ShellService.class.getName(), this);

+        this.tracker.open();

+    }

+

+    /**

+     * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)

+     */

+    public final void stop(BundleContext context) throws Exception

+    {

+        if (tracker != null)

+        {

+            tracker.close();

+            tracker = null;

+        }

+    }

+

+    // - begin tracker

+    /**

+     * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference,

+     *      java.lang.Object)

+     */

+    public final void modifiedService(ServiceReference reference, Object service)

+    {/* unused */

+    }

+

+    /**

+     * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference)

+     */

+    public final Object addingService(ServiceReference reference)

+    {

+        SimpleWebConsolePlugin plugin = this.plugin;

+        if (plugin == null)

+        {

+            this.plugin = plugin = new WebConsolePlugin(tracker).register(context);

+        }

+

+        return context.getService(reference);

+    }

+

+    /**

+     * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference,

+     *      java.lang.Object)

+     */

+    public final void removedService(ServiceReference reference, Object service)

+    {

+        SimpleWebConsolePlugin plugin = this.plugin;

+

+        if (tracker.getTrackingCount() == 0 && plugin != null)

+        {

+            plugin.unregister();

+            this.plugin = null;

+        }

+

+    }

+}

diff --git a/webconsole-plugins/shell/src/main/java/org/apache/felix/webconsole/plugins/shell/internal/WebConsolePlugin.java b/webconsole-plugins/shell/src/main/java/org/apache/felix/webconsole/plugins/shell/internal/WebConsolePlugin.java
new file mode 100644
index 0000000..9508ebc
--- /dev/null
+++ b/webconsole-plugins/shell/src/main/java/org/apache/felix/webconsole/plugins/shell/internal/WebConsolePlugin.java
@@ -0,0 +1,150 @@
+/*
+ * 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.webconsole.plugins.shell.internal;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.felix.shell.ShellService;
+import org.apache.felix.webconsole.DefaultVariableResolver;
+import org.apache.felix.webconsole.SimpleWebConsolePlugin;
+import org.apache.felix.webconsole.WebConsoleUtil;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * ShellServlet provides a Web bases interface to the Apache shell service, allowing
+ * the user to execute shell commands from the browser.
+ */
+class WebConsolePlugin extends SimpleWebConsolePlugin
+{
+
+    private static final String LABEL = "shell"; //$NON-NLS-1$
+    private static final String TITLE = "%shell.pluginTitle"; //$NON-NLS-1$
+    private static final String CSS[] = { "/" + LABEL + "/res/plugin.css" }; //$NON-NLS-1$ //$NON-NLS-2$
+
+    private final ServiceTracker tracker;
+
+    // templates
+    private final String TEMPLATE;
+
+    WebConsolePlugin(ServiceTracker tracker)
+    {
+        super(LABEL, TITLE, CSS);
+
+        // load templates
+        TEMPLATE = readTemplateFile("/res/plugin.html"); //$NON-NLS-1$
+        this.tracker = tracker;
+    }
+
+    /**
+     * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+     */
+    protected void doPost(HttpServletRequest request, HttpServletResponse response)
+        throws ServletException, IOException
+    {
+        response.setCharacterEncoding("utf-8"); //$NON-NLS-1$
+        response.setContentType("text/html"); //$NON-NLS-1$
+
+        PrintWriter pw = response.getWriter();
+
+        try
+        {
+            String command = request.getParameter("command"); //$NON-NLS-1$
+            if (command != null)
+            {
+                command = WebConsoleUtil.urlDecode(command);
+            }
+
+            pw.print("<span class=\"consolecommand\">-&gt; "); //$NON-NLS-1$
+            pw.print(command == null ? "" : WebConsoleUtil.escapeHtml(command)); //$NON-NLS-1$
+            pw.println("</span><br />"); //$NON-NLS-1$
+
+            if (command != null && command.length() > 0)
+            {
+                ShellService shellService = getShellService();
+                if (shellService != null)
+                {
+                    ByteArrayOutputStream baosOut = new ByteArrayOutputStream();
+                    ByteArrayOutputStream baosErr = new ByteArrayOutputStream();
+
+                    shellService.executeCommand(command, new PrintStream(baosOut, true),
+                        new PrintStream(baosErr, true));
+                    if (baosOut.size() > 0)
+                    {
+                        pw.print(WebConsoleUtil.escapeHtml(new String(
+                            baosOut.toByteArray())));
+                    }
+                    if (baosErr.size() > 0)
+                    {
+                        pw.print("<span class=\"error\">"); //$NON-NLS-1$
+                        pw.print(WebConsoleUtil.escapeHtml(new String(
+                            baosErr.toByteArray())));
+                        pw.println("</span>"); //$NON-NLS-1$
+                    }
+                }
+                else
+                {
+                    pw.print("<span class=\"error\">"); //$NON-NLS-1$
+                    pw.print("Error: No shell service available<br />");
+                    pw.println("</span>"); //$NON-NLS-1$
+                }
+            }
+        }
+        catch (Throwable t)
+        {
+            pw.print("<span class=\"error\">"); //$NON-NLS-1$
+            StringWriter out = new StringWriter();
+            t.printStackTrace(new PrintWriter(out, true));
+            pw.print(WebConsoleUtil.escapeHtml(out.toString()));
+            pw.println("</span>"); //$NON-NLS-1$
+        }
+    }
+
+    /**
+     * @see org.apache.felix.webconsole.AbstractWebConsolePlugin#renderContent(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+     */
+    protected void renderContent(HttpServletRequest request, HttpServletResponse response)
+        throws IOException
+    {
+        DefaultVariableResolver vr = (DefaultVariableResolver) WebConsoleUtil.getVariableResolver(request);
+        if (getShellService() == null)
+        {
+            vr.put("shell.status", "Shell Service not available"); //$NON-NLS-1$
+            vr.put("shell.disabled", "true"); //$NON-NLS-1$ //$NON-NLS-2$
+        }
+        else
+        {
+            vr.put("shell.disabled", "false"); //$NON-NLS-1$ //$NON-NLS-2$
+        }
+        response.getWriter().print(TEMPLATE);
+    }
+
+    private final ShellService getShellService()
+    {
+        return (ShellService) tracker.getService();
+    }
+
+}
diff --git a/webconsole-plugins/shell/src/main/native2ascii/OSGI-INF/l10n/bundle_bg.properties b/webconsole-plugins/shell/src/main/native2ascii/OSGI-INF/l10n/bundle_bg.properties
new file mode 100644
index 0000000..b2c2e0f
--- /dev/null
+++ b/webconsole-plugins/shell/src/main/native2ascii/OSGI-INF/l10n/bundle_bg.properties
@@ -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.

+

+#

+# Web Console strings for reference all strings here are commented.

+# This file may be used to produce a translation of the strings

+#

+# Note that properties files are ISO-8859-1 encoded. To provide translations

+# for languages requiring different character encodings, you may use the

+# native2ascii Maven Plugin from http://mojo.codehaus.org/native2ascii-maven-plugin/

+# to translate the natively encoded files to ISO-8859-1 during bundle build

+#

+# Translations requiring non-ISO-8859-1 encoding are placed in the

+# src/main/native2ascii/OSGI-INF/l10n folder and are converted using said

+# plugin while building the bundle

+# native2ascii -encoding utf-8 bundle_bg.raw_properties bundle_bg.properties

+

+# Shell plugin

+shell.pluginTitle=Конзола

+shell.clear=Изчистване

+shell.status=Използвайте командният ред за изпълнение на команди.

diff --git a/webconsole-plugins/shell/src/main/native2ascii/OSGI-INF/l10n/bundle_de.properties b/webconsole-plugins/shell/src/main/native2ascii/OSGI-INF/l10n/bundle_de.properties
new file mode 100644
index 0000000..265adcc
--- /dev/null
+++ b/webconsole-plugins/shell/src/main/native2ascii/OSGI-INF/l10n/bundle_de.properties
@@ -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.

+

+#

+# Web Console strings for reference all strings here are commented.

+# This file may be used to produce a translation of the strings

+#

+# Note that properties files are ISO-8859-1 encoded. To provide translations

+# for languages requiring different character encodings, you may use the

+# native2ascii Maven Plugin from http://mojo.codehaus.org/native2ascii-maven-plugin/

+# to translate the natively encoded files to ISO-8859-1 during bundle build

+#

+# Translations requiring non-ISO-8859-1 encoding are placed in the

+# src/main/native2ascii/OSGI-INF/l10n folder and are converted using said

+# plugin while building the bundle

+#

+

+# Shell plugin

+shell.pluginTitle=Shell

+shell.clear=Löschen

+shell.status=Nutzen Sie das Eingabefeld um Shell Kommandos auszuführen.

diff --git a/webconsole-plugins/shell/src/main/native2ascii/OSGI-INF/l10n/bundle_ru.properties b/webconsole-plugins/shell/src/main/native2ascii/OSGI-INF/l10n/bundle_ru.properties
new file mode 100644
index 0000000..88b47dc
--- /dev/null
+++ b/webconsole-plugins/shell/src/main/native2ascii/OSGI-INF/l10n/bundle_ru.properties
@@ -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.
+
+#
+# Web Console strings for reference all strings here are commented.
+# This file may be used to produce a translation of the strings
+#
+# Note that properties files are ISO-8859-1 encoded. To provide translations
+# for languages requiring different character encodings, you may use the
+# native2ascii Maven Plugin from http://mojo.codehaus.org/native2ascii-maven-plugin/
+# to translate the natively encoded files to ISO-8859-1 during bundle build
+#
+# Translations requiring non-ISO-8859-1 encoding are placed in the
+# src/main/native2ascii/OSGI-INF/l10n folder and are converted using said
+# plugin while building the bundle
+#
+
+# Shell plugin
+shell.pluginTitle=Консоль
+shell.clear=Очистить
+shell.status=Используйте строку ввода для выполнения команд в консоли.
diff --git a/webconsole-plugins/shell/src/main/resources/OSGI-INF/l10n/bundle.properties b/webconsole-plugins/shell/src/main/resources/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 0000000..bf0b203
--- /dev/null
+++ b/webconsole-plugins/shell/src/main/resources/OSGI-INF/l10n/bundle.properties
@@ -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.

+

+#

+# Web Console strings for reference all strings here are commented.

+# This file may be used to produce a translation of the strings

+#

+# Note that properties files are ISO-8859-1 encoded. To provide translations

+# for languages requiring different character encodings, you may use the

+# native2ascii Maven Plugin from http://mojo.codehaus.org/native2ascii-maven-plugin/

+# to translate the natively encoded files to ISO-8859-1 during bundle build

+#

+# Translations requiring non-ISO-8859-1 encoding are placed in the

+# src/main/native2ascii/OSGI-INF/l10n folder and are converted using said

+# plugin while building the bundle

+#

+

+# Shell plugin

+shell.pluginTitle=Shell

+shell.clear=Clear

+shell.status=Use the command prompt to execute shell commands.

diff --git a/webconsole-plugins/shell/src/main/resources/res/plugin.css b/webconsole-plugins/shell/src/main/resources/res/plugin.css
new file mode 100644
index 0000000..e164930
--- /dev/null
+++ b/webconsole-plugins/shell/src/main/resources/res/plugin.css
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+#consoleframe {
+    font-family: monospace;
+    background-color: #f0f0f0;
+    height: 500px;
+    overflow: auto;
+}
+
+span.consolecommand {
+    white-space: pre;
+	font-weight: bold;
+}
+
+span.error {
+    color: #ff0000;
+}
+
+input.command {
+    font-family: monospace;
+    width: 80%;
+}
diff --git a/webconsole-plugins/shell/src/main/resources/res/plugin.html b/webconsole-plugins/shell/src/main/resources/res/plugin.html
new file mode 100644
index 0000000..c2b9b9b
--- /dev/null
+++ b/webconsole-plugins/shell/src/main/resources/res/plugin.html
@@ -0,0 +1,27 @@
+<script type="text/javascript" src="${pluginRoot}/res/plugin.js"></script>

+<script type="text/javascript">

+// <![CDATA[

+var shellDisabled = ${shell.disabled};

+// ]]>

+</script>

+<p class="statline">${shell.status}</p>

+

+<form id="shell_form" method="post" action="${pluginRoot}">

+	<!-- top header -->

+	<div class="ui-widget-header ui-corner-top buttonGroup">

+		<input id="help" value="${help}" type="button" />

+		<input id="clear" value="${shell.clear}" type="button" />

+	</div>

+

+	<!-- the console window -->

+	<div id="consoleframe">

+		<div id="console">

+			<!-- HERE COMES CONSOLE CONTENTS -->

+		</div><!-- console -->

+	</div><!-- consoleframe -->

+

+	<!-- bottom header -->

+	<div class="ui-widget-header ui-corner-bottom buttonGroup" style="text-align: left">

+		&nbsp;-&gt; <input id="command" name="command" class="command" autocomplete="off" type="text" />

+	</div>

+</form>

diff --git a/webconsole-plugins/shell/src/main/resources/res/plugin.js b/webconsole-plugins/shell/src/main/resources/res/plugin.js
new file mode 100644
index 0000000..7d34014
--- /dev/null
+++ b/webconsole-plugins/shell/src/main/resources/res/plugin.js
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+// elements cache
+var consoleframe = false;
+var konsole = false;
+var command = false;
+
+function executeCommand(cmd) {
+	$.post(document.location.href, { 'command' : encodeURIComponent(cmd) },
+		function(result) {
+			konsole.removeClass('ui-helper-hidden').append(result);
+			consoleframe.attr('scrollTop', konsole.attr('scrollHeight'));
+			command.val('');
+			shellCommandFocus();
+		}, 'html');
+}
+
+function shellCommandFocus() { command.focus() }
+
+// automatically executed on load
+$(document).ready(function(){
+    
+    // disable the shell form if the shell service is not available
+    if (shellDisabled) {
+    
+        $('#shell_form').hide();
+    
+    } else {
+    
+    	// init cache
+    	consoleframe = $('#consoleframe').click(shellCommandFocus);
+    	konsole      = $('#console');
+    	command      = $('#command').focus();
+    
+    	// attach action handlers
+    	$('#clear').click(function() {
+    		konsole.addClass('ui-helper-hidden').html('');
+    		consoleframe.attr('scrollTop', 0);
+    		shellCommandFocus();
+    	});
+    	$('#help').click(function() {
+    		executeCommand('help');
+    	});
+    	$('form').submit(function() {
+    		executeCommand(command.val());
+    		return false;
+    	});
+    	
+	}
+});