private void initProviders() { if (dbFolder != null) { File dbDir = NbClassPath.toFile(dbFolder); if (dbDir != null) { String[] names = dbDir.list( new FilenameFilter() { public boolean accept(File dir, String name) { return name.endsWith(PROVIDER_FILE_EXT); } }); for (int i = 0; i < names.length; i++) { String name = names[i].substring(0, names[i].length() - PROVIDER_FILE_EXT.length()); String prefix = dbDir.getAbsolutePath() + File.separator + name; JCClassProvider provider = new JCFileProvider(prefix); JCStorageElement e = getElement(name); if (e != null) { e.setProvider(provider); } else { e = new JCStorageElement(name); e.setProvider(provider); addElement(e); } } } } }
public void checkProvider(JCStorageElement e) { if (e.getProvider() == null && dbFolder != null) { File dbDir = NbClassPath.toFile(dbFolder); if (dbDir != null) { JCClassProvider cp = new JCFileProvider(new File(dbDir, e.getName()).getAbsolutePath()); cp.reset(); e.setProvider(cp); } } }
private File getStorageFile() { File storage = null; if (dbFolder != null) { FileObject storageFO = dbFolder.getFileObject(STORAGE, STORAGE_EXT); try { if (storageFO == null) { storageFO = dbFolder.createData(STORAGE, STORAGE_EXT); } } catch (IOException e) { } if (storageFO != null) { storage = NbClassPath.toFile(storageFO); } } return storage; }