[jboss-cvs] JBossAS SVN: r86518 - in projects/jboss-osgi/trunk/service/webconsole: src/main/java/org/apache/felix/webconsole and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Mar 31 06:14:26 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-03-31 06:14:25 -0400 (Tue, 31 Mar 2009)
New Revision: 86518
Removed:
projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/Action.java
projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/ConfigurationPrinter.java
projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/Render.java
projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleConstants.java
projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/BaseManagementPlugin.java
projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/BaseWebConsolePlugin.java
projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/Logger.java
projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerActivator.java
projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerPlugin.java
projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/Util.java
projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/
projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/
projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/deppack/
projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/
projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/
projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManagerHttpContext.java
projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/RenderBridge.java
projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/
Modified:
projects/jboss-osgi/trunk/service/webconsole/pom.xml
Log:
Unpack felix webconsole rather than include the sources
Modified: projects/jboss-osgi/trunk/service/webconsole/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/service/webconsole/pom.xml 2009-03-31 09:51:56 UTC (rev 86517)
+++ projects/jboss-osgi/trunk/service/webconsole/pom.xml 2009-03-31 10:14:25 UTC (rev 86518)
@@ -22,21 +22,28 @@
<showDeprecation>false</showDeprecation>
</configuration>
</plugin>
- <!-- see resources/OSGI-INF/metatype.xml
<plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- <version>1.0.6</version>
+ <artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
- <id>generate-scr-scrdescriptor</id>
+ <id>copy</id>
+ <phase>process-resources</phase>
<goals>
- <goal>scr</goal>
+ <goal>unpack</goal>
</goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.webconsole</artifactId>
+ <type>jar</type>
+ <outputDirectory>target/classes</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
</execution>
</executions>
</plugin>
- -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
@@ -71,6 +78,7 @@
org.apache.felix.scr;
org.apache.felix.shell;
org.osgi.service.*;resolution:=optional,*
+ javax.portlet;resolution:=optional,*;
</Import-Package>
<Embed-Dependency>
<!-- Import/Export-Package parsing, OBR -->
@@ -92,33 +100,15 @@
<version>2.4</version>
<scope>provided</scope>
</dependency>
-
- <!-- This adds commons-io transitively -->
<dependency>
- <groupId>commons-fileupload</groupId>
- <artifactId>commons-fileupload</artifactId>
- <version>1.1.1</version>
- <scope>compile</scope>
- <optional>true</optional>
- </dependency>
-
- <dependency>
<groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
+ <artifactId>org.osgi.compendium</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <version>1.2.0</version>
+ <artifactId>org.apache.felix.webconsole</artifactId>
<scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>javax.servlet</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
@@ -143,6 +133,5 @@
<scope>compile</scope>
<optional>true</optional>
</dependency>
-
</dependencies>
</project>
Deleted: projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/Action.java
===================================================================
--- projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/Action.java 2009-03-31 09:51:56 UTC (rev 86517)
+++ projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/Action.java 2009-03-31 10:14:25 UTC (rev 86518)
@@ -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;
-
-
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-
-/**
- * The <code>Action</code> interface defines a service interface for actions
- * to be plugged into the web console.
- * <p>
- * <strong>NOTE: This interface is just an intermediate solution for making the
- * web console extensible. Future releases of the web console will remove this
- * and the {@link Render} interfaces and use the
- * <code>javax.servlet.Servlet</code> interface with predefined service
- * registration properties instead.</strong>
- *
- * @deprecated This interface will be removed when <a
- * href="https://issues.apache.org/jira/browse/FELIX-574">FELIX-574</a>
- * will be implemented.
- */
-public interface Action
-{
-
- static final String SERVICE = Action.class.getName();
-
- /**
- * The name of a request attribute, which may be set by performAction if
- * redirecting.
- */
- static final String ATTR_REDIRECT_PARAMETERS = "redirectParameters";
-
-
- String getName();
-
-
- String getLabel();
-
-
- /**
- * Performs the action the request data optionally sending a response to
- * the HTTP Servlet Response.
- *
- * @param request
- * @param response
- *
- * @return <code>true</code> the client should be redirected after the
- * action has been taken. <code>false</code> if this method also
- * provided response to the client and nore more processing is
- * required.
- *
- * @throws IOException May be thrown if an I/O error occurrs
- * @throws ServletException May be thrown if another error occurrs while
- * processing the action. The <code>rootCause</code> of the exception
- * should contain the cause of the error.
- */
- boolean performAction( HttpServletRequest request, HttpServletResponse response ) throws IOException,
- ServletException;
-
-}
Deleted: projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/ConfigurationPrinter.java
===================================================================
--- projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/ConfigurationPrinter.java 2009-03-31 09:51:56 UTC (rev 86517)
+++ projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/ConfigurationPrinter.java 2009-03-31 10:14:25 UTC (rev 86518)
@@ -1,54 +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;
-
-
-import java.io.PrintWriter;
-
-
-/**
- * The <code>ConfigurationPrinter</code> is a service interface to be used by
- * providers which want to hook into the display of the current configuration
- * of the OSGi framework.
- */
-public interface ConfigurationPrinter
-{
-
- /**
- * The service name under which services of this class must be registered
- * to be picked for inclusion in the configuration report.
- */
- static final String SERVICE = ConfigurationPrinter.class.getName();
-
-
- /**
- * Returns a human readable title string to be place in front of the configuration
- * report generated by the {@link #printConfiguration(PrintWriter)} method.
- */
- String getTitle();
-
-
- /**
- * Prints the configuration report to the given <code>printWriter</code>.
- * Implementations are free to print whatever information they deem useful.
- * The <code>printWriter</code> may be flushed but must not be closed.
- */
- void printConfiguration( PrintWriter printWriter );
-
-}
Deleted: projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/Render.java
===================================================================
--- projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/Render.java 2009-03-31 09:51:56 UTC (rev 86517)
+++ projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/Render.java 2009-03-31 10:14:25 UTC (rev 86518)
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.felix.webconsole;
-
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * The <code>Render</code> interface defines a service interface for
- * information renderings to be plugged into the web console.
- * <p>
- * <strong>NOTE: This interface is just an intermediate solution for making the
- * web console extensible. Future releases of the web console will remove this
- * and the {@link Action} interfaces and use the
- * <code>javax.servlet.Servlet</code> interface with predefined service
- * registration properties instead.</strong>
- *
- * @deprecated This interface will be removed when <a
- * href="https://issues.apache.org/jira/browse/FELIX-574">FELIX-574</a>
- * will be implemented.
- */
-public interface Render {
-
- static final String SERVICE = Render.class.getName();
-
- String getName();
-
- String getLabel();
-
- void render(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException;
-
-}
Deleted: projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleConstants.java
===================================================================
--- projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleConstants.java 2009-03-31 09:51:56 UTC (rev 86517)
+++ projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleConstants.java 2009-03-31 10:14:25 UTC (rev 86518)
@@ -1,41 +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;
-
-
-public interface WebConsoleConstants
-{
-
- /**
- * The name of the service to register as to be used as a "plugin" for
- * the OSGi Manager (value is "javax.servlet.Servlet").
- */
- public static final String SERVICE_NAME = "javax.servlet.Servlet";
-
- /**
- * The URI address label under which the OSGi Manager plugin is called by
- * the OSGi Manager (value is "felix.webconsole.label").
- * <p>
- * Only {@link #SERVICE_NAME} services with this service registration
- * property set to a non-empty String values are accepted by the OSGi
- * Manager as a plugin.
- */
- public static final String PLUGIN_LABEL = "felix.webconsole.label";
-
-}
Deleted: projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/BaseManagementPlugin.java
===================================================================
--- projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/BaseManagementPlugin.java 2009-03-31 09:51:56 UTC (rev 86517)
+++ projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/BaseManagementPlugin.java 2009-03-31 10:14:25 UTC (rev 86518)
@@ -1,105 +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.internal;
-
-
-import org.osgi.framework.BundleContext;
-import org.osgi.service.packageadmin.PackageAdmin;
-import org.osgi.service.startlevel.StartLevel;
-import org.osgi.util.tracker.ServiceTracker;
-
-
-public class BaseManagementPlugin implements OsgiManagerPlugin
-{
-
- private BundleContext bundleContext;
- private Logger log;
-
- private ServiceTracker startLevelService;
-
- private ServiceTracker packageAdmin;
-
-
- protected BaseManagementPlugin()
- {
- }
-
-
- public void activate( BundleContext bundleContext )
- {
- this.bundleContext = bundleContext;
- this.log = new Logger( bundleContext );
- }
-
-
- public void deactivate()
- {
- if ( log != null )
- {
- log.dispose();
- }
-
- if ( startLevelService != null )
- {
- startLevelService.close();
- startLevelService = null;
- }
-
- if ( packageAdmin != null )
- {
- packageAdmin.close();
- packageAdmin = null;
- }
- }
-
-
- protected BundleContext getBundleContext()
- {
- return bundleContext;
- }
-
-
- protected Logger getLog()
- {
- return log;
- }
-
-
- protected StartLevel getStartLevel()
- {
- if ( startLevelService == null )
- {
- startLevelService = new ServiceTracker( getBundleContext(), StartLevel.class.getName(), null );
- startLevelService.open();
- }
- return ( StartLevel ) startLevelService.getService();
- }
-
-
- protected PackageAdmin getPackageAdmin()
- {
- if ( packageAdmin == null )
- {
- packageAdmin = new ServiceTracker( getBundleContext(), PackageAdmin.class.getName(), null );
- packageAdmin.open();
- }
- return ( PackageAdmin ) packageAdmin.getService();
- }
-
-}
Deleted: projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/BaseWebConsolePlugin.java
===================================================================
--- projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/BaseWebConsolePlugin.java 2009-03-31 09:51:56 UTC (rev 86517)
+++ projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/BaseWebConsolePlugin.java 2009-03-31 10:14:25 UTC (rev 86518)
@@ -1,96 +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.internal;
-
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.felix.webconsole.AbstractWebConsolePlugin;
-import org.osgi.service.packageadmin.PackageAdmin;
-import org.osgi.service.startlevel.StartLevel;
-import org.osgi.util.tracker.ServiceTracker;
-
-
-public abstract class BaseWebConsolePlugin extends AbstractWebConsolePlugin implements OsgiManagerPlugin
-{
-
- private static String PACKAGE_ADMIN_NAME = PackageAdmin.class.getName();
- private static String START_LEVEL_NAME = StartLevel.class.getName();
-
- private Logger log;
-
- private Map services = new HashMap();
-
-
- public void deactivate()
- {
- for ( Iterator ti = services.values().iterator(); ti.hasNext(); )
- {
- ServiceTracker tracker = ( ServiceTracker ) ti.next();
- tracker.close();
- ti.remove();
- }
-
- if ( log != null )
- {
- log.dispose();
- log = null;
- }
- }
-
-
- protected Logger getLog()
- {
- if ( log == null )
- {
- log = new Logger( getBundleContext() );
- }
-
- return log;
- }
-
-
- protected StartLevel getStartLevel()
- {
- return ( StartLevel ) getService( START_LEVEL_NAME );
- }
-
-
- protected PackageAdmin getPackageAdmin()
- {
- return ( PackageAdmin ) getService( PACKAGE_ADMIN_NAME );
- }
-
-
- protected Object getService( String serviceName )
- {
- ServiceTracker serviceTracker = ( ServiceTracker ) services.get( serviceName );
- if ( serviceTracker == null )
- {
- serviceTracker = new ServiceTracker( getBundleContext(), serviceName, null );
- serviceTracker.open();
-
- services.put( serviceName, serviceTracker );
- }
-
- return serviceTracker.getService();
- }
-}
Deleted: projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/Logger.java
===================================================================
--- projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/Logger.java 2009-03-31 09:51:56 UTC (rev 86517)
+++ projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/Logger.java 2009-03-31 10:14:25 UTC (rev 86518)
@@ -1,96 +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.internal;
-
-
-import org.osgi.framework.BundleContext;
-import org.osgi.service.log.LogService;
-import org.osgi.util.tracker.ServiceTracker;
-
-
-public class Logger
-{
-
- private ServiceTracker logTracker;
-
-
- public Logger( BundleContext bundleContext )
- {
- logTracker = new ServiceTracker( bundleContext, LogService.class.getName(), null );
- logTracker.open();
- }
-
-
- public void dispose()
- {
- if ( logTracker != null )
- {
- logTracker.close();
- }
- }
-
-
- public void log( int logLevel, String message )
- {
- log( logLevel, message, null );
- }
-
-
- public void log( int logLevel, String message, Throwable t )
- {
- Object log = logTracker.getService();
- if ( log != null )
- {
- ( ( LogService ) log ).log( logLevel, message, t );
- }
- else
- {
- String level;
- switch ( logLevel )
- {
- case LogService.LOG_DEBUG:
- level = "*DEBUG*";
- break;
- case LogService.LOG_INFO:
- level = "*INFO *";
- break;
- case LogService.LOG_WARNING:
- level = "*WARN *";
- break;
- case LogService.LOG_ERROR:
- level = "*ERROR*";
- break;
- default:
- level = "*" + logLevel + "*";
- break;
- }
-
- if ( message == null && t != null )
- {
- message = t.getMessage();
- }
-
- System.out.println( level + " " + message );
- if ( t != null )
- {
- t.printStackTrace( System.out );
- }
- }
- }
-}
Deleted: projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerActivator.java
===================================================================
--- projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerActivator.java 2009-03-31 09:51:56 UTC (rev 86517)
+++ projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerActivator.java 2009-03-31 10:14:25 UTC (rev 86518)
@@ -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.
- */
-package org.apache.felix.webconsole.internal;
-
-
-import org.apache.felix.webconsole.internal.servlet.OsgiManager;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-
-public class OsgiManagerActivator implements BundleActivator
-{
-
- private OsgiManager osgiManager;
-
-
- public void start( BundleContext bundleContext )
- {
- osgiManager = new OsgiManager( bundleContext );
- }
-
-
- public void stop( BundleContext arg0 )
- {
- if ( osgiManager != null )
- {
- osgiManager.dispose();
- }
- }
-
-}
Deleted: projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerPlugin.java
===================================================================
--- projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerPlugin.java 2009-03-31 09:51:56 UTC (rev 86517)
+++ projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/OsgiManagerPlugin.java 2009-03-31 10:14:25 UTC (rev 86518)
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.felix.webconsole.internal;
-
-
-import org.osgi.framework.BundleContext;
-
-
-public interface OsgiManagerPlugin
-{
-
- void activate( BundleContext bundleContext );
-
-
- void deactivate();
-
-}
Deleted: projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/Util.java
===================================================================
--- projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/Util.java 2009-03-31 09:51:56 UTC (rev 86517)
+++ projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/Util.java 2009-03-31 10:14:25 UTC (rev 86518)
@@ -1,195 +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.internal;
-
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.util.Arrays;
-import java.util.Comparator;
-
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.io.IOUtils;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Version;
-
-
-/**
- * The <code>Util</code> TODO
- */
-public class Util
-{
-
- /** web apps subpage */
- public static final String PAGE_WEBAPPS = "/webapps";
-
- /** vm statistics subpage */
- public static final String PAGE_VM_STAT = "/vmstat";
-
- /** Logs subpage */
- public static final String PAGE_LOGS = "/logs";
-
- /** Parameter name */
- public static final String PARAM_ACTION = "action";
-
- /** Parameter name */
- public static final String PARAM_CONTENT = "content";
-
- /** Parameter name */
- public static final String PARAM_SHUTDOWN = "shutdown";
-
- /** Parameter value */
- public static final String VALUE_SHUTDOWN = "shutdown";
-
-
- public static void startScript( PrintWriter pw )
- {
- pw.println( "<script type='text/javascript'>" );
- pw.println( "// <![CDATA[" );
- }
-
-
- public static void endScript( PrintWriter pw )
- {
- pw.println( "// ]]>" );
- pw.println( "</script>" );
- }
-
-
- public static void spool( String res, HttpServletResponse resp ) throws IOException
- {
- InputStream ins = getResource( res );
- if ( ins != null )
- {
- try
- {
- IOUtils.copy( ins, resp.getOutputStream() );
- }
- finally
- {
- IOUtils.closeQuietly( ins );
- }
- }
- }
-
-
- private static InputStream getResource( String resource )
- {
- return Util.class.getResourceAsStream( resource );
- }
-
-
- /**
- * Return a display name for the given <code>bundle</code>:
- * <ol>
- * <li>If the bundle has a non-empty <code>Bundle-Name</code> manifest
- * header that value is returned.</li>
- * <li>Otherwise the symbolic name is returned if set</li>
- * <li>Otherwise the bundle's location is returned if defined</li>
- * <li>Finally, as a last ressort, the bundles id is returned</li>
- * </ol>
- */
- public static String getName( Bundle bundle )
- {
- String name = ( String ) bundle.getHeaders().get( Constants.BUNDLE_NAME );
- if ( name == null || name.length() == 0 )
- {
- name = bundle.getSymbolicName();
- if ( name == null )
- {
- name = bundle.getLocation();
- if ( name == null )
- {
- name = String.valueOf( bundle.getBundleId() );
- }
- }
- }
- return name;
- }
-
-
- /**
- * Orders the bundles according to their name as returned by
- * {@link #getName(Bundle)}, with the exception that the system bundle is
- * always place as the first entry. If two bundles have the same name, they
- * are ordered according to their version. If they have the same version,
- * the bundle with the lower bundle id comes before the other.
- */
- public static void sort( Bundle[] bundles )
- {
- Arrays.sort( bundles, BUNDLE_NAME_COMPARATOR );
- }
-
- // ---------- inner classes ------------------------------------------------
-
- private static final Comparator BUNDLE_NAME_COMPARATOR = new Comparator()
- {
- public int compare( Object o1, Object o2 )
- {
- return compare( ( Bundle ) o1, ( Bundle ) o2 );
- }
-
-
- public int compare( Bundle b1, Bundle b2 )
- {
-
- // the same bundles
- if ( b1 == b2 || b1.getBundleId() == b2.getBundleId() )
- {
- return 0;
- }
-
- // special case for system bundle, which always is first
- if ( b1.getBundleId() == 0 )
- {
- return -1;
- }
- else if ( b2.getBundleId() == 0 )
- {
- return 1;
- }
-
- // compare the symbolic names
- int snComp = Util.getName( b1 ).compareToIgnoreCase( Util.getName( b2 ) );
- if ( snComp != 0 )
- {
- return snComp;
- }
-
- // same names, compare versions
- Version v1 = Version.parseVersion( ( String ) b1.getHeaders().get( Constants.BUNDLE_VERSION ) );
- Version v2 = Version.parseVersion( ( String ) b2.getHeaders().get( Constants.BUNDLE_VERSION ) );
- int vComp = v1.compareTo( v2 );
- if ( vComp != 0 )
- {
- return vComp;
- }
-
- // same version ? Not really, but then, we compare by bundle id
- if ( b1.getBundleId() < b2.getBundleId() )
- {
- return -1;
- }
-
- // b1 id must be > b2 id because equality is already checked
- return 1;
- }
- };
-}
Deleted: projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManagerHttpContext.java
===================================================================
--- projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManagerHttpContext.java 2009-03-31 09:51:56 UTC (rev 86517)
+++ projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManagerHttpContext.java 2009-03-31 10:14:25 UTC (rev 86518)
@@ -1,260 +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.internal.servlet;
-
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URL;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.osgi.service.http.HttpContext;
-import org.osgi.service.http.HttpService;
-
-
-final class OsgiManagerHttpContext implements HttpContext
-{
-
- private static final String HEADER_WWW_AUTHENTICATE = "WWW-Authenticate";
-
- private static final String HEADER_AUTHORIZATION = "Authorization";
-
- private static final String AUTHENTICATION_SCHEME_BASIC = "Basic";
-
- /**
- * The encoding table which causes BaseFlex encoding/deconding to work like
- * Base64 encoding/deconding.
- */
- private static final String base64Table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
- /**
- * The pad character used in Base64 encoding/deconding.
- */
- private static final char base64Pad = '=';
-
- String realm;
-
- String userId;
- String user;
-
- private final HttpContext base;
-
-
- OsgiManagerHttpContext( HttpService httpService, String realm, String userId, String password )
- {
- this.base = httpService.createDefaultHttpContext();
- this.realm = realm;
- this.userId = userId;
- this.user = encode( userId, password );
- }
-
-
- public String getMimeType( String name )
- {
- return this.base.getMimeType( name );
- }
-
-
- public URL getResource( String name )
- {
- URL url = this.base.getResource( name );
- if ( url == null && name.endsWith( "/" ) )
- {
- return this.base.getResource( name.substring( 0, name.length() - 1 ) );
- }
- return url;
- }
-
-
- /**
- * Checks the <code>Authorization</code> header of the request for Basic
- * authentication user name and password. If contained, the credentials are
- * compared to the user name and password set for the OSGi Console.
- * <p>
- * If no user name is set, the <code>Authorization</code> header is
- * ignored and the client is assumed to be authenticated.
- *
- * @param request The HTTP request used to get the
- * <code>Authorization</code> header.
- * @param response The HTTP response used to send the authentication request
- * if authentication is required but not satisfied.
- * @return <code>true</code> if authentication is required and not
- * satisfied by the request.
- */
- public boolean handleSecurity( HttpServletRequest request, HttpServletResponse response )
- {
-
- // don't care for authentication if no user name is configured
- if ( this.user == null )
- {
- return true;
- }
-
- // Return immediately if the header is missing
- String authHeader = request.getHeader( HEADER_AUTHORIZATION );
- if ( authHeader != null && authHeader.length() > 0 )
- {
-
- // Get the authType (Basic, Digest) and authInfo (user/password)
- // from
- // the header
- authHeader = authHeader.trim();
- int blank = authHeader.indexOf( ' ' );
- if ( blank > 0 )
- {
- String authType = authHeader.substring( 0, blank );
- String authInfo = authHeader.substring( blank ).trim();
-
- // Check whether authorization type matches
- if ( authType.equalsIgnoreCase( AUTHENTICATION_SCHEME_BASIC ) && this.user.equals( authInfo ) )
- {
-
- // as per the spec, set attributes
- request.setAttribute( HttpContext.AUTHENTICATION_TYPE, "" );
- request.setAttribute( HttpContext.REMOTE_USER, this.userId );
-
- // succeed
- return true;
- }
- }
- }
-
- // request authentication
- response.setHeader( HEADER_WWW_AUTHENTICATE, AUTHENTICATION_SCHEME_BASIC + " realm=\"" + this.realm + "\"" );
- try
- {
- response.sendError( HttpServletResponse.SC_UNAUTHORIZED );
- }
- catch ( IOException ioe )
- {
- // failed sending the error, fall back to setting the status
- response.setStatus( HttpServletResponse.SC_UNAUTHORIZED );
- }
-
- // inform HttpService that authentication failed
- return false;
- }
-
-
- /**
- * Base64 encodes the user name and password for comparison to the value of
- * a Basic encoded HTTP header authentication.
- *
- * @param user The name of the user in the username/password pair
- * @param password The password in the username/password pair
- * @return The Base64 encoded username/password pair or <code>null</code>
- * if <code>user</code> is <code>null</code> or empty.
- */
- public static String encode( String user, String password )
- {
-
- /* check arguments */
- if ( user == null || user.length() == 0 )
- return null;
-
- String srcString = user + ":";
- if ( password != null && password.length() > 0 )
- {
- srcString += password;
- }
-
- // need bytes
- byte[] src;
- try
- {
- src = srcString.getBytes( "ISO-8859-1" );
- }
- catch ( UnsupportedEncodingException uee )
- {
- // we do not expect this, the API presribes ISO-8859-1 to be present
- // anyway, fallback to platform default
- src = srcString.getBytes();
- }
-
- int srcsize = src.length;
- int tbllen = base64Table.length();
-
- StringBuffer result = new StringBuffer( srcsize );
-
- /* encode */
- int tblpos = 0;
- int bitpos = 0;
- int bitsread = -1;
- int inpos = 0;
- int pos = 0;
-
- while ( inpos <= srcsize )
- {
-
- if ( bitsread < 0 )
- {
- if ( inpos < srcsize )
- {
- pos = src[inpos++];
- }
- else
- {
- // inpos++;
- // pos = 0;
- break;
- }
- bitsread = 7;
- }
-
- tblpos = 0;
- bitpos = tbllen / 2;
- while ( bitpos > 0 )
- {
- if ( bitsread < 0 )
- {
- pos = ( inpos < srcsize ) ? src[inpos] : '\0';
- inpos++;
- bitsread = 7;
- }
-
- /* test if bit at pos <bitpos> in <pos> is set.. */
- if ( ( ( 1 << bitsread ) & pos ) != 0 )
- tblpos += bitpos;
-
- bitpos /= 2;
- bitsread--;
- }
-
- // got one
- result.append( base64Table.charAt( tblpos ) );
- }
-
- /* add the padding bytes */
- while ( bitsread != -1 )
- {
- bitpos = tbllen / 2;
- while ( bitpos > 0 )
- {
- if ( bitsread < 0 )
- bitsread = 7;
- bitpos /= 2;
- bitsread--;
- }
-
- result.append( base64Pad );
- }
-
- return result.toString();
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/RenderBridge.java
===================================================================
--- projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/RenderBridge.java 2009-03-31 09:51:56 UTC (rev 86517)
+++ projects/jboss-osgi/trunk/service/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/RenderBridge.java 2009-03-31 10:14:25 UTC (rev 86518)
@@ -1,69 +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.internal.servlet;
-
-
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.felix.webconsole.AbstractWebConsolePlugin;
-import org.apache.felix.webconsole.Render;
-
-
-public class RenderBridge extends AbstractWebConsolePlugin
-{
-
- /** Pseudo class version ID to keep the IDE quite. */
- private static final long serialVersionUID = 1L;
-
- private final Render render;
-
-
- RenderBridge( Render render )
- {
- this.render = render;
- }
-
-
- public Render getRender()
- {
- return render;
- }
-
-
- public String getTitle()
- {
- return render.getLabel();
- }
-
-
- public String getLabel()
- {
- return render.getName();
- }
-
-
- protected void renderContent( HttpServletRequest request, HttpServletResponse response ) throws ServletException,
- IOException
- {
- render.render( request, response );
- }
-
-}
More information about the jboss-cvs-commits
mailing list