Changeset 350
- Timestamp:
- 04/14/10 12:39:22 (14 years ago)
- Location:
- VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/oai
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/oai/OAIProvider.java
r349 r350 15 15 import eu.clarin.cmdi.virtualcollectionregistry.oai.verb.GetRecordVerb; 16 16 import eu.clarin.cmdi.virtualcollectionregistry.oai.verb.IdentifyVerb; 17 import eu.clarin.cmdi.virtualcollectionregistry.oai.verb.ListMetadataFormatsVerb; 17 18 import eu.clarin.cmdi.virtualcollectionregistry.oai.verb.Verb; 18 19 … … 28 29 verbs = new ArrayList<Verb>(); 29 30 verbs.add(new IdentifyVerb()); 31 verbs.add(new ListMetadataFormatsVerb()); 30 32 verbs.add(new GetRecordVerb()); 31 33 } -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/oai/OAIRepository.java
r345 r350 5 5 6 6 public interface OAIRepository { 7 public static enum Deleted {7 public static enum DeletedNotion { 8 8 NO, 9 9 PERSISTENT, 10 10 TRANSIENT; 11 } 11 } // enum DeletedNotion 12 12 13 public static enum Granularity { 13 14 DAYS, 14 15 SECONDS; 15 } 16 } // enum Granularity 17 18 public static class MetadataFormat { 19 private final String prefix; 20 private final String namespaceURI; 21 private final String schemaLocation; 22 23 public MetadataFormat(String prefix, String namespaceURI, String schemaLocation) { 24 if (prefix == null) { 25 throw new NullPointerException("prefix == null"); 26 } 27 this.prefix = prefix; 28 if (namespaceURI == null) { 29 throw new NullPointerException("namespaceURI == null"); 30 } 31 this.namespaceURI = namespaceURI; 32 if (schemaLocation == null) { 33 throw new NullPointerException("schemaLocation == null"); 34 } 35 this.schemaLocation = schemaLocation; 36 } 37 38 public String getPrefix() { 39 return prefix; 40 } 41 42 public String getNamespaceURI() { 43 return namespaceURI; 44 } 45 46 public String getSchemaLocation() { 47 return schemaLocation; 48 } 49 } // class MetadataFormat 50 16 51 public String getId(); 17 52 … … 22 57 public Date getEarliestTimestamp(); 23 58 24 public Deleted getDeletedNotion();59 public DeletedNotion getDeletedNotion(); 25 60 26 61 public Granularity getGranularity(); 27 62 28 public List< String> getSupportedMetadataPrefixes();63 public List<MetadataFormat> getSupportedMetadataFormats(); 29 64 30 65 public String getDescription(); -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/oai/OAIRepositoryAdapter.java
r345 r350 6 6 import java.util.TimeZone; 7 7 8 import eu.clarin.cmdi.virtualcollectionregistry.oai.OAIRepository.Deleted ;8 import eu.clarin.cmdi.virtualcollectionregistry.oai.OAIRepository.DeletedNotion; 9 9 import eu.clarin.cmdi.virtualcollectionregistry.oai.OAIRepository.Granularity; 10 import eu.clarin.cmdi.virtualcollectionregistry.oai.OAIRepository.MetadataFormat; 10 11 11 12 … … 25 26 this.provider = provider; 26 27 this.repository = repository; 28 29 // check of repository supports oai_dc format 30 if (!supportsMetadataFormat("oai_dc")) { 31 throw new OAIException("repository does not supported " + 32 "mandatory \"oai_dc\" format"); 33 } 27 34 28 35 // cache earliest timestamp … … 53 60 } 54 61 55 public Deleted getDeletedNotion() {62 public DeletedNotion getDeletedNotion() { 56 63 return repository.getDeletedNotion(); 57 64 } … … 61 68 } 62 69 63 public List< String> getSupportedMetadataPrefixes() {64 return repository.getSupportedMetadata Prefixes();70 public List<MetadataFormat> getSupportedMetadataFormats() { 71 return repository.getSupportedMetadataFormats(); 65 72 } 66 73 … … 81 88 } 82 89 90 public boolean supportsMetadataFormat(String prefix) { 91 for (MetadataFormat format : repository.getSupportedMetadataFormats()) { 92 if (prefix.equals(format.getPrefix())) { 93 return true; 94 } 95 } 96 return false; 97 } 98 83 99 private static SimpleDateFormat createDateFormat(OAIRepository repository) { 84 100 SimpleDateFormat sdf = null; -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/oai/VerbContext.java
r344 r350 20 20 // XXX: add method for fetching request timestamp 21 21 22 public boolean hasArgument(Argument.Name name); 23 22 24 public String getArgument(Argument.Name name); 23 25 -
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/oai/impl/VerbContextImpl.java
r342 r350 115 115 116 116 @Override 117 public boolean hasArgument(Argument.Name name) { 118 boolean result = false; 119 if (arguments != null) { 120 result = arguments.containsKey(name); 121 } 122 return result; 123 } 124 125 @Override 117 126 public String getArgument(Argument.Name name) { 118 127 String value = null;
Note: See TracChangeset
for help on using the changeset viewer.