[savara-commits] savara SVN: r641 - in branches/experimental/2.0.x/bundles: org.savara.common and 20 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Feb 7 16:51:16 EST 2011


Author: objectiser
Date: 2011-02-07 16:51:16 -0500 (Mon, 07 Feb 2011)
New Revision: 641

Added:
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/Copyright.txt
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/META-INF/
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/META-INF/MANIFEST.MF
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/build.properties
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/pom.xml
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/java/
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/java/org/
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/java/org/savara/
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/java/org/savara/common/
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/java/org/savara/common/config/
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/java/org/savara/common/config/file/
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/java/org/savara/common/config/file/FileConfiguration.java
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/java/org/savara/common/config/file/osgi/
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/java/org/savara/common/config/file/osgi/Activator.java
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/test/
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/test/java/
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/test/java/org/
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/test/java/org/savara/
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/test/java/org/savara/common/
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/test/java/org/savara/common/config/
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/test/java/org/savara/common/config/file/
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/test/java/org/savara/common/config/file/FileConfigurationTest.java
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/test/resources/
   branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/test/resources/savara.properties
   branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/config/FileConfiguration.java
Modified:
   branches/experimental/2.0.x/bundles/org.savara.common/build.properties
   branches/experimental/2.0.x/bundles/pom.xml
Log:
File based configuration implementation.

Modified: branches/experimental/2.0.x/bundles/org.savara.common/build.properties
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.common/build.properties	2011-02-07 20:17:44 UTC (rev 640)
+++ branches/experimental/2.0.x/bundles/org.savara.common/build.properties	2011-02-07 21:51:16 UTC (rev 641)
@@ -1,4 +1,4 @@
-source.. = src/java/
+source.. = src/main/java/
 output.. = bin/
 bin.includes = META-INF/,\
                .

