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 4237516a28 No need to branc event webconsole plugin
4237516a28 is described below
commit 4237516a281a6d7000f43953ffa97a6cbe786ba2
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Mon Aug 21 13:55:30 2023 +0200
No need to branc event webconsole plugin
---
webconsole-plugins/event/changelog.txt | 52 ----
webconsole-plugins/event/pom.xml | 184 ------------
.../main/appended-resources/META-INF/DEPENDENCIES | 17 --
.../plugins/event/internal/Activator.java | 110 --------
.../event/internal/ConfigurationListener.java | 79 ------
.../plugins/event/internal/EventCollector.java | 100 -------
.../plugins/event/internal/EventHandler.java | 81 ------
.../plugins/event/internal/EventInfo.java | 62 -----
.../plugins/event/internal/EventListener.java | 77 -----
.../event/internal/OptionalFeaturesHandler.java | 239 ----------------
.../plugins/event/internal/OsgiUtil.java | 163 -----------
.../plugins/event/internal/PluginServlet.java | 310 ---------------------
.../event/internal/PropertiesEditorSupport.java | 113 --------
.../internal/converter/BundleEventConverter.java | 80 ------
.../converter/ConfigurationEventConverter.java | 58 ----
.../converter/FrameworkEventConverter.java | 67 -----
.../internal/converter/ServiceEventConverter.java | 93 -------
.../main/resources/OSGI-INF/l10n/bundle.properties | 47 ----
.../resources/OSGI-INF/l10n/bundle_bg.properties | 48 ----
.../resources/OSGI-INF/l10n/bundle_de.properties | 46 ---
.../resources/OSGI-INF/l10n/metatype.properties | 25 --
.../main/resources/OSGI-INF/metatype/metatype.xml | 27 --
.../event/src/main/resources/res/events.html | 66 -----
.../event/src/main/resources/res/ui/addremove.js | 114 --------
.../event/src/main/resources/res/ui/events.css | 36 ---
.../event/src/main/resources/res/ui/events.js | 159 -----------
.../event/src/main/resources/res/ui/propeditor.js | 206 --------------
27 files changed, 2659 deletions(-)
diff --git a/webconsole-plugins/event/changelog.txt
b/webconsole-plugins/event/changelog.txt
deleted file mode 100644
index ddbd451146..0000000000
--- a/webconsole-plugins/event/changelog.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-Changes from 1.1.6 to 1.1.8
----------------------------
-** Improvement
- * [FELIX-5702] - Plugin should work without configuration admin
-
-** Bug
- * [FELIX-5701] - metatype.properties file must not be in OSGI-INF/metatype
- * [FELIX-5668] - Prevent Nullpointer when receiving a ServiceEvent for a
service that has been already unregistered
-
-
-Changes from 1.1.4 to 1.1.6
----------------------------
-** Improvement
- * [FELIX-5510] - Remove usage of org.json form web console plugins
-
-
-Changes from 1.1.2 to 1.1.4
----------------------------
-
-** Bug
- * [FELIX-5025] - NPE in Events web console plugin - no events can be seen
-
-Changes from 1.1.0 to 1.1.2
----------------------------
-
-** Bug
- * [FELIX-4573] - Web Console Event plugin might cease operation if Event
property is null
- * [FELIX-4731] - Event plugin native2ascii plugin conflicts with Eclipse
- * [FELIX-4732] - Web Console event plugin is not compatible with
OSGi/Minimum EE
-
-** New Feature
- * [FELIX-4499] - BundleEventConverter reports UNINSTALLED for UNRESOLVED
events
- * [FELIX-4500] - EventListener should implement SynchronousBundleListener
-
-Changes from 1.0.2 to 1.1.0
----------------------------
-
-** New Feature
- * [FELIX-2331] - webconsole event plugin should be able to send/post
events.
-
-** Bug
- * [FELIX-3960] - exception in the event plugin
- * [FELIX-3449] - Event plugin cannot send events without properties
-
-** Improvement
- * [FELIX-4185] - Add category OSGi to event web console plugin
- * [FELIX-3454] - Add German language support for Event and UPnP plugins
-
-** Task
- * [FELIX-3440] - native2ascii doesn't work for event plugin
- * [FELIX-3268] - Cannot build webconsole and webconsole-plugins with JDK 7
-
diff --git a/webconsole-plugins/event/pom.xml b/webconsole-plugins/event/pom.xml
deleted file mode 100644
index dc28390c09..0000000000
--- a/webconsole-plugins/event/pom.xml
+++ /dev/null
@@ -1,184 +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.event</artifactId>
- <packaging>bundle</packaging>
- <version>3.0.0-SNAPSHOT</version>
-
- <name>Apache Felix Web Console Event Plugin</name>
- <description>
- This is a plugin for the Apache Felix OSGi web console for displaying
OSGi events.
- </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>
- </scm>
-
- <properties>
- <felix.java.version>17</felix.java.version>
- </properties>
-
- <build>
- <!-- add UTF-8-to-ISO translated resources -->
- <resources>
- <resource>
-
<directory>${basedir}/src/main/resources</directory>
- </resource>
- </resources>
-
- <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.event.internal.Activator
- </Bundle-Activator>
- <Import-Package>
-
org.osgi.service.cm;version="[1.4,2)";resolution:=optional,*
- </Import-Package>
- <Private-Package>
- org.apache.felix.webconsole.plugins.event.*
- </Private-Package>
- <DynamicImport-Package>
- org.osgi.service.cm;version="[1.4,2)"
- </DynamicImport-Package>
- <Embed-Dependency>
-
org.apache.felix.utils;inline=org/apache/felix/utils/json/JSONWriter**
- </Embed-Dependency>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>3.5.0</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
-
<createDependencyReducedPom>false</createDependencyReducedPom>
- <relocations>
- <relocation>
- <pattern>org.apache.felix.utils</pattern>
-
<shadedPattern>org.apache.felix.webconsole.plugins.event.utils</shadedPattern>
- </relocation>
- </relocations>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <includes>
- <include>src/**</include>
- </includes>
- <excludes>
- <exclude>src/main/resources/res/events.html</exclude>
- <exclude>src/main/appended-resources/**</exclude>
- </excludes>
- </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.event</artifactId>
- <version>1.4.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.servlet</artifactId>
- <version>3.0.0-SNAPSHOT</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.utils</artifactId>
- <version>1.11.8</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-</project>
diff --git
a/webconsole-plugins/event/src/main/appended-resources/META-INF/DEPENDENCIES
b/webconsole-plugins/event/src/main/appended-resources/META-INF/DEPENDENCIES
deleted file mode 100644
index d31a5b922a..0000000000
--- a/webconsole-plugins/event/src/main/appended-resources/META-INF/DEPENDENCIES
+++ /dev/null
@@ -1,17 +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/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/Activator.java
b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/Activator.java
deleted file mode 100644
index bc97c7ef1c..0000000000
---
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/Activator.java
+++ /dev/null
@@ -1,110 +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.event.internal;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.apache.felix.webconsole.WebConsoleConstants;
-import org.apache.felix.webconsole.internal.servlet.OsgiManager;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.servlet.whiteboard.HttpWhiteboardConstants;
-
-import jakarta.servlet.Servlet;
-
-/**
- * Setup the event plugin
- */
-public class Activator implements BundleActivator
-{
- private static final String NAME = "events";
-
- /** Registration for the plugin. */
- private ServiceRegistration<Servlet> pluginRegistration;
-
- /** Listener */
- private EventListener eventListener;
-
- /** The plugin. */
- private PluginServlet plugin;
-
- /** Optional features handler. */
- private OptionalFeaturesHandler featuresHandler;
-
- /**
- * @see
org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(final BundleContext context) throws Exception
- {
- // we start with the plugin
- this.plugin = new PluginServlet();
-
- // now we create the listener
- this.eventListener = new EventListener(this.plugin, context);
-
- // and the optional features handler
- this.featuresHandler = new OptionalFeaturesHandler(this.plugin,
context);
-
- // finally we register the plugin
- final Dictionary<String, Object> props = new Hashtable<>();
- props.put( Constants.SERVICE_DESCRIPTION, "Event Plugin for the Apache
Felix Web Console" );
- props.put( Constants.SERVICE_VENDOR, "The Apache Software Foundation"
);
- props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME, NAME);
- props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT,
- "(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME +
"=" + OsgiManager.DEFAULT_CONTEXT_NAME
- + ")");
- props.put( WebConsoleConstants.PLUGIN_LABEL, NAME);
- props.put( WebConsoleConstants.PLUGIN_TITLE, "%plugin.events.title");
- props.put( WebConsoleConstants.PLUGIN_CSS_REFERENCES,
"/events/res/ui/events.css");
- props.put( WebConsoleConstants.PLUGIN_CATEGORY, "OSGi");
- this.pluginRegistration = context.registerService(Servlet.class,
- plugin,
- props);
- }
-
- /**
- * @see
org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(final BundleContext context) throws Exception
- {
- if ( this.pluginRegistration != null )
- {
- this.pluginRegistration.unregister();
- this.pluginRegistration = null;
- }
- if ( this.eventListener != null )
- {
- this.eventListener.destroy();
- eventListener = null;
- }
- if ( this.featuresHandler != null)
- {
- this.featuresHandler.destroy();
- this.featuresHandler = null;
- }
- if ( this.plugin != null ) {
- this.plugin.destroy();
- this.plugin = null;
- }
- }
-
-}
diff --git
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/ConfigurationListener.java
b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/ConfigurationListener.java
deleted file mode 100644
index f8e3dfe464..0000000000
---
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/ConfigurationListener.java
+++ /dev/null
@@ -1,79 +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.event.internal;
-
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import
org.apache.felix.webconsole.plugins.event.internal.converter.ConfigurationEventConverter;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.cm.ConfigurationEvent;
-import org.osgi.service.cm.ManagedService;
-
-
-public class ConfigurationListener implements ManagedService,
org.osgi.service.cm.ConfigurationListener
-{
- private final PluginServlet plugin;
-
- private final String pid;
-
- static ServiceRegistration<?> create( final BundleContext context, final
PluginServlet plugin )
- {
- ConfigurationListener cl = new ConfigurationListener( plugin );
-
- Dictionary<String, Object> props = new Hashtable<>();
- props.put( Constants.SERVICE_VENDOR, "The Apache Software Foundation"
);
- props.put( Constants.SERVICE_DESCRIPTION, "Event plugin for the Felix
Web Console Configuration Receiver" );
- props.put( Constants.SERVICE_PID, cl.pid );
-
- return context.registerService( new String[]
{ManagedService.class.getName(),
- org.osgi.service.cm.ConfigurationListener.class.getName()},
cl, props );
- }
-
-
- private ConfigurationListener( PluginServlet plugin )
- {
- this.plugin = plugin;
- this.pid = plugin.getClass().getName();
- }
- //---------- ConfigurationListener
- /**
- * @see
org.osgi.service.cm.ConfigurationListener#configurationEvent(org.osgi.service.cm.ConfigurationEvent)
- */
- @Override
- public void configurationEvent(ConfigurationEvent event)
- {
-
this.plugin.getCollector().add(ConfigurationEventConverter.getInfo(event));
-
- }
-
- //---------- ManagedService
-
- /**
- * @see org.osgi.service.cm.ManagedService#updated(java.util.Dictionary)
- */
- @Override
- public void updated( Dictionary<String, ?> config )
- {
- plugin.updateConfiguration( config );
- }
-}
\ No newline at end of file
diff --git
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventCollector.java
b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventCollector.java
deleted file mode 100644
index 769c182e39..0000000000
---
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventCollector.java
+++ /dev/null
@@ -1,100 +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.event.internal;
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.List;
-
-/**
- * This class collects events
- */
-public class EventCollector
-{
-
- private static final String PROPERTY_MAX_SIZE = "max.size";
- private static final int DEFAULT_MAX_SIZE = 250;
-
- private List<EventInfo> eventInfos;
-
- private long startTime;
-
- private int maxSize;
-
- public EventCollector()
- {
- this.clear();
- this.updateConfiguration(null);
- }
-
- public void add(final EventInfo info)
- {
- if ( info != null )
- {
- synchronized ( this )
- {
- this.eventInfos.add( info );
- if ( eventInfos.size() > this.maxSize )
- {
- eventInfos.remove( 0 );
- }
- if ( this.eventInfos.size() == 1 )
- {
- this.startTime = info.received;
- }
- }
- }
- }
-
- public void clear()
- {
- synchronized ( this )
- {
- this.eventInfos = new ArrayList<>();
- this.startTime = System.currentTimeMillis();
- }
- }
-
- /**
- * Return a copy of the current event list
- */
- public List<EventInfo> getEvents()
- {
- synchronized ( this )
- {
- return new ArrayList<>(eventInfos);
- }
- }
-
- public void updateConfiguration( final Dictionary<String, ?> props)
- {
- this.maxSize = OsgiUtil.toInteger(props, PROPERTY_MAX_SIZE,
DEFAULT_MAX_SIZE);
- synchronized ( this )
- {
- while ( eventInfos.size() > this.maxSize )
- {
- eventInfos.remove( 0 );
- }
-
- }
- }
-
- public long getStartTime()
- {
- return this.startTime;
- }
-}
diff --git
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventHandler.java
b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventHandler.java
deleted file mode 100644
index 9349889937..0000000000
---
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventHandler.java
+++ /dev/null
@@ -1,81 +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.event.internal;
-
-
-import java.util.HashMap;
-import java.util.Map;
-
-import
org.apache.felix.webconsole.plugins.event.internal.converter.BundleEventConverter;
-import
org.apache.felix.webconsole.plugins.event.internal.converter.FrameworkEventConverter;
-import
org.apache.felix.webconsole.plugins.event.internal.converter.ServiceEventConverter;
-import org.osgi.service.event.Event;
-
-/**
- * Event listener for the OSGi event admin, listening
- * to all events.
- */
-public class EventHandler implements org.osgi.service.event.EventHandler
-{
- /** A list of topics that are always excluded, there is no way to change
this
- * via configuration.
- * This list includes the framework events that are already covered by the
- * event listener and all log events.
- */
- private final String[] excludeTopics = new String[]
{"org/osgi/service/log",
- BundleEventConverter.TOPIC,
- FrameworkEventConverter.TOPIC,
- ServiceEventConverter.TOPIC};
-
- private final EventCollector collector;
-
- public EventHandler(final EventCollector c)
- {
- this.collector = c;
- }
-
- /**
- * @see
org.osgi.service.event.EventHandler#handleEvent(org.osgi.service.event.Event)
- */
- @Override
- public void handleEvent( Event event )
- {
- boolean include = true;
- for(int i=0; i<excludeTopics.length; i++)
- {
- if ( event.getTopic().startsWith(excludeTopics[i]))
- {
- include = false;
- break;
- }
- }
- if ( include )
- {
- Map<String, Object> props = null;
- final String[] names = event.getPropertyNames();
- if ( names != null && names.length > 0 )
- {
- props = new HashMap<>();
- for ( int i = 0; i < names.length; i++ )
- {
- props.put(names[i], event.getProperty(names[i]));
- }
- }
- collector.add(new EventInfo(event.getTopic(), null, null, props));
- }
- }
-}
diff --git
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventInfo.java
b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventInfo.java
deleted file mode 100644
index d2fc33cdd6..0000000000
---
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventInfo.java
+++ /dev/null
@@ -1,62 +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.event.internal;
-
-import java.util.Map;
-
-/**
- * An event as displayed in the console.
- * The console displays the time {@link #received},
- * the {@link #topic} and if available the {@link #info}.
- * If the info is not available, the {@link #properties}
- * are displayed instead.
- */
-public class EventInfo {
-
- /** The event topic. */
- public final String topic;
-
- /** Additional information for this event. */
- public final String info;
-
- /** The time this event has been received. */
- public final long received;
-
- /** Properties. */
- public final Map<String, Object> properties;
-
- /** The event class. */
- public final String category;
-
- public EventInfo( final String topic, final String info, final String
category )
- {
- this.topic = topic;
- this.info = info;
- this.received = System.currentTimeMillis();
- this.properties = null;
- this.category = category;
- }
-
- public EventInfo( final String topic, final String info, final String
category, final Map<String, Object> props )
- {
- this.topic = topic;
- this.info = info;
- this.received = System.currentTimeMillis();
- this.properties = props;
- this.category = category;
- }
-}
diff --git
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventListener.java
b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventListener.java
deleted file mode 100644
index 8d6cf306cc..0000000000
---
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventListener.java
+++ /dev/null
@@ -1,77 +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.event.internal;
-
-import org.apache.felix.webconsole.plugins.event.internal.converter.*;
-import org.osgi.framework.*;
-
-/**
- * This class listens for all known framework events:
- * - bundle events
- * - framework events
- * - service events
- */
-public class EventListener
- implements SynchronousBundleListener, FrameworkListener, ServiceListener{
-
- private final EventCollector collector;
-
- private final BundleContext bundleContext;
-
- public EventListener(final PluginServlet plugin, final BundleContext
context)
- {
- this.collector = plugin.getCollector();
- this.bundleContext = context;
- context.addBundleListener(this);
- context.addFrameworkListener(this);
- context.addServiceListener(this);
- }
-
- public void destroy()
- {
- this.bundleContext.removeBundleListener(this);
- this.bundleContext.removeFrameworkListener(this);
- this.bundleContext.removeServiceListener(this);
- }
-
- /**
- * @see
org.osgi.framework.ServiceListener#serviceChanged(org.osgi.framework.ServiceEvent)
- */
- public void serviceChanged(ServiceEvent event)
- {
- final EventInfo info = ServiceEventConverter.getInfo(event);
- this.collector.add(info);
- }
-
- /**
- * @see
org.osgi.framework.FrameworkListener#frameworkEvent(org.osgi.framework.FrameworkEvent)
- */
- public void frameworkEvent(FrameworkEvent event)
- {
- final EventInfo info = FrameworkEventConverter.getInfo(event);
- this.collector.add(info);
- }
-
- /**
- * @see
org.osgi.framework.BundleListener#bundleChanged(org.osgi.framework.BundleEvent)
- */
- public void bundleChanged(BundleEvent event)
- {
- final EventInfo info = BundleEventConverter.getInfo(event);
- this.collector.add(info);
- }
-}
diff --git
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/OptionalFeaturesHandler.java
b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/OptionalFeaturesHandler.java
deleted file mode 100644
index f4befb451c..0000000000
---
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/OptionalFeaturesHandler.java
+++ /dev/null
@@ -1,239 +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.event.internal;
-
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.event.EventAdmin;
-
-/**
- * This class handles all optional stuff.
- * It listens for specific services and activates/deactivates
- * features.
- */
-public class OptionalFeaturesHandler
- implements ServiceListener
-{
- private static final String EVENT_ADMIN_CLASS_NAME =
"org.osgi.service.event.EventAdmin"; //$NON-NLS-1$
- private static final String CONFIGURATION_ADMIN_CLASS_NAME =
"org.osgi.service.cm.ConfigurationAdmin"; //$NON-NLS-1$
- private static final String EVENT_HANDLER_CLASS_NAME =
"org.osgi.service.event.EventHandler"; //$NON-NLS-1$
-
- private static final String FILTER = "(|(" + Constants.OBJECTCLASS + "=" +
EVENT_ADMIN_CLASS_NAME + ")"
- +"(" + Constants.OBJECTCLASS + "=" +
CONFIGURATION_ADMIN_CLASS_NAME + "))";
-
- /** Event admin service id */
- //private Long eventAdminServiceId;
- private ServiceReference<?> eventAdminServiceRef;
-
- /** Registration for the event handler. */
- private ServiceRegistration<?> eventHandlerRegistration;
-
- /** Configuration admin service id */
- private Long configAdminServiceId;
-
- /** Registration for the configuration listener. */
- private ServiceRegistration<?> configListenerRegistration;
-
- /** Bundle context. */
- private final BundleContext bundleContext;
-
- /** The plugin */
- private final PluginServlet plugin;
-
- public OptionalFeaturesHandler(final PluginServlet plugin, final
BundleContext context)
- {
- this.plugin = plugin;
- this.bundleContext = context;
- // check if event admin is already available
- final ServiceReference<?> ref =
this.bundleContext.getServiceReference(EVENT_ADMIN_CLASS_NAME);
- if ( ref != null )
- {
- bindEventAdmin(ref);
- }
-
- // check if config admin is already available
- this.configAdminServiceId = null;
- final ServiceReference<?> cfaRef =
this.bundleContext.getServiceReference(CONFIGURATION_ADMIN_CLASS_NAME);
- if ( cfaRef != null )
- {
- final Long id = (Long)cfaRef.getProperty(Constants.SERVICE_ID);
- bindConfigAdmin(id);
- }
-
- // listen for event and config admin from now on
- try {
- context.addServiceListener(this, FILTER);
- } catch (InvalidSyntaxException ise) {
- // this should never happen as this is a constant, so we ignore it
- }
- }
-
- /**
- * @see jakarta.servlet.GenericServlet#destroy()
- */
- public void destroy()
- {
- this.bundleContext.removeServiceListener(this);
- this.unbindEventAdmin(this.eventAdminServiceRef);
- this.unbindConfigAdmin(this.configAdminServiceId);
- }
-
- /**
- * @see
org.osgi.framework.ServiceListener#serviceChanged(org.osgi.framework.ServiceEvent)
- */
- @Override
- public void serviceChanged(final ServiceEvent event)
- {
- final ServiceReference<?> ref = event.getServiceReference();
- final String[] objectClasses =
(String[])ref.getProperty(Constants.OBJECTCLASS);
- if ( objectClasses != null)
- {
- for(int i=0; i<objectClasses.length; i++)
- {
- if ( objectClasses[i].equals(EVENT_ADMIN_CLASS_NAME) )
- {
- if ( event.getType() == ServiceEvent.REGISTERED )
- {
- new Thread()
- {
- @Override
- public void run()
- {
- try {
- Thread.sleep(500);
- } catch (InterruptedException ignore) {}
- bindEventAdmin(ref);
- }
- }.start();
- }
- else if ( event.getType() == ServiceEvent.UNREGISTERING )
- {
- new Thread()
- {
- @Override
- public void run()
- {
- try {
- Thread.sleep(500);
- } catch (InterruptedException ignore) {}
- unbindEventAdmin(ref);
- }
- }.start();
- }
- }
- else if (
objectClasses[i].equals(CONFIGURATION_ADMIN_CLASS_NAME) )
- {
- final Long id =
(Long)event.getServiceReference().getProperty(Constants.SERVICE_ID);
- if ( event.getType() == ServiceEvent.REGISTERED )
- {
- new Thread()
- {
- @Override
- public void run()
- {
- try {
- Thread.sleep(500);
- } catch (InterruptedException ignore) {}
- bindConfigAdmin(id);
- }
- }.start();
- }
- else if ( event.getType() == ServiceEvent.UNREGISTERING )
- {
- new Thread()
- {
- @Override
- public void run()
- {
- try {
- Thread.sleep(500);
- } catch (InterruptedException ignore) {}
- unbindConfigAdmin(id);
- }
- }.start();
- }
- }
- }
- }
- }
-
- synchronized void bindEventAdmin(ServiceReference<?> ref)
- {
- if ( this.eventAdminServiceRef != null)
- {
- this.unbindEventAdmin(this.eventAdminServiceRef);
- }
- this.eventAdminServiceRef = ref;
- final Dictionary<String, Object> props = new Hashtable<>();
- props.put( Constants.SERVICE_DESCRIPTION, "Event handler for the
Apache Felix Web Console" );
- props.put( Constants.SERVICE_VENDOR, "The Apache Software Foundation"
);
- props.put( "event.topics", "*"); //$NON-NLS-1$ //$NON-NLS-2$
- this.plugin.setEventAdmin((EventAdmin) bundleContext.getService(ref));
-
- this.eventHandlerRegistration =
this.bundleContext.registerService(EVENT_HANDLER_CLASS_NAME,
- new EventHandler(this.plugin.getCollector()), props);
- }
-
- synchronized void unbindEventAdmin(ServiceReference<?> ref)
- {
- if ( this.eventAdminServiceRef != null &&
this.eventAdminServiceRef.equals(ref) )
- {
- bundleContext.ungetService(ref);
- this.eventAdminServiceRef = null;
- this.plugin.setEventAdmin(null);
- if ( this.eventHandlerRegistration != null )
- {
- this.eventHandlerRegistration.unregister();
- this.eventHandlerRegistration = null;
- }
- }
- }
-
- synchronized void bindConfigAdmin(final Long id)
- {
- if ( this.configAdminServiceId != null )
- {
- this.unbindConfigAdmin(this.configAdminServiceId);
- }
- this.plugin.setConfigAdminAvailable(true);
- this.configAdminServiceId = id;
- this.configListenerRegistration =
ConfigurationListener.create(this.bundleContext, this.plugin);
- }
-
- synchronized void unbindConfigAdmin(final Long id)
- {
- if ( this.configAdminServiceId != null &&
this.configAdminServiceId.equals(id) )
- {
- this.configAdminServiceId = null;
- this.plugin.setConfigAdminAvailable(false);
- if ( this.configListenerRegistration != null )
- {
- this.configListenerRegistration.unregister();
- this.configListenerRegistration = null;
- }
- }
- }
-}
diff --git
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/OsgiUtil.java
b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/OsgiUtil.java
deleted file mode 100644
index b4471f64be..0000000000
---
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/OsgiUtil.java
+++ /dev/null
@@ -1,163 +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.event.internal;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Dictionary;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * The <code>OsgiUtil</code> is a utility class providing some usefull utility
- * methods.
- */
-public class OsgiUtil {
-
- public static boolean toBoolean(Dictionary<String, ?> props, String key,
boolean defaultValue)
- {
- Object propValue = toObject( props, key );
- if (propValue instanceof Boolean)
- {
- return ((Boolean) propValue).booleanValue();
- }
- else if (propValue != null)
- {
- return Boolean.valueOf(String.valueOf(propValue)).booleanValue();
- }
-
- return defaultValue;
- }
-
- public static String toString(Dictionary<String, ?> props, String key,
String defaultValue)
- {
- Object propValue = toObject( props, key );
- return (propValue != null) ? propValue.toString() : defaultValue;
- }
-
- public static int toInteger(Dictionary<String, ?> props, String key, int
defaultValue)
- {
- Object propValue = toObject( props, key );
- if (propValue instanceof Integer)
- {
- return ((Integer) propValue).intValue();
- }
- else if (propValue != null)
- {
- try
- {
- return Integer.valueOf(String.valueOf(propValue)).intValue();
- }
- catch (NumberFormatException nfe)
- {
- // don't care, fall through to default value
- }
- }
-
- return defaultValue;
- }
-
- public static Object toObject(Dictionary<String, ?> props, String key)
- {
- if (props == null || key == null )
- {
- return null;
- }
- final Object propValue = props.get(key);
- if ( propValue == null )
- {
- return null;
- }
- else if (propValue.getClass().isArray())
- {
- Object[] prop = (Object[]) propValue;
- return prop.length > 0 ? prop[0] : null;
- }
- else if (propValue instanceof Collection)
- {
- Collection<?> prop = (Collection<?>) propValue;
- return prop.isEmpty() ? null : prop.iterator().next();
- }
- else
- {
- return propValue;
- }
- }
-
- public static String[] toStringArray(Dictionary<String, ?> props, String
key, String[] defaultArray)
- {
- if (props == null || key == null )
- {
- return defaultArray;
- }
- final Object propValue = props.get(key);
- if (propValue == null)
- {
- // no value at all
- return defaultArray;
-
- }
- else if (propValue instanceof String)
- {
- // single string
- return new String[] { (String) propValue };
-
- }
- else if (propValue instanceof String[])
- {
- // String[]
- return (String[]) propValue;
-
- }
- else if (propValue.getClass().isArray())
- {
- // other array
- Object[] valueArray = (Object[]) propValue;
- List<String> values = new ArrayList<>(valueArray.length);
- for(int i=0; i<valueArray.length; i++)
- {
- final Object value = valueArray[i];
- if (value != null)
- {
- values.add(value.toString());
- }
- }
- return values.toArray(new String[values.size()]);
-
- }
- else if (propValue instanceof Collection)
- {
- // collection
- Collection<?> valueCollection = (Collection<?>) propValue;
- List<String> valueList = new ArrayList<>(valueCollection.size());
- final Iterator<?> i = valueCollection.iterator();
- while ( i.hasNext() )
- {
- final Object value = i.next();
- if (value != null)
- {
- valueList.add(value.toString());
- }
- }
- return valueList.toArray(new String[valueList.size()]);
- }
-
- return defaultArray;
- }
-}
diff --git
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/PluginServlet.java
b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/PluginServlet.java
deleted file mode 100644
index 91c7c67b7c..0000000000
---
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/PluginServlet.java
+++ /dev/null
@@ -1,310 +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.event.internal;
-
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.net.URL;
-import java.util.Date;
-import java.util.Dictionary;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import jakarta.servlet.ServletException;
-import jakarta.servlet.http.HttpServlet;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
-
-import org.apache.felix.utils.json.JSONWriter;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventAdmin;
-
-/**
- * The Event Plugin
- */
-public class PluginServlet extends HttpServlet
-{
-
- private static final long serialVersionUID = -8601361741848077124L;
-
- private static final String ACTION_POST = "post"; //$NON-NLS-1$
- private static final String ACTION_SEND = "send"; //$NON-NLS-1$
- private static final String ACTION_CLEAR = "clear"; //$NON-NLS-1$
-
- private static final String PARAMETER_ACTION = "action"; //$NON-NLS-1$
-
- /** The event collector. */
- private final EventCollector collector;
-
- /** Is the config admin available? */
- private volatile boolean configAdminAvailable = false;
-
- private EventAdmin eventAdmin;
-
- private final String TEMPLATE;
-
- public PluginServlet()
- {
- this.collector = new EventCollector();
- TEMPLATE = readTemplateFile(getClass(), "/res/events.html");
//$NON-NLS-1$
- }
-
- private final String readTemplateFile(final Class<?> clazz, final String
templateFile)
- {
- InputStream templateStream =
getClass().getResourceAsStream(templateFile);
- if (templateStream != null)
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- byte[] data = new byte[1024];
- try
- {
- int len = 0;
- while ((len = templateStream.read(data)) > 0)
- {
- baos.write(data, 0, len);
- }
- return baos.toString("UTF-8"); //$NON-NLS-1$
- }
- catch (IOException e)
- {
- // don't use new Exception(message, cause) because cause is
1.4+
- throw new RuntimeException("readTemplateFile: Error loading "
- + templateFile + ": " + e);
- }
- finally
- {
- try
- {
- templateStream.close();
- }
- catch (IOException e)
- {
- /* ignore */
- }
-
- }
- }
-
- // template file does not exist, return an empty string
- log("readTemplateFile: File '" + templateFile + "' not found through
class "
- + clazz);
- return ""; //$NON-NLS-1$
- }
-
- private static final Event newEvent(HttpServletRequest request)
- {
- String topic = request.getParameter("topic"); //$NON-NLS-1$
-
- return new Event(topic,
PropertiesEditorSupport.convertProperties(request));
- }
-
-
- /**
- * @see
jakarta.servlet.http.HttpServlet#doPost(jakarta.servlet.http.HttpServletRequest,
jakarta.servlet.http.HttpServletResponse)
- */
- @Override
- protected void doPost( HttpServletRequest req, HttpServletResponse resp )
- throws ServletException, IOException
- {
- final String action = req.getParameter( PARAMETER_ACTION );
- if ( ACTION_POST.equals(action) ) {
- final Event event = newEvent(req);
- eventAdmin.postEvent(event);
- } else if (ACTION_SEND.equals(action)) {
- final Event event = newEvent(req);
- eventAdmin.sendEvent(event);
- } else if ( ACTION_CLEAR.equals( action ) ) {
- this.collector.clear();
- }
- // we always send back the json data
- resp.setContentType( "application/json" ); //$NON-NLS-1$
- resp.setCharacterEncoding( "utf-8" ); //$NON-NLS-1$
-
- renderJSON( resp.getWriter() );
- }
-
- private void renderJSON( final PrintWriter pw ) throws IOException
- {
- List<EventInfo> events = this.collector.getEvents();
-
- StringBuffer statusLine = new StringBuffer();
- statusLine.append( events.size() );
- statusLine.append( " Event");
- if ( events.size() != 1 )
- {
- statusLine.append('s');
- }
- statusLine.append( " received" );
- if ( !events.isEmpty() )
- {
- statusLine.append( " since " );
- Date d = new Date();
- d.setTime( events.get( 0 ).received );
- statusLine.append( d );
- }
- statusLine.append( ". (Event admin: " );
- if ( this.eventAdmin == null )
- {
- statusLine.append("un");
- }
- statusLine.append("available; Config admin: ");
- if ( !this.configAdminAvailable )
- {
- statusLine.append("un");
- }
- statusLine.append("available)");
-
- // Compute scale: startTime is 0, lastTimestamp is 100%
- final long startTime = this.collector.getStartTime();
- final long endTime = (events.size() == 0 ? startTime :
events.get(events.size() - 1).received);
- final float scale = (endTime == startTime ? 100.0f : 100.0f / (endTime
- startTime));
-
- final JSONWriter writer = new JSONWriter(pw);
- writer.object();
- writer.key( "status" );
- writer.value( statusLine.toString() );
-
- writer.key( "data" );
- writer.array();
-
- // display list in reverse order
- for ( int index = events.size() - 1; index >= 0; index-- )
- {
- eventJson( writer, events.get( index ), index, startTime, scale );
- }
-
- writer.endArray();
-
- writer.endObject();
- }
-
-
- @Override
- protected void doGet( HttpServletRequest request, HttpServletResponse
response )
- throws ServletException, IOException
- {
-
- final String info = request.getPathInfo();
- if ( info.endsWith( ".json" ) ) //$NON-NLS-1$
- {
- response.setContentType( "application/json" ); //$NON-NLS-1$
- response.setCharacterEncoding( "UTF-8" ); //$NON-NLS-1$
-
- PrintWriter pw = response.getWriter();
- this.renderJSON( pw );
-
- // nothing more to do
- return;
- }
-
- this.renderContent( request, response );
- }
-
-
- protected void renderContent( HttpServletRequest request,
HttpServletResponse response )
- throws ServletException, IOException
- {
- final PrintWriter pw = response.getWriter();
- //final String appRoot = ( String ) request.getAttribute(
"felix.webconsole.appRoot" );
- //pw.println( "<script src='" + appRoot + "/events/res/ui/" +
"events.js" + "' type='text/javascript'></script>" );
- pw.print(TEMPLATE);
- }
-
- public URL getResource(String path)
- {
- if ( path.startsWith("/events/res/ui/") ) //$NON-NLS-1$
- {
- return this.getClass().getResource(path.substring(7));
- }
- return null;
- }
-
-
- private void eventJson( JSONWriter jw, EventInfo info, int index, final
long start, final float scale )
- throws IOException
- {
- final long msec = info.received - start;
-
- // Compute color bar size and make sure the bar is visible
- final int percent = Math.max((int)(msec * scale), 2);
-
- jw.object();
- jw.key( "id" );
- jw.value( String.valueOf( index ) );
-
- jw.key( "offset" );
- jw.value( msec );
-
- jw.key( "width" );
- jw.value( percent );
-
- jw.key( "category" );
- jw.value( info.category );
-
- jw.key( "received" );
- jw.value( info.received );
-
- jw.key( "topic" );
- jw.value( info.topic );
-
- if ( info.info != null )
- {
- jw.key( "info" );
- jw.value( info.info );
- }
-
- jw.key( "properties" );
- jw.object();
- if ( info.properties != null && info.properties.size() > 0 )
- {
- final Iterator<Map.Entry<String, Object>> i =
info.properties.entrySet().iterator();
- while ( i.hasNext() )
- {
- final Map.Entry<String, Object> current = i.next();
- jw.key( current.getKey().toString() );
- jw.value(current.getValue());
- }
- }
- jw.endObject();
-
- jw.endObject();
- }
-
- public void updateConfiguration( Dictionary<String, ?> dict)
- {
- this.collector.updateConfiguration(dict);
- }
-
- public EventCollector getCollector()
- {
- return this.collector;
- }
-
- public void setEventAdmin(final EventAdmin eventAdmin)
- {
- this.eventAdmin = eventAdmin;
- }
-
- public void setConfigAdminAvailable(final boolean flag)
- {
- this.configAdminAvailable = flag;
- }
-}
diff --git
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/PropertiesEditorSupport.java
b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/PropertiesEditorSupport.java
deleted file mode 100644
index 7c3e86733c..0000000000
---
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/PropertiesEditorSupport.java
+++ /dev/null
@@ -1,113 +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.event.internal;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.StringTokenizer;
-
-import jakarta.servlet.http.HttpServletRequest;
-
-/**
- * Java support for propeditor.js handling.
- */
-public class PropertiesEditorSupport
-{
-
- private PropertiesEditorSupport()
- {
- // prevent instantiation
- }
-
- /**
- * Converts the properties from the request to a key-value hashtable.
- *
- * @param request the request to process
- * @return the converted properties
- */
- public static final Dictionary<String, ?>
convertProperties(HttpServletRequest request)
- {
- String keys[] = request.getParameterValues("key"); //$NON-NLS-1$
- String vals[] = request.getParameterValues("val"); //$NON-NLS-1$
- String types[] = request.getParameterValues("type"); //$NON-NLS-1$
-
- final Dictionary<String, Object> properties = new Hashtable<>();
- synchronized (properties)
- {
- for (int i = 0; keys != null && i < keys.length; i++)
- {
- properties.put(keys[i], convert(vals[i], types[i]));
- }
- }
-
- return properties;
- }
-
- private static final Object convert(String value, String type)
- {
- if ("byte".equals(type)) //$NON-NLS-1$
- {
- return Byte.valueOf(value);
- }
- else if ("int".equals(type)) //$NON-NLS-1$
- {
- return Integer.valueOf(value);
- }
- else if ("long".equals(type)) //$NON-NLS-1$
- {
- return Long.valueOf(value);
- }
- else if ("float".equals(type)) //$NON-NLS-1$
- {
- return Float.valueOf(value);
- }
- else if ("double".equals(type)) //$NON-NLS-1$
- {
- return Double.valueOf(value);
- }
- else if ("string".equals(type)) //$NON-NLS-1$
- {
- return value.toString();
- }
- else if ("char".equals(type)) //$NON-NLS-1$
- {
- return value.toString().charAt(0);
- }
- else if ("byte array".equals(type)) //$NON-NLS-1$
- {
- return decodeHex(value.toString());
- }
- else
- {
- throw new IllegalArgumentException("Unsupported type!");
- }
- }
-
- private static final byte[] decodeHex(String data)
- {
- final StringTokenizer tok = new StringTokenizer(data, "[]{},;: \t");
//$NON-NLS-1$
- final byte[] bs = new byte[tok.countTokens()];
- int i = 0;
- while (tok.hasMoreTokens())
- {
- final String next = tok.nextToken();
- bs[i++] = Integer.decode(next).byteValue();
- }
- return bs;
- }
-
-}
diff --git
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/converter/BundleEventConverter.java
b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/converter/BundleEventConverter.java
deleted file mode 100644
index 4d0a400e56..0000000000
---
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/converter/BundleEventConverter.java
+++ /dev/null
@@ -1,80 +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.event.internal.converter;
-
-import org.apache.felix.webconsole.plugins.event.internal.EventInfo;
-import org.osgi.framework.BundleEvent;
-
-public class BundleEventConverter {
-
- public static final String TOPIC =
BundleEvent.class.getName().replace('.', '/');
-
- public static EventInfo getInfo(final BundleEvent event) {
- if ( event == null )
- {
- return null;
- }
- final StringBuffer topic = new StringBuffer(TOPIC);
- topic.append('/');
- final StringBuffer buffer = new StringBuffer( "Bundle " );
- buffer.append( event.getBundle().getSymbolicName() );
- buffer.append( ' ' );
- switch ( event.getType() )
- {
- case BundleEvent.INSTALLED:
- buffer.append( "installed" );
- topic.append("INSTALLED");
- break;
- case BundleEvent.RESOLVED:
- buffer.append( "resolved" );
- topic.append("RESOLVED");
- break;
- case BundleEvent.STARTED:
- buffer.append( "started" );
- topic.append("STARTED");
- break;
- case BundleEvent.STARTING:
- buffer.append( "starting" );
- topic.append("STARTING");
- break;
- case BundleEvent.STOPPED:
- buffer.append( "stopped" );
- topic.append("STOPPED");
- break;
- case BundleEvent.STOPPING:
- buffer.append( "stopping" );
- topic.append("STOPPING");
- break;
- case BundleEvent.UNINSTALLED:
- buffer.append( "uninstalled" );
- topic.append("UNINSTALLED");
- break;
- case BundleEvent.UNRESOLVED:
- buffer.append( "unresolved" );
- topic.append("UNRESOLVED");
- break;
- case BundleEvent.UPDATED:
- buffer.append( "updated" );
- topic.append("UPDATED");
- break;
- default:
- return null; // IGNORE
- }
-
- return new EventInfo(topic.toString(), buffer.toString(), "bundle");
- }
-}
diff --git
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/converter/ConfigurationEventConverter.java
b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/converter/ConfigurationEventConverter.java
deleted file mode 100644
index f79543fb9f..0000000000
---
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/converter/ConfigurationEventConverter.java
+++ /dev/null
@@ -1,58 +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.event.internal.converter;
-
-import org.apache.felix.webconsole.plugins.event.internal.EventInfo;
-import org.osgi.service.cm.ConfigurationEvent;
-
-public class ConfigurationEventConverter {
-
- public static final String TOPIC =
ConfigurationEventConverter.class.getName().replace('.', '/');
-
- public static EventInfo getInfo(final ConfigurationEvent event) {
- if ( event == null )
- {
- return null;
- }
-
- final StringBuffer topic = new StringBuffer(TOPIC);
- topic.append('/');
- final StringBuffer buffer = new StringBuffer( "Configuration event: "
);
- buffer.append(event.getPid());
- if ( event.getFactoryPid() != null )
- {
- buffer.append(" (factoryPid=");
- buffer.append(event.getFactoryPid());
- buffer.append(")");
- }
- switch ( event.getType() )
- {
- case ConfigurationEvent.CM_DELETED:
- buffer.append( " deleted" );
- topic.append( "CM_DELETED" );
- break;
- case ConfigurationEvent.CM_UPDATED:
- buffer.append( " changed" );
- topic.append( "CM_UPDATED" );
- break;
- default:
- return null; // IGNORE
- }
-
- return new EventInfo(topic.toString(), buffer.toString(), "config");
- }
-}
diff --git
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/converter/FrameworkEventConverter.java
b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/converter/FrameworkEventConverter.java
deleted file mode 100644
index 0481441bfc..0000000000
---
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/converter/FrameworkEventConverter.java
+++ /dev/null
@@ -1,67 +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.event.internal.converter;
-
-import org.apache.felix.webconsole.plugins.event.internal.EventInfo;
-import org.osgi.framework.FrameworkEvent;
-
-public class FrameworkEventConverter {
-
- public static final String TOPIC =
FrameworkEvent.class.getName().replace('.', '/');
-
- public static EventInfo getInfo(final FrameworkEvent event) {
- if ( event == null )
- {
- return null;
- }
-
- final StringBuffer topic = new StringBuffer(TOPIC);
- topic.append('/');
- final StringBuffer buffer = new StringBuffer( "Framework event " );
- switch ( event.getType() )
- {
- case FrameworkEvent.ERROR:
- buffer.append( "error" );
- topic.append( "ERROR" );
- break;
- case FrameworkEvent.INFO:
- buffer.append( "info" );
- topic.append( "INFO" );
- break;
- case FrameworkEvent.PACKAGES_REFRESHED:
- buffer.append( "packages refreshed" );
- topic.append( "PACKAGES_REFRESHED" );
- break;
- case FrameworkEvent.STARTED:
- buffer.append( "started" );
- topic.append( "STARTED" );
- break;
- case FrameworkEvent.STARTLEVEL_CHANGED:
- buffer.append( "start level changed" );
- topic.append( "STARTLEVEL_CHANGED" );
- break;
- case FrameworkEvent.WARNING:
- buffer.append( "warning" );
- topic.append( "WARNING" );
- break;
- default:
- return null; // IGNORE
- }
-
- return new EventInfo(topic.toString(), buffer.toString(), "framework");
- }
-}
diff --git
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/converter/ServiceEventConverter.java
b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/converter/ServiceEventConverter.java
deleted file mode 100644
index 2ddb1e6a6b..0000000000
---
a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/converter/ServiceEventConverter.java
+++ /dev/null
@@ -1,93 +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.event.internal.converter;
-
-import org.apache.felix.webconsole.plugins.event.internal.EventInfo;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceReference;
-
-public class ServiceEventConverter {
-
- public static final String TOPIC =
ServiceEvent.class.getName().replace('.', '/');
-
- public static EventInfo getInfo(final ServiceEvent event) {
- if ( event == null )
- {
- return null;
- }
-
- final ServiceReference<?> ref = event.getServiceReference();
-
- final StringBuffer buffer = new StringBuffer( "Service " );
- final Object pid = ref.getProperty( Constants.SERVICE_PID );
- if ( pid != null)
- {
- buffer.append( pid );
- }
- buffer.append( "(id=" );
- buffer.append( ref.getProperty( Constants.SERVICE_ID ) );
-
- final String[] arr = (String[]) ref.getProperty( Constants.OBJECTCLASS
);
- if ( arr != null )
- {
- buffer.append(", objectClass=");
- if ( arr.length > 1 )
- {
- buffer.append('[');
- }
- for(int m = 0; m <arr.length; m++)
- {
- if ( m > 0 )
- {
- buffer.append(", ");
- }
- buffer.append(arr[m].toString());
- }
- if ( arr.length > 1 )
- {
- buffer.append(']');
- }
- }
- buffer.append( ", bundle=" );
- Bundle bundle = ref.getBundle();
- buffer.append( bundle != null ? bundle.getSymbolicName() : "<unkown>"
);
- buffer.append( ") " );
- final StringBuffer topic = new StringBuffer(TOPIC);
- topic.append('/');
- switch ( event.getType() )
- {
- case ServiceEvent.REGISTERED:
- buffer.append( "registered" );
- topic.append("REGISTERED");
- break;
- case ServiceEvent.MODIFIED:
- buffer.append( "modified" );
- topic.append("MODIFIED");
- break;
- case ServiceEvent.UNREGISTERING:
- buffer.append( "unregistering" );
- topic.append("UNREGISTERING");
- break;
- default:
- return null; // IGNORE
- }
-
- return new EventInfo(topic.toString(), buffer.toString(), "service");
- }
-}
diff --git
a/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/bundle.properties
b/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/bundle.properties
deleted file mode 100644
index 3490075a64..0000000000
---
a/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/bundle.properties
+++ /dev/null
@@ -1,47 +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
-#
-
-# buttons on top
-displayTimeline=Timeline
-displayList=List
-clear=Clear Events
-
-# table headers
-received=Received
-topic=Event Topic
-properties=Event Properties
-
-plugin.events.title=Events
-
-# send event
-sendEvent=Send/Post Event
-post=Post Event
-send=Send Event
-close=Close
-reset=Reset
diff --git
a/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/bundle_bg.properties
b/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/bundle_bg.properties
deleted file mode 100644
index cbebbd3319..0000000000
---
a/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/bundle_bg.properties
+++ /dev/null
@@ -1,48 +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
-#
-
-# buttons on top
-displayTimeline=Време-диаграма
-displayList=Списък
-clear=Изчистване
-
-# table headers
-received=Получен
-topic=Тема
-properties=Атрибути
-
-plugin.events.title=Събития
-
-# send event
-sendEvent=Изпращане
-post=Прати
-send=Прати веднага
-close=Затваряне
-reset=Ресет
-
diff --git
a/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/bundle_de.properties
b/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/bundle_de.properties
deleted file mode 100644
index bc88a3c44e..0000000000
---
a/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/bundle_de.properties
+++ /dev/null
@@ -1,46 +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
-#
-
-# buttons on top
-displayTimeline=Zeitleiste
-displayList=Liste
-clear=Ereignisse abräumen
-
-# table headers
-received=Empfangene Ereignisse
-topic=Thema
-properties=Eigenschaften
-
-plugin.events.title=Ereignisse
-
-# send event
-sendEvent=Ereignis sync./async. senden
-post=Ereignis async. senden
-send=Ereignis sync. senden
-close=Schließen
diff --git
a/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/metatype.properties
b/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/metatype.properties
deleted file mode 100644
index 78836005c5..0000000000
---
a/webconsole-plugins/event/src/main/resources/OSGI-INF/l10n/metatype.properties
+++ /dev/null
@@ -1,25 +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.
-#
-
-plugin.name = Apache Felix Web Console Event Plugin
-plugin.description = This is a plugin for the Apache Felix Web Console \
- displaying all events occuring in the system.
-
-max.size.name = Maximum Events
-max.size.description = The maximum number of events displayed in the plugin.
diff --git
a/webconsole-plugins/event/src/main/resources/OSGI-INF/metatype/metatype.xml
b/webconsole-plugins/event/src/main/resources/OSGI-INF/metatype/metatype.xml
deleted file mode 100644
index 1d249ff569..0000000000
--- a/webconsole-plugins/event/src/main/resources/OSGI-INF/metatype/metatype.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0"
localization="OSGI-INF/l10n/metatype">
- <OCD id="org.apache.felix.webconsole.plugins.event.internal.PluginServlet"
name="%plugin.name" description="%plugin.description">
- <AD id="max.size" type="Integer" default="250" name="%max.size.name"
description="%max.size.description"/>
- </OCD>
- <Designate
pid="org.apache.felix.webconsole.plugins.event.internal.PluginServlet">
- <Object
ocdref="org.apache.felix.webconsole.plugins.event.internal.PluginServlet"/>
- </Designate>
-</metatype:MetaData>
diff --git a/webconsole-plugins/event/src/main/resources/res/events.html
b/webconsole-plugins/event/src/main/resources/res/events.html
deleted file mode 100644
index eee1e680df..0000000000
--- a/webconsole-plugins/event/src/main/resources/res/events.html
+++ /dev/null
@@ -1,66 +0,0 @@
-<script type="text/javascript"
src="${pluginRoot}/res/ui/addremove.js"></script>
-<script type="text/javascript"
src="${pluginRoot}/res/ui/propeditor.js"></script>
-<script type="text/javascript" src="${pluginRoot}/res/ui/events.js"></script>
-<script type="text/javascript">
-var i18n = {
- displayTimeline: '${displayTimeline}',
- displayList : '${displayList}',
- close : '${close}',
- reset : '${reset}',
- send : '${send}',
- post : '${post}'
-}
-</script>
-
-<!-- status line -->
-<p class="statline"> </p>
-
-<!-- table caption -->
-<div class="ui-widget-header ui-corner-top buttonGroup">
- <button id="switch">${displayTimeline}</button>
- <button id="clear">${clear}</button>
- <button id="sendButton">${sendEvent}</button>
- <button id="reload">${reload}</button>
-</div>
-
-<!-- table -->
-<table id="eventsTable" class="tablesorter nicetable">
- <thead>
- <tr>
- <th class="col_Received">${received}</th>
- <th class="col_Topic">${topic}</th>
- <th class="col_Props">${properties}</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td> </td>
- <td> </td>
- <td> </td>
- </tr>
- </tbody>
-</table>
-
-<div id="timeline" class="ui-helper-hidden"> </div>
-
-<div id="timelineLegend" class="ui-helper-hidden">
- <span class="event eventservice">Service Event</span>
- <span class="event eventbundle">Bundle Event</span>
- <span class="event eventconfig">Config Event</span>
- <span class="event eventframework">Framework Event</span>
-</div>
-
-<div id="sendDialog" title="${sendEvent}" class="ui-helper-hidden">
- <table>
- <tbody>
- <tr>
- <th>${topic}:</th>
- <td><input id="sendTopic"/></td>
- </tr>
- <tr>
- <th>${properties}:</th>
- <td id="sendProperties"></td>
- </tr>
- </tbody>
- </table>
-</div>
diff --git a/webconsole-plugins/event/src/main/resources/res/ui/addremove.js
b/webconsole-plugins/event/src/main/resources/res/ui/addremove.js
deleted file mode 100644
index 6f90da4a96..0000000000
--- a/webconsole-plugins/event/src/main/resources/res/ui/addremove.js
+++ /dev/null
@@ -1,114 +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.
- *
- Structure is:
- <div class="my-element-container">
- <div class="multiInput">
- <div id="myElement" /> + -
- </div>
- </div>
-
- Options:
- add : function(element) - called AFTER add
- remove : function(element) - called BEFORE remove
-*/
-(function( $ ){
-
- var methods = {
- init : function(options) {
- return this.each( function() {
- // If options exist, lets merge them with our
default settings
- var settings = {
- add : false,
- remove : false
- };
- if (options) settings = $.extend(settings,
options);
-
- var _this = $(this);
- var template = _init_template( _this );
- _this.data('addremove_settings', settings);
- _new_entry(template, _this);
- })
- },
- reset : function() {
- return this.each( function() {
- var self = $(this);
- self.find('div.addremove').not(':first').each(
function() {
- $(this).find('button.rem').click();
- });
- });
- },
- add : function(count) {
- return this.each( function() {
- var self = $(this);
- var addfn = self.find('div.addremove:last
button.add');
- if (addfn.size()) {
- var num = count ? count : 1;
- for(var i=0; i<num; i++) addfn.click();
- }
- });
- },
- count : function() {
- var self = $(this);
- return $(this).find('div.addremove').size();
- }
- };
-
- $.fn.addremove = function( method ) {
- // Method calling logic
- if ( methods[method] ) {
- return methods[ method ].apply( this,
Array.prototype.slice.call( arguments, 1 ));
- } else if ( typeof method === 'object' || ! method ) {
- return methods.init.apply( this, arguments );
- } else {
- $.error( 'Method ' + method + ' does not exist on
jQuery.addremove' );
- }
- };
-
- var _new_entry = function(template, container) {
- var settings = container.data('addremove_settings');
- var _entry = template.clone()
- .find('button.add').click( function() {
- _new_entry(template, container);
- return false;
- }).end()
- .find('button.rem').click( function() {
- if (container.addremove('count') > 1) {
- if (typeof settings.remove ==
'function') {
- settings.remove(_entry);
- }
- _entry.remove();
- }
- return false;
- }).end()
- .appendTo(container);
- if (typeof settings.add == 'function') settings.add(_entry);
- }
-
- var _init_template = function(entry) {
- return _el('div', 'addremove')
- .append(entry.children())
- .append(_el('button', 'add').text('+'))
- .append(_el('button', 'rem').text('-'));
- }
-
- var _el = function(el, clazz) {
- var ret = $(document.createElement(el));
- if (clazz) ret.addClass(clazz);
- return ret;
- }
-
-})( jQuery );
\ No newline at end of file
diff --git a/webconsole-plugins/event/src/main/resources/res/ui/events.css
b/webconsole-plugins/event/src/main/resources/res/ui/events.css
deleted file mode 100644
index a8dbe20966..0000000000
--- a/webconsole-plugins/event/src/main/resources/res/ui/events.css
+++ /dev/null
@@ -1,36 +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.
- */
-#timeline { width: 100%; overflow-x: scroll }
-#timelineLegend .event { display: inline-block; width: 12em; margin: .2em 0;
text-align: center }
-.event { overflow:visible; white-space:nowrap }
-.eventservice { background-color: #ADFF2F }
-.eventbundle { background-color: #FFCACD }
-.eventconfig { background-color: #FFD700 }
-.eventframework { background-color: #DCDCDC }
-
-table.propTable, table.propTable tr, table.propTable td { border: none
!important }
-td.propName { padding: 0 4px 0 0; text-align: right !important;
text-decoration: underline }
-td.propVal { padding: 0 0 0 4px }
-td.time { white-space: nowrap }
-
-/* send dialog styling */
-.addremove button { width: 16px; height: 16px; line-height: 10px; font-size:
10px; margin: 2px 2px }
-.addremove_inner { display: inline }
-.propeditor_entry select { margin-left: 4px }
-#sendTopic { width: 100%; margin-bottom: 1em }
-#sendDialog table { margin-left: auto; margin-right: auto }
-#sendDialog table th { text-align: right; font-weight: bold; padding-right:
.5em }
diff --git a/webconsole-plugins/event/src/main/resources/res/ui/events.js
b/webconsole-plugins/event/src/main/resources/res/ui/events.js
deleted file mode 100644
index 90121ffb5e..0000000000
--- a/webconsole-plugins/event/src/main/resources/res/ui/events.js
+++ /dev/null
@@ -1,159 +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.
- */
-var eventsTable = false;
-
-/* displays a date in the user's local timezone */
-function printDate(time) {
- var date = time ? new Date(time) : new Date();
- return date.toLocaleString();
-}
-
-function renderData( eventData ) {
- $('.statline').html(eventData.status); // FIXME:
-
- // append table view
- eventsBody.empty();
- for ( var i in eventData.data ) entry( eventData.data[i] );
- eventsTable.trigger('update').trigger('applyWidgets');
-
- // append timeline view
- timeline.empty();
- for ( var i in eventData.data ) entryTimeline( eventData.data[i] );
-}
-
-
-function entryTimeline( /* Object */ dataEntry ) {
- var txt = '<div class="event event' + dataEntry.category + '"
style="width:' + dataEntry.width + '%">' +
- '<b>' + dataEntry.offset + '</b> <b>' + dataEntry.topic +
'</b>';
- if ( dataEntry.info ) txt += ' : ' + dataEntry.info;
- txt += '</div>';
- timeline.prepend(txt);
-}
-
-function entry( /* Object */ dataEntry ) {
- var properties = dataEntry.properties;
-
- var propE;
- if ( dataEntry.info ) {
- propE = text(dataEntry.info);
- } else {
- var bodyE = createElement('tbody');
- for( var p in dataEntry.properties ) {
- bodyE.appendChild(tr(null, null, [
- td('propName', null, [text(p)]),
- td('propVal' , null,
[text(dataEntry.properties[p])])
- ]));
- }
- propE = createElement('table', 'propTable', null, [ bodyE ]);
- }
-
- $(tr( null, { id: 'entry' + dataEntry.id }, [
- td( 'time', null, [ text( printDate(dataEntry.received) ) ] ),
- td( 'topic', null, [ text( dataEntry.topic ) ] ),
- td( 'detailes', null, [ propE ] )
- ])).appendTo(eventsBody);
-}
-
-var timeline = false;
-var timelineLegend = false;
-$(document).ready(function(){
- eventsTable = $('#eventsTable');
- eventsBody = eventsTable.find('tbody');
- timeline = $('#timeline');
- timelineLegend = $('#timelineLegend');
-
- $('#clear').click(function () {
- $.post(pluginRoot, { 'action':'clear' }, renderData, 'json');
- });
- $('#switch').click(function() {
- var timelineHidden = timeline.hasClass('ui-helper-hidden');
- if (timelineHidden) {
- $(this).text(i18n.displayList);
- timeline.removeClass('ui-helper-hidden');
- timelineLegend.removeClass('ui-helper-hidden');
- eventsTable.addClass('ui-helper-hidden');
- } else {
- $(this).text(i18n.displayTimeline);
- timeline.addClass('ui-helper-hidden');
- timelineLegend.addClass('ui-helper-hidden');
- eventsTable.removeClass('ui-helper-hidden');
- }
- });
- $('#reload').click(function() {
- $.get(pluginRoot + '/data.json', null, renderData, 'json');
- }).click();
-
- function sendData(action) {
- // check topic
- var topic = sendTopic.val();
- var topicOk = topic.match(/^[\w-]+(\/[\w-]+)*$/g) != null;
- if (topicOk) {
- sendTopic.removeClass('ui-state-error');
- } else {
- sendTopic.addClass('ui-state-error');
- }
- var data = sendProperties.propeditor('serialize');
- if (topicOk && typeof data != 'boolean') {
- $.post(pluginRoot,
- data.concat([
- {name : 'action', value : action},
- {name : 'topic', value : topic}
- ]),
- renderData,
- 'json'
- );
- sendDialog.dialog("close");
- }
- }
-
- /* send dialog code */
- var sendButtons = {};
- sendButtons[i18n.close] = function() {
- $(this).dialog("close");
- }
- sendButtons[i18n.reset] = function() {
- sendTopic.val('');
- sendProperties.propeditor('reset');
- }
- sendButtons[i18n.send] = function() {
- sendData('send');
- }
- sendButtons[i18n.post] = function() {
- sendData('post');
- }
- var sendDialog = $('#sendDialog').dialog({
- autoOpen: false,
- modal : true,
- width : '40%',
- buttons : sendButtons,
- open : function() {
- //sendTopic.val('');
- //sendProperties.propeditor('reset');
- }
- });
- var sendTopic = $('#sendTopic');
- var sendProperties = $('#sendProperties').propeditor({
- add: function(el) {
- el.find('select').addClass('dynhover');
- initStaticWidgets(el);
- }
- });
- $('#sendButton').click(function() {
- sendDialog.dialog('open');
- });
-
-});
diff --git a/webconsole-plugins/event/src/main/resources/res/ui/propeditor.js
b/webconsole-plugins/event/src/main/resources/res/ui/propeditor.js
deleted file mode 100644
index cf26a0b7dd..0000000000
--- a/webconsole-plugins/event/src/main/resources/res/ui/propeditor.js
+++ /dev/null
@@ -1,206 +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.
- *
- Structure is:
- <div class="propeditor">
- <div>
- <input class="key"/> =
- <input class="value"/>
- <select>
- <option>byte</option>
- <option>int</option>
- <option>long</option>
- <option>float</option>
- <option>double</option>
- <option>string</option>
- <option>char</option>
- <option>hex</option>
- <option>sha1</option>
- <option>base64</option>
- </select>
- </div>
- </div>
-
- Options:
- validator : function(keyInputField, valInputField, type)
- types : ['byte', 'int', 'long', 'float', 'double', 'string',
'char', 'hex', 'base64', 'sha1']
-*/
-(function( $ ){
- var methods = {
- init : function(options) {
- return this.each( function() {
- // If options exist, lets merge them with our
default settings
- var settings = {
- validator : false,
- types : ['byte', 'int', 'long',
'float', 'double', 'string', 'char', 'byte array']
- };
- if (options) settings = $.extend(settings,
options);
-
- var _this = $(this);
- _this.data('propeditor_settings', settings);
- _this.append(_entry(settings.types));
- _this.addremove(settings);
- })
- },
- reset : function() {
- return this.each( function() {
- $(this).addremove('reset')
- .find('.key').val('').end()
- .find('.val').val('');
- });
- },
- serialize : function() {
- var self = $(this);
- var validator =
self.data('propeditor_settings').validator;
- var result = new Array();
- var ok = true;
- var entries = $(this).find('div.addremove');
- if (entries.size() == 1) {
- var k =
entries.find('.key').removeClass('ui-state-error').val();
- var v =
entries.find('.val').removeClass('ui-state-error').val();
- if (k || v) {
- var data = _check_entry( entries,
validator );
- if ( data == false ) ok = false; else
result = data;
- }
- } else {
- entries.each(function() {
- var data = _check_entry( $(this),
validator );
- if ( data == false ) ok = false; else
result = result.concat(data);
- });
- }
- return ok ? result : false;
- },
- setup : function(data, append) {
- var self = $(this);
- if (!append) self.propeditor('reset');
- for (var i in data) {
- self.addremove('add');
- var d = data[i];
- self.find('div.addremove:last')
- .find('.key').val(d.key).end()
- .find('.val').val(d.val).end()
- .find('.typ').val(d.type);
- }
- if (!append) self.find('div.addremove:first').remove();
- }
- };
-
- $.fn.propeditor = function( method ) {
- // Method calling logic
- if ( methods[method] ) {
- return methods[ method ].apply( this,
Array.prototype.slice.call( arguments, 1 ));
- } else if ( typeof method === 'object' || ! method ) {
- return methods.init.apply( this, arguments );
- } else {
- $.error( 'Method ' + method + ' does not exist on
jQuery.tooltip' );
- }
- };
-
- var _el = function(el, clazz) {
- var ret = $(document.createElement(el));
- if (clazz) ret.addClass(clazz);
- return ret;
- }
-
- var _entry = function(TYPES) {
- var sel = _el('select', 'typ');
- for(var i in TYPES) {
- sel.append( _el('option').text( TYPES[i] ) );
- }
- return _el('span', 'propeditor_entry')
- .append( _el('input', 'key') )
- .append( _el('span').text(' = '))
- .append( _el('input', 'val') )
- .append( sel );
- }
-
- var _check_entry = function(e, validator) {
- var k = e.find('.key').removeClass('ui-state-error');
- var v = e.find('.val').removeClass('ui-state-error');
- var t = e.find('.typ').val();
- var ok = _check_field(k);
- ok = _check_field(v) && ok;
- ok = ok && _defaultPropertyValidator(k, v, t);
- if (ok && typeof validator == 'function') {
- ok = validator(k, v, t);
- }
- if (ok) {
- return [
- { 'name' : 'key', 'value' : k.val() },
- { 'name' : 'val', 'value' : v.val() },
- { 'name' : 'type', 'value' : t }
- ];
- /*
- return {
- 'key': k.val(),
- 'val': v.val(),
- 'type': t
- }*/
- }
- return false;
- }
-
- var _check_field = function(f) {
- if (!f.val()) {
- f.addClass('ui-state-error');
- return false;
- }
- return true;
- }
-
- var _range = function(field, isint, min, max) {
- var v = false;
- if (isint) {
- var v = parseInt(field.val());
- var xv = parseFloat(field.val());
- if ( isNaN(v) || isNaN(xv) || xv != v) return false;
// field is actually double
- } else { // double
- v = parseFloat(field.val());
- if (isNaN(v)) return false;
- }
-
- return v >= min && v <= max;
- }
-
- // key == element, value == element, type == type string
- var _defaultPropertyValidator = function(key, value, type) {
- var v = value.val();
- var ok = true;
- switch(type) {
- case 'byte':
- ok = _range(value, true, -128, 127);
- break;
- case 'int':
- ok = _range(value, true, -2147483648,
2147483647);
- break;
- case 'long':
- ok = _range(value, true, -9223372036854775808,
9223372036854775807);
- break;
- case 'float':
- ok = _range(value, false, 1.4E-45, 3.4E38);
- break;
- case 'double':
- ok = _range(value, false, 4.9E-324, 1.7E308);
- break;
- case 'char':
- ok = v.length == 1;
- break;
- }
- if (!ok) value.addClass('ui-state-error');
- return ok;
- }
-
-})( jQuery );
\ No newline at end of file