Author: reto
Date: Sat Apr 9 17:56:26 2011
New Revision: 1090638
URL: http://svn.apache.org/viewvc?rev=1090638&view=rev
Log:
fixed typos
Modified:
incubator/clerezza/site/trunk/src/main/scala/Activator.scala
Modified: incubator/clerezza/site/trunk/src/main/scala/Activator.scala
URL:
http://svn.apache.org/viewvc/incubator/clerezza/site/trunk/src/main/scala/Activator.scala?rev=1090638&r1=1090637&r2=1090638&view=diff
==============================================================================
--- incubator/clerezza/site/trunk/src/main/scala/Activator.scala (original)
+++ incubator/clerezza/site/trunk/src/main/scala/Activator.scala Sat Apr 9
17:56:26 2011
@@ -31,35 +31,39 @@ class Activator extends BundleActivator
renderlet, null)
context.installBundle("mvn:org.apache.clerezza/rdf.stable.serializer").start();
context.installBundle("mvn:org.apache.clerezza/tools.offline").start();
- val tcManager = $[TcManager]
- val contentGraph =
tcManager.getMGraph(Constants.CONTENT_GRAPH_URI)
val path = {
val bl = context.getBundle.getLocation
bl.substring(bl.indexOf(':')+1)
}
val graphFile = new File(new File(path), "graph.nt");
- val fileGraph = $[Parser].parse(new FileInputStream(graphFile),
SupportedFormat.N_TRIPLE)
- if (contentGraph.size > fileGraph.size) {
- println("content graph if bigger than the graph from
file, not replacing with the content from file and not " +
- "writing any data to the file, you should
manually either write the content graph to the file or clear " +
- "the content graph. Restart this bundle after
resolving the issue.")
- graphListenerOption = None
- } else {
- contentGraph.clear
- contentGraph.addAll(fileGraph)
- println("the content graph has benn replaced with
"+graphFile)
- object graphListener extends GraphListener {
- val serializer = $[Serializer]
- override def graphChanged(events:
java.util.List[GraphEvent]) {
- serializer.serialize(new
FileOutputStream(graphFile), contentGraph,SupportedFormat.N_TRIPLE)
+ doWith {
+ (tcManager: TcManager, parser: Parser) => {
+ val contentGraph =
tcManager.getMGraph(Constants.CONTENT_GRAPH_URI)
+ val fileGraph = parser.parse(new
FileInputStream(graphFile), SupportedFormat.N_TRIPLE)
+ if (contentGraph.size > fileGraph.size) {
+ println("content graph if bigger than
the graph from file, not replacing with the content from file and not " +
+ "writing any data to the file,
you should manually either write the content graph to the file or clear " +
+ "the content graph. Restart
this bundle after resolving the issue.")
+ graphListenerOption = None
+ } else {
+ contentGraph.clear
+ contentGraph.addAll(fileGraph)
+ println("the content graph has been
replaced with "+graphFile)
+ object graphListener extends
GraphListener {
+ val serializer = $[Serializer]
+ override def
graphChanged(events: java.util.List[GraphEvent]) {
+
serializer.serialize(new FileOutputStream(graphFile),
contentGraph,SupportedFormat.N_TRIPLE)
+ }
+ }
+
contentGraph.addGraphListener(graphListener, new FilterTriple(null, null,
null), 2000)
+ graphListenerOption =
Some(graphListener)
+ println("A GraphListener has been added
that writes changes to the content graph to graph.nt")
}
}
- contentGraph.addGraphListener(graphListener, new
FilterTriple(null, null, null), 2000)
- graphListenerOption = Some(graphListener)
- println("A GraphLIstener has been added that writes
changes to the content graph to graph.nt")
}
}
+
/**
* called when the bundle is stopped, this method unregisters the
provided service
*/