Permalink
Browse files

added read only EFS filesystem wrapper for linked originals

generalized linking commands and a Link enum, support for tags as reflexive links
alphabetically sorted folders
  • Loading branch information...
1 parent 2316998 commit 70fb19143b14b57722dfd753d4e7bdf2b7598676 @gregjan gregjan committed Mar 19, 2012
Showing with 717 additions and 244 deletions.
  1. +1 −1 crosswalk-gmf/.classpath
  2. +1 −43 irods-efs.plugin/META-INF/MANIFEST.MF
  3. +4 −1 irods-efs.plugin/src/irods/efs/plugin/IrodsFileStore.java
  4. +1 −1 mets.model.edit/src/gov/loc/mets/provider/SmLinkTypeItemProvider.java
  5. +63 −0 mets.model/src/gov/loc/mets/util/AggregateRoleLinkTester.java
  6. +31 −0 mets.model/src/gov/loc/mets/util/AlphabeticalOrderLinkTester.java
  7. +47 −0 mets.model/src/gov/loc/mets/util/Link.java
  8. +15 −0 mets.model/src/gov/loc/mets/util/LinkTester.java
  9. +0 −10 mets.model/src/gov/loc/mets/util/METSConstants.java
  10. +24 −0 mets.model/src/gov/loc/mets/util/METSUtils.java
  11. +7 −0 org.slf4j.pde/.classpath
  12. +34 −0 org.slf4j.pde/.project
  13. +3 −0 org.slf4j.pde/.settings/org.eclipse.core.resources.prefs
  14. +5 −0 org.slf4j.pde/.settings/org.eclipse.m2e.core.prefs
  15. +17 −0 target-definition/.project
  16. +3 −0 target-definition/.settings/org.eclipse.core.resources.prefs
  17. +5 −0 target-definition/.settings/org.eclipse.m2e.core.prefs
  18. +0 −85 workbench_plugin/META-INF/MANIFEST.MF
  19. +115 −25 workbench_plugin/plugin.xml
  20. +31 −1 workbench_plugin/src/main/java/unc/lib/cdr/workbench/SelectionPropertyTester.java
  21. +11 −11 ...nch_plugin/src/main/java/unc/lib/cdr/workbench/arrange/ArrangementCommonDropAdapterAssistant.java
  22. +10 −2 workbench_plugin/src/main/java/unc/lib/cdr/workbench/arrange/ArrangementViewerSorter.java
  23. +7 −6 workbench_plugin/src/main/java/unc/lib/cdr/workbench/capture/OriginalsLinkJob.java
  24. +26 −39 ...in/src/main/java/unc/lib/cdr/workbench/commands/{LinkSurrogateHandler.java → DivLinkHandler.java}
  25. +19 −19 workbench_plugin/src/main/java/unc/lib/cdr/workbench/commands/SetDivTypeHandler.java
  26. +34 −0 workbench_plugin/src/main/java/unc/lib/cdr/workbench/readonly/ReadOnlyWrapperFileSystem.java
  27. +203 −0 workbench_plugin/src/main/java/unc/lib/cdr/workbench/readonly/ReadOnlyWrapperStore.java
