Author: thomas.diesler(a)jboss.com
Date: 2009-06-03 04:51:04 -0400 (Wed, 03 Jun 2009)
New Revision: 89716
Added:
projects/jboss-osgi/trunk/docbook/src/main/graphics/osgi-remote-logging.odp
Modified:
projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/DeploymentScannerImpl.java
projects/jboss-osgi/trunk/docbook/en/modules/ch20-runtime.xml
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/Constants.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiBootstrap.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiFramework.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/DeploymentScannerService.java
Log:
More userguide - WIP
Modified:
projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/DeploymentScannerImpl.java
===================================================================
---
projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/DeploymentScannerImpl.java 2009-06-03
08:25:22 UTC (rev 89715)
+++
projects/jboss-osgi/trunk/bundles/hotdeploy/src/main/java/org/jboss/osgi/service/hotdeploy/internal/DeploymentScannerImpl.java 2009-06-03
08:51:04 UTC (rev 89716)
@@ -23,6 +23,8 @@
//$Id$
+import static org.jboss.osgi.spi.Constants.OSGI_HOME;
+
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -61,6 +63,7 @@
private long scanInterval;
private File scanLocation;
private long scanCount;
+ private long lastChange;
private DeployerService deployer;
private ScannerThread scannerThread;
@@ -80,10 +83,36 @@
initScanner(context);
}
+ public long getScanCount()
+ {
+ return scanCount;
+ }
+
+ public long getScanInterval()
+ {
+ return scanInterval;
+ }
+
+ public URL getScanLocation()
+ {
+ return toURL(scanLocation.getAbsolutePath());
+ }
+
+ public long getLastChange()
+ {
+ return lastChange;
+ }
+
public void start()
{
- log.log(LogService.LOG_INFO, "Start DeploymentScanner: [scandir=" +
scanLocation + ",interval=" + scanInterval + "ms]");
+ String osgiHome = System.getProperty(OSGI_HOME);
+ String scandir = scanLocation.getAbsolutePath();
+ if (scandir.startsWith(osgiHome))
+ scandir = "..." + scandir.substring(osgiHome.length());
+
+ log.log(LogService.LOG_INFO, "Start DeploymentScanner: [scandir=" +
scandir + ",interval=" + scanInterval + "ms]");
scannerThread = new ScannerThread(context, this);
+ lastChange = System.currentTimeMillis();
scannerThread.start();
}
@@ -119,10 +148,12 @@
if (traceBundles)
logBundleInfos("Current Scan", currScan);
- processOldDeployments(currScan);
+ int oldDiff = processOldDeployments(currScan);
+ int newDiff = processNewDeployments(currScan);
- processNewDeployments(currScan);
-
+ if (oldDiff + newDiff > 0)
+ lastChange = System.currentTimeMillis();
+
lastScan = currScan;
scanCount++;
@@ -139,7 +170,7 @@
}
}
- private void processOldDeployments(List<BundleInfo> currScan)
+ private int processOldDeployments(List<BundleInfo> currScan)
{
List<BundleInfo> diff = new ArrayList<BundleInfo>();
@@ -163,9 +194,11 @@
{
log.log(LogService.LOG_ERROR, "Cannot undeploy bundles", ex);
}
+
+ return diff.size();
}
- private void processNewDeployments(List<BundleInfo> currScan)
+ private int processNewDeployments(List<BundleInfo> currScan)
{
List<BundleInfo> diff = new ArrayList<BundleInfo>();
@@ -189,6 +222,8 @@
{
log.log(LogService.LOG_ERROR, "Cannot deploy bundles", ex);
}
+
+ return diff.size();
}
public BundleInfo[] getBundles()
@@ -207,22 +242,6 @@
BundleInfo[] arr = new BundleInfoImpl[bundles.size()];
return bundles.toArray(arr);
}
-
- public long getScanCount()
- {
- return scanCount;
- }
-
- public long getScanInterval()
- {
- return scanInterval;
- }
-
- public URL getScanLocation()
- {
- return toURL(scanLocation.getAbsolutePath());
- }
-
private void initScanner(BundleContext context)
{
scanInterval = 2000;
Modified: projects/jboss-osgi/trunk/docbook/en/modules/ch20-runtime.xml
===================================================================
--- projects/jboss-osgi/trunk/docbook/en/modules/ch20-runtime.xml 2009-06-03 08:25:22 UTC
(rev 89715)
+++ projects/jboss-osgi/trunk/docbook/en/modules/ch20-runtime.xml 2009-06-03 08:51:04 UTC
(rev 89716)
@@ -102,28 +102,108 @@
</listitem>
<listitem><emphasis role="bold">Logging
System</emphasis> -
- The logging bridge writes OSGi LogEntries to the configured logging framework (e.g.
Log4J).
+ The logging bridge writes OSGi LogEntries to the configured logging framework (e.g.
Log4J). A local OSGi Runtime can receive LogEntries
+ from a remote instance.
</listitem>
- <listitem><emphasis role="bold">Microcontainer
Support</emphasis> - [TODO]</listitem>
+ <listitem><emphasis role="bold">Microcontainer
Support</emphasis> -
+ The <ulink
url="http://www.jboss.org/jbossmc">Microcontainer</ulink> service
allows bundles to contain a *-beans.xml descriptor,
+ which can be used for component wiring and injection of base services. It also
comes with a set of <link linkend="SecDeployers">deployers</link>
+ - so instead of simply installing a bundle to the underlying OSGi framework it
passes to the chain of deployers which each deal with a specific
+ aspect of bundle deployment.
+ </listitem>
</itemizedlist>
</sect1>
<sect1 xml:id="SecRuntimeProfiles">
<title>Runtime Profiles</title>
+ <para>A runtime profile is a collection bundles that logically work together.
The OSGi runtime configuration
+ contains the list of bundles that are installed/started automatically. You can start
create you own profile
+ by setting up a new directory with your specific set of bundles.</para>
+
+ <note>
+ <title>TODO: [JBOSGI-98] Support configuration per profile</title>
+ </note>
+
+ <para>A runtime profile can be started using the -c comand line
option.</para>
+
+ <programlisting>
+ [tdiesler@tddell runtime]$ bin/run.sh -c minimal
+ =========================================================================
+
+ JBossOSGi Bootstrap Environment
+
+ OSGI_HOME: /home/tdiesler/jboss-osgi-1.0.0.Beta2/runtime
+
+ JAVA: /usr/java/jdk1.6/bin/java
+
+ JAVA_OPTS: -Dprogram.name=run.sh
-Dosgi.home=/home/tdiesler/jboss-osgi-1.0.0.Beta2/runtime -server -Xms128m -Xmx512m
-XX:MaxPermSize=256m -Dsun.rmi.dgc.client.gcInterval=3600000
-Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true
+
+ =========================================================================
+
+ 10:33:13,758 INFO [FelixIntegration] OSGi Integration Felix - 1.0.0.Beta2
+ 10:33:14,185 INFO [FelixIntegration] Installed bundle [1]: org.osgi.compendium
+ 10:33:14,194 INFO [FelixIntegration] Installed bundle [2]: org.apache.felix.log
+ 10:33:14,203 INFO [FelixIntegration] Installed bundle [3]: jboss-osgi-common
+ 10:33:14,212 INFO [FelixIntegration] Installed bundle [4]: jboss-osgi-hotdeploy
+ 10:33:14,247 INFO [FelixIntegration] Started bundle: org.apache.felix.log
+ 10:33:14,315 INFO [FelixIntegration] Started bundle: jboss-osgi-common
+ 10:33:14,357 INFO [jboss-osgi-hotdeploy] Start DeploymentScanner:
[scandir=.../server/minimal/deploy,interval=2000ms]
+ 10:33:14,401 INFO [FelixIntegration] Started bundle: jboss-osgi-hotdeploy
+ <emphasis role="bold">10:33:14,403 INFO [OSGiBootstrap] JBossOSGi
Runtime booted in 0.644sec</emphasis>
+ </programlisting>
+
<emphasis role="bold">Minimal Profile</emphasis>
- <para>[TODO]</para>
+
+ <para>The 'minimal' profile provides logging and
hot-deployment.</para>
+
+ <para>The following bundles are installed:</para>
+ <itemizedlist>
+ <listitem><emphasis
role="bold">org.osgi.compendium.jar</emphasis> - OSGi compendium
API</listitem>
+ <listitem><emphasis
role="bold">jboss-osgi-common.jar</emphasis> - JBoss OSGi common
services</listitem>
+ <listitem><emphasis
role="bold">org.apache.felix.log.jar</emphasis> - Apache
LogService</listitem>
+ <listitem><emphasis
role="bold">jboss-osgi-hotdeploy.jar</emphasis> - JBoss OSGi hot
deployment service</listitem>
+ </itemizedlist>
+
<emphasis role="bold">Default Profile</emphasis>
- <para>[TODO]</para>
+
+ <para>The 'default' profile extends the 'minimal' profile by
JNDI and JMX</para>
+
+ <para>These additional bundles are installed:</para>
+ <itemizedlist>
+ <listitem><emphasis
role="bold">jboss-osgi-common-core.jar</emphasis> - JBoss Common Core
functionality</listitem>
+ <listitem><emphasis
role="bold">jboss-osgi-jmx.jar</emphasis> - JBoss OSGi JMX
service</listitem>
+ <listitem><emphasis
role="bold">jboss-osgi-jndi.jar</emphasis> - JBoss OSGi JNDI
service</listitem>
+ </itemizedlist>
+
<emphasis role="bold">Web Profile</emphasis>
- <para>[TODO]</para>
+
+ <para>The 'web' profile extends the 'default' profile by
HttpService and ConfigAdmin</para>
+
+ <para>These additional bundles are installed:</para>
+ <itemizedlist>
+ <listitem><emphasis
role="bold">org.apache.felix.configadmin.jar</emphasis> - Apache
ConfigAdmin service</listitem>
+ <listitem><emphasis
role="bold">org.apache.felix.http.jetty.jar</emphasis> - Apache
HttpService</listitem>
+ <listitem><emphasis
role="bold">jboss-osgi-webconsole.jar</emphasis> - JBoss OSGi Web
Console</listitem>
+ </itemizedlist>
+
<emphasis role="bold">All Profile</emphasis>
- <para>[TODO]</para>
+
+ <para>The 'all' profile extends the 'web' profile by SAX/DOM,
JAXB, JBossXB and Microcontainer</para>
+
+ <para>These additional bundles are installed:</para>
+
+ <itemizedlist>
+ <listitem><emphasis
role="bold">jboss-osgi-apache-xerces.jar</emphasis> - Apache Xerces
support</listitem>
+ <listitem><emphasis
role="bold">jboss-osgi-jaxb.jar</emphasis> - JAXB
support</listitem>
+ <listitem><emphasis
role="bold">jboss-osgi-xml-binding.jar</emphasis> - XML Binding
(JBossXB) support</listitem>
+ <listitem><emphasis
role="bold">jboss-osgi-microcontainer.jar</emphasis> - Microcontainer
support</listitem>
+ </itemizedlist>
</sect1>
-
+
</chapter>
Added: projects/jboss-osgi/trunk/docbook/src/main/graphics/osgi-remote-logging.odp
===================================================================
(Binary files differ)
Property changes on:
projects/jboss-osgi/trunk/docbook/src/main/graphics/osgi-remote-logging.odp
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/Constants.java
===================================================================
---
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/Constants.java 2009-06-03
08:25:22 UTC (rev 89715)
+++
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/Constants.java 2009-06-03
08:51:04 UTC (rev 89716)
@@ -48,7 +48,7 @@
String OSGI_HOME = "osgi.home";
/**
- * The JBossOSGi runtime system property that denotes the path to the active server
+ * The JBossOSGi runtime system property that denotes the path to the active runtime
profile
*/
String OSGI_SERVER_HOME = "osgi.server.home";
}
Modified:
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiBootstrap.java
===================================================================
---
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiBootstrap.java 2009-06-03
08:25:22 UTC (rev 89715)
+++
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiBootstrap.java 2009-06-03
08:51:04 UTC (rev 89716)
@@ -23,6 +23,9 @@
//$Id$
+import static org.jboss.osgi.spi.Constants.OSGI_HOME;
+import static org.jboss.osgi.spi.Constants.OSGI_SERVER_HOME;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
@@ -62,10 +65,8 @@
private static final String JAVA_PROTOCOL_HANDLERS =
"java.protocol.handler.pkgs";
private static final String JBOSS_BIND_ADDRESS = "jboss.bind.address";
private static final String OSGI_SERVER_NAME = "osgi.server.name";
- private static final String OSGI_SERVER_HOME = "osgi.server.home";
- private static final String OSGI_HOME = "osgi.home";
- @Option(name = "-c", aliases = { "--profile-name" }, usage =
"The runtime profile to start (-c minimal)", required = false)
+ @Option(name = "-c", aliases = { "--server-name" }, usage =
"The runtime profile to start. (-c minimal)", required = false)
public String serverName = "default";
@Option(name = "-b", aliases = { "--bind-address" }, usage =
"The network address various services can bind to (-b 127.0.0.1)", required =
false)
@@ -207,8 +208,9 @@
public void run()
{
// Start the framework
- final long start = System.currentTimeMillis();
+ final long beforeStart = System.currentTimeMillis();
framework.start();
+ final long afterStart = System.currentTimeMillis();
// Report how long it took to boot and do the first scan
BundleContext context = framework.getBundleContext();
@@ -225,19 +227,19 @@
public void afterScan(DeploymentScannerService service)
{
- long end = System.currentTimeMillis();
- float diff = (end - start) / 1000f;
- getLogger().info("JBossOSGi Runtime started in " + diff +
"sec");
-
- // Remove this listener after the first scan
+ long lastChange = service.getLastChange();
+ if (lastChange > afterStart)
+ {
+ float diff = (lastChange - beforeStart) / 1000f;
+ getLogger().info("JBossOSGi Runtime started in " + diff +
"sec");
+ }
service.removeScanListener(this);
}
};
scannerService.addScanListener(listener);
}
- long end = System.currentTimeMillis();
- float diff = (end - start) / 1000f;
+ float diff = (afterStart - beforeStart) / 1000f;
getLogger().info("JBossOSGi Runtime booted in " + diff +
"sec");
Reader br = new InputStreamReader(System.in);
Modified:
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiFramework.java
===================================================================
---
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiFramework.java 2009-06-03
08:25:22 UTC (rev 89715)
+++
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiFramework.java 2009-06-03
08:51:04 UTC (rev 89716)
@@ -38,56 +38,53 @@
*/
public interface OSGiFramework
{
- /**
- * Get the Framework properties
+ /*
+ * * Get the Framework properties
*/
Map<String, Object> getProperties();
- /**
- * Set the Framework properties.
- * This can only be done before the Framework is started.
+ /*
+ * * Set the Framework properties. This can only be done before the Framework is
started.
*/
void setProperties(Map<String, Object> props);
- /**
- * Get the list of bundles that get installed automatically
+ /*
+ * * Get the list of bundles that get installed automatically
*/
List<URL> getAutoInstall();
- /**
- * Set the list of bundles that get installed automatically.
- * This can only be done before the Framework is started.
+ /*
+ * * Set the list of bundles that get installed automatically. This can only be done
before the Framework is started.
*/
void setAutoInstall(List<URL> autoInstall);
- /**
- * Get the list of bundles that get installed and started automatically
+ /*
+ * * Get the list of bundles that get installed and started automatically
*/
List<URL> getAutoStart();
- /**
- * Set the list of bundles that get installed and started automatically.
- * This can only be done before the Framework is started.
+ /*
+ * * Set the list of bundles that get installed and started automatically. This can
only be done before the Framework is started.
*/
void setAutoStart(List<URL> autoStart);
- /**
- * Start the Framework
+ /*
+ * * Start the Framework
*/
void start();
- /**
- * Stop the Framework
+ /*
+ * * Stop the Framework
*/
void stop();
- /**
- * Get the System Bundle associated with this Framework
+ /*
+ * * Get the System Bundle associated with this Framework
*/
Bundle getBundle();
- /**
- * Get the System Bundle Context associated with this Framework
+ /*
+ * * Get the System Bundle Context associated with this Framework
*/
BundleContext getBundleContext();
}
\ No newline at end of file
Modified:
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/DeploymentScannerService.java
===================================================================
---
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/DeploymentScannerService.java 2009-06-03
08:25:22 UTC (rev 89715)
+++
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/DeploymentScannerService.java 2009-06-03
08:51:04 UTC (rev 89716)
@@ -62,6 +62,11 @@
long getScanInterval();
/**
+ * The timestamp of the last change
+ */
+ long getLastChange();
+
+ /**
* Run a directory scan
*/
void scan();