This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch jakarta-servlet-6
in repository https://gitbox.apache.org/repos/asf/felix-dev.git
The following commit(s) were added to refs/heads/jakarta-servlet-6 by this push:
new a1b1fa0afa No need for separate branch for ds plugin
a1b1fa0afa is described below
commit a1b1fa0afa8fcc0432553f10d7e382631255ee59
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Mon Aug 21 13:29:36 2023 +0200
No need for separate branch for ds plugin
---
webconsole-plugins/ds/changelog.txt | 64 --
webconsole-plugins/ds/pom.xml | 150 -----
.../main/appended-resources/META-INF/DEPENDENCIES | 18 -
.../webconsole/plugins/ds/internal/Activator.java | 140 ----
.../ds/internal/ComponentConfigurationPrinter.java | 393 -----------
.../ds/internal/ConfigurationAdminSupport.java | 56 --
.../plugins/ds/internal/ConfigurationSupport.java | 94 ---
.../plugins/ds/internal/InfoProvider.java | 151 -----
.../plugins/ds/internal/MetatypeSupport.java | 86 ---
.../felix/webconsole/plugins/ds/internal/Util.java | 44 --
.../plugins/ds/internal/WebConsolePlugin.java | 739 ---------------------
.../main/resources/OSGI-INF/l10n/bundle.properties | 52 --
.../resources/OSGI-INF/l10n/bundle_bg.properties | 52 --
.../resources/OSGI-INF/l10n/bundle_de.properties | 49 --
.../resources/OSGI-INF/l10n/bundle_ru.properties | 49 --
.../ds/src/main/resources/res/plugin.html | 83 ---
.../ds/src/main/resources/res/plugin.js | 188 ------
17 files changed, 2408 deletions(-)
diff --git a/webconsole-plugins/ds/changelog.txt
b/webconsole-plugins/ds/changelog.txt
deleted file mode 100755
index ae6320f612..0000000000
--- a/webconsole-plugins/ds/changelog.txt
+++ /dev/null
@@ -1,64 +0,0 @@
-Changes in 2.1.0
-----------------
-** Improvement
- * [FELIX-5841] : Update webconsole plugin to DS 1.4 (R7)
-
-
-Changes from 2.0.6 to 2.0.8
----------------------------
-** Improvement
- * [FELIX-5697] : DS WebConsole Plugin should neither require Configuration
Admin nor Metatype
- * [FELIX-5538] : Replace own JSONWriter with version from utils
-
-
-Changes from 2.0.4 to 2.0.6
----------------------------
-** Improvement
- * [FELIX-5495] : No details displayed if component is disabled
- * [FELIX-5496] : Use bundle id and component name as key for urls
-** Bug
- * [FELIX-5493] : Component descriptions requiring a policy are not
displayed if config is missing
- * [FELIX-5494] : URL handling not correct if component has no configuration
-
-
-Changes from 2.0.2 to 2.0.4
----------------------------
-** Improvement
- * [FELIX-5489] - Remove dependency to org.json
-** Bug
- * [FELIX-5488] - DS Plugin should use PID from ComponentDescriptionDTO
-
-
-Changes from 2.0.0 to 2.0.2
----------------------------
-** Improvement
- * [FELIX-4998] - Declarative Service plugin might provide JSON format
support for Inventory Printer
-** Bug
- * [FELIX-5005] - BundleInfoProvider should work with null being passed as
appRoot
- * [FELIX-5023] - Web Console plugin is missing function to enable
component descriptions
-
-
-Changes from 1.0.0 to 2.0.0
----------------------------
-
-** Improvement
- * [FELIX-4786] - Update to latest DS implementation
- * [FELIX-4559] - DS plugin should use Inventory instead of deprecated
ConfigurationPrinter
- * [FELIX-3861] - Set felix.webconsole.category on Web Console plugins
- * [FELIX-3140] - Display link for component id within the bundle details
and service details view
-
-** Bug
- * [FELIX-4872] - Error while downloadig full text config in
BundlesServlet: IllegalArgumentException: Invalid local link
-
-
-Initial Release 1.0.0
----------------------
-
-** Bug
- * [FELIX-3135] - Error page on component reload
- * [FELIX-3268] - Cannot build webconsole and webconsole-plugins with JDK 7
- * [FELIX-3442] - native2ascii doesn't work for DS plugin
-
-** Improvement
- * [FELIX-3100] - Separate SCR plugin
- * [FELIX-3441] - DS plugin inconsistent status text
diff --git a/webconsole-plugins/ds/pom.xml b/webconsole-plugins/ds/pom.xml
deleted file mode 100644
index 4dbf081871..0000000000
--- a/webconsole-plugins/ds/pom.xml
+++ /dev/null
@@ -1,150 +0,0 @@
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more
contributor
- license agreements. See the NOTICE file distributed with this work for
additional
- information regarding copyright ownership. The ASF licenses this file to
- you under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of
- the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. -->
-<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>8-SNAPSHOT</version>
- <relativePath>../../../pom/pom.xml</relativePath>
- </parent>
-
- <artifactId>org.apache.felix.webconsole.plugins.ds</artifactId>
- <packaging>bundle</packaging>
- <version>4.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:git:https://github.com/apache/felix-dev.git</connection>
-
<developerConnection>scm:git:https://github.com/apache/felix-dev.git</developerConnection>
- <url>https://gitbox.apache.org/repos/asf?p=felix-dev.git</url>
- <tag>HEAD</tag>
- </scm>
-
- <properties>
- <felix.java.version>17</felix.java.version>
- </properties>
-
- <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-beta-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>5.1.8</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>
- ${project.artifactId}
- </Bundle-SymbolicName>
- <Bundle-Activator>
-
org.apache.felix.webconsole.plugins.ds.internal.Activator
- </Bundle-Activator>
- <Include-Resource>
- {maven-resources},OSGI-INF=target/classes/OSGI-INF
- </Include-Resource>
- <Import-Package>
-
org.osgi.service.cm;version="[1.6,2)";resolution:=optional,
-
org.osgi.service.metatype;version="[1.2,2)";resolution:=optional,
- *
- </Import-Package>
- <DynamicImport-Package>
- org.osgi.service.cm;version="[1.6,2)",
- org.osgi.service.metatype;version="[1.2,2)"
- </DynamicImport-Package>
- <Embed-Dependency>
-
org.apache.felix.utils;inline=org/apache/felix/utils/json/JSONWriter**
- </Embed-Dependency>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>jakarta.servlet</groupId>
- <artifactId>jakarta.servlet-api</artifactId>
- <version>6.0.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>osgi.core</artifactId>
- <version>8.0.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.component</artifactId>
- <version>1.5.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.cm</artifactId>
- <version>1.6.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.metatype</artifactId>
- <version>1.4.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.util.promise</artifactId>
- <version>1.3.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.webconsole</artifactId>
- <version>6.0.0-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.inventory</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.utils</artifactId>
- <version>1.11.8</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-</project>
diff --git
a/webconsole-plugins/ds/src/main/appended-resources/META-INF/DEPENDENCIES
b/webconsole-plugins/ds/src/main/appended-resources/META-INF/DEPENDENCIES
deleted file mode 100644
index 2b2c35b4fc..0000000000
--- a/webconsole-plugins/ds/src/main/appended-resources/META-INF/DEPENDENCIES
+++ /dev/null
@@ -1,18 +0,0 @@
-
-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, 2012).
-Licensed under the Apache License 2.0.
-
-
-III. License Summary
-- Apache License 2.0
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
deleted file mode 100644
index 5f3e9c86de..0000000000
---
a/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/Activator.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.felix.webconsole.plugins.ds.internal;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.apache.felix.inventory.Format;
-import org.apache.felix.inventory.InventoryPrinter;
-import org.apache.felix.webconsole.SimpleWebConsolePlugin;
-import org.apache.felix.webconsole.bundleinfo.BundleInfoProvider;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.component.runtime.ServiceComponentRuntime;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
-
-/**
- * Activator is the main starting class.
- */
-public class Activator implements BundleActivator,
ServiceTrackerCustomizer<ServiceComponentRuntime, ServiceComponentRuntime>
-{
-
- private ServiceTracker<ServiceComponentRuntime, ServiceComponentRuntime>
tracker;
- private BundleContext context;
-
- private SimpleWebConsolePlugin plugin;
-
- private ServiceRegistration<InventoryPrinter> printerRegistration;
-
- private ServiceRegistration<BundleInfoProvider> infoRegistration;
-
- /**
- * @see
org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public final void start(BundleContext context) throws Exception
- {
- this.context = context;
- this.tracker = new ServiceTracker(context,
ServiceComponentRuntime.class, 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(final
ServiceReference<ServiceComponentRuntime> reference, final
ServiceComponentRuntime service)
- {/* unused */
- }
-
- /**
- * @see
org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference)
- */
- public final ServiceComponentRuntime addingService(final
ServiceReference<ServiceComponentRuntime> reference)
- {
- SimpleWebConsolePlugin plugin = this.plugin;
- if (plugin == null)
- {
- final ServiceComponentRuntime service =
context.getService(reference);
- this.plugin = plugin = new
WebConsolePlugin(service).register(context);
-
- final Dictionary<String, Object> props = new Hashtable<String,
Object>();
- final String name = "Declarative Services Components";
- props.put(InventoryPrinter.NAME, "scr"); //$NON-NLS-1$
- props.put(InventoryPrinter.TITLE, name);
- props.put(InventoryPrinter.FORMAT, new String[] {
- Format.TEXT.toString(),
- Format.JSON.toString()
- });
- printerRegistration =
context.registerService(InventoryPrinter.class,
- new ComponentConfigurationPrinter(service, (WebConsolePlugin)
plugin),
- props);
-
- infoRegistration = new InfoProvider(context.getBundle(),
service).register(context);
- }
-
- return context.getService(reference);
- }
-
- /**
- * @see
org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference,
- * java.lang.Object)
- */
- public final void removedService(final
ServiceReference<ServiceComponentRuntime> reference, final
ServiceComponentRuntime 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;
- }
- // unregister info provider too
- reg = infoRegistration;
- if (reg != null)
- {
- reg.unregister();
- infoRegistration = 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
deleted file mode 100644
index 97906cc450..0000000000
---
a/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ComponentConfigurationPrinter.java
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.felix.webconsole.plugins.ds.internal;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import org.apache.felix.inventory.Format;
-import org.apache.felix.inventory.InventoryPrinter;
-import org.apache.felix.utils.json.JSONWriter;
-import org.apache.felix.webconsole.WebConsoleUtil;
-import org.osgi.framework.Constants;
-import org.osgi.framework.dto.ServiceReferenceDTO;
-import org.osgi.service.component.ComponentConstants;
-import org.osgi.service.component.runtime.ServiceComponentRuntime;
-import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO;
-import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
-import org.osgi.service.component.runtime.dto.ReferenceDTO;
-import org.osgi.service.component.runtime.dto.SatisfiedReferenceDTO;
-
-/**
- * ComponentConfigurationPrinter prints the available SCR services.
- */
-class ComponentConfigurationPrinter implements InventoryPrinter
-{
-
- private final ServiceComponentRuntime scrService;
- private final WebConsolePlugin plugin;
-
- ComponentConfigurationPrinter(ServiceComponentRuntime scrService,
WebConsolePlugin plugin)
- {
- this.scrService = scrService;
- this.plugin = plugin;
- }
-
- /**
- * @see
org.apache.felix.inventory.InventoryPrinter#print(java.io.PrintWriter,
org.apache.felix.inventory.Format, boolean)
- */
- @Override
- public void print(PrintWriter pw, Format format, boolean isZip)
- {
- final List<ComponentDescriptionDTO> noConfig = new ArrayList<>();
- final List<ComponentDescriptionDTO> disabled = new ArrayList<>();
- final List<ComponentConfigurationDTO> configurations = new
ArrayList<>();
-
- final Collection<ComponentDescriptionDTO> descs =
scrService.getComponentDescriptionDTOs();
- for(final ComponentDescriptionDTO d : descs)
- {
- if ( !scrService.isComponentEnabled(d) )
- {
- disabled.add(d);
- }
- else
- {
- final Collection<ComponentConfigurationDTO> configs =
scrService.getComponentConfigurationDTOs(d);
- if ( configs.isEmpty() )
- {
- noConfig.add(d);
- }
- else
- {
- configurations.addAll(configs);
- }
- }
- }
- Collections.sort(configurations, Util.COMPONENT_COMPARATOR);
-
- if (Format.JSON.equals(format))
- {
- disabled.addAll(noConfig);
- try
- {
- printComponentsJson(pw, disabled, configurations, isZip);
- } catch (IOException ignore)
- {
- // ignore
- }
- }
- else
- {
- printComponentsText(pw, disabled, noConfig, configurations);
- }
- }
-
- private final void printComponentsJson(final PrintWriter pw,
- final List<ComponentDescriptionDTO> disabled,
- final List<ComponentConfigurationDTO> configurations,
- final boolean details) throws IOException
- {
- final JSONWriter jw = new JSONWriter(pw);
- jw.object();
- jw.key("components"); //$NON-NLS-1$
- jw.array();
-
- // render disabled descriptions
- for(final ComponentDescriptionDTO cd : disabled)
- {
- plugin.component(jw, cd, null, details);
- }
- // render configurations
- for (final ComponentConfigurationDTO cfg : configurations)
- {
- plugin.component(jw, cfg.description, cfg, details);
- }
-
- jw.endArray();
- jw.endObject();
- }
-
- private static final String SEP =
"----------------------------------------------------------------------";
-
- private static final void printComponentsText(final PrintWriter pw,
- final List<ComponentDescriptionDTO> disabled,
- final List<ComponentDescriptionDTO> noConfig,
- final List<ComponentConfigurationDTO> configurations)
- {
- if ( !disabled.isEmpty())
- {
- pw.println(SEP);
- pw.println("Disabled components:");
- pw.println(SEP);
- for(final ComponentDescriptionDTO cd : disabled)
- {
- disabledComponent(pw, cd);
- }
- pw.println();
- }
- if ( !noConfig.isEmpty())
- {
- pw.println(SEP);
- pw.println("Components with missing configuration in Config
Admin:");
- pw.println(SEP);
- for(final ComponentDescriptionDTO cd : noConfig)
- {
- disabledComponent(pw, cd);
- }
- pw.println();
- }
-
- pw.println(SEP);
- if (configurations.isEmpty())
- {
- pw.println("Status: No Component Configurations");
- pw.println(SEP);
- }
- else
- {
- pw.println("Component Configurations:");
- pw.println(SEP);
- // order components by id
- TreeMap<Long, ComponentConfigurationDTO> componentMap = new
TreeMap<>();
- for(final ComponentConfigurationDTO cfg : configurations)
- {
- componentMap.put(new Long(cfg.id), cfg);
- }
-
- // render components
- for (final ComponentConfigurationDTO cfg : componentMap.values())
- {
- component(pw, cfg);
- }
- }
- }
-
- private static final void component(PrintWriter pw, final
ComponentConfigurationDTO cfg)
- {
-
- pw.print(cfg.id);
- pw.print("=[");
- pw.print(cfg.description.name);
- pw.println("]");
-
- pw.println(" Bundle=" + cfg.description.bundle.symbolicName + " ("
- + cfg.description.bundle.id + ")");
- pw.println(" State=" + toStateString(cfg.state));
- if ( cfg.state == ComponentConfigurationDTO.FAILED_ACTIVATION ) {
- pw.println(" Failure=" + cfg.failure);
- }
- pw.println(" DefaultState="
- + (cfg.description.defaultEnabled ? "enabled" : "disabled"));
- pw.println(" Activation=" + (cfg.description.immediate ? "immediate"
: "delayed"));
- pw.println(" ConfigurationPolicy=" +
cfg.description.configurationPolicy);
-
- listServices(pw, cfg.description);
- if ( cfg.service != null ) {
- pw.println(" ServiceId=" + String.valueOf(cfg.service.id));
- }
-
- listReferences(pw, cfg.description, cfg);
- listProperties(pw, cfg.description, cfg);
-
- pw.println();
- }
-
- private static final void disabledComponent(PrintWriter pw, final
ComponentDescriptionDTO description)
- {
-
- pw.println(description.name);
-
- pw.println(" Bundle=" + description.bundle.symbolicName + " ("
- + description.bundle.id + ")");
- pw.println(" DefaultState="
- + (description.defaultEnabled ? "enabled" : "disabled"));
- pw.println(" Activation=" + (description.immediate ? "immediate" :
"delayed"));
- pw.println(" ConfigurationPolicy=" + description.configurationPolicy);
-
- listServices(pw, description);
- listReferences(pw, description, null);
- listProperties(pw, description, null);
-
- pw.println();
- }
-
- private static void listServices(PrintWriter pw, final
ComponentDescriptionDTO cfg)
- {
- String[] services = cfg.serviceInterfaces;
- if (services == null)
- {
- return;
- }
-
- if ( cfg.scope != null ) {
- pw.println(" ServiceType=" + cfg.scope);
- }
-
- 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 SatisfiedReferenceDTO findReference(final
ComponentConfigurationDTO component, final String name)
- {
- for(final SatisfiedReferenceDTO dto : component.satisfiedReferences)
- {
- if ( dto.name.equals(name))
- {
- return dto;
- }
- }
- return null;
- }
-
- private static final void listReferences(PrintWriter pw,
- final ComponentDescriptionDTO description,
- final ComponentConfigurationDTO configuration)
- {
- for(final ReferenceDTO dto : description.references)
- {
- final SatisfiedReferenceDTO satisfiedRef = configuration == null ?
null : findReference(configuration, dto.name);
-
- pw.print(" Reference=");
- pw.print(dto.name);
- if ( configuration != null )
- {
- pw.print(", ");
- pw.print(satisfiedRef != null ? "Satisfied" : "Unsatisfied");
- }
- pw.println();
- pw.println(" Service Name: " + dto.interfaceName);
-
- if (dto.target != null)
- {
- pw.println(" Target Filter: " + dto.target);
- }
-
- pw.println(" Cardinality: " + dto.cardinality);
- pw.println(" Policy: " + dto.policy);
- pw.println(" Policy Option: " + dto.policyOption);
-
- // list bound services
- if ( satisfiedRef != null )
- {
- for(final ServiceReferenceDTO sref :
satisfiedRef.boundServices )
- {
- pw.print(" Bound Service: ID ");
- pw.print(sref.properties.get(Constants.SERVICE_ID));
-
- String name = (String)
sref.properties.get(ComponentConstants.COMPONENT_NAME);
- if (name == null)
- {
- name = (String)
sref.properties.get(Constants.SERVICE_PID);
- if (name == null)
- {
- name = (String)
sref.properties.get(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,
- final ComponentDescriptionDTO description,
- final ComponentConfigurationDTO cfg)
- {
- Map<String, Object> props = cfg == null ? description.properties :
cfg.properties;
- if (props != null)
- {
-
- pw.println(" Properties=");
- TreeSet<String> keys = new TreeSet<>(props.keySet());
- for (Iterator<String> ki = keys.iterator(); ki.hasNext();)
- {
- String key = ki.next();
- Object value = props.get(key);
- value = WebConsoleUtil.toString(value);
- if (value.getClass().isArray())
- {
- value = Arrays.asList((Object[]) value);
- }
- pw.println(" " + key + "=" + value);
- }
- }
- if ( cfg == null && description.factoryProperties != null ) {
- pw.println(" FactoryProperties=");
- TreeSet<String> keys = new
TreeSet<>(description.factoryProperties.keySet());
- for (Iterator<String> ki = keys.iterator(); ki.hasNext();)
- {
- String key = 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 ComponentConfigurationDTO.ACTIVE:
- return "active";
- case ComponentConfigurationDTO.SATISFIED:
- return "satisfied";
- case ComponentConfigurationDTO.UNSATISFIED_CONFIGURATION:
- return "unsatisfied (configuration)";
- case ComponentConfigurationDTO.UNSATISFIED_REFERENCE:
- return "unsatisfied (reference)";
- case ComponentConfigurationDTO.FAILED_ACTIVATION:
- return "failed activation";
- default:
- return String.valueOf(state);
- }
- }
-}
diff --git
a/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ConfigurationAdminSupport.java
b/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ConfigurationAdminSupport.java
deleted file mode 100644
index 4a76d145a0..0000000000
---
a/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ConfigurationAdminSupport.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.felix.webconsole.plugins.ds.internal;
-
-import java.io.IOException;
-
-import org.osgi.framework.Constants;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-
-public class ConfigurationAdminSupport
-{
-
- public boolean check(final Object obj, final String pid)
- {
- final ConfigurationAdmin ca = (ConfigurationAdmin)obj;
- 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
- }
- return false;
- }
-}
diff --git
a/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ConfigurationSupport.java
b/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ConfigurationSupport.java
deleted file mode 100644
index 667bb5c883..0000000000
---
a/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/ConfigurationSupport.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.felix.webconsole.plugins.ds.internal;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.util.tracker.ServiceTracker;
-
-import java.util.Collection;
-import java.util.Collections;
-
-public class ConfigurationSupport {
-
- private final ServiceTracker<Object, Object> configAdminTracker;
-
- private final ServiceTracker<Object, Object> metatypeTracker;
-
- public ConfigurationSupport(final BundleContext bundleContext)
- {
- this.configAdminTracker = new ServiceTracker<Object,
Object>(bundleContext, "org.osgi.service.cm.ConfigurationAdmin", null);
- this.metatypeTracker = new ServiceTracker<Object,
Object>(bundleContext, "org.osgi.service.metatype.MetaTypeService", null);
-
- this.configAdminTracker.open();
- this.metatypeTracker.open();
- }
-
- public void close()
- {
- this.configAdminTracker.close();
- this.metatypeTracker.close();
- }
-
- /**
- * 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.
- */
- public boolean isConfigurable(final Bundle providingBundle, final String
pid)
- {
- // we first check if the config admin has something for this pid
- final Object ca = this.configAdminTracker.getService();
- if (ca != null)
- {
- if ( new ConfigurationAdminSupport().check(ca, pid) )
- {
- return true;
- }
- }
- // second check is using the meta type service
- if (providingBundle != null)
- {
- final Object mts = this.metatypeTracker.getService();
- if (mts != null)
- {
- return new MetatypeSupport().check(mts, providingBundle, pid);
- }
- }
- return false;
- }
-
- /**
- * Returns a Collection of IDs of Password Attributes Definitions for
given bundle and configuration PIDs
- * @param bundle The Bundle providing the component
- * @param configurationPids A non-null configuration pid
- * @return <code>Collection<String></code>
- */
- public Collection<String> getPasswordAttributeDefinitionIds(final Bundle
bundle, final String[] configurationPids) {
- Object metaTypeService = this.metatypeTracker.getService();
- if (bundle == null || metaTypeService == null) {
- return Collections.emptySet();
- }
- return new
MetatypeSupport().getPasswordAttributeDefinitionIds(metaTypeService, bundle,
configurationPids);
- }
-
-}
\ No newline at end of file
diff --git
a/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/InfoProvider.java
b/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/InfoProvider.java
deleted file mode 100644
index ce26da0de6..0000000000
---
a/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/InfoProvider.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.felix.webconsole.plugins.ds.internal;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-import org.apache.felix.webconsole.bundleinfo.BundleInfo;
-import org.apache.felix.webconsole.bundleinfo.BundleInfoProvider;
-import org.apache.felix.webconsole.bundleinfo.BundleInfoType;
-import org.apache.felix.webconsole.i18n.LocalizationHelper;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.component.runtime.ServiceComponentRuntime;
-import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO;
-import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
-
-class InfoProvider implements BundleInfoProvider
-{
-
- private final LocalizationHelper localization;
-
- private final ServiceComponentRuntime scrService;
-
- InfoProvider(Bundle bundle, Object scrService)
- {
- this.scrService = (ServiceComponentRuntime) scrService;
- localization = new LocalizationHelper(bundle);
- }
-
- /**
- * @see
org.apache.felix.webconsole.bundleinfo.BundleInfoProvider#getName(java.util.Locale)
- */
- public String getName(Locale locale)
- {
- return localization.getResourceBundle(locale).getString("info.name");
//$NON-NLS-1$;;
- }
-
- /**
- * @see
org.apache.felix.webconsole.bundleinfo.BundleInfoProvider#getBundleInfo(org.osgi.framework.Bundle,
- * java.lang.String, java.util.Locale)
- */
- public BundleInfo[] getBundleInfo(Bundle bundle, String webConsoleRoot,
Locale locale)
- {
- final List<ComponentDescriptionDTO> disabled = new
ArrayList<ComponentDescriptionDTO>();
- final List<ComponentConfigurationDTO> configurations = new
ArrayList<ComponentConfigurationDTO>();
-
- final Collection<ComponentDescriptionDTO> descs =
scrService.getComponentDescriptionDTOs(bundle);
- for(final ComponentDescriptionDTO d : descs)
- {
- if ( !scrService.isComponentEnabled(d))
- {
- disabled.add(d);
- }
- else
- {
- final Collection<ComponentConfigurationDTO> configs =
scrService.getComponentConfigurationDTOs(d);
- if ( configs.isEmpty() )
- {
- disabled.add(d);
- }
- else
- {
- configurations.addAll(configs);
- }
- }
- }
- Collections.sort(configurations, Util.COMPONENT_COMPARATOR);
-
- if (configurations.isEmpty())
- {
- return NO_INFO;
- }
-
- BundleInfo[] ret = new BundleInfo[configurations.size() +
disabled.size()];
- int i=0;
- for (final ComponentDescriptionDTO cfg : disabled)
- {
- ret[i] = toInfo(cfg, webConsoleRoot, locale);
- i++;
- }
- for (final ComponentConfigurationDTO cfg : configurations)
- {
- ret[i] = toInfo(cfg, webConsoleRoot, locale);
- i++;
- }
- return ret;
- }
-
- private BundleInfo toInfo(final ComponentDescriptionDTO cfg, String
webConsoleRoot, Locale locale)
- {
- final ResourceBundle bundle = localization.getResourceBundle(locale);
- final String state = "disabled";
- final String name = cfg.name;
- final String descr = bundle.getString("info.descr"); //$NON-NLS-1$;
- String key = bundle.getString("info.key"); //$NON-NLS-1$;
- // Component #{0} {1}, state {2}
- key = MessageFormat.format(key, new Object[] { "", //$NON-NLS-1$
- name,
- state
- });
- return new BundleInfo(key,
- (webConsoleRoot == null ? "" : webConsoleRoot) +
"/components", //$NON-NLS-1$
- BundleInfoType.LINK,
- descr);
- }
-
- private BundleInfo toInfo(final ComponentConfigurationDTO cfg, String
webConsoleRoot, Locale locale)
- {
- final ResourceBundle bundle = localization.getResourceBundle(locale);
- final String state =
ComponentConfigurationPrinter.toStateString(cfg.state);
- final String name = cfg.description.name;
- final String descr = bundle.getString("info.descr"); //$NON-NLS-1$;
- String key = bundle.getString("info.key"); //$NON-NLS-1$;
- // Component #{0} {1}, state {2}
- key = MessageFormat.format(key, new Object[] { String.valueOf(cfg.id),
- name,
- state
- });
- return new BundleInfo(key, (webConsoleRoot == null ? "" :
webConsoleRoot) + "/components/" + cfg.id, //$NON-NLS-1$
- BundleInfoType.LINK, descr);
- }
-
- ServiceRegistration<BundleInfoProvider> register(BundleContext context)
- {
- return context.registerService(BundleInfoProvider.class, this, null);
- }
-
-}
diff --git
a/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/MetatypeSupport.java
b/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/MetatypeSupport.java
deleted file mode 100644
index ef10a45123..0000000000
---
a/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/MetatypeSupport.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.felix.webconsole.plugins.ds.internal;
-
-import org.osgi.framework.Bundle;
-import org.osgi.service.metatype.AttributeDefinition;
-import org.osgi.service.metatype.MetaTypeInformation;
-import org.osgi.service.metatype.MetaTypeService;
-import org.osgi.service.metatype.ObjectClassDefinition;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Set;
-import java.util.HashSet;
-
-public class MetatypeSupport
-{
-
- public boolean check(final Object obj, final Bundle providingBundle, final
String pid)
- {
- final MetaTypeService mts = (MetaTypeService)obj;
- final MetaTypeInformation mti =
mts.getMetaTypeInformation(providingBundle);
- if (mti != null)
- {
- try {
- return mti.getObjectClassDefinition(pid, null) != null;
- } catch (final IllegalArgumentException e) {
- return false;
- }
- }
- return false;
- }
-
- public Collection<String> getPasswordAttributeDefinitionIds(final Object
mts, final Bundle bundle, final String[] configurationPids) {
- MetaTypeService metaTypeService = (MetaTypeService) mts;
- MetaTypeInformation metaTypeInformation =
metaTypeService.getMetaTypeInformation(bundle);
- if (metaTypeInformation == null) {
- return Collections.emptySet();
- }
-
- Set<String> allPasswordIds = new HashSet<>();
- for(String configurationPid: configurationPids) {
- allPasswordIds.addAll(getPasswordIds(metaTypeInformation,
configurationPid));
- }
-
- return allPasswordIds;
- }
-
- private Set<String> getPasswordIds(MetaTypeInformation
metaTypeInformation, String configurationPid) {
- AttributeDefinition[] defs = null;
- try {
- ObjectClassDefinition ocd =
metaTypeInformation.getObjectClassDefinition(configurationPid, null);
- defs = ocd.getAttributeDefinitions(ObjectClassDefinition.ALL);
- } catch (final IllegalArgumentException ignore) {
- // just ignore this exception?
- }
-
- Set<String> passwordsDefIds = new HashSet<>();
- if (defs != null) {
- for (int i = 0; i < defs.length; i++) {
- if (defs[i].getType() == AttributeDefinition.PASSWORD) {
- passwordsDefIds.add(defs[i].getID());
- }
- }
- }
-
- return passwordsDefIds;
- }
-
-}
\ No newline at end of file
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
deleted file mode 100644
index 2b65ed1628..0000000000
---
a/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/Util.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.felix.webconsole.plugins.ds.internal;
-
-import java.util.Comparator;
-
-import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO;
-
-class Util
-{
-
- static final Comparator<ComponentConfigurationDTO> COMPONENT_COMPARATOR =
new Comparator<ComponentConfigurationDTO>()
- {
- public int compare(ComponentConfigurationDTO c0,
ComponentConfigurationDTO c1)
- {
- final int nameCmp =
c0.description.name.compareTo(c1.description.name);
- if (nameCmp != 0)
- {
- return nameCmp;
- }
- return (c0.id < c1.id) ? -1 : ((c0.id > c1.id) ? 1 : 0);
- }
- };
-
- private Util()
- {
- // prevent instantiation
- }
-
-}
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
deleted file mode 100644
index 942d9fece7..0000000000
---
a/webconsole-plugins/ds/src/main/java/org/apache/felix/webconsole/plugins/ds/internal/WebConsolePlugin.java
+++ /dev/null
@@ -1,739 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.felix.webconsole.plugins.ds.internal;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeSet;
-
-import jakarta.servlet.ServletException;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
-
-import org.apache.felix.utils.json.JSONWriter;
-import org.apache.felix.webconsole.DefaultVariableResolver;
-import org.apache.felix.webconsole.SimpleWebConsolePlugin;
-import org.apache.felix.webconsole.WebConsoleUtil;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.service.component.ComponentConstants;
-import org.osgi.service.component.runtime.ServiceComponentRuntime;
-import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO;
-import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
-import org.osgi.service.component.runtime.dto.ReferenceDTO;
-import org.osgi.service.component.runtime.dto.SatisfiedReferenceDTO;
-import org.osgi.util.promise.Promise;
-
-/**
- * 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 CATEGORY = "OSGi"; //$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";
-
- // templates
- private final String TEMPLATE;
-
- private volatile ConfigurationSupport support;
-
- private final ServiceComponentRuntime runtime;
-
- /** Default constructor */
- WebConsolePlugin(final ServiceComponentRuntime service)
- {
- super(LABEL, TITLE, CSS);
-
- this.runtime = service;
- // load templates
- TEMPLATE = readTemplateFile("/res/plugin.html"); //$NON-NLS-1$
- }
-
-
- @Override
- public void deactivate() {
- if ( this.support != null )
- {
- this.support.close();
- this.support = null;
- }
- super.deactivate();
- }
-
-
- @Override
- public void activate(final BundleContext bundleContext)
- {
- super.activate(bundleContext);
- this.support = new ConfigurationSupport(bundleContext);
- }
-
-
- @Override
- public String getCategory()
- {
- return CATEGORY;
- }
-
- private void wait(final Promise<Void> p )
- {
- while ( !p.isDone() )
- {
- try
- {
- Thread.sleep(5);
- }
- catch (final InterruptedException e)
- {
- Thread.currentThread().interrupt();
- }
- }
- }
-
- /**
- * @see
jakarta.servlet.http.HttpServlet#doPost(jakarta.servlet.http.HttpServletRequest,
jakarta.servlet.http.HttpServletResponse)
- */
- @Override
- protected void doPost(HttpServletRequest request, HttpServletResponse
response)
- throws IOException
- {
- final String op = request.getParameter(OPERATION);
- RequestInfo reqInfo = new RequestInfo(request, true);
- if (reqInfo.componentRequested)
- {
- boolean found = false;
- if ( reqInfo.component != null )
- {
- if (OPERATION_ENABLE.equals(op))
- {
-
wait(this.runtime.enableComponent(reqInfo.component.description));
- reqInfo = new RequestInfo(request, false);
- found = true;
- }
- else if ( OPERATION_DISABLE.equals(op) )
- {
-
wait(this.runtime.disableComponent(reqInfo.component.description));
- found = true;
- }
- }
- if ( !found )
- {
- response.sendError(404);
- return;
- }
- }
- else
- {
- response.sendError(500);
- return;
- }
-
- final PrintWriter pw = response.getWriter();
- response.setContentType("application/json"); //$NON-NLS-1$
- response.setCharacterEncoding("UTF-8"); //$NON-NLS-1$
- renderResult(pw, reqInfo, null);
- }
-
- /**
- * @see
org.apache.felix.webconsole.AbstractWebConsolePlugin#doGet(jakarta.servlet.http.HttpServletRequest,
jakarta.servlet.http.HttpServletResponse)
- */
- @Override
- 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, true);
- 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,
reqInfo.component);
-
- // nothing more to do
- return;
- }
- }
- super.doGet(request, response);
- }
-
- /**
- * @see
org.apache.felix.webconsole.AbstractWebConsolePlugin#renderContent(jakarta.servlet.http.HttpServletRequest,
jakarta.servlet.http.HttpServletResponse)
- */
- @SuppressWarnings("unchecked")
- @Override
- 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, 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, RequestInfo info, final
ComponentConfigurationDTO component)
- throws IOException
- {
- final JSONWriter jw = new JSONWriter(pw);
- jw.object();
-
- jw.key("status"); //$NON-NLS-1$
- jw.value(info.configurations.size());
- if ( !info.configurations.isEmpty() )
- {
- // render components
- jw.key("data"); //$NON-NLS-1$
- jw.array();
- if (component != null)
- {
- if ( component.state == -1 )
- {
- component(jw, component.description, null, true);
- }
- else
- {
- component(jw, component.description, component, true);
- }
- }
- else
- {
- for( final ComponentDescriptionDTO cd : info.disabled )
- {
- component(jw, cd, null, false);
- }
- for (final ComponentConfigurationDTO cfg : info.configurations)
- {
- component(jw, cfg.description, cfg, false);
- }
- }
- jw.endArray();
- }
-
- jw.endObject();
- }
-
- void writePid(final JSONWriter jw, final ComponentDescriptionDTO desc)
throws IOException
- {
- final String configurationPid = desc.configurationPid[0];
- final String pid;
- if (desc.configurationPid.length == 1) {
- pid = configurationPid;
- } else {
- pid = Arrays.toString(desc.configurationPid);
- }
- jw.key("pid"); //$NON-NLS-1$
- jw.value(pid);
- final ConfigurationSupport localSupport = this.support;
- if (localSupport != null && localSupport.isConfigurable(
-
this.getBundleContext().getBundle(0).getBundleContext().getBundle(desc.bundle.id),
- configurationPid))
- {
- jw.key("configurable"); //$NON-NLS-1$
- jw.value(configurationPid);
- }
- }
-
- void component(JSONWriter jw,
- final ComponentDescriptionDTO desc,
- final ComponentConfigurationDTO config, boolean details) throws
IOException
- {
- String id = config == null ? "" : String.valueOf(config.id);
- String name = desc.name;
-
- jw.object();
-
- // component information
- jw.key("id"); //$NON-NLS-1$
- jw.value(id);
- jw.key("bundleId"); //$NON-NLS-1$
- jw.value(desc.bundle.id);
- jw.key("name"); //$NON-NLS-1$
- jw.value(name);
- jw.key("state"); //$NON-NLS-1$
- if ( config != null )
- {
-
jw.value(ComponentConfigurationPrinter.toStateString(config.state));
- jw.key("stateRaw"); //$NON-NLS-1$
- jw.value(config.state);
- }
- else
- {
- if ( desc.defaultEnabled &&
"require".equals(desc.configurationPolicy))
- {
- jw.value("no config");
- }
- else
- {
- jw.value("disabled"); //$NON-NLS-1$
- }
- jw.key("stateRaw"); //$NON-NLS-1$
- jw.value(-1);
- }
-
- writePid(jw, desc);
-
- // component details
- if (details)
- {
- gatherComponentDetails(jw, desc, config);
- }
-
- jw.endObject();
- }
-
- private void gatherComponentDetails(JSONWriter jw,
- ComponentDescriptionDTO desc,
- ComponentConfigurationDTO component) throws IOException
- {
- final Bundle bundle =
this.getBundleContext().getBundle(0).getBundleContext().getBundle(desc.bundle.id);
-
- jw.key("props"); //$NON-NLS-1$
- jw.array();
-
- keyVal(jw, "Bundle", bundle.getSymbolicName() + " ("
- + bundle.getBundleId() + ")");
- keyVal(jw, "Implementation Class", desc.implementationClass);
- if (desc.factory != null)
- {
- keyVal(jw, "Component Factory Name", desc.factory);
- }
- keyVal(jw, "Default State", desc.defaultEnabled ? "enabled" :
"disabled");
- keyVal(jw, "Activation", desc.immediate ? "immediate" : "delayed");
-
- keyVal(jw, "Configuration Policy", desc.configurationPolicy);
-
- if ( component != null && component.state ==
ComponentConfigurationDTO.FAILED_ACTIVATION && component.failure != null ) {
- keyVal(jw, "failure", component.failure);
- }
- if ( component != null && component.service != null ) {
- keyVal(jw, "serviceId", component.service.id);
- }
- listServices(jw, desc);
- if (desc.configurationPid.length == 1) {
- keyVal(jw, "PID", desc.configurationPid[0]);
- } else {
- keyVal(jw, "PIDs", Arrays.toString(desc.configurationPid));
- }
- listReferences(jw, desc, component);
- listProperties(jw, desc, component);
-
- jw.endArray();
- }
-
- private void listServices(JSONWriter jw, ComponentDescriptionDTO desc)
throws IOException
- {
- String[] services = desc.serviceInterfaces;
- if (services == null)
- {
- return;
- }
-
- if ( desc.scope != null ) {
- keyVal(jw, "Service Type", desc.scope);
- }
- jw.object();
- jw.key("key");
- jw.value("Services");
- jw.key("value");
- jw.array();
- for (int i = 0; i < services.length; i++)
- {
- jw.value(services[i]);
- }
- jw.endArray();
- jw.endObject();
- }
-
- private SatisfiedReferenceDTO findReference(final
ComponentConfigurationDTO component, final String name)
- {
- for(final SatisfiedReferenceDTO dto : component.satisfiedReferences)
- {
- if ( dto.name.equals(name))
- {
- return dto;
- }
- }
- return null;
- }
-
- private void listReferences(JSONWriter jw, ComponentDescriptionDTO desc,
ComponentConfigurationDTO config) throws IOException
- {
- for(final ReferenceDTO dto : desc.references)
- {
- jw.object();
- jw.key("key");
- jw.value("Reference " + dto.name);
- jw.key("value");
- jw.array();
- final SatisfiedReferenceDTO satisfiedRef;
- if ( config != null )
- {
- satisfiedRef = findReference(config, dto.name);
-
- jw.value(satisfiedRef != null ? "Satisfied" : "Unsatisfied");
- }
- else
- {
- satisfiedRef = null;
- }
- jw.value("Service Name: " + dto.interfaceName);
- if (dto.target != null)
- {
- jw.value("Target Filter: " + dto.target);
- }
- jw.value("Cardinality: " + dto.cardinality);
- jw.value("Policy: " + dto.policy);
- jw.value("Policy Option: " + dto.policyOption);
-
- // list bound services
- if ( satisfiedRef != null )
- {
- for (int j = 0; j < satisfiedRef.boundServices.length; j++)
- {
- final StringBuffer b = new StringBuffer();
- b.append("Bound Service ID ");
- b.append(satisfiedRef.boundServices[j].id);
-
- String name = (String)
satisfiedRef.boundServices[j].properties.get(ComponentConstants.COMPONENT_NAME);
- if (name == null)
- {
- name = (String)
satisfiedRef.boundServices[j].properties.get(Constants.SERVICE_PID);
- if (name == null)
- {
- name = (String)
satisfiedRef.boundServices[j].properties.get(Constants.SERVICE_DESCRIPTION);
- }
- }
- if (name != null)
- {
- b.append(" (");
- b.append(name);
- b.append(")");
- }
- jw.value(b.toString());
- }
- }
- else if ( config != null )
- {
- jw.value("No Services bound");
- }
-
- jw.endArray();
- jw.endObject();
- }
- }
-
- private void listProperties(JSONWriter jw, ComponentDescriptionDTO desc,
ComponentConfigurationDTO component) throws IOException
- {
- Map<String, Object> props = component != null ? component.properties :
desc.properties;
-
- // Is this the right way to get bundle and configuration PID?
- Bundle bundle =
this.getBundleContext().getBundle(0).getBundleContext().getBundle(desc.bundle.id);
- String[] configurationPids = desc.configurationPid;
-
- final ConfigurationSupport localSupport = this.support;
- Collection<String> passwordPropertyIds = localSupport != null ?
- localSupport.getPasswordAttributeDefinitionIds(bundle,
configurationPids) : Collections.emptyList();
-
- if (props != null)
- {
- jw.object();
- jw.key("key");
- jw.value("Properties");
- jw.key("value");
- jw.array();
- TreeSet<String> keys = new TreeSet<String>(props.keySet());
- for (Iterator<String> ki = keys.iterator(); ki.hasNext();)
- {
- final String key = ki.next();
- final StringBuilder b = new StringBuilder();
- b.append(key).append(" = ");
-
- if (passwordPropertyIds.contains(key)) {
- b.append("********");
- } else {
- Object prop = props.get(key);
- prop = WebConsoleUtil.toString(prop);
- b.append(prop);
- }
-
- jw.value(b.toString());
- }
- jw.endArray();
- jw.endObject();
- }
- if ( component == null && desc.factoryProperties != null ) {
- jw.object();
- jw.key("key");
- jw.value("FactoryProperties");
- jw.key("value");
- jw.array();
- TreeSet<String> keys = new
TreeSet<String>(desc.factoryProperties.keySet());
- for (Iterator<String> ki = keys.iterator(); ki.hasNext();)
- {
- final String key = ki.next();
- final StringBuilder b = new StringBuilder();
- b.append(key).append(" = ");
-
- if (passwordPropertyIds.contains(key)) {
- b.append("********");
- } else {
- Object prop = props.get(key);
- prop = WebConsoleUtil.toString(prop);
- b.append(prop);
- }
-
- jw.value(b.toString());
- }
- jw.endArray();
- jw.endObject();
- }
- }
-
- private void keyVal(JSONWriter jw, String key, Object value) throws
IOException
- {
- if (key != null && value != null)
- {
- jw.object();
- jw.key("key"); //$NON-NLS-1$
- jw.value(key);
- jw.key("value"); //$NON-NLS-1$
- jw.value(value);
- jw.endObject();
- }
- }
-
-
-
- private final class RequestInfo
- {
- public final String extension;
- public final ComponentConfigurationDTO component;
- public final boolean componentRequested;
- public final List<ComponentDescriptionDTO> descriptions = new
ArrayList<ComponentDescriptionDTO>();
- public final List<ComponentConfigurationDTO> configurations = new
ArrayList<ComponentConfigurationDTO>();
- public final List<ComponentDescriptionDTO> disabled = new
ArrayList<ComponentDescriptionDTO>();
-
- protected RequestInfo(final HttpServletRequest request, final boolean
checkPathInfo)
- {
- 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$
- }
-
- this.descriptions.addAll(runtime.getComponentDescriptionDTOs());
- if (checkPathInfo && info.length() > 1 && info.startsWith("/"))
//$NON-NLS-1$
- {
- this.componentRequested = true;
- info = info.substring(1);
- ComponentConfigurationDTO component = getComponentId(info);
- if (component == null)
- {
- component = getComponentByName(info);
- }
- this.component = component;
- if ( this.component != null )
- {
- this.configurations.add(this.component);
- }
- }
- else
- {
- this.componentRequested = false;
- this.component = null;
-
- for(final ComponentDescriptionDTO d : this.descriptions)
- {
- if ( !runtime.isComponentEnabled(d) )
- {
- disabled.add(d);
- }
- else
- {
- final Collection<ComponentConfigurationDTO> configs =
runtime.getComponentConfigurationDTOs(d);
- if ( configs.isEmpty() )
- {
- disabled.add(d);
- }
- else
- {
- configurations.addAll(configs);
- }
- }
- }
- Collections.sort(configurations, Util.COMPONENT_COMPARATOR);
- }
-
- request.setAttribute(WebConsolePlugin.this.getClass().getName(),
this);
- }
-
- protected ComponentConfigurationDTO getComponentId(final String
componentIdPar)
- {
- try
- {
- final long componentId = Long.parseLong(componentIdPar);
- for(final ComponentDescriptionDTO desc : this.descriptions)
- {
- for(final ComponentConfigurationDTO cfg :
runtime.getComponentConfigurationDTOs(desc))
- {
- if ( cfg.id == componentId )
- {
- return cfg;
- }
- }
- }
- }
- catch (NumberFormatException nfe)
- {
- // don't care
- }
-
- return null;
- }
-
- protected ComponentConfigurationDTO getComponentByName(final String
names)
- {
- if (names.length() > 0)
- {
- final int slash = names.lastIndexOf('/');
- final String componentName;
- final String pid;
- long bundleId = -1;
- if (slash > 0)
- {
- pid = names.substring(slash + 1);
- final String firstPart = names.substring(0, slash);
- final int bundleIndex = firstPart.indexOf('/');
- if ( bundleIndex == -1 )
- {
- componentName = firstPart;
- }
- else
- {
- componentName = firstPart.substring(bundleIndex + 1);
- try
- {
- bundleId = Long.valueOf(firstPart.substring(0,
bundleIndex));
- }
- catch ( final NumberFormatException nfe)
- {
- // wrong format
- return null;
- }
- }
- }
- else
- {
- componentName = names;
- pid = null;
- }
-
- Collection<ComponentConfigurationDTO> components = null;
- for(final ComponentDescriptionDTO d : this.descriptions)
- {
- if ( d.name.equals(componentName) && (bundleId == -1 ||
d.bundle.id == bundleId))
- {
- components = runtime.getComponentConfigurationDTOs(d);
- if ( components.isEmpty() )
- {
- final ComponentConfigurationDTO cfg = new
ComponentConfigurationDTO();
- cfg.description = d;
- cfg.state = -1;
- return cfg;
- }
- else
- {
- if (pid != null)
- {
- final Iterator<ComponentConfigurationDTO> i =
components.iterator();
- while ( i.hasNext() )
- {
- ComponentConfigurationDTO c = i.next();
- if (
pid.equals(c.description.configurationPid[0]))
- {
- return c;
- }
-
- }
- }
- else if (components.size() > 0)
- {
- return components.iterator().next();
- }
-
- }
- }
- }
- }
-
- return null;
- }
- }
-
- static RequestInfo getRequestInfo(final HttpServletRequest request)
- {
- return (RequestInfo)
request.getAttribute(WebConsolePlugin.class.getName());
- }
-}
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
deleted file mode 100644
index 3d6be1b12f..0000000000
--- a/webconsole-plugins/ds/src/main/resources/OSGI-INF/l10n/bundle.properties
+++ /dev/null
@@ -1,52 +0,0 @@
-#Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#
-# 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
-info.name=Declarative Service Components
-info.key=Component #{0} {1}, state {2}
-info.descr=This Declarative Service Component is provided by the bundle. Click
to see more details in "Components" plugin.
diff --git
a/webconsole-plugins/ds/src/main/resources/OSGI-INF/l10n/bundle_bg.properties
b/webconsole-plugins/ds/src/main/resources/OSGI-INF/l10n/bundle_bg.properties
deleted file mode 100644
index a4b9199b7f..0000000000
---
a/webconsole-plugins/ds/src/main/resources/OSGI-INF/l10n/bundle_bg.properties
+++ /dev/null
@@ -1,52 +0,0 @@
-#Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#
-# 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=Име
-info.name=Компоненти
-info.key=Компонент #{0} {1}, статус {2}
-info.descr=Този компонент се предоставя от текущият бъндъл. Кликнете за повече
детайли в "Компоненти" плъгина.
diff --git
a/webconsole-plugins/ds/src/main/resources/OSGI-INF/l10n/bundle_de.properties
b/webconsole-plugins/ds/src/main/resources/OSGI-INF/l10n/bundle_de.properties
deleted file mode 100644
index 4165c7a896..0000000000
---
a/webconsole-plugins/ds/src/main/resources/OSGI-INF/l10n/bundle_de.properties
+++ /dev/null
@@ -1,49 +0,0 @@
-#Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#
-# 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/resources/OSGI-INF/l10n/bundle_ru.properties
b/webconsole-plugins/ds/src/main/resources/OSGI-INF/l10n/bundle_ru.properties
deleted file mode 100644
index d10d52efc0..0000000000
---
a/webconsole-plugins/ds/src/main/resources/OSGI-INF/l10n/bundle_ru.properties
+++ /dev/null
@@ -1,49 +0,0 @@
-#Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#
-# 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/res/plugin.html
b/webconsole-plugins/ds/src/main/resources/res/plugin.html
deleted file mode 100644
index 608166a047..0000000000
--- a/webconsole-plugins/ds/src/main/resources/res/plugin.html
+++ /dev/null
@@ -1,83 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<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"> </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> </td> <!-- id -->
- <td> <!-- name with arrow -->
- <div class="bIcon ui-icon ui-icon-triangle-1-e"
style="float:left" title="${scr.details.tip}"> </div>
- </td>
- <td> </td> <!-- status -->
- <td>
- <ul class="icons">
- <li class="dynhover ui-helper-hidden"
title="${scr.action.enable}"><span class="ui-icon
ui-icon-play"> </span></li>
- <li class="dynhover ui-helper-hidden"
title="${scr.action.disable}"><span class="ui-icon
ui-icon-stop"> </span></li>
- <li class="dynhover ui-helper-hidden"
title="${scr.action.configure}"><span class="ui-icon
ui-icon-wrench"> </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
deleted file mode 100644
index f956cec15d..0000000000
--- a/webconsole-plugins/ds/src/main/resources/res/plugin.js
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-function renderData( eventData ) {
- switch(eventData.status) {
- case -1: // no scr service
- $('.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 == null || id < 0 || id === "") {
- id = dataEntry.bundleId + '/' + 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 ) { // disabled or disabling
-
_.find('li:eq(0)').removeClass('ui-helper-hidden').click(function() {
changeDataEntryState(dataEntry.name, '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.configurable, '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, path ) {
- 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(path)});
- });
-}
-
-function renderDetails( data ) {
- data = data.data[0];
- var idPath = getEntryId(data);
- var id = idPath.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, idPath)});
- }
- });
- $('#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 {
- if ( prop.key == "serviceId" ) {
- txt = txt + '<a href="../services/' +
prop.value + '">' + prop.value + '</a>';
- } 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
- });
-});
-