clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r911024 - in /incubator/clerezza/issues/CLEREZZA-113/org.apache.clerezza.platform.language: ./ org.apache.clerezza.platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageService.java
Date Wed, 17 Feb 2010 15:41:18 GMT
Author: reto
Date: Wed Feb 17 15:41:18 2010
New Revision: 911024

URL: http://svn.apache.org/viewvc?rev=911024&view=rev
Log:
CLEREZZA-113: merged down trunk

Modified:
    incubator/clerezza/issues/CLEREZZA-113/org.apache.clerezza.platform.language/   (props
changed)
    incubator/clerezza/issues/CLEREZZA-113/org.apache.clerezza.platform.language/org.apache.clerezza.platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageService.java

Propchange: incubator/clerezza/issues/CLEREZZA-113/org.apache.clerezza.platform.language/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 17 15:41:18 2010
@@ -1 +1,2 @@
 /incubator/clerezza/issues/CLEREZZA-72/org.apache.clerezza.platform.language:898371-901144
+/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.language:908544-910847

Modified: incubator/clerezza/issues/CLEREZZA-113/org.apache.clerezza.platform.language/org.apache.clerezza.platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageService.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-113/org.apache.clerezza.platform.language/org.apache.clerezza.platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageService.java?rev=911024&r1=911023&r2=911024&view=diff
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-113/org.apache.clerezza.platform.language/org.apache.clerezza.platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageService.java
(original)
+++ incubator/clerezza/issues/CLEREZZA-113/org.apache.clerezza.platform.language/org.apache.clerezza.platform.language.core/src/main/java/org/apache/clerezza/platform/language/LanguageService.java
Wed Feb 17 15:41:18 2010
@@ -57,7 +57,7 @@
  */
 @Component(immediate=true, enabled= true)
 @Service(LanguageService.class)
-public class LanguageService {
+public class LanguageService {	
 
 	@Reference(target = SystemConfig.SYSTEM_GRAPH_FILTER)
 	private MGraph systemGraph;
@@ -65,7 +65,14 @@
 	@Reference
 	private ContentGraphProvider cgProvider;
 
+	/** this is linked to the system-graph, accessing requires respective
+	 * permission
+	 */
 	private List<Resource> languageList;
+	/**
+	 * no permission on the system graph required to access this
+	 */
+	private List<Resource> languageListCache;
 
 	private static final String PARSER_FILTER =
 			"(supportedFormat=" + SupportedFormat.RDF_XML +")";
@@ -83,7 +90,7 @@
 	 */
 	public List<LanguageDescription> getLanguages() {
 		List<LanguageDescription> langList = new ArrayList<LanguageDescription>();
-		Iterator<Resource> languages = languageList.iterator();
+		Iterator<Resource> languages = languageListCache.iterator();
 		while (languages.hasNext()) {
 			UriRef language = (UriRef) languages.next();
 			langList.add(
@@ -100,7 +107,7 @@
 	 */
 	public LanguageDescription getDefaultLanguage() {
 		return new LanguageDescription(
-				new GraphNode(languageList.get(0), cgProvider.getContentGraph()));
+				new GraphNode(languageListCache.get(0), cgProvider.getContentGraph()));
 	}
 
 	/**
@@ -131,11 +138,12 @@
 	 *		added to the platform.
 	 */
 	public void addLanguage(UriRef languageUri) {
-		if (!languageList.contains(languageUri)) {
+		if (!languageListCache.contains(languageUri)) {
 			if(languageList.add(languageUri)) {
 				cgProvider.getContentGraph().
 						addAll(getLanguageContext(languageUri));
 			}
+			languageListCache.add(languageUri);
 		}
 	}
 
@@ -170,11 +178,13 @@
 	 * @param componentContext
 	 */
 	protected void activate(ComponentContext componentContext) {
+		final RdfList rdfList = new RdfList(getListNode(), systemGraph);
+		languageList = Collections.synchronizedList(rdfList);
 		//access to languages should not require access to system graph,
 		//so copying the resources to an ArrayList
-		languageList = Collections.synchronizedList(
-				new ArrayList<Resource>(new RdfList(getListNode(), systemGraph)));
-		if (languageList.size() == 0) {
+		languageListCache = Collections.synchronizedList(
+				new ArrayList<Resource>(rdfList));
+		if (languageListCache.size() == 0) {
 			addLanguage(new UriRef("http://www.lingvoj.org/lang/en"));
 		}
 	}



Mime
View raw message