Added: branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/config/FileConfiguration.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/config/FileConfiguration.java	                        (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/config/FileConfiguration.java	2011-02-07 21:51:16 UTC (rev 641)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008-11, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.savara.common.config;
+
+import org.savara.common.config.Configuration;
+
+/**
+ * This class provides a file based configuration implementation.
+ * 
+ * @author gbrown
+ *
+ */
+public class FileConfiguration implements Configuration {
+
+	private java.util.ResourceBundle m_properties=null;
+	private boolean f_initialized=false;
+	
+	private void initialize() {
+		f_initialized = true;
+		m_properties = java.util.ResourceBundle.getBundle("savara");
+	}
+	
+	public String getProperty(String name) {
+		if (f_initialized == false) {
+			initialize();
+		}
+		
+		return(m_properties == null ? null : m_properties.getString(name));
+	}
+
+}

Added: branches/experimental/2.0.x/bundles/org.savara.common.config.file/Copyright.txt
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.common.config.file/Copyright.txt	                        (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.common.config.file/Copyright.txt	2011-02-07 21:51:16 UTC (rev 641)
@@ -0,0 +1,17 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */

Added: branches/experimental/2.0.x/bundles/org.savara.common.config.file/META-INF/MANIFEST.MF
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.common.config.file/META-INF/MANIFEST.MF	                        (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.common.config.file/META-INF/MANIFEST.MF	2011-02-07 21:51:16 UTC (rev 641)
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: SAVARA Common Config File
+Bundle-SymbolicName: org.savara.common.config.file
+Bundle-Version: 2.0.0.qualifier
+Bundle-Activator: org.savara.common.config.file.osgi.Activator
+Bundle-Vendor: www.savara.org
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.osgi.framework;version="1.3.0"
+Require-Bundle: org.savara.common,
+ org.junit

Added: branches/experimental/2.0.x/bundles/org.savara.common.config.file/build.properties
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.common.config.file/build.properties	                        (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.common.config.file/build.properties	2011-02-07 21:51:16 UTC (rev 641)
@@ -0,0 +1,4 @@
+source.. = src/main/java/
+output.. = bin/
+bin.includes = META-INF/,\
+               .

Added: branches/experimental/2.0.x/bundles/org.savara.common.config.file/pom.xml
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.common.config.file/pom.xml	                        (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.common.config.file/pom.xml	2011-02-07 21:51:16 UTC (rev 641)
@@ -0,0 +1,34 @@
+<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>
+	<groupId>org.savara.bundles</groupId>
+	<artifactId>org.savara.common.config.file</artifactId> 
+	<version>2.0.0-SNAPSHOT</version>
+	<packaging>jar</packaging>
+	<name>Savara::Bundles::CommonConfigFile</name>
+
+	<parent>
+		<groupId>org.savara</groupId>
+		<artifactId>bundles</artifactId>
+		<version>2.0.0-SNAPSHOT</version>
+	</parent>
+  
+	<dependencies>
+		<dependency>
+			<groupId>org.savara.bundles</groupId>
+			<artifactId>org.savara.common</artifactId>
+			<version>${savara.version}</version>
+		</dependency>
+	    <dependency>
+	      <groupId>org.apache.felix</groupId>
+	      <artifactId>org.osgi.core</artifactId>
+	      <version>${osgi.version}</version>
+	    </dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+           	<version>${junit.version}</version>
+			<scope>test</scope>
+		</dependency>
+   </dependencies>
+</project>

Added: branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/java/org/savara/common/config/file/FileConfiguration.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/java/org/savara/common/config/file/FileConfiguration.java	                        (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/java/org/savara/common/config/file/FileConfiguration.java	2011-02-07 21:51:16 UTC (rev 641)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008-11, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.savara.common.config.file;
+
+import org.savara.common.config.Configuration;
+
+/**
+ * This class provides a file based configuration implementation.
+ * 
+ * @author gbrown
+ *
+ */
+public class FileConfiguration implements Configuration {
+
+	private java.util.ResourceBundle m_properties=null;
+	private boolean f_initialized=false;
+	
+	private void initialize() {
+		f_initialized = true;
+		m_properties = java.util.ResourceBundle.getBundle("savara");
+	}
+	
+	public String getProperty(String name) {
+		if (f_initialized == false) {
+			initialize();
+		}
+		
+		return(m_properties == null ? null : m_properties.getString(name));
+	}
+
+}

Added: branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/java/org/savara/common/config/file/osgi/Activator.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/java/org/savara/common/config/file/osgi/Activator.java	                        (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/java/org/savara/common/config/file/osgi/Activator.java	2011-02-07 21:51:16 UTC (rev 641)
@@ -0,0 +1,30 @@
+package org.savara.common.config.file.osgi;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+	private static BundleContext context;
+
+	static BundleContext getContext() {
+		return context;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext bundleContext) throws Exception {
+		Activator.context = bundleContext;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+	 */
+	public void stop(BundleContext bundleContext) throws Exception {
+		Activator.context = null;
+	}
+
+}

Added: branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/test/java/org/savara/common/config/file/FileConfigurationTest.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/test/java/org/savara/common/config/file/FileConfigurationTest.java	                        (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/test/java/org/savara/common/config/file/FileConfigurationTest.java	2011-02-07 21:51:16 UTC (rev 641)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008-11, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.savara.common.config.file;
+
+import static org.junit.Assert.*;
+
+public class FileConfigurationTest {
+
+	@org.junit.Test
+	public void testGetProperty() {
+		FileConfiguration config=new FileConfiguration();
+		
+		String val=config.getProperty("test.property");
+		
+		if (val == null) {
+			fail("'test.property' not found");
+		}
+		
+		if (val.equals("testvalue") == false) {
+			fail("Unexpected value '"+val+"', expecting 'testvalue'");
+		}
+	}
+}

Added: branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/test/resources/savara.properties
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/test/resources/savara.properties	                        (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/test/resources/savara.properties	2011-02-07 21:51:16 UTC (rev 641)
@@ -0,0 +1 @@
+test.property = testvalue
\ No newline at end of file

Modified: branches/experimental/2.0.x/bundles/pom.xml
===================================================================
--- branches/experimental/2.0.x/bundles/pom.xml	2011-02-07 20:17:44 UTC (rev 640)
+++ branches/experimental/2.0.x/bundles/pom.xml	2011-02-07 21:51:16 UTC (rev 641)
@@ -23,6 +23,7 @@
 		<module>org.savara.activity</module>
 		<module>org.savara.bpel</module>
 		<module>org.savara.common</module>
+		<module>org.savara.common.config.file</module>
 		<module>org.savara.contract</module>
 		<module>org.savara.monitor</module>
 		<module>org.savara.monitor.sstore.rdbms</module>



More information about the savara-commits mailing list