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 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); } }