public OutputStream createDataStream() { tempDataFile = TempFileProvider.createTempFile("exportDataStream", ".xml"); try { tempDataFileStream = new FileOutputStream(tempDataFile); return tempDataFileStream; } catch (FileNotFoundException e) { throw new ExporterException("Failed to create data file stream", e); } }
/** * Get the Alfresco temp dir, by defaut %java.io.tempdir%/Alfresco. * Will create the temp dir on the fly if it does not already exist. * * @return Returns a temporary directory, i.e. <code>isDir == true</code> */ public static File getTempDir() { return getTempDir(ALFRESCO_TEMP_FILE_DIR); }
public FileExportHandle exportSystem(String packageName) { // create a temporary file to hold the system info export File systemTempDir = TempFileProvider.getSystemTempDir(); File tempFile = TempFileProvider.createTempFile("repoExpSystemInfo", ".xml", systemTempDir); try { OutputStream outputStream = new FileOutputStream(tempFile); systemExporterImporter.exportSystem(outputStream); } catch(FileNotFoundException e) { tempFile.delete(); throw new ExporterException("Failed to create temporary file for holding export of system info"); } // return handle onto temp file FileExportHandle handle = new FileExportHandle(); handle.storeRef = null; handle.packageName = packageName; handle.mimeType = MimetypeMap.MIMETYPE_XML; handle.exportFile = tempFile; return handle; } };
private File createRequisiteFile() { File tempDir = TempFileProvider.getLongLifeTempDir(FILE_DIRECTORY); File reqFile = TempFileProvider.createTempFile("TRX-REQ", FILE_SUFFIX, tempDir); return reqFile; }
/** * Create a temp file in the alfresco temp dir. * * @return Returns a temp <code>File</code> that will be located in the * <b>Alfresco</b> subdirectory of the default temp directory * * @see #ALFRESCO_TEMP_FILE_DIR * @see File#createTempFile(java.lang.String, java.lang.String) */ public static File createTempFile(String prefix, String suffix) { File tempDir = TempFileProvider.getTempDir(); // we have the directory we want to use return createTempFile(prefix, suffix, tempDir); }
@Before public void before() throws Exception { File tempDir = TempFileProvider.getTempDir(); backingStore = new FileContentStore(ctx, tempDir.getAbsolutePath() + File.separatorChar + getName()); cache = new ContentCacheImpl(); cache.setCacheRoot(TempFileProvider.getLongLifeTempDir("cached_content_test")); cache.setMemoryStore(createMemoryStore()); store = new CachingContentStore(backingStore, cache, false); }
File systemTempDir = getSystemTempDir();
private FixBpmPackagesPatchHelper() throws IOException { // put the log file into a long life temp directory File tempDir = TempFileProvider.getLongLifeTempDir("patches"); logFile = new File(tempDir, "FixBpmPackagesPatch.log"); // open the file for appending RandomAccessFile outputFile = new RandomAccessFile(logFile, "rw"); channel = outputFile.getChannel(); // move to the end of the file channel.position(channel.size()); // add a newline and it's ready writeLine("").writeLine(""); writeLine("FixBpmPackagesPatch executing on " + new Date()); }
/** * Create a temp file in the alfresco temp dir. * * @return Returns a temp <code>File</code> that will be located in the * <b>Alfresco</b> subdirectory of the default temp directory * * @see #ALFRESCO_TEMP_FILE_DIR * @see File#createTempFile(java.lang.String, java.lang.String) */ public static File createTempFile(String prefix, String suffix) { File tempDir = TempFileProvider.getTempDir(); // we have the directory we want to use return createTempFile(prefix, suffix, tempDir); }
private File createRequisiteFile() { File tempDir = TempFileProvider.getLongLifeTempDir(FILE_DIRECTORY); File reqFile = TempFileProvider.createTempFile("TRX-REQ", FILE_SUFFIX, tempDir); return reqFile; }
File systemTempDir = getSystemTempDir();
private FixBpmPackagesPatchHelper() throws IOException { // put the log file into a long life temp directory File tempDir = TempFileProvider.getLongLifeTempDir("patches"); logFile = new File(tempDir, "FixBpmPackagesPatch.log"); // open the file for appending RandomAccessFile outputFile = new RandomAccessFile(logFile, "rw"); channel = outputFile.getChannel(); // move to the end of the file channel.position(channel.size()); // add a newline and it's ready writeLine("").writeLine(""); writeLine("FixBpmPackagesPatch executing on " + new Date()); }
public OutputStream createDataStream() { tempDataFile = TempFileProvider.createTempFile("exportDataStream", ".xml"); try { tempDataFileStream = new FileOutputStream(tempDataFile); return tempDataFileStream; } catch (FileNotFoundException e) { throw new ExporterException("Failed to create data file stream", e); } }
/** * Get the Alfresco temp dir, by defaut %java.io.tempdir%/Alfresco. * Will create the temp dir on the fly if it does not already exist. * * @return Returns a temporary directory, i.e. <code>isDir == true</code> */ public static File getTempDir() { return getTempDir(ALFRESCO_TEMP_FILE_DIR); }
/** * test create a temporary file * * create another file with the same prefix and suffix. * @throws Exception */ public void testTempFile() throws Exception { File tempFile = TempFileProvider.createTempFile("AAAA", ".tmp"); File tempFileParent = tempFile.getParentFile(); File tempDir = TempFileProvider.getTempDir(); assertEquals("Temp file not located in our temp directory", tempDir, tempFileParent); /** * Create another temp file and then delete it. */ File tempFile2 = TempFileProvider.createTempFile("AAAA", ".tmp"); tempFile2.delete(); }
public FileExportHandle exportSystem(String packageName) { // create a temporary file to hold the system info export File systemTempDir = TempFileProvider.getSystemTempDir(); File tempFile = TempFileProvider.createTempFile("repoExpSystemInfo", ".xml", systemTempDir); try { OutputStream outputStream = new FileOutputStream(tempFile); systemExporterImporter.exportSystem(outputStream); } catch(FileNotFoundException e) { tempFile.delete(); throw new ExporterException("Failed to create temporary file for holding export of system info"); } // return handle onto temp file FileExportHandle handle = new FileExportHandle(); handle.storeRef = null; handle.packageName = packageName; handle.mimeType = MimetypeMap.MIMETYPE_XML; handle.exportFile = tempFile; return handle; } };
File tempDir = TempFileProvider.getLongLifeTempDir(FILE_DIRECTORY); File snapshotFile = TempFileProvider.createTempFile("TRX-SNAP", FILE_SUFFIX, tempDir); Writer snapshotWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(snapshotFile), "UTF-8"));
private File createFileOfSize(long sizeInKB) throws IOException { File file = new File(TempFileProvider.getSystemTempDir(), GUID.generate() + ".generated"); file.deleteOnExit(); BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(file)); for (long i = 0; i < sizeInKB; i++) { os.write(aKB); } os.close(); return file; }
private File createATempFileForTheDifferentMimeTypeTest(String outputFileExtension) { return TempFileProvider.createTempFile("DifferentMimeTypeTest-results-", "." + outputFileExtension); }
public void setup() { File tempDir = TempFileProvider.getTempDir(); this.tmp = new File(tempDir, "CMISAppend"); if(!this.tmp.exists() && !this.tmp.mkdir()) { throw new AlfrescoRuntimeException("Failed to create CMIS temporary directory"); } }