View
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="src/"/>
<classpathentry exported="true" kind="lib" path="lib/opencsv-2.2.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
@@ -17,46 +17,4 @@ Bundle-ClassPath: .,
lib/slf4j-api-1.6.0.jar,
lib/jargon-core-3.0.0-SNAPSHOT.jar
Import-Package: org.eclipse.core.filesystem
-Export-Package: irods.efs.plugin,
- irods.efs.plugin.properties,
- org.apache.log4j,
- org.apache.log4j.chainsaw,
- org.apache.log4j.config,
- org.apache.log4j.helpers,
- org.apache.log4j.jdbc,
- org.apache.log4j.jmx,
- org.apache.log4j.lf5,
- org.apache.log4j.lf5.config,
- org.apache.log4j.lf5.util,
- org.apache.log4j.lf5.viewer,
- org.apache.log4j.lf5.viewer.categoryexplorer,
- org.apache.log4j.lf5.viewer.configure,
- org.apache.log4j.lf5.viewer.images,
- org.apache.log4j.net,
- org.apache.log4j.nt,
- org.apache.log4j.or,
- org.apache.log4j.or.jms,
- org.apache.log4j.or.sax,
- org.apache.log4j.pattern,
- org.apache.log4j.spi,
- org.apache.log4j.varia,
- org.apache.log4j.xml,
- org.irods.jargon.core.connection,
- org.irods.jargon.core.exception,
- org.irods.jargon.core.packinstr,
- org.irods.jargon.core.protovalues,
- org.irods.jargon.core.pub,
- org.irods.jargon.core.pub.aohelper,
- org.irods.jargon.core.pub.domain,
- org.irods.jargon.core.pub.io,
- org.irods.jargon.core.query,
- org.irods.jargon.core.remoteexecute,
- org.irods.jargon.core.rule,
- org.irods.jargon.core.security,
- org.irods.jargon.core.sql,
- org.irods.jargon.core.transfer,
- org.irods.jargon.core.utils,
- org.slf4j,
- org.slf4j.helpers,
- org.slf4j.impl,
- org.slf4j.spi
+Export-Package: irods.efs.plugin
@@ -436,7 +436,7 @@ public void delete(int options, IProgressMonitor monitor)
.getIRODSFileFactory(getAccount());
IRODSFile file = irodsFileFactory
.instanceIRODSFile(getDecodedPath());
- file.delete();
+ file.deleteWithForceOption();
irodsFileSystem.close();
monitor.worked(1);
monitor.done();
@@ -498,6 +498,9 @@ public OutputStream openOutputStream(int options, IProgressMonitor monitor)
if (!parent.exists()) {
parent.mkdirs();
}
+ if(irodsFile.exists()) {
+ irodsFile.deleteWithForceOption();
+ }
parent.close();
irodsFile.close();
IRODSFileOutputStream irodsFileOutputStream = irodsFileFactory
@@ -17,8 +17,8 @@
import gov.loc.mets.MetsPackage;
import gov.loc.mets.SmLinkType;
+import gov.loc.mets.util.Link;
import gov.loc.mets.util.METSConstants;
-import gov.loc.mets.util.METSConstants.Link;
import java.util.Collection;
import java.util.List;
@@ -0,0 +1,63 @@
+package gov.loc.mets.util;
+
+import gov.loc.mets.DivType;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Accepts lists where all members are children of the same aggregate. List may also include that parent aggregate.
+ * whose parents are an aggregate.
+ *
+ * @param list
+ * @return a list of potential links
+ * @author count0
+ */
+public class AggregateRoleLinkTester implements LinkTester {
+ private String roleURI = null;
+
+ public AggregateRoleLinkTester(String uri) {
+ this.roleURI = uri;
+ }
+
+ @Override
+ public Collection<DivType[]> potentialLinks(List list) {
+ DivType passedInAggregate = null;
+ DivType impliedParentAggregate = null;
+ for (Object o : list) {
+ DivType d = (DivType) o;
+ if(METSConstants.Div_AggregateWork.equals(d.getTYPE())) {
+ if(passedInAggregate != null) return Collections.EMPTY_LIST;
+ passedInAggregate = d;
+ } else {
+ if(DivType.class.isInstance(d.eContainer())) {
+ DivType parent = (DivType)d.eContainer();
+ if(METSConstants.Div_AggregateWork.equals(parent.getTYPE())) {
+ if(impliedParentAggregate != null) {
+ if(!impliedParentAggregate.equals(parent)) return Collections.EMPTY_LIST;
+ } else {
+ impliedParentAggregate = parent;
+ }
+ } else {
+ return Collections.EMPTY_LIST;
+ }
+ }
+ }
+ }
+ if(passedInAggregate != null && !passedInAggregate.equals(impliedParentAggregate)) {
+ return Collections.EMPTY_LIST;
+ }
+ ArrayList<DivType[]> result = new ArrayList<DivType[]>();
+ for(Object o : list) {
+ if(impliedParentAggregate.equals(o)) continue;
+ if(METSUtils.findLink(impliedParentAggregate, this.roleURI, (DivType)o) != null) {
+ continue; // link exists
+ }
+ result.add(new DivType[] {impliedParentAggregate, (DivType)o} );
+ }
+ return result;
+ }
+
+}
@@ -0,0 +1,31 @@
+package gov.loc.mets.util;
+
+import gov.loc.mets.DivType;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Requires all the items to be containers. These are then potentially linked to themselves, i.e. tagged as alphabetical.
+ * @author count0
+ *
+ */
+public class AlphabeticalOrderLinkTester implements LinkTester {
+
+ @Override
+ public Collection<DivType[]> potentialLinks(List list) {
+ ArrayList<DivType[]> result = new ArrayList<DivType[]>();
+ for(Object o : list) {
+ DivType d = (DivType)o;
+ if(!METSUtils.isContainer(d)) return Collections.EMPTY_LIST;
+ if(METSUtils.findLink(d, Link.ALPHABETICALORDER.uri, d) != null) {
+ continue; // link exists
+ }
+ result.add(new DivType[] {d, d} );
+ }
+ return result;
+ }
+
+}
@@ -0,0 +1,47 @@
+package gov.loc.mets.util;
+
+import gov.loc.mets.DivType;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+
+public enum Link {
+ SURROGATE("has surrogate", "surrogate", "http://cdr.unc.edu/definitions/1.0/base-model.xml#hasSurrogate", new LinkTester() {
+ @Override
+ public Collection<DivType[]> potentialLinks(List list) {
+ if(list.size() != 2) return Collections.EMPTY_LIST;
+ DivType thumb = null;
+ DivType subject = null;
+ if (METSConstants.Div_File.equals(((DivType) list.get(0)).getTYPE())) {
+ thumb = (DivType) list.get(0);
+ subject = (DivType) list.get(1);
+ } else {
+ subject = (DivType) list.get(0);
+ thumb = (DivType) list.get(1);
+ }
+ if(METSUtils.findLink(subject, Link.SURROGATE.uri, thumb) != null) {
+ return Collections.EMPTY_LIST;
+ } else {
+ return Collections.singletonList(new DivType[] {subject, thumb});
+ }
+ }
+ }),
+ SUPPLEMENTAL("has supplemental", "supplemental", "http://cdr.unc.edu/definitions/1.0/base-model.xml#hasSupplemental",
+ new AggregateRoleLinkTester("http://cdr.unc.edu/definitions/1.0/base-model.xml#hasSupplemental")),
+ ALPHABETICALORDER("has alphabetical order", "alphabetical", "http://cdr.unc.edu/definitions/1.0/base-model.xml#hasAlphabeticalOrder",
+ new AlphabeticalOrderLinkTester()),
+ DEFAULTACCESS("has default access", "defaut access", "http://cdr.unc.edu/definitions/1.0/base-model.xml#defaultWebObject",
+ new AggregateRoleLinkTester("http://cdr.unc.edu/definitions/1.0/base-model.xml#defaultWebObject"));
+ public String predicateText = null;
+ public String label = null;
+ public String uri = null;
+ public LinkTester tester = null;
+ Link(String predicateText, String label, String uri, LinkTester tester) {
+ this.predicateText = predicateText;
+ this.uri = uri;
+ this.tester = tester;
+ this.label = label;
+ }
+}
@@ -0,0 +1,15 @@
+package gov.loc.mets.util;
+
+import gov.loc.mets.DivType;
+
+import java.util.Collection;
+import java.util.List;
+
+public interface LinkTester {
+ /** Validates that the supplied list can be linked. Returns the list of links implied by the list. The subject DivType object
+ * may or may not be in the supplied list.
+ * @param list a list of DivType objects
+ * @return a collection of the links implied by the list
+ */
+ public Collection<DivType[]> potentialLinks(List list);
+}
@@ -23,16 +23,6 @@
*
*/
public class METSConstants {
- public static enum Link {
- SURROGATE("has surrogate", "http://cdr.unc.edu/definitions/1.0/base-model.xml#hasSurrogate"),
- SUPPLEMENTAL("has surrogate", "http://cdr.unc.edu/definitions/1.0/base-model.xml#hasSurrogate");
- public String predicateText = null;
- public String uri = null;
- Link(String predicateText, String uri) {
- this.predicateText = predicateText;
- this.uri = uri;
- }
- }
private static Map<String, Link> linkTypesByURI = null;
static {
linkTypesByURI = new HashMap<String, Link>();
@@ -30,6 +30,7 @@
import gov.loc.mets.MetsHdrType;
import gov.loc.mets.MetsType;
import gov.loc.mets.ROLEType;
+import gov.loc.mets.SmLinkType;
import gov.loc.mets.StructMapType;
import gov.loc.mets.TYPEType;
import gov.loc.mets.impl.MetsPackageImpl;
@@ -133,6 +134,29 @@ public static FileGrpType getBatchMetadataGroup(MetsType m) {
}
return result;
}
+
+ public static SmLinkType findLink(EObject s, String p, EObject o) {
+ SmLinkType result = null;
+ EObject testMets = s.eContainer();
+ while(!MetsType.class.isInstance(testMets)) {
+ testMets = testMets.eContainer();
+ if(testMets == null) {
+ return null;
+ }
+ }
+ MetsType mets = (MetsType)testMets;
+ for(SmLinkType l : mets.getStructLink().getSmLink()) {
+ if(l.getXlinkFrom().equals(s)) {
+ if(l.getXlinkTo().equals(o)) {
+ if(l.getArcrole().equals(p)) {
+ result = l;
+ break;
+ }
+ }
+ }
+ }
+ return result;
+ }
/**
* @param m
View
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
View
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.slf4j.pde</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
@@ -0,0 +1,3 @@
+#Fri Mar 02 11:37:08 EST 2012
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
@@ -0,0 +1,5 @@
+#Fri Mar 02 11:37:08 EST 2012
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
View
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>target-definition</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ </natures>
+</projectDescription>
@@ -0,0 +1,3 @@
+#Fri Mar 02 11:37:08 EST 2012
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
@@ -0,0 +1,5 @@
+#Fri Mar 02 11:37:08 EST 2012
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
Oops, something went wrong.

0 comments on commit 70fb191

Please sign in to comment.