You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2007/02/20 20:01:20 UTC
svn commit: r509708 [2/7] - in /incubator/uima/sandbox/trunk/CasEditor: ./
META-INF/ src/main/assembly/ src/main/java/org/apache/uima/caseditor/
src/main/java/org/apache/uima/caseditor/core/
src/main/java/org/apache/uima/caseditor/core/model/ src/main/...
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/ConsumerElement.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/ConsumerElement.java?view=diff&rev=509708&r1=509707&r2=509708
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/ConsumerElement.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/ConsumerElement.java Tue Feb 20 11:01:12 2007
@@ -21,9 +21,8 @@
import java.io.File;
-
import org.apache.uima.UIMAFramework;
-import org.apache.uima.caseditor.core.TaeCorePlugin;
+import org.apache.uima.caseditor.CasEditorPlugin;
import org.apache.uima.caseditor.core.model.delta.INlpElementDelta;
import org.apache.uima.caseditor.core.uima.CasConsumerConfiguration;
import org.apache.uima.caseditor.core.util.MarkerUtil;
@@ -39,9 +38,6 @@
/**
* The ConsumerELement containts the uima consumer descriptor.
- *
- * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
- * @version $Revision: 1.7.2.2 $, $Date: 2007/01/04 14:56:25 $
*/
public class ConsumerElement extends AbstractNlpElement {
private UimaConfigurationElement mParent;
@@ -66,9 +62,6 @@
}
/**
- * TODO: if something goes wrong ... then mark the resource with a problem in the correct line if
- * resource changes resynchronize it ...
- *
* @return the configuration
*
* @throws CoreException
@@ -79,7 +72,7 @@
try {
MarkerUtil.clearMarkers(mConsumerResource, MarkerUtil.PROBLEM_MARKER);
} catch (CoreException e) {
- TaeCorePlugin.log(e);
+ CasEditorPlugin.log(e);
}
}
};
@@ -91,6 +84,7 @@
CasConsumerDescription casConsumerDesciptor;
try {
+ // TODO: this throws a class cast eception if the fiel has an other descripter, check it
casConsumerDesciptor = (CasConsumerDescription) xmlParser.parse(inCasConsumer);
} catch (final InvalidXMLException e) {
Runnable createMarker = new Runnable() {
@@ -98,7 +92,7 @@
try {
MarkerUtil.createMarker(mConsumerResource, e);
} catch (CoreException e2) {
- TaeCorePlugin.log(e2);
+ CasEditorPlugin.log(e2);
}
}
};
@@ -111,7 +105,7 @@
try {
MarkerUtil.createMarker(mConsumerResource, "This file must contain a cas consumer!");
} catch (CoreException e2) {
- TaeCorePlugin.log(e2);
+ CasEditorPlugin.log(e2);
}
}
};
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/CorpusElement.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/CorpusElement.java?view=diff&rev=509708&r1=509707&r2=509708
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/CorpusElement.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/CorpusElement.java Tue Feb 20 11:01:12 2007
@@ -22,7 +22,6 @@
import java.util.Collection;
import java.util.LinkedList;
-
import org.apache.uima.caseditor.core.IDocument;
import org.apache.uima.caseditor.core.model.delta.INlpElementDelta;
import org.eclipse.core.resources.IFile;
@@ -35,9 +34,6 @@
* The CorpusElement is a container for {@link IDocument}s.
*
* TODO: do not include defective elements!
- *
- * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
- * @version $Revision: 1.5.2.2 $, $Date: 2007/01/04 14:56:25 $
*/
public final class CorpusElement extends AbstractNlpElement implements INlpElement, IAdaptable {
private NlpProject mParentElement;
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/DocumentElement.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/DocumentElement.java?view=diff&rev=509708&r1=509707&r2=509708
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/DocumentElement.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/DocumentElement.java Tue Feb 20 11:01:12 2007
@@ -1,374 +1,172 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-package org.apache.uima.caseditor.core.model;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Collection;
-import java.util.Map;
-
-
-import org.apache.uima.cas.CAS;
-import org.apache.uima.cas.FeatureStructure;
-import org.apache.uima.cas.Type;
-import org.apache.uima.cas.text.AnnotationFS;
-import org.apache.uima.caseditor.core.IDocument;
-import org.apache.uima.caseditor.core.IDocumentListener;
-import org.apache.uima.caseditor.core.TaeCorePlugin;
-import org.apache.uima.caseditor.core.model.delta.INlpElementDelta;
-import org.apache.uima.caseditor.core.uima.DocumentUimaImpl;
-import org.apache.uima.caseditor.core.util.Span;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-
-/**
- * The document element contains the uima cas document.
- *
- * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
- * @version $Revision: 1.7.2.2 $, $Date: 2007/01/04 14:56:25 $
- */
-public final class DocumentElement extends AbstractNlpElement implements INlpElement, IDocument,
- IAdaptable {
- private CorpusElement mParent;
-
- private IFile mDocumentFile;
-
- private IDocument mDocument;
-
- /**
- * Initializes a new instance.
- *
- * @param corpus
- * @param documentFile
- */
- DocumentElement(CorpusElement corpus, IFile documentFile) {
- mParent = corpus;
- mDocumentFile = documentFile;
- }
-
- /**
- * Retrives the TCAS object of the current document.
- */
- public CAS getCAS() {
- if (getDocument() != null) {
- return getDocument().getCAS();
- } else {
- return null;
- }
- }
-
- /**
- * Retrives the coresponding resource.
- */
- public IResource getResource() {
- return mDocumentFile;
- }
-
- /**
- * Retrives the name.
- */
- public String getName() {
- return mDocumentFile.getName();
- }
-
- private synchronized IDocument getDocument() {
- if (mDocument != null) {
- return mDocument;
- }
-
- try {
- mDocument = getWorkingCopy();
- } catch (CoreException e1) {
- TaeCorePlugin.log(e1);
- return null;
- }
-
- mDocument.addChangeListener(new IDocumentListener() {
- public void added(FeatureStructure newAnnotation) {
- writeToFile();
- }
-
- public void added(Collection<FeatureStructure> newAnnotations) {
- writeToFile();
- }
-
- public void removed(FeatureStructure deletedAnnotation) {
- writeToFile();
- }
-
- public void removed(Collection<FeatureStructure> deletedAnnotations) {
- writeToFile();
- }
-
- public void updated(FeatureStructure annotation) {
- writeToFile();
- }
-
- public void updated(Collection<FeatureStructure> annotations) {
- writeToFile();
- }
-
- private void writeToFile() {
- try {
- ByteArrayOutputStream outStream = new ByteArrayOutputStream(40000);
- serialize(outStream);
-
- InputStream stream = new ByteArrayInputStream(outStream.toByteArray());
-
- mDocumentFile.setContents(stream, true, false, null);
- } catch (CoreException e) {
- // TODO: handle it
- e.printStackTrace();
- }
- }
- });
-
- return mDocument;
-
- }
-
- /**
- * Forwards the call to {@link IDocument} instance retrived by getDocument().
- *
- * @param out
- * @throws CoreException
- */
- public synchronized void serialize(OutputStream out) throws CoreException {
- if (getDocument() != null) {
- getDocument().serialize(out);
- }
- }
-
- /**
- * Forwards the call to {@link IDocument} instance retrived by getDocument().
- */
- public synchronized void addFeatureStructure(FeatureStructure annotation) {
- getDocument().addFeatureStructure(annotation);
- }
-
- /**
- * Forwards the call to {@link IDocument} instance retrived by getDocument().
- */
- public synchronized void addFeatureStructures(Collection<FeatureStructure> annotations) {
- getDocument().addFeatureStructures(annotations);
- }
-
- /**
- * Forwards the call to {@link IDocument} instance retrived by getDocument().
- */
- public void addAnnotations(Collection<AnnotationFS> annotations) {
- getDocument().addAnnotations(annotations);
- }
-
- /**
- * Forwards the call to {@link IDocument} instance retrived by getDocument().
- */
- public synchronized void removeAnnotation() {
- getDocument().removeAnnotation();
- }
-
- /**
- * Forwards the call to {@link IDocument} instance retrived by getDocument().
- */
- public synchronized void removeFeatureStructure(FeatureStructure annotation) {
- getDocument().removeFeatureStructure(annotation);
- }
-
- /**
- * Forwards the call to {@link IDocument} instance retrived by getDocument().
- */
- public void removeAnnotations(Collection<AnnotationFS> annotationsToRemove) {
- getDocument().removeAnnotations(annotationsToRemove);
- }
-
- /**
- * Forwards the call to {@link IDocument} instance retrived by getDocument().
- */
- public synchronized void removeFeatureStructures(Collection<FeatureStructure> annotationsToRemove) {
- getDocument().removeFeatureStructures(annotationsToRemove);
- }
-
- /**
- * Forwards the call to {@link IDocument} instance retrived by getDocument().
- */
- public void update(FeatureStructure annotation) {
- getDocument().update(annotation);
- }
-
- /**
- * Forwards the call to {@link IDocument} instance retrived by getDocument().
- */
- public void updateFeatureStructure(Collection<FeatureStructure> annotations) {
- getDocument().updateFeatureStructure(annotations);
- }
-
- /**
- * Forwards the call to {@link IDocument} instance retrived by getDocument().
- */
- public void updateAnnotations(Collection<AnnotationFS> annotations) {
- getDocument().updateAnnotations(annotations);
- }
-
- /**
- * Forwards the call to {@link IDocument} instance retrived by getDocument().
- */
- public synchronized Collection<AnnotationFS> getAnnotations(Type type) {
- return getDocument().getAnnotations(type);
- }
-
- /**
- * Forwards the call to {@link IDocument} instance retrived by getDocument().
- */
- public synchronized Map<Integer, AnnotationFS> getView(Type annotationType) {
- return getDocument().getView(annotationType);
- }
-
- /**
- * Forwards the call to {@link IDocument} instance retrived by getDocument().
- */
- public synchronized void addChangeListener(IDocumentListener listener) {
- getDocument().addChangeListener(listener);
- }
-
- /**
- * Forwards the call to {@link IDocument} instance retrived by getDocument().
- */
- public synchronized void removeChangeListener(IDocumentListener listener) {
- getDocument().removeChangeListener(listener);
- }
-
- /**
- * Forwards the call to {@link IDocument} instance retrived by getDocument().
- */
- public synchronized Collection<AnnotationFS> getAnnotation(Type type, Span span) {
- return getDocument().getAnnotation(type, span);
- }
-
- /**
- * Forwards the call to {@link IDocument} instance retrived by getDocument().
- */
- public synchronized String getText() {
- return getDocument().getText();
- }
-
- /**
- * Forwards the call to {@link IDocument} instance retrived by getDocument().
- */
- public synchronized String getText(int start, int end) {
- return getDocument().getText(start, end);
- }
-
- /**
- * Forwards the call to {@link IDocument} instance retrived by getDocument().
- */
- public Type getType(String type) {
- return getDocument().getType(type);
- }
-
- /**
- * Does nothing.
- *
- * @param content
- */
- public synchronized void setContent(InputStream content) {
- // must not be implemented
- }
-
- /**
- * Retrives the parent.
- */
- public INlpElement getParent() {
- return mParent;
- }
-
- /**
- * Retrives the working copy.
- *
- * @return the working copy
- * @throws CoreException
- */
- public IDocument getWorkingCopy() throws CoreException {
- InputStream in = mDocumentFile.getContents();
-
- // TODO: create typeSystemExtension.xml element ...
- // and pass this to th UIMADocument
- DocumentUimaImpl document = new DocumentUimaImpl((NlpProject) mParent.getParent());
-
- document.setContent(in);
-
- return document;
- }
-
- /**
- * Writes the document element to the file system.
- *
- * @throws CoreException
- */
- public void writeToFile() throws CoreException {
- ByteArrayOutputStream outStream = new ByteArrayOutputStream(40000);
- serialize(outStream);
-
- InputStream stream = new ByteArrayInputStream(outStream.toByteArray());
-
- mDocumentFile.setContents(stream, true, false, null);
- }
-
- /**
- * Retrives the coresponding {@link NlpProject} instance.
- *
- * @return the {@link NlpProject} instance
- */
- public NlpProject getNlpProject() {
- return (NlpProject) getParent().getParent();
- }
-
- /**
- * Not implemented.
- */
- @Override
- void addResource(IResource resource) {
- // not needed here, there are no resources
- }
-
- @Override
- void changedResource(IResource resource, INlpElementDelta delta) {
- mDocument = null;
- }
-
- /**
- * Not implemented.
- */
- @Override
- void removeResource(IResource resource) {
- // not needed here, there are no resources
- }
-
- /**
- * Generates a hash code for the current instance.
- */
- @Override
- public int hashCode() {
- return getName().hashCode();
- }
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.apache.uima.caseditor.core.model;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.lang.ref.SoftReference;
+
+import org.apache.uima.caseditor.core.IDocument;
+import org.apache.uima.caseditor.core.model.delta.INlpElementDelta;
+import org.apache.uima.caseditor.core.uima.DocumentUimaImpl;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+
+/**
+ * The document element contains the uima cas document.
+ */
+public final class DocumentElement extends AbstractNlpElement implements IAdaptable {
+ private CorpusElement mParent;
+
+ private IFile mDocumentFile;
+
+ /**
+ * The working copy of the document. This instance is
+ * shared by everyone who wants to edit the document.
+ */
+ private SoftReference<DocumentUimaImpl> mWorkingCopy =
+ new SoftReference<DocumentUimaImpl>(null);
+
+ /**
+ * Initializes a new instance.
+ *
+ * @param corpus
+ * @param documentFile
+ */
+ DocumentElement(CorpusElement corpus, IFile documentFile) {
+
+ if (corpus == null || documentFile == null) {
+ throw new IllegalArgumentException("Parameters must not be null!");
+
+ }
+
+ mParent = corpus;
+ mDocumentFile = documentFile;
+ }
+
+ /**
+ * Retrives the coresponding resource.
+ */
+ public IFile getResource() {
+ return mDocumentFile;
+ }
+
+ /**
+ * Retrives the name.
+ */
+ public String getName() {
+ return mDocumentFile.getName();
+ }
+
+
+ /**
+ * Retrives the parent.
+ */
+ public INlpElement getParent() {
+ return mParent;
+ }
+
+ /**
+ * Retrives the working copy.
+ *
+ * @return the working copy
+ * @throws CoreException
+ */
+ public IDocument getDocument() throws CoreException {
+
+ DocumentUimaImpl document = mWorkingCopy.get();
+
+ if (document == null) {
+ InputStream in = mDocumentFile.getContents();
+
+ document =
+ new DocumentUimaImpl((NlpProject) mParent.getParent());
+
+ document.setContent(in);
+ document.setDocumentElement(this);
+
+ mWorkingCopy = new SoftReference<DocumentUimaImpl>(document);
+ }
+
+ return document;
+ }
+
+ /**
+ * Writes the document element to the file system.
+ *
+ * TODO: move it to the document, maybe the document gets not
+ * saved if the caller lost the reference to it, befor the this call
+ *
+ * @throws CoreException
+ */
+ public void saveDocument() throws CoreException {
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream(40000);
+
+ // getDocument().serialize(outStream);
+
+ InputStream stream = new ByteArrayInputStream(outStream.toByteArray());
+
+ mDocumentFile.setContents(stream, true, false, null);
+ }
+
+ /**
+ * Retrives the coresponding {@link NlpProject} instance.
+ *
+ * @return the {@link NlpProject} instance
+ */
+ public NlpProject getNlpProject() {
+ return (NlpProject) getParent().getParent();
+ }
+
+ /**
+ * Not implemented.
+ */
+ @Override
+ void addResource(IResource resource) {
+ // not needed here, there are no resources
+ }
+
+ @Override
+ void changedResource(IResource resource, INlpElementDelta delta) {
+
+ // TODO: What should happen if the doucment is changed externally
+ // e.g. with a texteditor ?
+ mWorkingCopy = new SoftReference<DocumentUimaImpl>(null);
+ }
+
+ /**
+ * Not implemented.
+ */
+ @Override
+ void removeResource(IResource resource) {
+ // not needed here, there are no resources
+ }
+
+ /**
+ * Generates a hash code for the current instance.
+ */
+ @Override
+ public int hashCode() {
+ return getName().hashCode();
+ }
}
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/DotCorpusElement.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/DotCorpusElement.java?view=diff&rev=509708&r1=509707&r2=509708
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/DotCorpusElement.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/DotCorpusElement.java Tue Feb 20 11:01:12 2007
@@ -25,9 +25,8 @@
import java.util.Collections;
import java.util.LinkedList;
-
import org.apache.uima.cas.Type;
-import org.apache.uima.caseditor.core.TaeCorePlugin;
+import org.apache.uima.caseditor.CasEditorPlugin;
import org.apache.uima.caseditor.core.model.dotcorpus.AnnotationStyle;
import org.apache.uima.caseditor.core.model.dotcorpus.DotCorpus;
import org.apache.uima.caseditor.core.model.dotcorpus.DotCorpusSerializer;
@@ -40,12 +39,7 @@
/**
* The <code>DotCorpus</code> is responseibil to load/store the project dependent configuration.
- * It has serveral methods to set and retrive configuration parameters. TODO: What can be done if
- * the dot corpus file is missing or not parsebale att all ?. How should the error be reported ? How
- * do the guys from jdt do this ?
- *
- * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
- * @version $Revision: 1.7.2.2 $, $Date: 2007/01/04 14:56:25 $
+ * It has serveral methods to set and retrive configuration parameters.
*/
public class DotCorpusElement extends AbstractNlpElement {
private DotCorpus mDotCorpus;
@@ -286,19 +280,24 @@
*/
@Override
public boolean equals(Object object) {
+
+ boolean result;
+
if (this == object) {
- return true;
+ result = true;
}
-
- if (object != null && object instanceof DotCorpusElement) {
+ else if (object instanceof DotCorpusElement) {
DotCorpusElement element = (DotCorpusElement) object;
- return mDotCorpus.equals(element.mDotCorpus) && mResource.equals(element.mResource)
+ result = mDotCorpus.equals(element.mDotCorpus) && mResource.equals(element.mResource)
&& mNlpProject.equals(element.mNlpProject);
}
-
- return false;
+ else {
+ result = false;
+ }
+
+ return result;
}
/**
@@ -319,7 +318,7 @@
try {
MarkerUtil.clearMarkers(file, MarkerUtil.PROBLEM_MARKER);
} catch (CoreException e) {
- TaeCorePlugin.log(e);
+ CasEditorPlugin.log(e);
}
}
};
@@ -333,7 +332,7 @@
try {
MarkerUtil.createMarker(file, e.getMessage());
} catch (CoreException e2) {
- TaeCorePlugin.log(e2);
+ CasEditorPlugin.log(e2);
}
}
};
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/INlpElement.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/INlpElement.java?view=diff&rev=509708&r1=509707&r2=509708
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/INlpElement.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/INlpElement.java Tue Feb 20 11:01:12 2007
@@ -23,10 +23,7 @@
import org.eclipse.core.runtime.CoreException;
/**
- * Interface for all nlp element.
- *
- * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
- * @version $Revision: 1.2.2.2 $, $Date: 2007/01/04 14:56:25 $
+ * Interface for all nlp elements.
*/
public interface INlpElement {
/**
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/NlpModel.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/NlpModel.java?view=diff&rev=509708&r1=509707&r2=509708
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/NlpModel.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/NlpModel.java Tue Feb 20 11:01:12 2007
@@ -26,8 +26,7 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-
-import org.apache.uima.caseditor.core.TaeCorePlugin;
+import org.apache.uima.caseditor.CasEditorPlugin;
import org.apache.uima.caseditor.core.model.delta.AbstractResourceDelta;
import org.apache.uima.caseditor.core.model.delta.INlpElementDelta;
import org.apache.uima.caseditor.core.model.delta.INlpModelChangeListener;
@@ -44,11 +43,9 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+
/**
* The root element of nlp workbench. Contains NLPProjects Contains IProject s
- *
- * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
- * @version $Revision: 1.7.2.2 $, $Date: 2007/01/04 14:56:25 $
*/
public final class NlpModel extends AbstractNlpElement {
private final class ResourceChangeListener implements IResourceChangeListener {
@@ -139,7 +136,7 @@
* Executes the current action.
*/
public void handle(NlpModelDeltaImpl delta) {
- TaeCorePlugin.getNlpModel().addInternal(delta.getResource());
+ CasEditorPlugin.getNlpModel().addInternal(delta.getResource());
/*
* Note: If a projcet is added, it is closed (isOpen() == false). Tough, the .project file is
@@ -147,7 +144,7 @@
*/
// set nlp element here
- delta.setNlpElement(TaeCorePlugin.getNlpModel().findMember(delta.getResource()));
+ delta.setNlpElement(CasEditorPlugin.getNlpModel().findMember(delta.getResource()));
processChildEvents(delta);
}
@@ -168,7 +165,7 @@
*/
public void handle(NlpModelDeltaImpl delta) {
// set nlp element here
- delta.setNlpElement(TaeCorePlugin.getNlpModel().findMember(delta.getResource()));
+ delta.setNlpElement(CasEditorPlugin.getNlpModel().findMember(delta.getResource()));
processChildEvents(delta);
@@ -176,7 +173,7 @@
INlpElement parent = delta.getNlpElement().getParent();
if (parent != null) {
- TaeCorePlugin.getNlpModel().removeInternal(delta.getResource());
+ CasEditorPlugin.getNlpModel().removeInternal(delta.getResource());
}
}
}
@@ -331,19 +328,19 @@
}
// set nlp element here
- delta.setNlpElement(TaeCorePlugin.getNlpModel().findMember(delta.getResource()));
+ delta.setNlpElement(CasEditorPlugin.getNlpModel().findMember(delta.getResource()));
processChildEvents(delta);
INlpElement parent;
try {
- parent = TaeCorePlugin.getNlpModel().getParent(delta.getResource());
+ parent = CasEditorPlugin.getNlpModel().getParent(delta.getResource());
if (parent != null) {
- TaeCorePlugin.getNlpModel().changeInternal(delta);
+ CasEditorPlugin.getNlpModel().changeInternal(delta);
}
} catch (CoreException e) {
- TaeCorePlugin.log(e);
+ CasEditorPlugin.log(e);
}
}
}
@@ -376,7 +373,7 @@
}
private void handleExceptionDuringResoruceChange(CoreException e) {
- TaeCorePlugin.log(e);
+ CasEditorPlugin.log(e);
}
void changeInternal(INlpElementDelta delta) {
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/NlpProject.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/NlpProject.java?view=diff&rev=509708&r1=509707&r2=509708
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/NlpProject.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/NlpProject.java Tue Feb 20 11:01:12 2007
@@ -22,9 +22,8 @@
import java.util.Collection;
import java.util.LinkedList;
-
import org.apache.uima.cas.CAS;
-import org.apache.uima.caseditor.core.TaeCorePlugin;
+import org.apache.uima.caseditor.CasEditorPlugin;
import org.apache.uima.caseditor.core.model.delta.INlpElementDelta;
import org.apache.uima.caseditor.core.model.dotcorpus.EditorAnnotationStatus;
import org.eclipse.core.resources.IFile;
@@ -38,16 +37,13 @@
/**
* TODO: add comment
- *
- * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
- * @version $Revision: 1.9.2.2 $, $Date: 2007/01/04 14:56:25 $
*/
public final class NlpProject extends AbstractNlpElement implements IProjectNature, INlpElement,
IAdaptable {
/**
* The ID of the <code>NLPProject</code>
*/
- public static final String ID = "net.sf.tae.core.NLPProject";
+ public static final String ID = "org.apache.uima.caseditor.NLPProject";
private static final String DOT_CORPUS_FILENAME = ".corpus";
@@ -444,7 +440,7 @@
initialize();
- TaeCorePlugin.getNlpModel().fireRefreshEvent(this);
+ CasEditorPlugin.getNlpModel().fireRefreshEvent(this);
}
}
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/TypesystemElement.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/TypesystemElement.java?view=diff&rev=509708&r1=509707&r2=509708
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/TypesystemElement.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/TypesystemElement.java Tue Feb 20 11:01:12 2007
@@ -1,213 +1,211 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-package org.apache.uima.caseditor.core.model;
-
-import java.io.File;
-import java.io.InputStream;
-
-
-import org.apache.uima.ResourceSpecifierFactory;
-import org.apache.uima.UIMAFramework;
-import org.apache.uima.cas.CAS;
-import org.apache.uima.caseditor.core.TaeCorePlugin;
-import org.apache.uima.caseditor.core.model.delta.INlpElementDelta;
-import org.apache.uima.caseditor.core.util.MarkerUtil;
-import org.apache.uima.resource.ResourceInitializationException;
-import org.apache.uima.resource.metadata.FsIndexDescription;
-import org.apache.uima.resource.metadata.TypePriorities;
-import org.apache.uima.resource.metadata.TypeSystemDescription;
-import org.apache.uima.util.CasCreationUtils;
-import org.apache.uima.util.InvalidXMLException;
-import org.apache.uima.util.XMLInputSource;
-import org.apache.uima.util.XMLParser;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-/**
- * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
- * @version $Revision: 1.3.2.2 $, $Date: 2007/01/04 14:56:25 $
- */
-public class TypesystemElement extends AbstractNlpElement {
- private IFile mTypesytemFile;
-
- private NlpProject mProject;
-
- TypesystemElement(IFile resource, NlpProject parent) {
- mTypesytemFile = resource;
- mProject = parent;
-
- getCAS();
- }
-
- /**
- * Retrives the {@link CAS}.
- *
- * @return the {@link CAS}
- */
- public CAS getCAS() {
- Runnable clearMarkers = new Runnable() {
- public void run() {
- try {
- MarkerUtil.clearMarkers(mTypesytemFile, MarkerUtil.PROBLEM_MARKER);
- } catch (CoreException e) {
- TaeCorePlugin.log(e);
- }
- }
- };
- ((NlpModel) mProject.getParent()).asyncExcuteQueue(clearMarkers);
-
- try {
- return getCASInternal();
- } catch (final CoreException e) {
- Runnable createMarker = new Runnable() {
- public void run() {
- try {
- MarkerUtil.createMarker(mTypesytemFile, e.getMessage());
- } catch (CoreException e2) {
- TaeCorePlugin.log(e2);
- }
- }
- };
- ((NlpModel) mProject.getParent()).asyncExcuteQueue(createMarker);
- return null;
- }
- }
-
- private CAS getCASInternal() throws CoreException {
- ResourceSpecifierFactory resourceSpecifierFactory = UIMAFramework.getResourceSpecifierFactory();
-
- IFile extensionTypeSystemFile = mTypesytemFile;
-
- InputStream inTypeSystem;
-
- if (extensionTypeSystemFile != null && extensionTypeSystemFile.exists()) {
- inTypeSystem = extensionTypeSystemFile.getContents();
- } else {
- return null;
- }
-
- XMLInputSource xmlTypeSystemSource = new XMLInputSource(inTypeSystem, new File(""));
-
- XMLParser xmlParser = UIMAFramework.getXMLParser();
-
- TypeSystemDescription typeSystemDesciptor;
-
- try {
- typeSystemDesciptor = (TypeSystemDescription) xmlParser.parse(xmlTypeSystemSource);
-
- typeSystemDesciptor.resolveImports();
- } catch (InvalidXMLException e) {
-
- String message = (e.getMessage() != null ? e.getMessage() : "");
-
- IStatus s = new Status(IStatus.ERROR, TaeCorePlugin.ID, IStatus.OK, message, e);
-
- throw new CoreException(s);
- }
-
- TypePriorities typePriorities = resourceSpecifierFactory.createTypePriorities();
-
- InputStream inIndex = getClass().getClassLoader().getResourceAsStream(
- "net/sf/tae/core/Index.xml");
-
- if (inIndex == null) {
- throw new NoClassDefFoundError("net/sf/tae/core/Index.xml" + " is missing on the classpath");
- }
-
- XMLInputSource xmlIndexSource = new XMLInputSource(inIndex, new File(""));
-
- xmlIndexSource = new XMLInputSource(inIndex, new File(""));
-
- FsIndexDescription indexDesciptor;
-
- try {
- indexDesciptor = (FsIndexDescription) xmlParser.parse(xmlIndexSource);
- } catch (InvalidXMLException e) {
- String message = (e.getMessage() != null ? e.getMessage() : "");
-
- IStatus s = new Status(IStatus.ERROR, TaeCorePlugin.ID, IStatus.OK, message, e);
-
- throw new CoreException(s);
- }
-
- CAS cas;
- try {
- cas = CasCreationUtils.createCas(typeSystemDesciptor, typePriorities,
- new FsIndexDescription[] { indexDesciptor });
- } catch (ResourceInitializationException e) {
- String message = (e.getMessage() != null ? e.getMessage() : "");
-
- IStatus s = new Status(IStatus.ERROR, TaeCorePlugin.ID, IStatus.OK, message, e);
-
- throw new CoreException(s);
- }
-
- return cas;
- }
-
- /**
- * Retrives the name.
- */
- public String getName() {
- return "Typesystem";
- }
-
- /**
- * Retrives the nlp project.
- */
- public NlpProject getNlpProject() {
- return mProject;
- }
-
- /**
- * Rerives the parent.
- */
- public INlpElement getParent() {
- return mProject;
- }
-
- /**
- * Retrives the resource.
- */
- public IResource getResource() {
- return mTypesytemFile;
- }
-
- @Override
- void changedResource(IResource resource, INlpElementDelta delta) throws CoreException {
- if ((delta.getFlags() & IResourceDelta.CONTENT) != 0) {
- getCAS();
- }
- }
-
- @Override
- void addResource(IResource resource) throws CoreException {
- // not needed here, there are no child resources
- }
-
- @Override
- void removeResource(IResource resource) throws CoreException {
- // not needed here, there are no child resources
- }
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.apache.uima.caseditor.core.model;
+
+import java.io.File;
+import java.io.InputStream;
+
+import org.apache.uima.ResourceSpecifierFactory;
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.cas.CAS;
+import org.apache.uima.caseditor.CasEditorPlugin;
+import org.apache.uima.caseditor.core.model.delta.INlpElementDelta;
+import org.apache.uima.caseditor.core.util.MarkerUtil;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.resource.metadata.FsIndexDescription;
+import org.apache.uima.resource.metadata.TypePriorities;
+import org.apache.uima.resource.metadata.TypeSystemDescription;
+import org.apache.uima.util.CasCreationUtils;
+import org.apache.uima.util.InvalidXMLException;
+import org.apache.uima.util.XMLInputSource;
+import org.apache.uima.util.XMLParser;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * TODO: add javadoc
+ */
+public class TypesystemElement extends AbstractNlpElement {
+ private IFile mTypesytemFile;
+
+ private NlpProject mProject;
+
+ TypesystemElement(IFile resource, NlpProject parent) {
+ mTypesytemFile = resource;
+ mProject = parent;
+
+ getCAS();
+ }
+
+ /**
+ * Retrives the {@link CAS}.
+ *
+ * @return the {@link CAS}
+ */
+ public CAS getCAS() {
+ Runnable clearMarkers = new Runnable() {
+ public void run() {
+ try {
+ MarkerUtil.clearMarkers(mTypesytemFile, MarkerUtil.PROBLEM_MARKER);
+ } catch (CoreException e) {
+ CasEditorPlugin.log(e);
+ }
+ }
+ };
+ ((NlpModel) mProject.getParent()).asyncExcuteQueue(clearMarkers);
+
+ try {
+ return getCASInternal();
+ } catch (final CoreException e) {
+ Runnable createMarker = new Runnable() {
+ public void run() {
+ try {
+ MarkerUtil.createMarker(mTypesytemFile, e.getMessage());
+ } catch (CoreException e2) {
+ CasEditorPlugin.log(e2);
+ }
+ }
+ };
+ ((NlpModel) mProject.getParent()).asyncExcuteQueue(createMarker);
+ return null;
+ }
+ }
+
+ private CAS getCASInternal() throws CoreException {
+ ResourceSpecifierFactory resourceSpecifierFactory = UIMAFramework.getResourceSpecifierFactory();
+
+ IFile extensionTypeSystemFile = mTypesytemFile;
+
+ InputStream inTypeSystem;
+
+ if (extensionTypeSystemFile != null && extensionTypeSystemFile.exists()) {
+ inTypeSystem = extensionTypeSystemFile.getContents();
+ } else {
+ return null;
+ }
+
+ XMLInputSource xmlTypeSystemSource = new XMLInputSource(inTypeSystem, new File(""));
+
+ XMLParser xmlParser = UIMAFramework.getXMLParser();
+
+ TypeSystemDescription typeSystemDesciptor;
+
+ try {
+ typeSystemDesciptor = (TypeSystemDescription) xmlParser.parse(xmlTypeSystemSource);
+
+ typeSystemDesciptor.resolveImports();
+ } catch (InvalidXMLException e) {
+
+ String message = (e.getMessage() != null ? e.getMessage() : "");
+
+ IStatus s = new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK, message, e);
+
+ throw new CoreException(s);
+ }
+
+ TypePriorities typePriorities = resourceSpecifierFactory.createTypePriorities();
+
+ InputStream inIndex = getClass().getClassLoader().getResourceAsStream(
+ "org/apache/uima/caseditor/core/Index.xml");
+
+ if (inIndex == null) {
+ throw new NoClassDefFoundError("org/apache/uima/caseditor/core/Index.xml" + " is missing on the classpath");
+ }
+
+ XMLInputSource xmlIndexSource = new XMLInputSource(inIndex, new File(""));
+
+ xmlIndexSource = new XMLInputSource(inIndex, new File(""));
+
+ FsIndexDescription indexDesciptor;
+
+ try {
+ indexDesciptor = (FsIndexDescription) xmlParser.parse(xmlIndexSource);
+ } catch (InvalidXMLException e) {
+ String message = (e.getMessage() != null ? e.getMessage() : "");
+
+ IStatus s = new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK, message, e);
+
+ throw new CoreException(s);
+ }
+
+ CAS cas;
+ try {
+ cas = CasCreationUtils.createCas(typeSystemDesciptor, typePriorities,
+ new FsIndexDescription[] { indexDesciptor });
+ } catch (ResourceInitializationException e) {
+ String message = (e.getMessage() != null ? e.getMessage() : "");
+
+ IStatus s = new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK, message, e);
+
+ throw new CoreException(s);
+ }
+
+ return cas;
+ }
+
+ /**
+ * Retrives the name.
+ */
+ public String getName() {
+ return "Typesystem";
+ }
+
+ /**
+ * Retrives the nlp project.
+ */
+ public NlpProject getNlpProject() {
+ return mProject;
+ }
+
+ /**
+ * Rerives the parent.
+ */
+ public INlpElement getParent() {
+ return mProject;
+ }
+
+ /**
+ * Retrives the resource.
+ */
+ public IResource getResource() {
+ return mTypesytemFile;
+ }
+
+ @Override
+ void changedResource(IResource resource, INlpElementDelta delta) throws CoreException {
+ if ((delta.getFlags() & IResourceDelta.CONTENT) != 0) {
+ getCAS();
+ }
+ }
+
+ @Override
+ void addResource(IResource resource) throws CoreException {
+ // not needed here, there are no child resources
+ }
+
+ @Override
+ void removeResource(IResource resource) throws CoreException {
+ // not needed here, there are no child resources
+ }
}
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/UimaConfigurationElement.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/UimaConfigurationElement.java?view=diff&rev=509708&r1=509707&r2=509708
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/UimaConfigurationElement.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/UimaConfigurationElement.java Tue Feb 20 11:01:12 2007
@@ -22,7 +22,6 @@
import java.util.Collection;
import java.util.LinkedList;
-
import org.apache.uima.caseditor.core.model.delta.INlpElementDelta;
import org.apache.uima.caseditor.core.uima.AnnotatorConfiguration;
import org.eclipse.core.resources.IFile;
@@ -35,9 +34,6 @@
* The ConfigurationElement is folder which contains uima descriptors and resources.
*
* TODO: do not include defective elements!
- *
- * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
- * @version $Revision: 1.5.2.2 $, $Date: 2007/01/04 14:56:25 $
*/
public class UimaConfigurationElement extends AbstractNlpElement implements IAdaptable {
private IFolder mConfigFolder;
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/UimaSourceFolder.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/UimaSourceFolder.java?view=diff&rev=509708&r1=509707&r2=509708
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/UimaSourceFolder.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/UimaSourceFolder.java Tue Feb 20 11:01:12 2007
@@ -30,9 +30,6 @@
/**
* The UimaSourceFolder contains folders, each of these folders can contain uima consumer or
* annoatator configurations.
- *
- * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
- * @version $Revision: 1.6.2.2 $, $Date: 2007/01/04 14:56:25 $
*/
public class UimaSourceFolder extends AbstractNlpElement implements IAdaptable {
private NlpProject mProject;
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/AbstractResourceDelta.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/AbstractResourceDelta.java?view=diff&rev=509708&r1=509707&r2=509708
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/AbstractResourceDelta.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/AbstractResourceDelta.java Tue Feb 20 11:01:12 2007
@@ -28,9 +28,6 @@
/**
* Abstract base class, so clients must not implement all methods.
- *
- * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
- * @version $Revision: 1.2.2.2 $, $Date: 2007/01/04 14:56:26 $
*/
public abstract class AbstractResourceDelta implements IResourceDelta {
/**
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/INlpElementDelta.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/INlpElementDelta.java?view=diff&rev=509708&r1=509707&r2=509708
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/INlpElementDelta.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/INlpElementDelta.java Tue Feb 20 11:01:12 2007
@@ -26,9 +26,6 @@
/**
* A element delta represents changes in the state of a element tree between two discrete points in
* time.
- *
- * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
- * @version $Revision: 1.3.2.2 $, $Date: 2007/01/04 14:56:25 $
*/
public interface INlpElementDelta {
/**
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/INlpModelChangeListener.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/INlpModelChangeListener.java?view=diff&rev=509708&r1=509707&r2=509708
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/INlpModelChangeListener.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/INlpModelChangeListener.java Tue Feb 20 11:01:12 2007
@@ -23,9 +23,6 @@
/**
* This listener is notfied when the nlp model changes.
- *
- * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
- * @version $Revision: 1.2.2.2 $, $Date: 2007/01/04 14:56:26 $
*/
public interface INlpModelChangeListener {
/**
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/INlpModelDeltaVisitor.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/INlpModelDeltaVisitor.java?view=diff&rev=509708&r1=509707&r2=509708
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/INlpModelDeltaVisitor.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/INlpModelDeltaVisitor.java Tue Feb 20 11:01:12 2007
@@ -21,9 +21,6 @@
/**
* The listener is used to visit the given delta.
- *
- * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
- * @version $Revision: 1.2.2.2 $, $Date: 2007/01/04 14:56:26 $
*/
public interface INlpModelDeltaVisitor {
/**
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/Kind.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/Kind.java?view=diff&rev=509708&r1=509707&r2=509708
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/Kind.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/Kind.java Tue Feb 20 11:01:12 2007
@@ -1,43 +1,40 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-package org.apache.uima.caseditor.core.model.delta;
-
-/**
- * The kind of the {@link INlpElementDelta}.
- *
- * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
- * @version $Revision: 1.1.2.2 $, $Date: 2007/01/04 14:56:26 $
- */
-public enum Kind {
- /**
- * Added a resource.
- */
- ADDED,
-
- /**
- * Removed a resource.
- */
- REMOVED,
-
- /**
- * Chnaged a resource or one of its childs.
- */
- CHANGED;
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.apache.uima.caseditor.core.model.delta;
+
+/**
+ * The kind of the {@link INlpElementDelta}.
+ */
+public enum Kind {
+ /**
+ * Added a resource.
+ */
+ ADDED,
+
+ /**
+ * Removed a resource.
+ */
+ REMOVED,
+
+ /**
+ * Chnaged a resource or one of its childs.
+ */
+ CHANGED;
+}
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/NlpModelDeltaImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/NlpModelDeltaImpl.java?view=diff&rev=509708&r1=509707&r2=509708
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/NlpModelDeltaImpl.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/delta/NlpModelDeltaImpl.java Tue Feb 20 11:01:12 2007
@@ -22,7 +22,6 @@
import java.util.Collection;
import java.util.LinkedList;
-
import org.apache.uima.caseditor.core.model.INlpElement;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
@@ -31,9 +30,6 @@
* The internal implementation of the nlp model delta interface.
*
* TODO: Add a filter to avoid node with Kind.NOTHING.
- *
- * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
- * @version $Revision: 1.5.2.2 $, $Date: 2007/01/04 14:56:26 $
*/
public final class NlpModelDeltaImpl implements INlpElementDelta {
private IResourceDelta mResourceDelta;
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/AnnotationStyle.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/AnnotationStyle.java?view=diff&rev=509708&r1=509707&r2=509708
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/AnnotationStyle.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/AnnotationStyle.java Tue Feb 20 11:01:12 2007
@@ -24,9 +24,6 @@
/**
* The <code>AnnotationStyle</code> describes the look of an certain annotation type in the
* <code>AnnotationEditor</code>.
- *
- * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
- * @version $Revision: 1.2.2.2 $, $Date: 2007/01/04 14:56:24 $
*/
public final class AnnotationStyle {
/**
Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpus.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpus.java?view=diff&rev=509708&r1=509707&r2=509708
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpus.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpus.java Tue Feb 20 11:01:12 2007
@@ -1,247 +1,249 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-
-package org.apache.uima.caseditor.core.model.dotcorpus;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.uima.cas.Type;
-
-/**
- * This class contains all project specific configuration parameters. Note: Use DotCorpusSerialzer
- * to read or write an instance of this class to or from a byte stream.
- *
- * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
- * @version $Revision: 1.4.2.2 $, $Date: 2007/01/04 14:56:24 $
- */
-public class DotCorpus {
- /**
- * The default value for editor line length hint
- */
- public static final int EDITOR_LINE_LENGTH_HINT_DEFAULT = 80;
-
- /**
- * Name of the typesystem file
- */
- private String mTypeSystemFileName;
-
- /**
- * names of the corpus folders
- */
- private Set<String> mCorpusFolders = new HashSet<String>();
-
- /**
- * Names of the configuration source folders
- */
- private String mUimaConfigFolder;
-
- /**
- * Length hint of the lines in the editor.
- */
- private int mEditorLineLengthHint = EDITOR_LINE_LENGTH_HINT_DEFAULT;
-
- /**
- * Maps style names to style objects.
- */
- private HashMap<String, AnnotationStyle> mStyleMap = new HashMap<String, AnnotationStyle>();
-
- /**
- * Retrives type system name parameter.
- *
- * @return type system name parameter
- */
- public String getTypeSystemFileName() {
- return mTypeSystemFileName;
- }
-
- /**
- * Sets type system name parameter.
- *
- * @param name
- * type system name parameter
- */
- public void setTypeSystemFilename(String name) {
- mTypeSystemFileName = name;
- }
-
- /**
- * Retrvies the uima config folder name parameter.
- *
- * @return uima config folder name parameter.
- */
- public String getUimaConfigFolder() {
- return mUimaConfigFolder;
- }
-
- /**
- * Sets the uima config folder name parameter.
- *
- * @param folder
- * uima config folder name parameter.
- */
- public void setUimaConfigFolderName(String folder) {
- mUimaConfigFolder = folder;
- }
-
- /**
- * Adds a corpus folder
- *
- * @param name
- */
- public void addCorpusFolder(String name) {
- mCorpusFolders.add(name);
- }
-
- /**
- * Removes the given corpus folder.
- *
- * @param name
- */
- public void removeCorpusFolder(String name) {
- mCorpusFolders.remove(name);
- }
-
- /**
- * Retrives the list of all corpus fodlers.
- *
- * @return corpus folder list
- */
- public Collection<String> getCorpusFolderNameList() {
- return Collections.unmodifiableCollection(mCorpusFolders);
- }
-
- /**
- * Retrvies the editor line length hint parameter.
- *
- * @return line length hint
- */
- public int getEditorLineLengthHint() {
- return mEditorLineLengthHint;
- }
-
- /**
- * Sets the editor line length hint parameter.
- *
- * @param lineLengthHint
- */
- public void setEditorLineLength(int lineLengthHint) {
- mEditorLineLengthHint = lineLengthHint;
- }
-
- /**
- * Retrives the annotation styles.
- *
- * @return - the annoation styles
- */
- public Collection<AnnotationStyle> getAnnotationStyles() {
- return mStyleMap.values();
- }
-
- /**
- * Adds an AnnotationStyle. TODO: move style stuff to nlp project
- *
- * @param style
- */
- public void setStyle(AnnotationStyle style) {
- if (!(AnnotationStyle.DEFAULT_COLOR.equals(style.getColor()) && AnnotationStyle.DEFAULT_STYLE
- .equals(style.getStyle()))) {
- mStyleMap.put(style.getAnnotation(), style);
- } else {
- mStyleMap.remove(style.getAnnotation());
- }
- }
-
- /**
- * Removes an AnnotationStyle for the given name, does nothing if not existent.
- *
- * @param name
- */
- public void removeStyle(String name) {
- mStyleMap.remove(name);
- }
-
- /**
- * Retrives the AnnotationStyle for the given type or null if not available.
- *
- * @param type
- * @return the requested style or null if none
- */
- public AnnotationStyle getAnnotation(Type type) {
- AnnotationStyle style = mStyleMap.get(type.getName());
-
- if (style == null) {
- style = new AnnotationStyle(type.getName(), AnnotationStyle.DEFAULT_STYLE,
- AnnotationStyle.DEFAULT_COLOR);
- }
-
- return style;
- }
-
- /**
- * Checks if the given object is equal to the current instance.
- */
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
-
- if (obj != null && obj instanceof DotCorpus) {
-
- DotCorpus corpus = (DotCorpus) obj;
-
- return isEqual(mTypeSystemFileName, corpus.mTypeSystemFileName)
- && isEqual(mCorpusFolders, corpus.mCorpusFolders)
- && isEqual(mUimaConfigFolder, corpus.mUimaConfigFolder)
- && isEqual(mStyleMap, corpus.mStyleMap)
- && isEqual(mEditorLineLengthHint, corpus.mEditorLineLengthHint);
- }
-
- return false;
- }
-
- /**
- * Compares two objects for equality.
- *
- * @param a -
- * the first object or null
- * @param b -
- * the secend object or null
- * @return - a.equals(b) or true if both null
- */
- private static boolean isEqual(Object a, Object b) {
- boolean result;
-
- if (a != null && b != null) {
- result = a.equals(b);
- } else {
- if (a == null && b == null) {
- result = true;
- } else {
- result = false;
- }
- }
-
- return result;
- }
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+package org.apache.uima.caseditor.core.model.dotcorpus;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.uima.cas.Type;
+
+/**
+ * This class contains all project specific configuration parameters. Note: Use DotCorpusSerialzer
+ * to read or write an instance of this class to or from a byte stream.
+ */
+public class DotCorpus {
+ /**
+ * The default value for editor line length hint
+ */
+ public static final int EDITOR_LINE_LENGTH_HINT_DEFAULT = 80;
+
+ /**
+ * Name of the typesystem file
+ */
+ private String mTypeSystemFileName;
+
+ /**
+ * names of the corpus folders
+ */
+ private Set<String> mCorpusFolders = new HashSet<String>();
+
+ /**
+ * Names of the configuration source folders
+ */
+ private String mUimaConfigFolder;
+
+ /**
+ * Length hint of the lines in the editor.
+ */
+ private int mEditorLineLengthHint = EDITOR_LINE_LENGTH_HINT_DEFAULT;
+
+ /**
+ * Maps style names to style objects.
+ */
+ private HashMap<String, AnnotationStyle> mStyleMap = new HashMap<String, AnnotationStyle>();
+
+ /**
+ * Retrives type system name parameter.
+ *
+ * @return type system name parameter
+ */
+ public String getTypeSystemFileName() {
+ return mTypeSystemFileName;
+ }
+
+ /**
+ * Sets type system name parameter.
+ *
+ * @param name
+ * type system name parameter
+ */
+ public void setTypeSystemFilename(String name) {
+ mTypeSystemFileName = name;
+ }
+
+ /**
+ * Retrvies the uima config folder name parameter.
+ *
+ * @return uima config folder name parameter.
+ */
+ public String getUimaConfigFolder() {
+ return mUimaConfigFolder;
+ }
+
+ /**
+ * Sets the uima config folder name parameter.
+ *
+ * @param folder
+ * uima config folder name parameter.
+ */
+ public void setUimaConfigFolderName(String folder) {
+ mUimaConfigFolder = folder;
+ }
+
+ /**
+ * Adds a corpus folder
+ *
+ * @param name
+ */
+ public void addCorpusFolder(String name) {
+ mCorpusFolders.add(name);
+ }
+
+ /**
+ * Removes the given corpus folder.
+ *
+ * @param name
+ */
+ public void removeCorpusFolder(String name) {
+ mCorpusFolders.remove(name);
+ }
+
+ /**
+ * Retrives the list of all corpus fodlers.
+ *
+ * @return corpus folder list
+ */
+ public Collection<String> getCorpusFolderNameList() {
+ return Collections.unmodifiableCollection(mCorpusFolders);
+ }
+
+ /**
+ * Retrvies the editor line length hint parameter.
+ *
+ * @return line length hint
+ */
+ public int getEditorLineLengthHint() {
+ return mEditorLineLengthHint;
+ }
+
+ /**
+ * Sets the editor line length hint parameter.
+ *
+ * @param lineLengthHint
+ */
+ public void setEditorLineLength(int lineLengthHint) {
+ mEditorLineLengthHint = lineLengthHint;
+ }
+
+ /**
+ * Retrives the annotation styles.
+ *
+ * @return - the annoation styles
+ */
+ public Collection<AnnotationStyle> getAnnotationStyles() {
+ return mStyleMap.values();
+ }
+
+ /**
+ * Adds an AnnotationStyle. TODO: move style stuff to nlp project
+ *
+ * @param style
+ */
+ public void setStyle(AnnotationStyle style) {
+ if (!(AnnotationStyle.DEFAULT_COLOR.equals(style.getColor()) && AnnotationStyle.DEFAULT_STYLE
+ .equals(style.getStyle()))) {
+ mStyleMap.put(style.getAnnotation(), style);
+ } else {
+ mStyleMap.remove(style.getAnnotation());
+ }
+ }
+
+ /**
+ * Removes an AnnotationStyle for the given name, does nothing if not existent.
+ *
+ * @param name
+ */
+ public void removeStyle(String name) {
+ mStyleMap.remove(name);
+ }
+
+ /**
+ * Retrives the AnnotationStyle for the given type or null if not available.
+ *
+ * @param type
+ * @return the requested style or null if none
+ */
+ public AnnotationStyle getAnnotation(Type type) {
+ AnnotationStyle style = mStyleMap.get(type.getName());
+
+ if (style == null) {
+ style = new AnnotationStyle(type.getName(), AnnotationStyle.DEFAULT_STYLE,
+ AnnotationStyle.DEFAULT_COLOR);
+ }
+
+ return style;
+ }
+
+ /**
+ * Checks if the given object is equal to the current instance.
+ */
+ @Override
+ public boolean equals(Object obj) {
+
+ boolean result;
+
+ if (obj == this) {
+ result = true;
+ }
+ else if (obj instanceof DotCorpus) {
+
+ DotCorpus corpus = (DotCorpus) obj;
+
+ result = isEqual(mTypeSystemFileName, corpus.mTypeSystemFileName)
+ && isEqual(mCorpusFolders, corpus.mCorpusFolders)
+ && isEqual(mUimaConfigFolder, corpus.mUimaConfigFolder)
+ && isEqual(mStyleMap, corpus.mStyleMap)
+ && isEqual(mEditorLineLengthHint, corpus.mEditorLineLengthHint);
+ }
+ else {
+ result = false;
+ }
+
+ return result;
+ }
+
+ /**
+ * Compares two objects for equality.
+ *
+ * @param a -
+ * the first object or null
+ * @param b -
+ * the secend object or null
+ * @return - a.equals(b) or true if both null
+ */
+ private static boolean isEqual(Object a, Object b) {
+ boolean result;
+
+ if (a != null && b != null) {
+ result = a.equals(b);
+ } else {
+ if (a == null && b == null) {
+ result = true;
+ } else {
+ result = false;
+ }
+ }
+
+ return result;
+ }
}