private LineBreakpointComparable(String url) { setURL(url); try { fo = URLMapper.findFileObject(new URL(getURL())); if (fo != null) { fo.addFileChangeListener(WeakListeners.create(FileChangeListener.class, this, fo)); } } catch (MalformedURLException ex) { ErrorManager.getDefault().notify(ex); } }
private ModeParser createModeParser(String path, String name) { URL url; url = ModeParserTest.class.getResource(path); assertNotNull("url not found.", url); FileObject parentFolder = URLMapper.findFileObject(url); assertNotNull("Test parent folder not found. ParentFolder is null.", url); Set setLocal = new HashSet(); ModeParser modeParser = new ModeParser(name, setLocal); modeParser.setInLocalFolder(true); modeParser.setLocalParentFolder(parentFolder); return modeParser; }
/** Returns a list of jdbc drivers that need to be deployed. */ private List<FileObject> jdbcDriversToDeploy(Set<Datasource> datasources) { List<FileObject> jdbcDriverFiles = new ArrayList<FileObject>(); Collection<File> driverCP = getJDBCDriverClasspath(); for (Datasource datasource : datasources) { String className = datasource.getDriverClassName(); boolean exists = false; try { exists = Util.containsClass(driverCP, className); } catch (IOException e) { LOGGER.log(Level.INFO, null, e); } if (!exists) { for (DatabaseConnection databaseConnection : DatasourceHelper.findDatabaseConnections(datasource)) { JDBCDriver[] jdbcDrivers; JDBCDriver connDriver = databaseConnection.getJDBCDriver(); if (connDriver != null) { jdbcDrivers = new JDBCDriver[] {connDriver}; } else { // old fashioned way - fallback String driverClass = databaseConnection.getDriverClass(); jdbcDrivers = JDBCDriverManager.getDefault().getDrivers(driverClass); } for (JDBCDriver jdbcDriver : jdbcDrivers) { for (URL url : jdbcDriver.getURLs()) { FileObject file = URLMapper.findFileObject(url); if (file != null) { jdbcDriverFiles.add(file); } } } } } } return jdbcDriverFiles; }