clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject svn commit: r1062539 - /incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java
Date Sun, 23 Jan 2011 22:00:34 GMT
Author: hasan
Date: Sun Jan 23 22:00:34 2011
New Revision: 1062539

URL: http://svn.apache.org/viewvc?rev=1062539&view=rev
Log:
CLEREZZA-405: removed unnecessary statement and merged two similar methods: registerGraphAsService
and registerMGraphAsService

Modified:
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java?rev=1062539&r1=1062538&r2=1062539&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java
(original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java
Sun Jan 23 22:00:34 2011
@@ -148,10 +148,10 @@ public class TcManager extends TcProvide
 	protected void activate(final ComponentContext componentContext) {
 		this.componentContext = componentContext;
 		for (UriRef name : mGraphsToRegisterOnActivation) {
-			registerMGraphAsService(name);
+			registerTripleCollectionAsService(name, true);
 		}
 		for (UriRef name : graphsToRegisterOnActivation) {
-			registerGraphAsService(name);
+			registerTripleCollectionAsService(name, false);
 		}
 	}
 
@@ -387,7 +387,7 @@ public class TcManager extends TcProvide
 		if (componentContext == null) {
 			mGraphsToRegisterOnActivation.add(name);
 		} else {
-			registerMGraphAsService(name);
+			registerTripleCollectionAsService(name, true);
 		}
 	}
 
@@ -396,35 +396,27 @@ public class TcManager extends TcProvide
 		if (componentContext == null) {
 			graphsToRegisterOnActivation.add(name);
 		} else {
-			registerGraphAsService(name);
+			registerTripleCollectionAsService(name, false);
 		}
 	}
 
-	private void registerMGraphAsService(UriRef name) {
-		
+	private void registerTripleCollectionAsService(UriRef name, boolean isMGraph) {
 		Dictionary props = new Properties();
 		props.put("name", name.getUnicodeString());
 		String[] interfaceNames;
-		final TripleCollection triples = getTriples(name);
-		interfaceNames = new String[]{
-			MGraph.class.getName(),
-			LockableMGraph.class.getName()
-		};
-		Object service = new MGraphServiceFactory(this, name, tcAccessController);
-		ServiceRegistration serviceReg = componentContext.getBundleContext().registerService(
-				interfaceNames, service, props);
-		serviceRegistrations.put(name, serviceReg);
-	}
-
-	private void registerGraphAsService(UriRef name) {
-		Dictionary props = new Properties();
-		props.put("name", name.getUnicodeString());
-		String[] interfaceNames;
-		interfaceNames = new String[]{Graph.class.getName()};
-		Object service = new GraphServiceFactory(this, name, tcAccessController);
-
-		ServiceRegistration serviceReg = componentContext.getBundleContext().registerService(
-				interfaceNames, service, props);
+		Object service;
+		if (isMGraph) {
+			interfaceNames = new String[] {
+				MGraph.class.getName(),
+				LockableMGraph.class.getName()
+			};
+			service = new MGraphServiceFactory(this, name, tcAccessController);
+		} else {
+			interfaceNames = new String[] {Graph.class.getName()};
+			service = new GraphServiceFactory(this, name, tcAccessController);
+		}
+		ServiceRegistration serviceReg = componentContext.getBundleContext()
+				.registerService(interfaceNames, service, props);
 		serviceRegistrations.put(name, serviceReg);
 	}
 



Mime
View raw message