Package org.xmlvm.util.analytics.data

Examples of org.xmlvm.util.analytics.data.Dependencies$MethodDeps


    }
    fillGoodBadOverrides();
    String libraryPath= args[0];

    // Get a complete dependency map.
    Dependencies dependencies= loadDepencencies(libraryPath);

    writeDepsToGraphFile(dependencies);

    // Note(Sascha): The analysis showed, that in the JDK there are not a
    // lot of red/green mixed hierarchies. So for now, we skip this part.
View Full Code Here


    return false;
  }

  private static Dependencies loadDepencencies(String jdkFileName)
  {
    Dependencies dependencies= new Dependencies();

    // This is a shortcut, in case we already have the analytical data about
    // the dependencies loaded and stored on the file system. If so, we use
    // this data.
    File resultsFile= new File(RESULTS_FILENAME);
    if (resultsFile.exists())
    {
      Log.debug(TAG, "Loading results from " + RESULTS_FILENAME + " ...");
      ObjectInputStream ois;
      try
      {
        ois= new ObjectInputStream(new FileInputStream(resultsFile));
        dependencies= (Dependencies) ois.readObject();
        ois.close();
        Log.debug(TAG, "Loaded results from file: " + dependencies.size());
      }
      catch (FileNotFoundException e)
      {
        e.printStackTrace();
        return null;
      }
      catch (IOException e)
      {
        e.printStackTrace();
        return null;
      }
      catch (ClassNotFoundException e)
      {
        e.printStackTrace();
        return null;
      }
    }
    else
    {
      // If there is no stored result, we nee to analyze the classes
      // first.
      // First the class files are loaded.
      UniversalFile library= UniversalFileCreator.createDirectory(null, jdkFileName);
      UniversalFile[] classes= library.listFilesRecursively(new UniversalFileFilter()
      {

        public boolean accept(UniversalFile file)
        {
          return file.getName().toLowerCase().endsWith(".class");
        }
      });
      Log.debug(TAG, "Analyzing " + classes.length + " classes.");
      final String basePath= library.getAbsolutePath();

      // We go through all the class files and get their dependencies.
      for (UniversalFile clazz : classes)
      {
        String fileName= clazz.getRelativePath(basePath).replace('\\', '.');
        Dependencies.ClassDeps classDeps= dependencies.getDepsForClass(fileName.substring(0, fileName.length() - 6).replace(File.separatorChar, '.'));
        getAllDependencies(clazz.getFileAsBytes(), fileName, classDeps);
      }

      // Store results on disk so we save time when executing this a
      // second time.
View Full Code Here

TOP

Related Classes of org.xmlvm.util.analytics.data.Dependencies$MethodDeps

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.