You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by jo...@apache.org on 2012/03/13 11:43:04 UTC

svn commit: r1300062 - /opennlp/sandbox/corpus-server/src/main/java/org/apache/opennlp/corpus_server/store/MemoryCorpusStore.java

Author: joern
Date: Tue Mar 13 10:43:04 2012
New Revision: 1300062

URL: http://svn.apache.org/viewvc?rev=1300062&view=rev
Log:
No jira, fixed formating.

Modified:
    opennlp/sandbox/corpus-server/src/main/java/org/apache/opennlp/corpus_server/store/MemoryCorpusStore.java

Modified: opennlp/sandbox/corpus-server/src/main/java/org/apache/opennlp/corpus_server/store/MemoryCorpusStore.java
URL: http://svn.apache.org/viewvc/opennlp/sandbox/corpus-server/src/main/java/org/apache/opennlp/corpus_server/store/MemoryCorpusStore.java?rev=1300062&r1=1300061&r2=1300062&view=diff
==============================================================================
--- opennlp/sandbox/corpus-server/src/main/java/org/apache/opennlp/corpus_server/store/MemoryCorpusStore.java (original)
+++ opennlp/sandbox/corpus-server/src/main/java/org/apache/opennlp/corpus_server/store/MemoryCorpusStore.java Tue Mar 13 10:43:04 2012
@@ -31,54 +31,56 @@ import org.apache.uima.resource.metadata
  */
 public class MemoryCorpusStore implements CorpusStore {
 
-	private final String corpusName;
-	private final TypeSystemDescription typeSystem;
-	private byte[] indexMapping;
-	
-	private Map<String, byte[]> casStore = new HashMap<String, byte[]>();
-	
-	MemoryCorpusStore(String corpusName, TypeSystemDescription typeSystem, byte[] indexMapping) {
-		this.corpusName = corpusName;
-		this.typeSystem = typeSystem;
-		this.indexMapping = indexMapping;
-	}
-	
-	@Override
-	public String getCorpusId() {
-	  return corpusName;
-	}
-	
-	public byte[] getCAS(String casId) {
-		return casStore.get(casId);
-	}
-	
-	// TODO: Add exception declaration to propagte errors back to client ...
-	public void addCAS(String casID, byte[] content) {
-		
-		// Note:
-		// Directly store data as xmi, but deserialization is needed to index and validate it!
-		
-		CAS cas = UimaUtil.createEmptyCAS(typeSystem);
-		
-		try {
-			UimaUtil.deserializeXmiCAS(cas, new ByteArrayInputStream(content));
-		} catch (IOException e) {
-			// TODO: Send error back to client ...
-			e.printStackTrace();
-		}
-		
-		casStore.put(casID, content);
-	}
-	
-	@Override
-	public void updateCAS(String casID, byte[] content) throws IOException {
-	  addCAS(casID, content);
-	}
-	
-	public TypeSystemDescription getTypeSystem() {
-		return typeSystem;
-	}
-	
+  private final String corpusName;
+  private final TypeSystemDescription typeSystem;
+  private byte[] indexMapping;
+
+  private Map<String, byte[]> casStore = new HashMap<String, byte[]>();
+
+  MemoryCorpusStore(String corpusName, TypeSystemDescription typeSystem,
+      byte[] indexMapping) {
+    this.corpusName = corpusName;
+    this.typeSystem = typeSystem;
+    this.indexMapping = indexMapping;
+  }
+
+  @Override
+  public String getCorpusId() {
+    return corpusName;
+  }
+
+  public byte[] getCAS(String casId) {
+    return casStore.get(casId);
+  }
+
+  // TODO: Add exception declaration to propagte errors back to client ...
+  public void addCAS(String casID, byte[] content) {
+
+    // Note:
+    // Directly store data as xmi, but deserialization is needed to index and
+    // validate it!
+
+    CAS cas = UimaUtil.createEmptyCAS(typeSystem);
+
+    try {
+      UimaUtil.deserializeXmiCAS(cas, new ByteArrayInputStream(content));
+    } catch (IOException e) {
+      // TODO: Send error back to client ...
+      e.printStackTrace();
+    }
+
+    casStore.put(casID, content);
+  }
+
+  @Override
+  public void updateCAS(String casID, byte[] content) throws IOException {
+    addCAS(casID, content);
+  }
+
+  public TypeSystemDescription getTypeSystem() {
+    return typeSystem;
+  }
+
   @Override
   public byte[] getIndexMapping() throws IOException {
     return indexMapping;