List of usage examples for weka.core WekaPackageManager PACKAGES_DIR
File PACKAGES_DIR
To view the source code for weka.core WekaPackageManager PACKAGES_DIR.
Click Source Link
From source file:adams.core.management.WekaPackagesClassPathAugmenter.java
License:Open Source License
/** * Returns the classpath parts (jars, directories) to add to the classpath. * /* w ww . jav a 2s. co m*/ * @return the additional classpath parts */ public synchronized String[] getClassPathAugmentation() { Environment env; String loadPackages; File[] contents; int i; Package toLoad; boolean load; m_Augmentations = new ArrayList<String>(); // load packages? env = Environment.getSystemWide(); loadPackages = env.getVariableValue("weka.core.loadPackages"); if (loadPackages != null && loadPackages.equalsIgnoreCase("false")) return new String[0]; // init packages WekaPackageManager.loadPackages(false); // try and load any jar files and add to the classpath contents = WekaPackageManager.PACKAGES_DIR.listFiles(); for (i = 0; i < contents.length; i++) { if (contents[i].isDirectory()) { try { toLoad = WekaPackageManager.getInstalledPackageInfo(contents[i].getName()); // Only perform the check against the current version of Weka if there exists // a Description.props file if (toLoad != null) { load = WekaPackageManager.loadCheck(toLoad, contents[i], System.err); if (load) loadPackageDirectory(contents[i]); } } catch (Exception ex) { ex.printStackTrace(); System.err.println("[WEKA] Problem loading package " + contents[i].getName() + " skipping..."); } } } return m_Augmentations.toArray(new String[m_Augmentations.size()]); }
From source file:distributed.spark.BaseSparkJobConfig.java
License:Open Source License
private void addWekaPackageLibrariesToContext(List<String> packageNames, JavaSparkContext context) { // first determine all the jars necessary File packagesDir = WekaPackageManager.PACKAGES_DIR; List<String> installLibraries = new ArrayList<String>(); for (String packageDir : packageNames) { // package dir File current = new File(packagesDir.toString() + File.separator + packageDir); if (current.exists() && current.isDirectory()) { File[] contents = current.listFiles(); if (contents != null) { for (File f : contents) { if (f.isFile() && f.toString().toLowerCase().endsWith(".jar")) { installLibraries.add(f.toString()); }//from ww w .j ava 2 s . c o m } } } // lib dir File libDir = new File(current.toString() + File.separator + "lib"); if (libDir.exists() && libDir.isDirectory()) { File[] libContents = libDir.listFiles(); if (libContents != null) { for (File f : libContents) { if (f.isFile() && f.toString().toLowerCase().endsWith(".jar")) { installLibraries.add(f.toString()); } } } } } for (String jar : installLibraries) { context.addJar(jar); } }