Author: reto
Date: Fri Jul 16 21:29:09 2010
New Revision: 964955
URL: http://svn.apache.org/viewvc?rev=964955&view=rev
Log:
CLEREZZA-260: introducing platform.Constants and moving the conventional
platform graph names to it
Added:
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform/src/main/java/org/apache/clerezza/platform/Constants.java
Modified:
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.config/pom.xml
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.config/src/main/java/org/apache/clerezza/platform/config/PlatformConfig.java
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.config/src/main/java/org/apache/clerezza/platform/config/SystemConfig.java
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.graphprovider.content/pom.xml
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.graphprovider.content/src/main/java/org/apache/clerezza/platform/graphprovider/content/ContentGraphProvider.java
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform/pom.xml
Modified:
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.config/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.config/pom.xml?rev=964955&r1=964954&r2=964955&view=diff
==============================================================================
---
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.config/pom.xml
(original)
+++
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.config/pom.xml
Fri Jul 16 21:29:09 2010
@@ -37,6 +37,10 @@
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
+ <artifactId>org.apache.clerezza.platform</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
<artifactId>org.apache.clerezza.platform.graphprovider.content</artifactId>
</dependency>
<dependency>
Modified:
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.config/src/main/java/org/apache/clerezza/platform/config/PlatformConfig.java
URL:
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.config/src/main/java/org/apache/clerezza/platform/config/PlatformConfig.java?rev=964955&r1=964954&r2=964955&view=diff
==============================================================================
---
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.config/src/main/java/org/apache/clerezza/platform/config/PlatformConfig.java
(original)
+++
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.config/src/main/java/org/apache/clerezza/platform/config/PlatformConfig.java
Fri Jul 16 21:29:09 2010
@@ -23,6 +23,7 @@ import java.security.PrivilegedAction;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
+import org.apache.clerezza.platform.Constants;
import org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
@@ -55,17 +56,19 @@ public class PlatformConfig {
private LockableMGraph systemGraph;
private BundleContext context;
private static String DEFAULT_PORT = "8080";
- private static final String CONFIG_GRAPH_STRING =
- "http://tpf.localhost/config.graph";
- public static final UriRef CONFIG_GRAPH_URI =
- new UriRef(CONFIG_GRAPH_STRING);
+
+ /**
+ * @deprecated use org.apache.clerezza.platform.Contants instead
+ */
+ @Deprecated
+ public static final UriRef CONFIG_GRAPH_URI =
Constants.CONFIG_GRAPH_URI;
/**
* A filter that can be used to get the config graph as OSGi service,
* that is provided by
<code>org.apache.clerezza.rdf.core.access.TcManager</code>.
*/
public static final String CONFIG_GRAPH_FILTER =
- "(name="+ CONFIG_GRAPH_STRING +")";
+ "(name="+ Constants.CONFIG_GRAPH_URI_STRING +")";
@Reference
private TcManager tcManager;
Modified:
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.config/src/main/java/org/apache/clerezza/platform/config/SystemConfig.java
URL:
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.config/src/main/java/org/apache/clerezza/platform/config/SystemConfig.java?rev=964955&r1=964954&r2=964955&view=diff
==============================================================================
---
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.config/src/main/java/org/apache/clerezza/platform/config/SystemConfig.java
(original)
+++
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.config/src/main/java/org/apache/clerezza/platform/config/SystemConfig.java
Fri Jul 16 21:29:09 2010
@@ -21,6 +21,7 @@ package org.apache.clerezza.platform.con
import java.io.IOException;
import java.net.URL;
+import org.apache.clerezza.platform.Constants;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.osgi.service.component.ComponentContext;
@@ -47,18 +48,19 @@ public class SystemConfig {
private final Logger logger = LoggerFactory.getLogger(getClass());
- private static final String SYSTEM_GRAPH_STRING =
- "http://tpf.localhost/system.graph";
-
- public static final UriRef SYSTEM_GRAPH_URI =
- new UriRef(SYSTEM_GRAPH_STRING);
+ /**
+ *
+ * @deprecated use org.apache.clerezza.platform.Contants instead
+ */
+ @Deprecated
+ public static final UriRef SYSTEM_GRAPH_URI =
Constants.SYSTEM_GRAPH_URI;
/**
* A filter that can be used to get the system graph as OSGi service,
* that is provided by
<code>org.apache.clerezza.rdf.core.access.TcManager</code>.
*/
public static final String SYSTEM_GRAPH_FILTER =
- "(name="+ SYSTEM_GRAPH_STRING +")";
+ "(name="+ Constants.SYSTEM_GRAPH_URI_STRING +")";
public static final String PARSER_FILTER =
"(supportedFormat=" + SupportedFormat.RDF_XML +")";
@@ -70,9 +72,9 @@ public class SystemConfig {
protected void activate(ComponentContext componentContext) {
try {
- tcManager.getMGraph(SYSTEM_GRAPH_URI);
+ tcManager.getMGraph(Constants.SYSTEM_GRAPH_URI);
} catch (NoSuchEntityException nsee) {
- MGraph systemGraph =
tcManager.createMGraph(SYSTEM_GRAPH_URI);
+ MGraph systemGraph =
tcManager.createMGraph(Constants.SYSTEM_GRAPH_URI);
Graph configGraph = readConfigGraphFile();
logger.info("Add initial configuration to system
graph");
systemGraph.addAll(configGraph);
Modified:
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.graphprovider.content/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.graphprovider.content/pom.xml?rev=964955&r1=964954&r2=964955&view=diff
==============================================================================
---
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.graphprovider.content/pom.xml
(original)
+++
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.graphprovider.content/pom.xml
Fri Jul 16 21:29:09 2010
@@ -21,6 +21,10 @@
</dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
+ <artifactId>org.apache.clerezza.platform</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
<artifactId>org.apache.clerezza.rdf.core</artifactId>
</dependency>
<dependency>
Modified:
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.graphprovider.content/src/main/java/org/apache/clerezza/platform/graphprovider/content/ContentGraphProvider.java
URL:
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.graphprovider.content/src/main/java/org/apache/clerezza/platform/graphprovider/content/ContentGraphProvider.java?rev=964955&r1=964954&r2=964955&view=diff
==============================================================================
---
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.graphprovider.content/src/main/java/org/apache/clerezza/platform/graphprovider/content/ContentGraphProvider.java
(original)
+++
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.graphprovider.content/src/main/java/org/apache/clerezza/platform/graphprovider/content/ContentGraphProvider.java
Fri Jul 16 21:29:09 2010
@@ -23,6 +23,7 @@ import java.util.Dictionary;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.locks.ReentrantReadWriteLock;
+import org.apache.clerezza.platform.Constants;
import org.osgi.service.component.ComponentContext;
import org.apache.clerezza.rdf.core.MGraph;
@@ -49,15 +50,6 @@ import org.apache.clerezza.rdf.utils.Uni
*/
public class ContentGraphProvider {
- /**
- * Service property header which specifies the URI of the graph used by
- * Discobits
- *
- * @scr.property type="String"
value="http://tpf.localhost/content.graph"
- * description
- * ="Specifies the URI of the graph used by Discobits."
- */
- public static final String DISCOBITS_GRAPH_URI_PROPERTY =
"Discobits_graph_URI";
/**
* Service property header, which contains the URIs of additional
@@ -75,10 +67,7 @@ public class ContentGraphProvider {
*/
private TcManager tcManager;
- /**
- * The URI which is specified in the service property
"Discobits_graph_URI"
- */
- private UriRef graphUri;
+
/**
* The URIs of the read-only addition-<code>TripleCollection</code>s
@@ -88,13 +77,10 @@ public class ContentGraphProvider {
private ReentrantReadWriteLock configLock = new
ReentrantReadWriteLock();
protected void activate(ComponentContext context) {
- Dictionary<?, ?> properties = context.getProperties();
- graphUri = new UriRef((String) properties
- .get(DISCOBITS_GRAPH_URI_PROPERTY));
try {
- tcManager.getMGraph(graphUri);
+ tcManager.getMGraph(Constants.CONTENT_GRAPH_URI);
} catch (NoSuchEntityException nsee) {
- tcManager.createMGraph(graphUri);
+ tcManager.createMGraph(Constants.CONTENT_GRAPH_URI);
}
String[] additionUriStrings = (String[])
context.getProperties().get(
CONTENT_ADDITIONS);
@@ -110,7 +96,7 @@ public class ContentGraphProvider {
try {
TripleCollection[] united = new
TripleCollection[additions.length + 1];
int i = 0;
- united[i++] = tcManager.getMGraph(graphUri);
+ united[i++] =
tcManager.getMGraph(Constants.CONTENT_GRAPH_URI);
for (UriRef uriRef : additions) {
united[i++] = tcManager.getTriples(uriRef);
}
Modified:
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform/pom.xml?rev=964955&r1=964954&r2=964955&view=diff
==============================================================================
---
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform/pom.xml
(original)
+++
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform/pom.xml
Fri Jul 16 21:29:09 2010
@@ -26,6 +26,10 @@
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>org.apache.clerezza.rdf.core</artifactId>
+ </dependency>
</dependencies>
</project>
Added:
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform/src/main/java/org/apache/clerezza/platform/Constants.java
URL:
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform/src/main/java/org/apache/clerezza/platform/Constants.java?rev=964955&view=auto
==============================================================================
---
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform/src/main/java/org/apache/clerezza/platform/Constants.java
(added)
+++
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform/src/main/java/org/apache/clerezza/platform/Constants.java
Fri Jul 16 21:29:09 2010
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2010 reto.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * under the License.
+ */
+
+package org.apache.clerezza.platform;
+
+import org.apache.clerezza.rdf.core.UriRef;
+
+/**
+ * This class gropus some constant values used by the clerezza.platform
components
+ *
+ * @author reto
+ */
+public class Constants {
+ /**
+ * the uri of the system graph as string
+ */
+ public static final String SYSTEM_GRAPH_URI_STRING =
+ "http://tpf.localhost/system.graph";
+ /**
+ * the uri of the system graph
+ */
+ public static final UriRef SYSTEM_GRAPH_URI =
+ new UriRef(SYSTEM_GRAPH_URI_STRING);
+
+ /**
+ * the uri of the config graph as string
+ */
+ public static final String CONFIG_GRAPH_URI_STRING =
+ "http://tpf.localhost/config.graph";
+ /**
+ * the uri of the config graph as string
+ */
+ public static final UriRef CONFIG_GRAPH_URI =
+ new UriRef(CONFIG_GRAPH_URI_STRING);
+
+ /**
+ * the uri of the content graph as string
+ */
+ public static final String CONTENT_GRAPH_URI_STRING =
+ "http://tpf.localhost/content.graph";
+ /**
+ * the uri of the content graph
+ */
+ public static final UriRef CONTENT_GRAPH_URI =
+ new UriRef(CONTENT_GRAPH_URI_STRING);
+
+}