Esempio n. 1
0
 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);
   }
 }
Esempio n. 2
0
  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;
  }
  public void testQuery() throws Exception {
    JavaPlatform platform = JavaPlatform.getDefault();
    ClassPath cp = platform.getBootstrapLibraries();
    FileObject pfo = cp.getRoots()[0];
    URL u = URLMapper.findURL(pfo, URLMapper.EXTERNAL);
    URL urls[] = JavadocForBinaryQuery.findJavadoc(u).getRoots();
    assertEquals(1, urls.length);
    assertTrue(urls[0].toString(), urls[0].toString().startsWith("http://download.oracle.com/"));

    List<URL> l = new ArrayList<URL>();
    File javadocFile = getBaseDir();
    File api = new File(javadocFile, "api");
    File index = new File(api, "index-files");
    FileUtil.toFileObject(index);
    index.mkdirs();
    l.add(Utilities.toURI(javadocFile).toURL());
    J2SEPlatformImpl platformImpl = (J2SEPlatformImpl) platform;
    platformImpl.setJavadocFolders(l);
    urls = JavadocForBinaryQuery.findJavadoc(u).getRoots();
    assertEquals(1, urls.length);
    assertEquals(Utilities.toURI(api).toURL(), urls[0]);
  }
 /** 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;
 }