[savara-commits] savara SVN: r642 - in branches/experimental/2.0.x/bundles: org.savara.common.config.file and 5 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Feb 7 18:21:41 EST 2011
Author: objectiser
Date: 2011-02-07 18:21:41 -0500 (Mon, 07 Feb 2011)
New Revision: 642
Added:
branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/resources/
branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/resources/savara.properties
Removed:
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.config.file/
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/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/Activator.java
Log:
Currently the file configuration implementation can only load from the contained savara.properties when deployed in an OSGi container. Not sure if will be possible to obtain the properties from an external property file.
Deleted: 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 2011-02-07 21:51:16 UTC (rev 641)
+++ branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/config/FileConfiguration.java 2011-02-07 23:21:41 UTC (rev 642)
@@ -1,46 +0,0 @@
-/*
- * 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));
- }
-
-}
Property changes on: branches/experimental/2.0.x/bundles/org.savara.common.config.file
___________________________________________________________________
Name: svn:ignore
+ target
.settings
.classpath
.project
Modified: 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 2011-02-07 21:51:16 UTC (rev 641)
+++ branches/experimental/2.0.x/bundles/org.savara.common.config.file/META-INF/MANIFEST.MF 2011-02-07 23:21:41 UTC (rev 642)
@@ -7,5 +7,4 @@
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
+Require-Bundle: org.savara.common
Modified: 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 2011-02-07 21:51:16 UTC (rev 641)
+++ branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/java/org/savara/common/config/file/FileConfiguration.java 2011-02-07 23:21:41 UTC (rev 642)
@@ -32,6 +32,7 @@
private void initialize() {
f_initialized = true;
+
m_properties = java.util.ResourceBundle.getBundle("savara");
}
Modified: 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 2011-02-07 21:51:16 UTC (rev 641)
+++ 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 23:21:41 UTC (rev 642)
@@ -1,10 +1,34 @@
+/*
+ * 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.osgi;
+import java.util.Properties;
+import java.util.logging.Logger;
+
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
+import org.savara.common.config.Configuration;
+import org.savara.common.config.file.FileConfiguration;
public class Activator implements BundleActivator {
+ private static final Logger _log=Logger.getLogger(Activator.class.getName());
+
private static BundleContext context;
static BundleContext getContext() {
@@ -17,6 +41,16 @@
*/
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
+
+ Properties props = new Properties();
+
+ // Register parser manager
+ final Configuration config=new FileConfiguration();
+
+ context.registerService(Configuration.class.getName(),
+ config, props);
+
+ _log.info("Registered File based Configuration");
}
/*
Added: branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/resources/savara.properties
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/resources/savara.properties (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.common.config.file/src/main/resources/savara.properties 2011-02-07 23:21:41 UTC (rev 642)
@@ -0,0 +1 @@
+test.property = Hello World
More information about the savara-commits
mailing list