Changeset 2260
- Timestamp:
- 02/24/08 21:54:39 (9 months ago)
- Location:
- trunk
- Files:
-
- 5 added
- 10 modified
-
.classpath (modified) (1 diff)
-
components/model/resources/mappings/acquisition.ome.xml (modified) (1 diff)
-
components/server/ivy.xml (modified) (1 diff)
-
components/server/resources/ome/services/service-ome.api.Search.xml (modified) (2 diffs)
-
components/server/src/ome/services/fulltext/FileParser.java (modified) (4 diffs)
-
components/server/src/ome/services/fulltext/FullTextBridge.java (modified) (1 diff)
-
components/server/src/ome/services/fulltext/PdfParser.java (added)
-
components/server/test/ome/server/itests/search/FileParserTest.java (modified) (3 diffs)
-
components/server/test/ome/server/utests/fileparsers (added)
-
components/server/test/ome/server/utests/fileparsers/ABC123.pdf (added)
-
components/server/test/ome/server/utests/fileparsers/FileParserUnitTest.java (added)
-
lib/repository/PDFBox-0.7.3.jar (added)
-
sql/psql/OMERO3A__4/OMERO3A__3.sql (modified) (1 diff)
-
sql/psql/OMERO3A__4/OMERO3__5.sql (modified) (1 diff)
-
sql/psql/OMERO3A__4/data.sql (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/.classpath
r2177 r2260 117 117 <classpathentry exported="true" kind="lib" path="target/libs/xml-apis.jar"/> 118 118 <classpathentry exported="true" kind="lib" path="target/libs/c3p0.jar"/> 119 <classpathentry kind="lib" path="target/libs/activation.jar"/> 120 <classpathentry kind="lib" path="target/libs/mail.jar"/> 121 <classpathentry kind="lib" path="target/libs/PDFBox.jar"/> 119 122 <classpathentry kind="output" path="target/eclipse-bin"/> 120 123 </classpath> -
trunk/components/model/resources/mappings/acquisition.ome.xml
r2194 r2260 477 477 <entry name="text/xml"/> 478 478 <entry name="text/x-python"/> 479 <entry name="application/pdf"/> 479 480 </enum> 480 481 -
trunk/components/server/ivy.xml
r2252 r2260 43 43 <dependency org="mail" name="mail" rev="1.4.1" conf="build->default"/> 44 44 <dependency org="activation" name="activation" rev="1.1.1" conf="build->default"/> 45 <dependency org="PDFBox" name="PDFBox" rev="0.7.3" conf="build->default"/> 45 46 <!-- Duplicated with client/ivy.xml --> 46 47 <dependency org="omero" name="jbossall-client" rev="${versions.jboss}" conf="build->default"/> -
trunk/components/server/resources/ome/services/service-ome.api.Search.xml
r2257 r2260 54 54 <constructor-arg> 55 55 <map> 56 <entry key="text/plain" value-ref="fileParser"/> 57 <entry key="text/csv" value-ref="fileParser"/> 58 <entry key="text/xml" value-ref="fileParser"/> 56 <entry key="text/plain" value-ref="fileParser"/> 57 <entry key="text/csv" value-ref="fileParser"/> 58 <entry key="text/xml" value-ref="fileParser"/> 59 <entry key="application/pdf" value-ref="pdfParser"/> 59 60 </map> 60 61 </constructor-arg> … … 62 63 63 64 <bean id="fileParser" class="ome.services.fulltext.FileParser"/> 65 <bean id="pdfParser" class="ome.services.fulltext.PdfParser"/> 64 66 65 67 <alias name="persistentEventLogLoader" alias="eventLogLoader"/> -
trunk/components/server/src/ome/services/fulltext/FileParser.java
r2204 r2260 38 38 private final static Log log = LogFactory.getLog(FileParser.class); 39 39 40 pr ivateOmeroContext context;40 protected OmeroContext context; 41 41 42 42 public void setApplicationContext(ApplicationContext arg0) … … 101 101 } 102 102 } catch (Exception e) { 103 log. debug("Implementation threw an exception.");103 log.warn("Implementation threw an exception.", e); 104 104 return EMPTY; 105 105 } … … 133 133 r.close(); 134 134 } catch (Exception e) { 135 // May not throw exception135 log.debug("Error closing " + resource, e); 136 136 } 137 137 } … … 155 155 } 156 156 return new IteratorWrapper(it); 157 } 158 159 public Iterable<Reader> wrap(Reader r) { 160 if (r == null) { 161 return EMPTY; 162 } 163 return wrap(new SingleIterator(r)); 157 164 } 158 165 -
trunk/components/server/src/ome/services/fulltext/FullTextBridge.java
r2204 r2260 241 241 } 242 242 243 // However, we're not copying Reader information to the combined field 244 // here, because can only read from a reader once. 245 243 246 // Never storing in combined fields, since it's duplicated 244 f = new Field(COMBINED, reader); 245 if (boost != null) { 246 f.setBoost(boost); 247 } 248 d.add(f); 247 /* 248 * f = new Field(COMBINED, reader); if (boost != null) { 249 * f.setBoost(boost); } d.add(f); 250 */ 249 251 } 250 252 -
trunk/components/server/test/ome/server/itests/search/FileParserTest.java
r2259 r2260 15 15 import java.util.UUID; 16 16 17 import ome.api.Search; 17 18 import ome.model.annotations.FileAnnotation; 18 19 import ome.model.core.Image; … … 21 22 import ome.testing.FileUploader; 22 23 24 import org.springframework.util.ResourceUtils; 23 25 import org.testng.annotations.Test; 24 26 … … 79 81 80 82 } 83 84 @Test() 85 public void testPdfFile() throws Exception { 86 87 // Test data 88 89 // Upload 90 File file = ResourceUtils 91 .getFile("classpath:ome/server/utests/fileparsers/ABC123.pdf"); 92 FileUploader upload = new FileUploader(this.factory, file); 93 upload.setFormat("application/pdf"); 94 try { 95 upload.run(); 96 } catch (Exception e) { 97 // This seems to be throwing an exception 98 // when run in the server 99 } 100 101 i = new Image(); 102 i.setName("annotated"); // Don't put ABC123 here. 103 FileAnnotation fa = new FileAnnotation(); 104 fa.setFile(new OriginalFile(upload.getId(), false)); 105 i.linkAnnotation(fa); 106 i = iUpdate.saveAndReturnObject(i); 107 iUpdate.indexObject(i); 108 109 loginRoot(); 110 Search search = this.factory.createSearchService(); 111 search.onlyType(Image.class); 112 search.onlyIds(i.getId()); 113 search.byFullText("annotation:ABC123"); 114 assertTrue(search.hasNext()); 115 } 116 81 117 } -
trunk/sql/psql/OMERO3A__4/OMERO3A__3.sql
r2259 r2260 8 8 ALTER TABLE annotations ALTER COLUMN name RENAME to ns; 9 9 10 INSERT INTO FORMAT (id,permissions,owner_id,group_id,creation_id,value) 11 SELECT nextval('seq_format'),-35,0,0,0,'application/pdf'; 12 10 13 INSERT INTO dbpatch (currentVersion, currentPatch, previousVersion, previousPatch, message, finished) 11 14 VALUES ('OMERO3A', 4, 'OMERO3A', 3, 'Database updated.', now()); -
trunk/sql/psql/OMERO3A__4/OMERO3__5.sql
r2259 r2260 1889 1889 ALTER TABLE annotations ALTER COLUMN name RENAME to ns; 1890 1890 1891 INSERT INTO format (id,permissions,owner_id,group_id,creation_id,value) 1892 SELECT nextval('seq_format'),-35,0,0,0,'application/pdf'; 1893 1891 1894 INSERT INTO dbpatch (currentVersion, currentPatch, previousVersion, previousPatch, message, finished) 1892 1895 VALUES ('OMERO3A', 4, 'OMERO3', 5, 'Database updated.', now()); -
trunk/sql/psql/OMERO3A__4/data.sql
r2259 r2260 188 188 insert into format (id,permissions,owner_id,group_id,creation_id,value) 189 189 select nextval('seq_format'),-35,0,0,0,'text/x-python'; 190 insert into format (id,permissions,owner_id,group_id,creation_id,value) 191 select nextval('seq_format'),-35,0,0,0,'application/pdf'; 190 192 insert into lasertype (id,permissions,owner_id,group_id,creation_id,value) 191 193 select nextval('seq_lasertype'),-35,0,0,0,'Excimer';
