本文整理汇总了Java中org.alfresco.util.TempFileProvider.getTempDir方法的典型用法代码示例。如果您正苦于以下问题:Java TempFileProvider.getTempDir方法的具体用法?Java TempFileProvider.getTempDir怎么用?Java TempFileProvider.getTempDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.util.TempFileProvider
的用法示例。
在下文中一共展示了TempFileProvider.getTempDir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dumpSchema
import org.alfresco.util.TempFileProvider; //导入方法依赖的package包/类
/**
* Dumps the DB schema to temporary file(s), named similarly to:
* <pre>
* Alfresco-schema-DialectName-whenDumped-dbPrefix-23498732.xml
* </pre>
* Where the digits serve to create a unique temp file name. If whenDumped is empty or null,
* then the output is similar to:
* <pre>
* Alfresco-schema-DialectName-dbPrefix-23498732.xml
* </pre>
* If dbPrefixes is null, then the default list is used (see {@link MultiFileDumper#DEFAULT_PREFIXES})
* The dump files' paths are logged at info level.
*
* @param whenDumped String
* @param dbPrefixes Array of database object prefixes to filter by, e.g. "alf_"
* @return List of output files.
*/
private List<File> dumpSchema(String whenDumped, String[] dbPrefixes)
{
// Build a string to use as the file name template,
// e.g. "Alfresco-schema-MySQLDialect-pre-upgrade-{0}-"
StringBuilder sb = new StringBuilder(64);
sb.append("Alfresco-schema-").
append(dialect.getClass().getSimpleName());
if (whenDumped != null && whenDumped.length() > 0)
{
sb.append("-");
sb.append(whenDumped);
}
sb.append("-{0}-");
File outputDir = TempFileProvider.getTempDir();
String fileNameTemplate = sb.toString();
return dumpSchema(outputDir, fileNameTemplate, dbPrefixes);
}
示例2: extractToDir
import org.alfresco.util.TempFileProvider; //导入方法依赖的package包/类
private String extractToDir(String extension, String location)
{
File tmpDir = TempFileProvider.getTempDir();
try {
TFile zipFile = new TFile(this.getClass().getClassLoader().getResource(location).getPath());
TFile outDir = new TFile(tmpDir.getAbsolutePath()+"/moduleManagementToolTestDir"+System.currentTimeMillis());
outDir.mkdir();
zipFile.cp_rp(outDir);
TVFS.umount(zipFile);
return outDir.getPath();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
示例3: before
import org.alfresco.util.TempFileProvider; //导入方法依赖的package包/类
@Before
public void before() throws Exception
{
File tempDir = TempFileProvider.getTempDir();
// create a primary file store
String storeDir = tempDir.getAbsolutePath() + File.separatorChar + GUID.generate();
primaryStore = new FileContentStore(ctx, storeDir);
// create some secondary file stores
secondaryStores = new ArrayList<ContentStore>(3);
for (int i = 0; i < 4; i++)
{
storeDir = tempDir.getAbsolutePath() + File.separatorChar + GUID.generate();
FileContentStore store = new FileContentStore(ctx, storeDir);
secondaryStores.add(store);
}
// Create the aggregating store
aggregatingStore = new AggregatingContentStore();
aggregatingStore.setPrimaryStore(primaryStore);
aggregatingStore.setSecondaryStores(secondaryStores);
}
示例4: before
import org.alfresco.util.TempFileProvider; //导入方法依赖的package包/类
@Before
public void before() throws Exception
{
File tempDir = TempFileProvider.getTempDir();
// Create a subdirectory for A
File storeADir = new File(tempDir, "A");
storeA = new FileContentStore(ctx, storeADir);
// Create a subdirectory for B
File storeBDir = new File(tempDir, "B");
storeB = new FileContentStore(ctx, storeBDir);
// Create a subdirectory for C
File storeCDir = new File(tempDir, "C");
storeC = new DumbReadOnlyFileStore(new FileContentStore(ctx, storeCDir));
// No subdirectory for D
storeD = new SupportsNoUrlFormatStore();
// Create the routing store
routingStore = new RandomRoutingContentStore(storeA, storeB, storeC, storeD);
}
示例5: canVisitOldestDirsFirst
import org.alfresco.util.TempFileProvider; //导入方法依赖的package包/类
@Test
public void canVisitOldestDirsFirst()
{
File cacheRoot = new File(TempFileProvider.getTempDir(), GUID.generate());
cacheRoot.deleteOnExit();
contentCache.setCacheRoot(cacheRoot);
File f1 = tempfile(createDirs("2000/3/30/17/45/31"), "files-are-unsorted.bin");
File f2 = tempfile(createDirs("2000/3/4/17/45/31"), "another-file.bin");
File f3 = tempfile(createDirs("2010/12/24/23/59/58"), "a-second-before.bin");
File f4 = tempfile(createDirs("2010/12/24/23/59/59"), "last-one.bin");
File f5 = tempfile(createDirs("2000/1/7/2/7/12"), "first-one.bin");
// Check that directories and files are visited in correct order
FileHandler handler = Mockito.mock(FileHandler.class);
contentCache.processFiles(handler);
InOrder inOrder = Mockito.inOrder(handler);
inOrder.verify(handler).handle(f5);
inOrder.verify(handler).handle(f2);
inOrder.verify(handler).handle(f1);
inOrder.verify(handler).handle(f3);
inOrder.verify(handler).handle(f4);
}
示例6: before
import org.alfresco.util.TempFileProvider; //导入方法依赖的package包/类
@Before
public void before() throws Exception
{
// create a store that uses a subdirectory of the temp directory
File tempDir = TempFileProvider.getTempDir();
store = new FileContentStore(ctx,
tempDir.getAbsolutePath() +
File.separatorChar +
getName());
// Put some content into it
ContentWriter writer = store.getWriter(new ContentContext(null, null));
writer.putContent("Content for getExistingContentUrl");
this.contentUrl = writer.getContentUrl();
// disallow random access
store.setReadOnly(true);
}
示例7: setup
import org.alfresco.util.TempFileProvider; //导入方法依赖的package包/类
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");
}
}
示例8: before
import org.alfresco.util.TempFileProvider; //导入方法依赖的package包/类
@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);
}
示例9: willCreateNonExistentCacheRoot
import org.alfresco.util.TempFileProvider; //导入方法依赖的package包/类
@Test
public void willCreateNonExistentCacheRoot()
{
File cacheRoot = new File(TempFileProvider.getTempDir(), GUID.generate());
cacheRoot.deleteOnExit();
assertFalse("Pre-condition of test is that cacheRoot does not exist", cacheRoot.exists());
contentCache.setCacheRoot(cacheRoot);
assertTrue("cacheRoot should have been created", cacheRoot.exists());
}
示例10: before
import org.alfresco.util.TempFileProvider; //导入方法依赖的package包/类
@Before
public void before() throws Exception
{
// create a store that uses a subdirectory of the temp directory
File tempDir = TempFileProvider.getTempDir();
store = new FileContentStore(ctx,
tempDir.getAbsolutePath() +
File.separatorChar +
getName());
store.setDeleteEmptyDirs(true);
// Do not need super class's transactions
}
示例11: before
import org.alfresco.util.TempFileProvider; //导入方法依赖的package包/类
@Before
public void before() throws Exception
{
// create a store that uses a subdirectory of the temp directory
File tempDir = TempFileProvider.getTempDir();
store = new FileContentStore(ctx,
tempDir.getAbsolutePath() +
File.separatorChar +
getName());
// disallow random access
store.setAllowRandomAccess(false);
}
示例12: setUp
import org.alfresco.util.TempFileProvider; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception
{
ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
transactionService = serviceRegistry.getTransactionService();
txnHelper = transactionService.getRetryingTransactionHelper();
contentDataDAO = (ContentDataDAO) ctx.getBean("contentDataDAO");
contentStore = new FileContentStore(ctx, TempFileProvider.getTempDir());
}
示例13: execute
import org.alfresco.util.TempFileProvider; //导入方法依赖的package包/类
@Test
public void execute()
{
ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
File outFile = new File(TempFileProvider.getTempDir(), getClass().getSimpleName() + ".xml");
System.out.println("Writing to temp file: " + outFile);
DbToXML dbToXML = new DbToXML(ctx, outFile);
dbToXML.execute();
}
示例14: canDumpSchemaToFiles
import org.alfresco.util.TempFileProvider; //导入方法依赖的package包/类
@Test
public void canDumpSchemaToFiles()
{
String[] prefixes = new String[] { "a_", "b_", "c_" };
File directory = TempFileProvider.getTempDir();
String fileNamePattern = "SchemaDump-MySQL-{0}-";
MultiFileDumper dumper = new MultiFileDumper(prefixes, directory, fileNamePattern, dbToXMLFactory, null);
when(dbToXMLFactory.create(argThat(isFileNameStartingWith("SchemaDump-MySQL-a_-")), eq("a_"))).
thenReturn(dbToXMLForA);
when(dbToXMLFactory.create(argThat(isFileNameStartingWith("SchemaDump-MySQL-b_-")), eq("b_"))).
thenReturn(dbToXMLForB);
when(dbToXMLFactory.create(argThat(isFileNameStartingWith("SchemaDump-MySQL-c_-")), eq("c_"))).
thenReturn(dbToXMLForC);
List<File> files = dumper.dumpFiles();
Iterator<File> it = files.iterator();
assertPathCorrect("SchemaDump-MySQL-a_-", directory, it.next());
assertPathCorrect("SchemaDump-MySQL-b_-", directory, it.next());
assertPathCorrect("SchemaDump-MySQL-c_-", directory, it.next());
verify(dbToXMLForA).execute();
verify(dbToXMLForB).execute();
verify(dbToXMLForC).execute();
}
示例15: setUp
import org.alfresco.util.TempFileProvider; //导入方法依赖的package包/类
public void setUp() throws Exception
{
ctx = ApplicationContextHelper.getApplicationContext(CONFIG_LOCATIONS);
File tempDir = new File(TempFileProvider.getTempDir(), GUID.generate());
this.streamFactory = TempStoreOutputStreamFactory.newInstance(tempDir, 1024, 1024, false);
this.eventPublisher = (EventPublisherForTestingOnly) ctx.getBean("eventPublisher");
}