Changeset 3510
- Timestamp:
- Jun 19, 2007, 8:56:23 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/set_classpath.bat
r3476 r3510 86 86 REM Affymetrix Fusion SDK 87 87 SET CP=%CP%;%WEBINF%/lib/AffxFusion.jar 88 89 REM TAR and BZIP 90 SET CP=%CP%;%WEBINF%/lib/tar.jar 91 SET CP=%CP%;%WEBINF%/lib/bzip2.jar -
trunk/bin/set_classpath.sh
r3476 r3510 85 85 # Affymetrix Fusion SDK 86 86 CP=$CP:$WEBINF/lib/AffxFusion.jar 87 88 # TAR and BZIP 89 CP=$CP:$WEBINF/lib/tar.jar 90 CP=$CP:$WEBINF/lib/bzip2.jar -
trunk/doc/3rd-party-components.txt
r3476 r3510 238 238 Files : AffxFusion.jar 239 239 240 TAR file support 241 ---------------- 242 Package for reading and writing TAR files. 243 244 More info: http://www.trustice.com/java/tar/ 245 Version : 2.5 246 License : tar.license.txt 247 Files : tar.jar 248 249 BZIP file support 250 ----------------- 251 Package for reading and writing BZIP files. 252 253 More info: http://www.kohsuke.org/bzip2/ 254 Version : unknown 255 License : Apache software license (apache.license.txt) 256 Files : bzip2.jar 257 258 259 -
trunk/src/core/net/sf/basedb/core/Install.java
r3503 r3510 602 602 createPluginDefinition("net.sf.basedb.plugins.SpotImageCreator", null, keyEveryoneUse, true, null, false); 603 603 createPluginDefinition("net.sf.basedb.plugins.ZipFileUnpacker", null, keyEveryoneUse, true, null, true); 604 createPluginDefinition("net.sf.basedb.plugins.TarFileUnpacker", null, keyEveryoneUse, true, null, true); 604 605 createPluginDefinition("net.sf.basedb.plugins.PluginConfigurationExporter", null, keyEveryoneUse, true, null, true); 605 606 createPluginDefinition("net.sf.basedb.plugins.PluginConfigurationImporter", null, null, true, null, false); -
trunk/src/core/net/sf/basedb/util/FileUtil.java
r2304 r3510 36 36 import net.sf.basedb.core.query.Orders; 37 37 38 import java.util.Arrays; 38 39 import java.util.List; 39 40 import java.util.LinkedList; … … 49 50 import java.io.FileInputStream; 50 51 import java.io.BufferedInputStream; 52 import java.io.PushbackInputStream; 51 53 52 54 /** … … 118 120 119 121 /** 122 Take a peek at an input stream and check if the first few bytes 123 matches the bCheck parameter. After the check the bytes are 124 pushed back to the stream again. This method is useful to check 125 the file format of a file, which can often be done by checing 126 the first few bytes at the start of the file. For example 127 to check if the file is gzip file: 128 <p> 129 <code>bCheck = new byte[] { 0x1f, (byte)0x8b };</code> 130 131 @param pin The input stream to read from which must have 132 large enough buffer to be able to unread the bytes 133 @param bCheck The byte values to use for comparison 134 @return TRUE if the file matches the specified bytes, 135 FALSE otherwise 136 @throws IOException If there is an error reading or unreading 137 the bytes 138 @throws NullPointerException If pin or bCheck is null 139 @throws IllegalArgumentException If bCheck is zero length 140 @since 2.4 141 */ 142 public static boolean checkMagicNumber(PushbackInputStream pin, byte[] bCheck) 143 throws IOException 144 { 145 if (pin == null) throw new NullPointerException("pin"); 146 if (bCheck == null) throw new NullPointerException("bCheck"); 147 if (bCheck.length == 0) throw new IllegalArgumentException("bCheck has zero length"); 148 byte[] b = new byte[bCheck.length]; 149 pin.read(b); 150 boolean match = Arrays.equals(b, bCheck); 151 pin.unread(b); 152 return match; 153 } 154 155 /** 120 156 Get the complete tree of subdirectories from a given directory. 121 157 @param directory The directory to start with -
trunk/src/core/net/sf/basedb/util/zip/AbstractFileUnpacker.java
r2981 r3510 198 198 if (!getMimeTypes().contains(mimeType)) 199 199 { 200 int dotIndex = name.lastIndexOf('.'); 201 String extension = name.substring(dotIndex + 1); 202 if (dotIndex == -1 || !getExtensions().contains(extension)) 200 for (String extension : getExtensions()) 203 201 { 204 message = "Unsupported file: " + f.getPath().toString();202 if (name.endsWith(extension)) return null; 205 203 } 204 message = "Unsupported file: " + f.getPath().toString(); 206 205 } 207 206 } … … 277 276 @return The packed file or null 278 277 @see #getZipFileParameter(String, String) 278 @see #getCurrentFile(DbControl) 279 279 */ 280 280 protected File getZipFile(DbControl dc) … … 304 304 if (label == null) label = "Save in"; 305 305 if (description == null) description = "The directory where the unpacked files should be saved."; 306 return new PluginParameter<String>(UNPACK_DIRECTORY, label, description , unpackType); 307 } 306 DbControl dc = sc.newDbControl(); 307 String defaultDir = null; 308 try 309 { 310 Directory dir = getCurrentDirectory(dc); 311 if (dir != null) defaultDir = dir.getPath().toString(); 312 } 313 finally 314 { 315 if (dc != null) dc.close(); 316 } 317 return new PluginParameter<String>(UNPACK_DIRECTORY, label, description , defaultDir, unpackType); 318 } 319 320 /** 321 Get the current directory or null there is no current or it can't be loaded. 322 This method will first try to load the current file and use the file's 323 directory as the current. If there is no current file, the current directory 324 is loaded from the session context. 325 The current directory is only available in the configuration phase. 326 327 @param dc A DbControl to use for database access 328 @return A directory or null 329 @since 2.4 330 @see #getUnpackDirectory(DbControl) 331 */ 332 protected Directory getCurrentDirectory(DbControl dc) 333 { 334 File currentFile = getCurrentFile(dc); 335 if (currentFile != null) return currentFile.getDirectory(); 336 int directoryId = sc.getCurrentContext(Item.DIRECTORY).getId(); 337 if (directoryId != 0) 338 { 339 try 340 { 341 return Directory.getById(dc, directoryId); 342 } 343 catch (Throwable t) 344 {} 345 } 346 return null; 347 } 348 349 /** 350 Get the current file or null there is no current or it can't be loaded. 351 The current file is only available in the configuration phase. 352 @param dc A DbControl to use for database access 353 @return A file or null 354 @since 2.4 355 @see #getZipFile(DbControl) 356 */ 357 protected File getCurrentFile(DbControl dc) 358 { 359 int fileId = sc.getCurrentContext(Item.FILE).getId(); 360 if (fileId != 0) 361 { 362 try 363 { 364 return File.getById(dc, fileId); 365 } 366 catch (Throwable t) 367 {} 368 } 369 return null; 370 } 308 371 309 372 /** … … 314 377 @return The directory or null 315 378 @see #getDirectoryParameter(String, String) 379 @see #getCurrentDirectory(DbControl) 316 380 */ 317 381 protected Directory getUnpackDirectory(DbControl dc) -
trunk/src/test/set_classpath.bat
r3476 r3510 81 81 REM Affymetrix Fusion SDK 82 82 SET CP=%CP%;../../lib/dist/AffxFusion.jar 83 84 REM TAR and BZIP 85 SET CP=%CP%;../../lib/dist/tar.jar 86 SET CP=%CP%;../../lib/dist/bzip2.jar 87 -
trunk/src/test/set_classpath.sh
r3476 r3510 82 82 # Affymetrix Fusion SDK 83 83 CP=$CP:$LIB/AffxFusion.jar 84 85 # TAR and BZIP 86 CP=$CP:$LIB/tar.jar 87 CP=$CP:$LIB/bzip2.jar
Note: See TracChangeset
for help on using the changeset viewer.