private IOpenLBuilder makeBuilder(String openl, IConfigurableResourceContext cxt, IUserContext ucxt) throws Exception { String builderClassPath = cxt.findProperty(openl + BUILDER_CLASS_PATH); if (builderClassPath == null) { builderClassPath = cxt.findProperty(DEFAULT_BUILDER_CLASS_PATH_PROPERTY); } ClassLoader ucl = ucxt.getUserClassLoader(); ClassLoader cl = OpenL.class.getClassLoader(); try { Class<?> c = ucl.loadClass(OpenL.class.getName()); if (c != null) { cl = ucl; } } catch (Exception ignored) { // Ignore } if (builderClassPath != null) { cl = ClassLoaderFactory.createClassLoader(builderClassPath, cl, ucxt.getUserHome()); } String builderClassName = cxt.findProperty(openl + BUILDER_CLASS); if (builderClassName == null) { builderClassName = cxt.findProperty(DEFAULT_BUILDER_CLASS_PROPERTY); } if (builderClassName == null) { builderClassName = openl + "." + OPENL_BUILDER; } return (IOpenLBuilder)ClassFactory.forName(builderClassName, cl).newInstance(); } }
private IOpenLBuilder makeBuilder(String openl, IConfigurableResourceContext cxt, IUserContext ucxt) throws Exception { String builderClassPath = cxt.findProperty(openl + BUILDER_CLASS_PATH); if (builderClassPath == null) { builderClassPath = cxt.findProperty(DEFAULT_BUILDER_CLASS_PATH_PROPERTY); } ClassLoader ucl = ucxt.getUserClassLoader(); ClassLoader cl = OpenL.class.getClassLoader(); try { Class<?> c = ucl.loadClass(OpenL.class.getName()); if (c != null) { cl = ucl; } } catch (Exception ignored) { // Ignore } if (builderClassPath != null) { cl = ClassLoaderFactory.createClassLoader(builderClassPath, cl, ucxt.getUserHome()); } String builderClassName = cxt.findProperty(openl + BUILDER_CLASS); if (builderClassName == null) { builderClassName = cxt.findProperty(DEFAULT_BUILDER_CLASS_PROPERTY); } if (builderClassName == null) { builderClassName = openl + "." + OPENL_BUILDER; } return (IOpenLBuilder)ClassFactory.forName(builderClassName, cl).newInstance(); } }
public String getProperty(String propertyName) { String res = getProperties().getProperty(propertyName); if (res != null) { return res; } res = getContext().findProperty(propertyName); if (res != null) { return res; } return parent == null ? null : parent.getProperty(propertyName); }
private ICompileContext buildCompileContext() { ICompileContext compileContext = new DefaultCompileContext(); IConfigurableResourceContext resourceContext = getResourceContext(); if (resourceContext != null) { String propertyValue = resourceContext.findProperty("validation"); if (propertyValue != null) { Boolean value = Boolean.valueOf(propertyValue); compileContext.setValidationEnabled(value); } } return compileContext; }
public String getProperty(String propertyName) { String res = getProperties().getProperty(propertyName); if (res != null) { return res; } res = getContext().findProperty(propertyName); if (res != null) { return res; } return parent == null ? null : parent.getProperty(propertyName); }
protected String getAntFile(String openl) { String name = getResourceContext().findProperty(openl + ".ant.build.file"); if (name != null) { File f = getResourceContext().findFileSystemResource(name); if (f != null) { return f.getAbsolutePath(); } throw new OpenConfigurationException("File " + name + " is not found ", null, null); } name = openl + ".build.xml"; if (name != null) { File f = getResourceContext().findFileSystemResource(name); if (f != null) { return f.getAbsolutePath(); } } name = getResourceContext().findProperty("org.openl.default.ant.build.file"); if (name != null) { File f = getResourceContext().findFileSystemResource(name); if (f != null) { return f.getAbsolutePath(); } throw new OpenConfigurationException("File " + name + " is not found ", null, null); } throw new OpenConfigurationException("Can not find Ant configuration file for " + openl, null, null); }
Properties getProperties() { if (properties != null) { return properties; } // check the propertiesFileProperty first String propertiesFileName = getContext().findProperty(propertiesFileProperty); if (propertiesFileName == null) { propertiesFileName = propertiesFileDefaultName; } // is it valid URL? Log.debug("Looking for " + propertiesFileName); if (!loadAsURL(propertiesFileName) && !loadAsResource(propertiesFileName) && !loadAsFile(propertiesFileName)) { properties = parent == null ? NO_PROPERTIES : parent.getProperties(); } return properties; }
Properties getProperties() { if (properties != null) { return properties; } // check the propertiesFileProperty first String propertiesFileName = getContext().findProperty(propertiesFileProperty); if (propertiesFileName == null) { propertiesFileName = propertiesFileDefaultName; } // is it valid URL? Log.debug("Looking for " + propertiesFileName); if (!loadAsURL(propertiesFileName) && !loadAsResource(propertiesFileName) && !loadAsFile(propertiesFileName)) { properties = parent == null ? NO_PROPERTIES : parent.getProperties(); } return properties; }