use of lucee.transformer.library.ClassDefinitionImpl in project Lucee by lucee.
the class Admin method doUpdateGatewayEntry.
private void doUpdateGatewayEntry() throws PageException {
String strStartupMode = getString("admin", action, "startupMode");
int startup = GatewayEntryImpl.toStartup(strStartupMode, -1);
if (startup == -1)
throw new ApplicationException("invalid startup mode [" + strStartupMode + "], valid values are [automatic,manual,disabled]");
// print.out("doUpdateGatewayEntry");
ClassDefinition cd = new ClassDefinitionImpl(getString("admin", action, "class"), getString("bundleName", null), getString("bundleVersion", null), config.getIdentification());
admin.updateGatewayEntry(getString("admin", action, "id"), cd, getString("admin", action, "cfcPath"), getString("admin", action, "listenerCfcPath"), startup, getStruct("admin", action, "custom"), getBoolV("readOnly", false));
store();
adminSync.broadcast(attributes, config);
}
use of lucee.transformer.library.ClassDefinitionImpl in project Lucee by lucee.
the class Admin method doUpdateCacheConnection.
private void doUpdateCacheConnection() throws PageException {
ClassDefinition cd = new ClassDefinitionImpl(getString("admin", action, "class"), getString("bundleName", null), getString("bundleVersion", null), config.getIdentification());
admin.updateCacheConnection(getString("admin", action, "name"), cd, toCacheConstant("default"), getStruct("admin", action, "custom"), getBoolV("readOnly", false), getBoolV("storage", false));
store();
adminSync.broadcast(attributes, config);
}
use of lucee.transformer.library.ClassDefinitionImpl in project Lucee by lucee.
the class XMLConfigWebFactory method loadResourceProvider.
private static void loadResourceProvider(ConfigServerImpl configServer, ConfigImpl config, Document doc) throws ClassException, BundleException {
boolean hasCS = configServer != null;
config.clearResourceProviders();
Element resources = getChildByName(doc.getDocumentElement(), "resources");
Element[] providers = getChildren(resources, "resource-provider");
Element[] defaultProviders = getChildren(resources, "default-resource-provider");
// Default Resource Provider
if (hasCS)
config.setDefaultResourceProvider(configServer.getDefaultResourceProvider());
if (defaultProviders != null && defaultProviders.length > 0) {
Element defaultProvider = defaultProviders[defaultProviders.length - 1];
ClassDefinition defProv = getClassDefinition(defaultProvider, "", config.getIdentification());
String strDefaultProviderComponent = getAttr(defaultProvider, "component");
if (StringUtil.isEmpty(strDefaultProviderComponent))
strDefaultProviderComponent = getAttr(defaultProvider, "class");
// class
if (defProv.hasClass()) {
config.setDefaultResourceProvider(defProv.getClazz(), toArguments(getAttr(defaultProvider, "arguments"), true));
} else // component
if (!StringUtil.isEmpty(strDefaultProviderComponent)) {
strDefaultProviderComponent = strDefaultProviderComponent.trim();
Map<String, String> args = toArguments(getAttr(defaultProvider, "arguments"), true);
args.put("component", strDefaultProviderComponent);
config.setDefaultResourceProvider(CFMLResourceProvider.class, args);
}
}
// Resource Provider
if (hasCS)
config.setResourceProviders(configServer.getResourceProviders());
if (providers != null && providers.length > 0) {
ClassDefinition prov;
String strProviderCFC;
String strProviderScheme;
ClassDefinition httpClass = null;
Map httpArgs = null;
boolean hasHTTPs = false;
for (int i = 0; i < providers.length; i++) {
try {
prov = getClassDefinition(providers[i], "", config.getIdentification());
strProviderCFC = getAttr(providers[i], "component");
if (StringUtil.isEmpty(strProviderCFC))
strProviderCFC = getAttr(providers[i], "class");
// lucee.commons.io.res.type.s3.S3ResourceProvider
if ("lucee.extension.io.resource.type.s3.S3ResourceProvider".equals(prov.getClassName()) || "lucee.commons.io.res.type.s3.S3ResourceProvider".equals(prov.getClassName()))
continue;
// prov=new ClassDefinitionImpl(S3ResourceProvider.class);
strProviderScheme = getAttr(providers[i], "scheme");
// class
if (prov.hasClass() && !StringUtil.isEmpty(strProviderScheme)) {
strProviderScheme = strProviderScheme.trim().toLowerCase();
config.addResourceProvider(strProviderScheme, prov, toArguments(getAttr(providers[i], "arguments"), true));
// patch for user not having
if (strProviderScheme.equalsIgnoreCase("http")) {
httpClass = prov;
httpArgs = toArguments(getAttr(providers[i], "arguments"), true);
} else if (strProviderScheme.equalsIgnoreCase("https"))
hasHTTPs = true;
} else // cfc
if (!StringUtil.isEmpty(strProviderCFC) && !StringUtil.isEmpty(strProviderScheme)) {
strProviderCFC = strProviderCFC.trim();
strProviderScheme = strProviderScheme.trim().toLowerCase();
Map<String, String> args = toArguments(getAttr(providers[i], "arguments"), true);
args.put("component", strProviderCFC);
config.addResourceProvider(strProviderScheme, CFMLResourceProvider.class, args);
}
} catch (Throwable t) {
// TODO log the exception
ExceptionUtil.rethrowIfNecessary(t);
}
}
// adding https when not exist
if (!hasHTTPs && httpClass != null) {
config.addResourceProvider("https", httpClass, httpArgs);
}
// we make sure we have the default on server level
if (!hasCS && !config.hasResourceProvider("s3")) {
ClassDefinition s3Class = new ClassDefinitionImpl(DummyS3ResourceProvider.class);
;
config.addResourceProvider("s3", s3Class, toArguments("lock-timeout:10000;", false));
}
}
}
use of lucee.transformer.library.ClassDefinitionImpl in project Lucee by lucee.
the class XMLConfigWebFactory method getClassDefinition.
private static ClassDefinition getClassDefinition(Element el, String prefix, Identification id) {
String cn = getAttr(el, prefix + "class");
String bn = getAttr(el, prefix + "bundle-name");
String bv = getAttr(el, prefix + "bundle-version");
// proxy jar libary no longer provided, so if still this class name is used ....
if ("com.microsoft.jdbc.sqlserver.SQLServerDriver".equals(cn)) {
cn = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
}
ClassDefinition cd = new ClassDefinitionImpl(cn, bn, bv, id);
// if(!StringUtil.isEmpty(cd.className,true))cd.getClazz();
return cd;
}
use of lucee.transformer.library.ClassDefinitionImpl in project Lucee by lucee.
the class DataSourceSupport method _initializeCD.
private static ClassDefinition _initializeCD(JDBCDriver jdbc, ClassDefinition cd, Config config) {
// try to link the class defintion with a jdbc driver defintion
if (!cd.isBundle()) {
if ("com.microsoft.jdbc.sqlserver.SQLServerDriver".equals(cd.getClassName())) {
cd = new ClassDefinitionImpl("com.microsoft.sqlserver.jdbc.SQLServerDriver", cd.getName(), cd.getVersionAsString(), null);
}
ConfigImpl ci = ((ConfigImpl) ThreadLocalPageContext.getConfig(config));
JDBCDriver tmp = jdbc != null ? ci.getJDBCDriverById(jdbc.cd.getId(), null) : null;
if (tmp == null)
tmp = ((ConfigImpl) config).getJDBCDriverByClassName(cd.getClassName(), null);
// we have a matching jdbc driver found
if (tmp != null) {
cd = tmp.cd;
}
}
return cd;
}
Aggregations