[jboss-osgi-commits] JBoss-OSGI SVN: r87823 - in projects/jboss-osgi/trunk/bundle: blueprint and 11 other directories.
jboss-osgi-commits at lists.jboss.org
jboss-osgi-commits at lists.jboss.org
Fri Apr 24 13:35:14 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-04-24 13:35:14 -0400 (Fri, 24 Apr 2009)
New Revision: 87823
Added:
projects/jboss-osgi/trunk/bundle/blueprint/
projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/
projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/PropertiesBootstrapProvider.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/SystemBundleTestCase.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jboss-osgi-framework.properties
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/log4j.xml
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
Removed:
projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/common/
Modified:
projects/jboss-osgi/trunk/bundle/blueprint/.classpath
projects/jboss-osgi/trunk/bundle/blueprint/.project
projects/jboss-osgi/trunk/bundle/blueprint/pom.xml
Log:
Start blueprint prototyping
Copied: projects/jboss-osgi/trunk/bundle/blueprint (from rev 87817, projects/jboss-osgi/trunk/bundle/common)
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint
___________________________________________________________________
Name: svn:ignore
+ target
felix-cache
Name: svn:mergeinfo
+
Modified: projects/jboss-osgi/trunk/bundle/blueprint/.classpath
===================================================================
--- projects/jboss-osgi/trunk/bundle/common/.classpath 2009-04-24 15:37:29 UTC (rev 87817)
+++ projects/jboss-osgi/trunk/bundle/blueprint/.classpath 2009-04-24 17:35:14 UTC (rev 87823)
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
Modified: projects/jboss-osgi/trunk/bundle/blueprint/.project
===================================================================
--- projects/jboss-osgi/trunk/bundle/common/.project 2009-04-24 15:37:29 UTC (rev 87817)
+++ projects/jboss-osgi/trunk/bundle/blueprint/.project 2009-04-24 17:35:14 UTC (rev 87823)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>jboss-osgi-common</name>
+ <name>jboss-osgi-blueprint</name>
<comment></comment>
<projects>
</projects>
Modified: projects/jboss-osgi/trunk/bundle/blueprint/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/common/pom.xml 2009-04-24 15:37:29 UTC (rev 87817)
+++ projects/jboss-osgi/trunk/bundle/blueprint/pom.xml 2009-04-24 17:35:14 UTC (rev 87823)
@@ -1,9 +1,9 @@
<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>
- <name>JBossOSGi - Bundle Common</name>
- <artifactId>jboss-osgi-common</artifactId>
- <packaging>bundle</packaging>
+ <name>JBossOSGi - Bundle Blueprint Service</name>
+ <artifactId>jboss-osgi-blueprint</artifactId>
+ <packaging>jar</packaging>
<parent>
<groupId>org.jboss.osgi</groupId>
@@ -18,9 +18,9 @@
<!-- Dependencies -->
<dependencies>
<dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- <scope>provided</scope>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-spi</artifactId>
+ <version>${version}</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
@@ -32,32 +32,18 @@
<artifactId>org.osgi.compendium</artifactId>
<scope>provided</scope>
</dependency>
+
+ <!-- Test Dependencies -->
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-runtime-felix</artifactId>
+ <version>${version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>org.jboss.osgi.common</Bundle-SymbolicName>
- <Export-Package>
- org.jboss.osgi.common,
- org.jboss.osgi.common.log
- </Export-Package>
- <Private-Package>
- org.jboss.osgi.common.log.internal
- </Private-Package>
- <Import-Package>
- org.osgi.framework;version=1.4,
- org.osgi.service.log;version=1.3,
- org.osgi.util.tracker
- </Import-Package>
- </instructions>
- </configuration>
- </plugin>
</plugins>
</build>
Copied: projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/PropertiesBootstrapProvider.java (from rev 87817, projects/jboss-osgi/trunk/bundle/common/src/main/java/org/jboss/osgi/common/StringConstants.java)
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/PropertiesBootstrapProvider.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/PropertiesBootstrapProvider.java 2009-04-24 17:35:14 UTC (rev 87823)
@@ -0,0 +1,136 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.blueprint;
+
+//$Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Properties;
+
+import org.jboss.osgi.spi.NotImplementedException;
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.spi.framework.OSGiFramework;
+
+/**
+ * A simple properties based bootstrap provider
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 24-Apr-2009
+ */
+public class PropertiesBootstrapProvider implements OSGiBootstrapProvider
+{
+ /** The OSGi framework integration class: osgi.framework.impl */
+ public static final String PROP_OSGI_FRAMEWORK_IMPL = "framework.impl";
+
+ /** The default framework beans property: jboss.osgi.bootstrap.config */
+ public static final String OSGI_BOOTSTRAP_CONFIG = "jboss.osgi.bootstrap.config";
+ /** The default framework beans: jboss-osgi-bootstrap-beans.xml */
+ public static final String DEFAULT_OSGI_BOOTSTRAP_PROPERTIES = "jboss-osgi-bootstrap.properties";
+ /** The default framework beans property: jboss.osgi.framework.config */
+ public static final String OSGI_FRAMEWORK_CONFIG = "jboss.osgi.framework.config";
+ /** The default framework beans: jboss-osgi-beans.xml */
+ public static final String DEFAULT_OSGI_FRAMEWORK_PROPERTIES = "jboss-osgi-framework.properties";
+
+ private OSGiFramework framework;
+ private boolean configured;
+
+ public void configure()
+ {
+ throw new NotImplementedException();
+ }
+
+ public void configure(URL urlConfig)
+ {
+ // Read the configuration properties
+ Properties props = new Properties();
+ try
+ {
+ InputStream inStream = urlConfig.openStream();
+ props.load(inStream);
+ inStream.close();
+ }
+ catch (IOException ex)
+ {
+ throw new IllegalStateException("Cannot load properties from: " + urlConfig, ex);
+ }
+
+ String frameworkImpl = props.getProperty(PROP_OSGI_FRAMEWORK_IMPL);
+ if (frameworkImpl == null)
+ throw new IllegalStateException("Cannot get : " + urlConfig);
+
+ // Load the framework instance
+ try
+ {
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ Class<?> frameworkClass = ctxLoader.loadClass(frameworkImpl);
+ framework = (OSGiFramework)frameworkClass.newInstance();
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot load framework: " + frameworkImpl, ex);
+ }
+
+ // Start the Framework
+ framework.start();
+ }
+
+ public void configure(String resourceConfig)
+ {
+ URL urlConfig = Thread.currentThread().getContextClassLoader().getResource(resourceConfig);
+ if (urlConfig == null)
+ throw new IllegalStateException("Cannot find resource: " + resourceConfig);
+
+ configure(urlConfig);
+ }
+
+ public void configure(InputStream streamConfig)
+ {
+ throw new NotImplementedException();
+ }
+
+ public OSGiFramework getFramework()
+ {
+ if (configured == false)
+ {
+ String defaultFrameworkProps = System.getProperty(OSGI_FRAMEWORK_CONFIG, DEFAULT_OSGI_FRAMEWORK_PROPERTIES);
+ configure(defaultFrameworkProps);
+ }
+ return framework;
+ }
+
+ public OSGiFramework getFramework(String name)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Object getInstance(String name)
+ {
+ throw new NotImplementedException();
+ }
+
+ public <T> T getInstance(String name, Class<T> expectedType)
+ {
+ throw new NotImplementedException();
+ }
+}
Added: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/SystemBundleTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/SystemBundleTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/SystemBundleTestCase.java 2009-04-24 17:35:14 UTC (rev 87823)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+
+//$Id$
+package org.jboss.test.osgi.blueprint;
+
+import org.jboss.osgi.spi.framework.OSGiBootstrap;
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.spi.framework.OSGiFramework;
+import org.jboss.osgi.spi.junit.OSGiTest;
+import org.osgi.framework.Bundle;
+
+/**
+ * Test OSGi System bundle access
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 23-Jan-2009
+ */
+public class SystemBundleTestCase extends OSGiTest
+{
+ public void testSystemBundle()
+ {
+ OSGiBootstrapProvider configProvider = OSGiBootstrap.getBootstrapProvider();
+ OSGiFramework framework = configProvider.getFramework();
+ Bundle bundle = framework.getSystemBundle();
+
+ assertEquals("BundleId == 0", 0, bundle.getBundleId());
+ assertEquals("SymbolicName", "org.apache.felix.framework", bundle.getSymbolicName());
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/SystemBundleTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jboss-osgi-framework.properties
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jboss-osgi-framework.properties (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jboss-osgi-framework.properties 2009-04-24 17:35:14 UTC (rev 87823)
@@ -0,0 +1,9 @@
+#
+# Properties read by the org.jboss.osgi.blueprint.PropertiesBootstrapProvider
+#
+# $Id: $
+#
+framework.impl=org.jboss.osgi.felix.framework.FelixIntegration
+
+# properties passed on to the framework start with: 'framework.prop'
+framework.prop.org.osgi.framework.storage.clean=onFirstInit
\ No newline at end of file
Added: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/log4j.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/log4j.xml (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/log4j.xml 2009-04-24 17:35:14 UTC (rev 87823)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <appender name="FILE" class="org.apache.log4j.FileAppender">
+ <param name="File" value="${log4j.output.dir}/test.log"/>
+ <param name="Append" value="false"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out" />
+ <param name="Threshold" value="INFO" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{1}] %m%n" />
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.hibernate">
+ <priority value="INFO" />
+ </category>
+
+ <!-- hide optimistic locking failures
+ <category name="org.hibernate.event.def.AbstractFlushingEventListener">
+ <priority value="FATAL" />
+ </category>
+ -->
+
+ <!-- hide proxy narrowing warns -->
+ <category name="org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog">
+ <priority value="ERROR" />
+ </category>
+
+ <!-- show SQL DML statements as they are executed -->
+ <category name="org.hibernate.SQL">
+ <priority value="DEBUG" />
+ </category>
+
+ <!-- show JDBC parameters
+ <category name="org.hibernate.type">
+ <priority value="TRACE" />
+ </category>
+ -->
+
+ <!-- hide httpclient wire dumps -->
+ <category name="httpclient.wire.header">
+ <priority value="INFO" />
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <!--appender-ref ref="CONSOLE"/-->
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/log4j.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider 2009-04-24 17:35:14 UTC (rev 87823)
@@ -0,0 +1 @@
+org.jboss.osgi.blueprint.PropertiesBootstrapProvider
\ No newline at end of file
More information about the jboss-osgi-commits
mailing list