本文整理汇总了Java中org.openide.modules.Places.getCacheDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java Places.getCacheDirectory方法的具体用法?Java Places.getCacheDirectory怎么用?Java Places.getCacheDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.modules.Places
的用法示例。
在下文中一共展示了Places.getCacheDirectory方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.openide.modules.Places; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
cacheDir = new File(Places.getCacheDirectory(), PlatformLayersCacheManager.CACHE_PATH);
assertFalse("Cache not yet saved", cacheDir.isDirectory());
plaf = NbPlatform.getDefaultPlatform();
jarNames = new HashSet<String>();
Collections.addAll(jarNames, "org-netbeans-modules-apisupport-project.jar",
"org-netbeans-core-windows.jar",
"org-openide-filesystems.jar", // not in "modules" dir, but has layer.xml
"org-openide-util.jar"); // doesn't have layer.xml
clusters = plaf.getDestDir().listFiles(new FileFilter() {
public boolean accept(File pathname) {
return (pathname.getName().startsWith("platform")
|| pathname.getName().startsWith("apisupport"))
&& ClusterUtils.isValidCluster(pathname);
}
});
PlatformLayersCacheManager.reset();
}
示例2: findProject
import org.openide.modules.Places; //导入方法依赖的package包/类
private static Project findProject(Lookup context) {
Project prj = context.lookup(Project.class);
if (prj == null) {
FileObject f = context.lookup(FileObject.class);
if (f != null) {
File cache = Places.getCacheDirectory();
FileObject cacheFO = FileUtil.toFileObject(cache);
prj = FileOwnerQuery.getOwner(f);
if (cacheFO != null && prj != null) {
if (FileUtil.isParentOf(prj.getProjectDirectory(), cacheFO)) {
prj = null;
}
}
}
}
return prj;
}
示例3: fileImpl
import org.openide.modules.Places; //导入方法依赖的package包/类
private static File fileImpl(String cache, int[] len, long moduleJARs) {
File cacheFile = new File(Places.getCacheDirectory(), cache);
long last = cacheFile.lastModified();
if (last <= 0) {
LOG.log(Level.FINE, "Cache does not exist when asking for {0}", cache); // NOI18N
cacheFile = findFallbackCache(cache);
if (cacheFile == null || (last = cacheFile.lastModified()) <= 0) {
return null;
}
LOG.log(Level.FINE, "Found fallback cache at {0}", cacheFile);
}
if (moduleJARs > last) {
LOG.log(Level.FINE, "Timestamp does not pass when asking for {0}. Newest file {1}", new Object[] { cache, moduleNewestFile }); // NOI18N
return null;
}
long longLen = cacheFile.length();
if (longLen > Integer.MAX_VALUE) {
LOG.log(Level.WARNING, "Cache file is too big: {0} bytes for {1}", new Object[]{longLen, cacheFile}); // NOI18N
return null;
}
if (len != null) {
len[0] = (int)longLen;
}
LOG.log(Level.FINE, "Cache found: {0}", cache); // NOI18N
return cacheFile;
}
示例4: testRememberCacheDir
import org.openide.modules.Places; //导入方法依赖的package包/类
public void testRememberCacheDir() {
File cacheDir = Places.getCacheDirectory();
assertTrue("It is a directory", cacheDir.isDirectory());
System.setProperty("mycache", cacheDir.getPath());
File boot = InstalledFileLocator.getDefault().locate("lib/boot.jar", "org.netbeans.bootstrap", false);
assertNotNull("Boot.jar found", boot);
System.setProperty("myinstall", boot.getParentFile().getParentFile().getParentFile().getPath());
}
示例5: getDummyFilePath
import org.openide.modules.Places; //导入方法依赖的package包/类
private static String getDummyFilePath() {
File cache = Places.getCacheDirectory();
String path = "dummy.png";
if (cache != null && cache.exists()) {
File f = new File(cache, path);
path = f.getAbsolutePath();
}
return path;
}
示例6: existsDefaultIndexLocation
import org.openide.modules.Places; //导入方法依赖的package包/类
private boolean existsDefaultIndexLocation() {
File cacheDir = new File(Places.getCacheDirectory(), "mavenindex");//NOI18N
return cacheDir.exists() && cacheDir.isDirectory();
}
示例7: scan
import org.openide.modules.Places; //导入方法依赖的package包/类
/**
* Uses {@link Scanner} to scan repository content. A {@link ArtifactScanningListener} is used to process found
* artifacts and to add them to the index using
* {@link NexusIndexer#artifactDiscovered(ArtifactContext, IndexingContext)}.
*
* @see DefaultScannerListener
* @see #artifactDiscovered(ArtifactContext, IndexingContext)
*/
private void scan( final IndexingContext context, final String fromPath, final ArtifactScanningListener listener,
final boolean update )
throws IOException
{
final File repositoryDirectory = context.getRepository();
if ( repositoryDirectory == null )
{
// nothing to scan
return;
}
if ( !repositoryDirectory.exists() )
{
throw new IOException( "Repository directory " + repositoryDirectory + " does not exist" );
}
// always use cache directory when reindexing
final File tmpDir = new File(Places.getCacheDirectory(), "tmp-" + context.getRepositoryId());
if ( !tmpDir.mkdirs() )
{
throw new IOException( "Cannot create temporary directory: " + tmpDir );
}
final File tmpFile = new File(tmpDir, context.getId() + "-tmp");
IndexingContext tmpContext = null;
try
{
final FSDirectory directory = FSDirectory.open( tmpDir.toPath() );
if ( update )
{
IndexUtils.copyDirectory( context.getIndexDirectory(), directory );
}
tmpContext = new DefaultIndexingContext( context.getId() + "-tmp", //
context.getRepositoryId(), //
context.getRepository(), //
directory, //
context.getRepositoryUrl(), //
context.getIndexUpdateUrl(), //
context.getIndexCreators(), //
true );
scanner.scan( new ScanningRequest( tmpContext, //
new DefaultScannerListener( tmpContext, embedder.lookup(IndexerEngine.class),
update, listener ), fromPath ) );
tmpContext.updateTimestamp( true );
context.replace( tmpContext.getIndexDirectory() );
}
catch ( Exception ex )
{
throw new IOException("Error scanning context " + context.getId() + ": " + ex, ex);
}
finally
{
if ( tmpContext != null )
{
tmpContext.close( true );
}
if ( tmpFile.exists() )
{
tmpFile.delete();
}
FileUtils.deleteDirectory( tmpDir );
}
}