You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by re...@apache.org on 2014/03/03 20:18:03 UTC
git commit: CLEREZZA-886: fixed to run outside OSGi
Repository: clerezza
Updated Branches:
refs/heads/master c28940f1d -> f49f541da
CLEREZZA-886: fixed to run outside OSGi
Project: http://git-wip-us.apache.org/repos/asf/clerezza/repo
Commit: http://git-wip-us.apache.org/repos/asf/clerezza/commit/f49f541d
Tree: http://git-wip-us.apache.org/repos/asf/clerezza/tree/f49f541d
Diff: http://git-wip-us.apache.org/repos/asf/clerezza/diff/f49f541d
Branch: refs/heads/master
Commit: f49f541da6475d078bbce7c6f2fbe4ecc80ec1db
Parents: c28940f
Author: retobg <re...@apache.org>
Authored: Mon Mar 3 20:17:43 2014 +0100
Committer: retobg <re...@apache.org>
Committed: Mon Mar 3 20:17:43 2014 +0100
----------------------------------------------------------------------
.../rdf/core/serializedform/Parser.java | 19 +++++++++------
.../rdf/core/serializedform/Serializer.java | 25 ++++++++++++--------
2 files changed, 27 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/clerezza/blob/f49f541d/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Parser.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Parser.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Parser.java
index 474902b..4852d24 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Parser.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Parser.java
@@ -100,6 +100,7 @@ public class Parser {
* @param dummy an ignored argument to distinguish this from the other constructor
*/
Parser(Object dummy) {
+ active = true;
}
/**
@@ -121,6 +122,8 @@ public class Parser {
ParsingProvider parsingProvider = parsingProviders.next();
instance.bindParsingProvider(parsingProvider);
}
+ instance.active = true;
+ instance.refreshProviderMap();
}
}
}
@@ -283,14 +286,16 @@ public class Parser {
}
}
providerMap = newProviderMap;
- Dictionary<String, Object> newConfig = configurationAdmin.getConfiguration(getClass().getName()).getProperties();
- if (newConfig == null) {
- newConfig = new Hashtable<String, Object>();
+ if (configurationAdmin != null) { //i.e. when we are in an OSGi environment
+ Dictionary<String, Object> newConfig = configurationAdmin.getConfiguration(getClass().getName()).getProperties();
+ if (newConfig == null) {
+ newConfig = new Hashtable<String, Object>();
+ }
+ Set<String> supportedFormats = getSupportedFormats();
+ String[] supportedFromatsArray = supportedFormats.toArray(new String[supportedFormats.size()]);
+ newConfig.put(SupportedFormat.supportedFormat, supportedFromatsArray);
+ configurationAdmin.getConfiguration(getClass().getName()).update(newConfig);
}
- Set<String> supportedFormats = getSupportedFormats();
- String[] supportedFromatsArray = supportedFormats.toArray(new String[supportedFormats.size()]);
- newConfig.put(SupportedFormat.supportedFormat, supportedFromatsArray);
- configurationAdmin.getConfiguration(getClass().getName()).update(newConfig);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/f49f541d/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Serializer.java
----------------------------------------------------------------------
diff --git a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Serializer.java b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Serializer.java
index 05bf549..c65c19e 100644
--- a/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Serializer.java
+++ b/rdf.core/src/main/java/org/apache/clerezza/rdf/core/serializedform/Serializer.java
@@ -102,6 +102,7 @@ public class Serializer {
* constructor
*/
Serializer(Object dummy) {
+ active = true;
}
/**
@@ -124,6 +125,8 @@ public class Serializer {
.next();
instance.bindSerializingProvider(SerializingProvider);
}
+ instance.active = true;
+ instance.refreshProviderMap();
}
}
}
@@ -229,17 +232,19 @@ public class Serializer {
}
}
providerMap = newProviderMap;
- try {
- Dictionary<String, Object> newConfig = configurationAdmin.getConfiguration(getClass().getName()).getProperties();
- if (newConfig == null) {
- newConfig = new Hashtable<String, Object>();
+ if (configurationAdmin != null) { //we are in OSGi environment
+ try {
+ Dictionary<String, Object> newConfig = configurationAdmin.getConfiguration(getClass().getName()).getProperties();
+ if (newConfig == null) {
+ newConfig = new Hashtable<String, Object>();
+ }
+ Set<String> supportedFormats = getSupportedFormats();
+ String[] supportedFromatsArray = supportedFormats.toArray(new String[supportedFormats.size()]);
+ newConfig.put(SupportedFormat.supportedFormat, supportedFromatsArray);
+ configurationAdmin.getConfiguration(getClass().getName()).update(newConfig);
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
}
- Set<String> supportedFormats = getSupportedFormats();
- String[] supportedFromatsArray = supportedFormats.toArray(new String[supportedFormats.size()]);
- newConfig.put(SupportedFormat.supportedFormat, supportedFromatsArray);
- configurationAdmin.getConfiguration(getClass().getName()).update(newConfig);
- } catch (IOException ex) {
- throw new RuntimeException(ex);
}
}
}