Java Code Examples for org.alfresco.util.TempFileProvider#getSystemTempDir()
The following examples show how to use
org.alfresco.util.TempFileProvider#getSystemTempDir() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RepositoryExporterComponent.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
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; }
Example 2
Source File: RepositoryExporterComponent.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
public FileExportHandle exportStore(ExporterCrawlerParameters exportParameters, String packageName, Exporter progress) { // create a temporary file to hold the acp export File systemTempDir = TempFileProvider.getSystemTempDir(); File tempFile = TempFileProvider.createTempFile("repoExp" + packageName, "." + ACPExportPackageHandler.ACP_EXTENSION, systemTempDir); // create acp export handler around the temp file File dataFile = new File(packageName); File contentDir = new File(packageName); try { OutputStream outputStream = new FileOutputStream(tempFile); ACPExportPackageHandler acpHandler = new ACPExportPackageHandler(outputStream, dataFile, contentDir, mimetypeService); // export the store exporterService.exportView(acpHandler, exportParameters, progress); } catch(FileNotFoundException e) { tempFile.delete(); throw new ExporterException("Failed to create temporary file for holding export of store " + exportParameters.getExportFrom().getStoreRef()); } // return handle onto temp file FileExportHandle handle = new FileExportHandle(); handle.storeRef = exportParameters.getExportFrom().getStoreRef(); handle.packageName = packageName; handle.mimeType = MimetypeMap.MIMETYPE_ACP; handle.exportFile = tempFile; return handle; }
Example 3
Source File: StandardQuotaStrategyTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
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; }