/** * Initializes generic object editor properties * * @return a properties object * @throws Exception if a problem occurs */ protected Properties initGOEProps() throws Exception { Properties GOEProps = GenericPropertiesCreator.getGlobalOutputProperties(); if (GOEProps == null) { GenericPropertiesCreator creator = new GenericPropertiesCreator(); if (creator.useDynamic()) { creator.execute(false); GOEProps = creator.getOutputProperties(); } else { GOEProps = Utils.readProperties("weka/gui/GenericObjectEditor.props"); } } return GOEProps; }
/** * generates the props-file for the GenericObjectEditor and stores it only if * the the param <code>store</code> is TRUE. If it is FALSE then the generated * properties file can be retrieved via the <code>getOutputProperties</code> * method. * * @param store if TRUE then the properties file is stored to the stored * filename * @param loadInputProps true if the input properties should be loaded * @throws Exception if something goes wrong * @see #getOutputFilename() * @see #setOutputFilename(String) * @see #getOutputProperties() */ public void execute(boolean store, boolean loadInputProps) throws Exception { // read properties file if (loadInputProps) { loadInputProperties(); } // generate the props file generateOutputProperties(); // write properties file if (store) { storeOutputProperties(); } }
/** * Regenerate the global output properties. Does not load the input * properties, instead uses the GLOBAL_INPUT_PROPERTIES */ public static void regenerateGlobalOutputProperties() { if (GLOBAL_CREATOR != null) { try { GLOBAL_CREATOR.execute(false, false); GLOBAL_INPUT_PROPERTIES = GLOBAL_CREATOR.getInputProperties(); GLOBAL_OUTPUT_PROPERTIES = GLOBAL_CREATOR.getOutputProperties(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
gpc = new GenericPropertiesCreator(); gpc.execute(false); classes = gpc.getOutputProperties().getProperty(property); tok = new StringTokenizer(classes, ",");
c = new GenericPropertiesCreator(); } else if (args.length == 1) { c = new GenericPropertiesCreator(); c.setOutputFilename(args[0]); } else if (args.length == 2) { c = new GenericPropertiesCreator(args[0]); c.setOutputFilename(args[1]); } else { System.out.println("usage: " + GenericPropertiesCreator.class.getName() c.execute(true);
creator = new GenericPropertiesCreator(); creator.execute(false); props = creator.getInputProperties(); tok = new StringTokenizer(props.getProperty(m_Superclass), ","); m_Packages = new Vector<String>();
/** * generates the props-file for the GenericObjectEditor and stores it * * @throws Exception if something goes wrong * @see #execute(boolean) */ public void execute() throws Exception { execute(true, true); }
/** * gets whether the dynamic approach should be used or not * * @return true if the dynamic approach is to be used */ public boolean useDynamic() { if (getInputProperties() == null) { loadInputProperties(); } // check our classloader against the system one - if different then // return false (as dynamic classloading only works for classes discoverable // in the system classpath /* * if * (!ClassLoader.getSystemClassLoader().equals(this.getClass().getClassLoader * ())) { if * (Boolean.parseBoolean(getInputProperties().getProperty(USE_DYNAMIC, * "true")) == true) { System.out.println( * "[GenericPropertiesCreator] classloader in use is not the system " + * "classloader: using static entries in weka/gui/GenericObjectEditor.props rather " * + "than dynamic class discovery."); } return false; } */ return Boolean.parseBoolean(getInputProperties().getProperty(USE_DYNAMIC, "true")); }
System.out.println("Loading '" + getInputFilename() + "'..."); File f = new File(getInputFilename()); if (getExplicitPropsFile() && f.exists()) { m_InputProperties.load(new FileInputStream(getInputFilename())); } else { m_InputProperties = Utils.readProperties(getInputFilename());
/** * stores the generated output properties file * * @throws Exception if the saving fails * @see #m_OutputProperties * @see #m_OutputFilename */ protected void storeOutputProperties() throws Exception { if (VERBOSE) { System.out.println("Saving '" + getOutputFilename() + "'..."); } m_OutputProperties .store( new FileOutputStream(getOutputFilename()), " Customises the list of options given by the GenericObjectEditor\n# for various superclasses."); }
bi = null; Properties GPCInputProps = GenericPropertiesCreator.getGlobalInputProperties();
gpc = new GenericPropertiesCreator(); gpc.execute(false); classes = gpc.getOutputProperties().getProperty(property); tok = new StringTokenizer(classes, ",");
c = new GenericPropertiesCreator(); } else if (args.length == 1) { c = new GenericPropertiesCreator(); c.setOutputFilename(args[0]); } else if (args.length == 2) { c = new GenericPropertiesCreator(args[0]); c.setOutputFilename(args[1]); } else { System.out.println("usage: " + GenericPropertiesCreator.class.getName() c.execute(true);
creator = new GenericPropertiesCreator(); creator.execute(false); props = creator.getInputProperties(); tok = new StringTokenizer(props.getProperty(m_Superclass), ","); m_Packages = new Vector<String>();
/** * generates the props-file for the GenericObjectEditor * * @param store true if the generated props should be stored * @throws Exception */ public void execute(boolean store) throws Exception { execute(store, true); }
/** * gets whether the dynamic approach should be used or not * * @return true if the dynamic approach is to be used */ public boolean useDynamic() { if (getInputProperties() == null) { loadInputProperties(); } // check our classloader against the system one - if different then // return false (as dynamic classloading only works for classes discoverable // in the system classpath /* * if * (!ClassLoader.getSystemClassLoader().equals(this.getClass().getClassLoader * ())) { if * (Boolean.parseBoolean(getInputProperties().getProperty(USE_DYNAMIC, * "true")) == true) { System.out.println( * "[GenericPropertiesCreator] classloader in use is not the system " + * "classloader: using static entries in weka/gui/GenericObjectEditor.props rather " * + "than dynamic class discovery."); } return false; } */ return Boolean.parseBoolean(getInputProperties().getProperty(USE_DYNAMIC, "true")); }
System.out.println("Loading '" + getInputFilename() + "'..."); File f = new File(getInputFilename()); if (getExplicitPropsFile() && f.exists()) { m_InputProperties.load(new FileInputStream(getInputFilename())); } else { m_InputProperties = Utils.readProperties(getInputFilename());
/** * stores the generated output properties file * * @throws Exception if the saving fails * @see #m_OutputProperties * @see #m_OutputFilename */ protected void storeOutputProperties() throws Exception { if (VERBOSE) { System.out.println("Saving '" + getOutputFilename() + "'..."); } m_OutputProperties .store( new FileOutputStream(getOutputFilename()), " Customises the list of options given by the GenericObjectEditor\n# for various superclasses."); }
bi = null; Properties GPCInputProps = GenericPropertiesCreator.getGlobalInputProperties();
/** * Initializes generic object editor properties * * @return a properties object * @throws Exception if a problem occurs */ protected Properties initGOEProps() throws Exception { Properties GOEProps = GenericPropertiesCreator.getGlobalOutputProperties(); if (GOEProps == null) { GenericPropertiesCreator creator = new GenericPropertiesCreator(); if (creator.useDynamic()) { creator.execute(false); GOEProps = creator.getOutputProperties(); } else { GOEProps = Utils.readProperties("weka/gui/GenericObjectEditor.props"); } } return GOEProps; }