private UserContext getUserContext(ClassLoader cl) throws Exception { return new UserContext(cl, userHome); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("home=").append(userHome).append("cl=").append(printClassloader(userClassLoader)); return sb.toString(); }
public IUserContext getUserContext() { if (userContext == null) { synchronized (this) { if (userContext == null) { userContext = new UserContext(getDefaultUserClassLoader(), userHome); } } } return userContext; }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("home=").append(userHome).append("cl=").append(printClassloader(userClassLoader)); return sb.toString(); }
public IUserContext getUserContext() { if (userContext == null) { synchronized (this) { if (userContext == null) { userContext = new UserContext(getDefaultUserClassLoader(), userHome); } } } return userContext; }
protected synchronized IUserContext getUserContext() { if (userContext == null) { userContext = new UserContext(getProjectClassLoader(), getProjectHome()); } return userContext; }
/** * Gets instance of <code>OpenL</code> with given name. * * @param name OpenL name * @return instance of OpenL * @throws OpenConfigurationException */ //TODO: Do not use this method! Should be removed! public static synchronized OpenL getInstance(String name) throws OpenConfigurationException { return getInstance(name, new UserContext(config.getClassLoader(), DEFAULT_USER_HOME)); }
/** * Gets instance of <code>OpenL</code> with given name. * * @param name OpenL name * @return instance of OpenL * @throws OpenConfigurationException */ //TODO: Do not use this method! Should be removed! public static synchronized OpenL getInstance(String name) throws OpenConfigurationException { return getInstance(name, new UserContext(config.getClassLoader(), DEFAULT_USER_HOME)); }
private List<XlsTable> load(IOpenSourceCodeModule src) { UserContext ucxt = new UserContext(Thread.currentThread().getContextClassLoader(), "."); IParsedCode pc = new XlsParser(ucxt).parseAsModule(src); IBoundCode bc = new XlsBinder(ucxt).bind(pc); IOpenClass ioc = bc.getTopNode().getType(); XlsMetaInfo xmi = (XlsMetaInfo) ioc.getMetaInfo(); XlsModuleSyntaxNode xsn = xmi.getXlsModuleNode(); TableSyntaxNode[] nodes = xsn.getXlsTableSyntaxNodes(); List<XlsTable> tables = new ArrayList<>(nodes.length); for (TableSyntaxNode node : nodes) { tables.add(new XlsTable(node)); } return tables; }
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); }
private List<XlsTable> load(IOpenSourceCodeModule src) { final ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); SimpleBundleClassLoader bundleCl = null; try { bundleCl = new SimpleBundleClassLoader(oldCl); Thread.currentThread().setContextClassLoader(bundleCl); UserContext ucxt = new UserContext(bundleCl, "."); IParsedCode pc = new SequentialParser(ucxt).parseAsModule(src); IBoundCode bc = new XlsBinder(ucxt).bind(pc); IOpenClass ioc = bc.getTopNode().getType(); XlsMetaInfo xmi = (XlsMetaInfo) ioc.getMetaInfo(); XlsModuleSyntaxNode xsn = xmi.getXlsModuleNode(); TableSyntaxNode[] nodes = xsn.getXlsTableSyntaxNodes(); List<XlsTable> tables = new ArrayList<>(nodes.length); for (TableSyntaxNode node : nodes) { tables.add(new XlsTable(node)); } return tables; } finally { OpenClassUtil.releaseClassLoader(bundleCl); Thread.currentThread().setContextClassLoader(oldCl); } }
UserContext ucxt = new UserContext(bundleClassLoader, userHome); Thread.currentThread().setContextClassLoader(bundleClassLoader);
UserContext ucxt = new UserContext(bundleClassLoader, userHome); Thread.currentThread().setContextClassLoader(bundleClassLoader);