/** * Configures web application from system classpath * @see #configure(java.io.File[]) */ public void configure() { configure(ClassLoaderUtil.getDefaultClasspath()); }
/** * Parses class name that matches madvoc-related names. */ @Override protected void onEntry(EntryData entryData) { String entryName = entryData.getName(); if (entryName.endsWith(actionClassSuffix) == true) { try { onActionClass(entryName); } catch (ClassNotFoundException cnfex) { throw new MadvocException("Unable to load Madvoc action class: " + entryName, cnfex); } } else if (entryName.endsWith(resultClassSuffix) == true) { try { onResultClass(entryName); } catch (ClassNotFoundException cnfex) { throw new MadvocException("Unable to load Madvoc result class: " + entryName, cnfex); } } }
/** * Configures web application from specified classpath. The whole process is done in the following steps: * <ol> * <li>scanning web application classpath</li> * <li>invoking external configurations, if exist</li> * <li>applying defaults</li> * </ol> * @see #configure() */ public void configure(File[] classpath) { elapsed = System.currentTimeMillis(); try { scanPaths(classpath); } catch (Exception ex) { throw new MadvocException("Unable to scan classpath.", ex); } elapsed = System.currentTimeMillis() - elapsed; log.info("Madvoc configured in " + elapsed + " ms. Total actions: " + actionsManager.getActionsCount()); }
/** * Loads {@link jodd.madvoc.config.MadvocConfigurator}. If class name is <code>null</code>, * {@link jodd.madvoc.config.AutomagicMadvocConfigurator} will be created. */ protected MadvocConfigurator loadMadvocConfig() { if ((madvocConfiguratorClassName != null) && (madvocConfiguratorClass != null)) { throw new MadvocException("Ambiguous MadvocConfigurator setting."); } if ((madvocConfiguratorClassName == null) && (madvocConfiguratorClass == null)) { log.info("Configuring Madvoc using default automagic configurator"); return new AutomagicMadvocConfigurator(); } MadvocConfigurator configurator; try { if (madvocConfiguratorClass == null) { madvocConfiguratorClass = ClassLoaderUtil.loadClass(madvocConfiguratorClassName); } configurator = (MadvocConfigurator) madvocConfiguratorClass.newInstance(); log.info("Configuring Madvoc using configurator: " + madvocConfiguratorClass.getName()); } catch (ClassNotFoundException cnfex) { throw new MadvocException("Madvoc configurator class not found: " + madvocConfiguratorClassName, cnfex); } catch (ClassCastException ccex) { throw new MadvocException("Class '" + madvocConfiguratorClass.getName() + "' is not a Madvoc configurator.", ccex); } catch (Exception ex) { throw new MadvocException("Unable to load Madvoc configurator class: " + ex.toString(), ex); } return configurator; }
Class<?> actionClass = ClassLoaderUtil.loadClass(className); if (checkClass(actionClass) == false) { return;