Author: mrdon
Date: Mon Feb 25 04:04:16 2008
New Revision: 630822
URL: http://svn.apache.org/viewvc?rev=630822&view=rev
Log:
Adding beginnings of an admin web bundle
Added:
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/pom.xml
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/org/
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/org/apache/
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/org/apache/struts2/
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/org/apache/struts2/osgi/
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/org/apache/struts2/osgi/admin/
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/org/apache/struts2/osgi/admin/BundlesAction.java
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/org/apache/struts2/osgi/admin/MyBundleActivator.java
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/viewBundle.vm
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/viewBundles.vm
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/struts.xml
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/test/
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/test/java/
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/test/resources/
struts/sandbox/trunk/struts2-osgi-plugin/plugin/
struts/sandbox/trunk/struts2-osgi-plugin/plugin/pom.xml
- copied unchanged from r630762,
struts/sandbox/trunk/struts2-osgi-plugin/pom.xml
struts/sandbox/trunk/struts2-osgi-plugin/plugin/src/
- copied from r630762, struts/sandbox/trunk/struts2-osgi-plugin/src/
struts/sandbox/trunk/struts2-osgi-plugin/plugin/src/main/
- copied from r630821, struts/sandbox/trunk/struts2-osgi-plugin/src/main/
Removed:
struts/sandbox/trunk/struts2-osgi-plugin/pom.xml
struts/sandbox/trunk/struts2-osgi-plugin/src/
Modified:
struts/sandbox/trunk/struts2-osgi-plugin/plugin/src/main/java/org/apache/struts2/osgi/OsgiConfigurationProvider.java
struts/sandbox/trunk/struts2-osgi-plugin/plugin/src/main/resources/struts-plugin.xml
Added: struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/pom.xml
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/pom.xml?rev=630822&view=auto
==============================================================================
--- struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/pom.xml (added)
+++ struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/pom.xml Mon Feb 25
04:04:16 2008
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.struts2.osgi.admin</groupId>
+ <artifactId>admin-bundle</artifactId>
+ <packaging>bundle</packaging>
+ <name>Struts 2 OSGi Admin Bundle</name>
+ <version>1.0-SNAPSHOT</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.struts</groupId>
+ <artifactId>struts2-osgi-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <version>1.0.0</version>
+ <configuration>
+ <instructions>
+ <manifestLocation>META-INF</manifestLocation>
+ <Export-Package>org.apache.struts2.osgi.admin*</Export-Package>
+ <Import-Package>*</Import-Package>
+
<Bundle-Activator>org.apache.struts2.osgi.admin.MyBundleActivator</Bundle-Activator>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </project>
Added:
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/org/apache/struts2/osgi/admin/BundlesAction.java
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/org/apache/struts2/osgi/admin/BundlesAction.java?rev=630822&view=auto
==============================================================================
---
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/org/apache/struts2/osgi/admin/BundlesAction.java
(added)
+++
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/org/apache/struts2/osgi/admin/BundlesAction.java
Mon Feb 25 04:04:16 2008
@@ -0,0 +1,24 @@
+package org.apache.struts2.osgi.admin;
+
+import org.apache.struts2.dispatcher.DefaultActionSupport;
+
+public class BundlesAction extends DefaultActionSupport {
+
+ private String id;
+
+ public String index() {
+ return SUCCESS;
+ }
+
+ public String view() {
+ return SUCCESS;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+}
Added:
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/org/apache/struts2/osgi/admin/MyBundleActivator.java
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/org/apache/struts2/osgi/admin/MyBundleActivator.java?rev=630822&view=auto
==============================================================================
---
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/org/apache/struts2/osgi/admin/MyBundleActivator.java
(added)
+++
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/java/org/apache/struts2/osgi/admin/MyBundleActivator.java
Mon Feb 25 04:04:16 2008
@@ -0,0 +1,12 @@
+package org.apache.struts2.osgi.admin;
+
+import org.apache.struts2.osgi.StrutsActivator;
+
+public class MyBundleActivator extends StrutsActivator {
+
+ public MyBundleActivator() {
+ super();
+
+ }
+
+}
Added:
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/viewBundle.vm
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/viewBundle.vm?rev=630822&view=auto
==============================================================================
---
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/viewBundle.vm
(added)
+++
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/viewBundle.vm
Mon Feb 25 04:04:16 2008
@@ -0,0 +1 @@
+This is a bundle view ${id}
\ No newline at end of file
Added:
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/viewBundles.vm
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/viewBundles.vm?rev=630822&view=auto
==============================================================================
---
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/viewBundles.vm
(added)
+++
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/osgi/admin/viewBundles.vm
Mon Feb 25 04:04:16 2008
@@ -0,0 +1 @@
+These are all bundles
\ No newline at end of file
Added:
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/struts.xml
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/struts.xml?rev=630822&view=auto
==============================================================================
---
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/struts.xml
(added)
+++
struts/sandbox/trunk/struts2-osgi-plugin/admin-bundle/src/main/resources/struts.xml
Mon Feb 25 04:04:16 2008
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE struts PUBLIC
+ "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
+ "http://struts.apache.org/dtds/struts-2.0.dtd">
+
+<struts>
+
+ <package name="bundle" namespace="/osgi/admin" extends="struts-default">
+ <action name="bundles/*"
class="org.apache.struts2.osgi.admin.BundlesAction" method="view">
+ <param name="id">{1}</param>
+ <result type="velocity">viewBundle.vm</result>
+ </action>
+ <action name="bundles"
class="org.apache.struts2.osgi.admin.BundlesAction" method="index">
+ <result type="velocity">viewBundles.vm</result>
+ </action>
+ </package>
+ <include file="example.xml"/>
+
+ <!-- Add packages here -->
+
+</struts>
Modified:
struts/sandbox/trunk/struts2-osgi-plugin/plugin/src/main/java/org/apache/struts2/osgi/OsgiConfigurationProvider.java
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-osgi-plugin/plugin/src/main/java/org/apache/struts2/osgi/OsgiConfigurationProvider.java?rev=630822&r1=630821&r2=630822&view=diff
==============================================================================
---
struts/sandbox/trunk/struts2-osgi-plugin/plugin/src/main/java/org/apache/struts2/osgi/OsgiConfigurationProvider.java
(original)
+++
struts/sandbox/trunk/struts2-osgi-plugin/plugin/src/main/java/org/apache/struts2/osgi/OsgiConfigurationProvider.java
Mon Feb 25 04:04:16 2008
@@ -25,6 +25,7 @@
import org.apache.felix.framework.cache.BundleCache;
import org.apache.felix.framework.util.FelixConstants;
import org.apache.felix.framework.util.StringMap;
+import org.apache.felix.main.AutoActivator;
import org.apache.struts2.osgi.loaders.VelocityBundleResourceLoader;
import org.apache.struts2.views.velocity.VelocityManager;
import org.apache.velocity.app.Velocity;
@@ -42,6 +43,7 @@
import com.opensymphony.xwork2.config.Configuration;
import com.opensymphony.xwork2.config.ConfigurationException;
import com.opensymphony.xwork2.config.ConfigurationProvider;
+import com.opensymphony.xwork2.config.PackageProvider;
import com.opensymphony.xwork2.config.entities.PackageConfig;
import com.opensymphony.xwork2.inject.ContainerBuilder;
import com.opensymphony.xwork2.inject.Inject;
@@ -50,7 +52,7 @@
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;
-public class OsgiConfigurationProvider implements ConfigurationProvider {
+public class OsgiConfigurationProvider implements PackageProvider {
private static final Logger LOG =
LoggerFactory.getLogger(OsgiConfigurationProvider.class);
@@ -128,10 +130,6 @@
return bundlesChanged;
}
- public void register(ContainerBuilder builder, LocatableProperties props)
- throws ConfigurationException {
- }
-
protected void loadOsgi() {
//configuration properties
Properties systemProperties = getProperties("default.properties");
@@ -145,7 +143,9 @@
"org.osgi.framework; version=1.4.0," +
"org.osgi.service.packageadmin; version=1.2.0," +
"org.osgi.service.startlevel; version=1.0.0," +
- "org.osgi.service.url; version=1.0.0" +
+ "org.osgi.service.url; version=1.0.0," +
+ "org.apache.struts2.dispatcher; version=1.0.0," +
+ "org.apache.xwork2; version=1.0.0" +
getSystemPackages(systemProperties) +
strutsProperties.getProperty("xwork"));
@@ -157,8 +157,8 @@
sb.append(path).append(" ");
}
- //configMap.put(FelixConstants.AUTO_START_PROP + ".1",
- // sb.toString());
+ configMap.put(AutoActivator.AUTO_START_PROP + ".1",
+ sb.toString());
configMap.put(BundleCache.CACHE_PROFILE_DIR_PROP,
System.getProperty("java.io.tmpdir"));
configMap.put(BundleCache.CACHE_DIR_PROP, "jim");
configMap.put(FelixConstants.EMBEDDED_EXECUTION_PROP, "true");
@@ -171,8 +171,10 @@
try {
List list = new ArrayList();
list.add(new BundleRegistration());
+ list.add(new AutoActivator(configMap));
// Now create an instance of the framework.
- felix = new Felix(configMap, list);
+ Map configMap2 = new StringMap(configMap, false);
+ felix = new Felix(configMap2, list);
felix.start();
}
catch (Exception ex) {
@@ -226,8 +228,8 @@
}
public void bundleChanged(BundleEvent evt) {
- if (evt.getType() == BundleEvent.INSTALLED) {
- LOG.debug("Installed bundle
"+evt.getBundle().getSymbolicName());
+ if (evt.getType() == BundleEvent.STARTED) {
+ LOG.info("Started bundle #1",
evt.getBundle().getSymbolicName());
bundles.put(evt.getBundle().getLocation(), evt.getBundle());
bundlesChanged = true;
}
Modified:
struts/sandbox/trunk/struts2-osgi-plugin/plugin/src/main/resources/struts-plugin.xml
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-osgi-plugin/plugin/src/main/resources/struts-plugin.xml?rev=630822&r1=630821&r2=630822&view=diff
==============================================================================
---
struts/sandbox/trunk/struts2-osgi-plugin/plugin/src/main/resources/struts-plugin.xml
(original)
+++
struts/sandbox/trunk/struts2-osgi-plugin/plugin/src/main/resources/struts-plugin.xml
Mon Feb 25 04:04:16 2008
@@ -8,6 +8,7 @@
<bean type="org.apache.struts2.osgi.BundleAccessor"
class="org.apache.struts2.osgi.DefaultBundleAccessor" />
<bean type="org.apache.struts2.osgi.PackageLoader"
class="org.apache.struts2.osgi.BundlePackageLoader" />
<bean name="osgi" type="com.opensymphony.xwork2.ObjectFactory"
class="org.apache.struts2.osgi.DelegatingObjectFactory" />
+ <bean name="osgi" type="com.opensymphony.xwork2.config.PackageProvider"
class="org.apache.struts2.osgi.OsgiConfigurationProvider" />
<constant name="struts.objectFactory" value="osgi" />
<constant name="struts.objectFactory.delegate" value="struts" />