1 40 package org.dspace.app.oai; 41 42 import java.util.Date ; 43 import java.util.Iterator ; 44 import java.util.LinkedList ; 45 import java.util.List ; 46 import java.util.Properties ; 47 48 import org.apache.log4j.Logger; 49 import org.dspace.content.DCDate; 50 import org.dspace.search.HarvestedItemInfo; 51 52 import ORG.oclc.oai.server.catalog.RecordFactory; 53 import ORG.oclc.oai.server.verb.CannotDisseminateFormatException; 54 55 61 public class DSpaceRecordFactory extends RecordFactory 62 { 63 64 private static Logger log = Logger.getLogger(DSpaceRecordFactory.class); 65 66 public DSpaceRecordFactory(Properties properties) 67 { 68 super(properties); 70 } 71 72 public String fromOAIIdentifier(String identifier) 73 { 74 return identifier; 76 } 77 78 public String quickCreate(Object nativeItem, String schemaURL, 79 String metadataPrefix) throws IllegalArgumentException , 80 CannotDisseminateFormatException 81 { 82 return null; 84 } 85 86 public String getOAIIdentifier(Object nativeItem) 87 { 88 String h = DSpaceOAICatalog.OAI_ID_PREFIX 89 + ((HarvestedItemInfo) nativeItem).handle; 90 91 return h; 92 } 93 94 public String getDatestamp(Object nativeItem) 95 { 96 Date d = ((HarvestedItemInfo) nativeItem).datestamp; 97 98 return new DCDate(d).toString(); 100 } 101 102 public Iterator getSetSpecs(Object nativeItem) 103 { 104 HarvestedItemInfo hii = (HarvestedItemInfo) nativeItem; 105 Iterator i = hii.collectionHandles.iterator(); 106 List setSpecs = new LinkedList (); 107 108 while (i.hasNext()) 111 { 112 String handle = "hdl_" + (String ) i.next(); 113 setSpecs.add(handle.replace('/', '_')); 114 } 115 116 return setSpecs.iterator(); 117 } 118 119 public boolean isDeleted(Object nativeItem) 120 { 121 HarvestedItemInfo hii = (HarvestedItemInfo) nativeItem; 122 123 return hii.withdrawn; 124 } 125 126 public Iterator getAbouts(Object nativeItem) 127 { 128 return new LinkedList ().iterator(); 130 } 131 } 132 | Popular Tags |