public Class<?> findClass(String className) { try { return getClassLoader().loadClass(className); } catch (Throwable t) { log.debug("Cannot load class '{}'", className, t); return null; } }
private IConfigurableResourceContext getConfigurationContext(IOpenLConfiguration extendsConfiguration, IUserContext ucxt) { ClassLoader parentLoader = extendsConfiguration == null ? OpenL.class.getClassLoader() : extendsConfiguration.getConfigurationContext().getClassLoader(); if (!inheritExtendedConfigurationLoader) { parentLoader = ucxt.getUserClassLoader(); } return new ConfigurableResourceContext(parentLoader, conf); }
public synchronized IOpenLBuilder getBuilder(String openlName, IUserContext ucxt) throws OpenConfigurationException { String userHome = ucxt.getUserHome(); String[] homes; try { String altHome = new File(userHome + "/../" + OPENL_ALT_CONFIG_ROOT).getCanonicalPath(); homes = new String[] { userHome, altHome }; } catch (Exception t) { homes = new String[] { userHome }; } ConfigurableResourceContext cxt = new ConfigurableResourceContext(ucxt.getUserClassLoader(), homes); PropertyFileLoader propertyLoader = new PropertyFileLoader(openlName + "." + OPENL_DEFAULT_PROPERTY_FILE_NAME, openlName + "." + OPENL_PROPERTY_FILE_PROPERTY, cxt, new PropertyFileLoader( OPENL_DEFAULT_PROPERTY_FILE_NAME, "org.openl." + OPENL_PROPERTY_FILE_PROPERTY, cxt, null)); Properties pp = propertyLoader.getProperties(); cxt.setProperties(pp); try { IOpenLBuilder builder = makeBuilder(openlName, cxt, ucxt); builder.setContexts(cxt, ucxt); return builder; } catch (Exception ex) { throw new OpenConfigurationException("Error creating builder: ", null, ex); } }
public IParsedCode parseAsModule(IOpenSourceCodeModule source) { String[] roots = {userContext.getUserHome()}; ClassLoader classLoader = userContext.getUserClassLoader(); IncludeSearcher includeSeeker = new IncludeSearcher(new ConfigurableResourceContext(classLoader, roots)); XlsLoader xlsLoader = new XlsLoader(includeSeeker); return xlsLoader.parse(source); }
public synchronized IOpenLBuilder getBuilder(String openlName, IUserContext ucxt) throws OpenConfigurationException { String userHome = ucxt.getUserHome(); String[] homes; try { String altHome = new File(userHome + "/../" + OPENL_ALT_CONFIG_ROOT).getCanonicalPath(); homes = new String[] { userHome, altHome }; } catch (Exception t) { homes = new String[] { userHome }; } ConfigurableResourceContext cxt = new ConfigurableResourceContext(ucxt.getUserClassLoader(), homes); PropertyFileLoader propertyLoader = new PropertyFileLoader(openlName + "." + OPENL_DEFAULT_PROPERTY_FILE_NAME, openlName + "." + OPENL_PROPERTY_FILE_PROPERTY, cxt, new PropertyFileLoader( OPENL_DEFAULT_PROPERTY_FILE_NAME, "org.openl." + OPENL_PROPERTY_FILE_PROPERTY, cxt, null)); Properties pp = propertyLoader.getProperties(); cxt.setProperties(pp); try { IOpenLBuilder builder = makeBuilder(openlName, cxt, ucxt); builder.setContexts(cxt, ucxt); return builder; } catch (Exception ex) { throw new OpenConfigurationException("Error creating builder: ", null, ex); } }
private IConfigurableResourceContext getConfigurationContext(IOpenLConfiguration extendsConfiguration, IUserContext ucxt) { ClassLoader parentLoader = extendsConfiguration == null ? OpenL.class.getClassLoader() : extendsConfiguration.getConfigurationContext().getClassLoader(); if (!inheritExtendedConfigurationLoader) { parentLoader = ucxt.getUserClassLoader(); } return new ConfigurableResourceContext(parentLoader, conf); }
public URL findClassPathResource(String url) { return getClassLoader().getResource(url); }
@Override public IParsedCode parseAsModule(IOpenSourceCodeModule source) { String[] roots = { userContext.getUserHome() }; ClassLoader classLoader = userContext.getUserClassLoader(); IncludeSearcher includeSeeker = new IncludeSearcher(new ConfigurableResourceContext(classLoader, roots)); return new SequentialXlsLoader(includeSeeker).parse(source); } }
public Class<?> findClass(String className) { try { return getClassLoader().loadClass(className); } catch (Throwable t) { log.debug("Cannot load class '{}'", className, t); return null; } }
IConfigurableResourceContext getConfigurationContext(IOpenLConfiguration extendsConfiguration) throws Exception { ClassLoader parentLoader = extendsConfiguration == null ? ClassLoaderFactory.getOpenlCoreLoader(null) : extendsConfiguration.getConfigurationContext().getClassLoader(); ClassLoader myClassLoader = parentLoader; if (classpath != null && classpath.trim().length() != 0) { String baseDir = getProject().getBaseDir().getCanonicalPath(); UserContext ucxt = new UserContext(null, baseDir); myClassLoader = ClassLoaderFactory.createUserClassloader(category, classpath, parentLoader, ucxt); } else { myClassLoader = AntOpenLBuilder.userCxt.top().getUserClassLoader(); } return new ConfigurableResourceContext(myClassLoader, conf); }
public URL findClassPathResource(String url) { return getClassLoader().getResource(url); }