Search in sources :

Example 1 with Info

use of lucee.Info in project Lucee by lucee.

the class RHExtension method readManifestConfig.

private void readManifestConfig(Manifest manifest, String label, String _img) throws ApplicationException {
    boolean isWeb = config instanceof ConfigWeb;
    type = isWeb ? "web" : "server";
    Log logger = ((ConfigImpl) config).getLog("deploy");
    Info info = ConfigWebUtil.getEngine(config).getInfo();
    Attributes attr = manifest.getMainAttributes();
    readName(label, StringUtil.unwrap(attr.getValue("name")));
    label = name;
    readVersion(label, StringUtil.unwrap(attr.getValue("version")));
    label += " : " + version;
    readId(label, StringUtil.unwrap(attr.getValue("id")));
    readReleaseType(label, StringUtil.unwrap(attr.getValue("release-type")), isWeb);
    description = StringUtil.unwrap(attr.getValue("description"));
    trial = Caster.toBooleanValue(StringUtil.unwrap(attr.getValue("trial")), false);
    if (_img == null)
        _img = StringUtil.unwrap(attr.getValue("image"));
    image = _img;
    String cat = StringUtil.unwrap(attr.getValue("category"));
    if (StringUtil.isEmpty(cat, true))
        cat = StringUtil.unwrap(attr.getValue("categories"));
    readCategories(label, cat);
    readCoreVersion(label, StringUtil.unwrap(attr.getValue("lucee-core-version")), info);
    readLoaderVersion(label, StringUtil.unwrap(attr.getValue("lucee-loader-version")));
    startBundles = Caster.toBooleanValue(StringUtil.unwrap(attr.getValue("start-bundles")), true);
    readAMF(label, StringUtil.unwrap(attr.getValue("amf")), logger);
    readResource(label, StringUtil.unwrap(attr.getValue("resource")), logger);
    readSearch(label, StringUtil.unwrap(attr.getValue("search")), logger);
    readORM(label, StringUtil.unwrap(attr.getValue("orm")), logger);
    readMonitor(label, StringUtil.unwrap(attr.getValue("monitor")), logger);
    readCache(label, StringUtil.unwrap(attr.getValue("cache")), logger);
    readCacheHandler(label, StringUtil.unwrap(attr.getValue("cache-handler")), logger);
    readJDBC(label, StringUtil.unwrap(attr.getValue("jdbc")), logger);
    readMapping(label, StringUtil.unwrap(attr.getValue("mapping")), logger);
    readEventGatewayInstances(label, StringUtil.unwrap(attr.getValue("event-gateway-instance")), logger);
}
Also used : Log(lucee.commons.io.log.Log) Attributes(java.util.jar.Attributes) Info(lucee.Info) BundleInfo(lucee.runtime.osgi.BundleInfo) ConfigWeb(lucee.runtime.config.ConfigWeb) ConfigImpl(lucee.runtime.config.ConfigImpl)

Example 2 with Info

use of lucee.Info in project Lucee by lucee.

the class ServerImpl method reload.

public void reload(PageContext pc, Boolean jsr223) {
    Info info = pc.getConfig().getFactory().getEngine().getInfo();
    ReadOnlyStruct coldfusion = new ReadOnlyStruct();
    coldfusion.setEL(PRODUCT_LEVEL, info.getLevel());
    // coldfusion.setEL(PRODUCT_VERSION,"11,0,07,296330");
    coldfusion.setEL(PRODUCT_VERSION, "2016,0,03,300357");
    coldfusion.setEL(SERIAL_NUMBER, "0");
    coldfusion.setEL(PRODUCT_NAME, "Lucee");
    // TODO scope server missing values
    // Jrun
    coldfusion.setEL(KeyConstants._appserver, "");
    // 
    coldfusion.setEL(EXPIRATION, expired);
    // 
    coldfusion.setEL(INSTALL_KIT, "");
    String rootdir = "";
    try {
        rootdir = ThreadLocalPageContext.getConfig(pc).getRootDirectory().getAbsolutePath();
    } catch (Throwable t) {
        ExceptionUtil.rethrowIfNecessary(t);
    }
    // 
    coldfusion.setEL(ROOT_DIR, rootdir);
    // 
    coldfusion.setEL(SUPPORTED_LOCALES, LocaleFactory.getLocaleList());
    coldfusion.setReadOnly(true);
    super.setEL(KeyConstants._coldfusion, coldfusion);
    ReadOnlyStruct os = new ReadOnlyStruct();
    os.setEL(KeyConstants._name, System.getProperty("os.name"));
    os.setEL(ARCH, System.getProperty("os.arch"));
    os.setEL(MAC_ADDRESS, SystemUtil.getMacAddressAsWrap());
    int arch = SystemUtil.getOSArch();
    if (arch != SystemUtil.ARCH_UNKNOW)
        os.setEL(ARCH_MODEL, new Double(arch));
    os.setEL(KeyConstants._version, System.getProperty("os.version"));
    os.setEL(ADDITIONAL_INFORMATION, "");
    os.setEL(BUILD_NUMBER, "");
    os.setEL(HOST_NAME, SystemUtil.getLocalHostName());
    os.setReadOnly(true);
    super.setEL(KeyConstants._os, os);
    ReadOnlyStruct lucee = new ReadOnlyStruct();
    lucee.setEL(KeyConstants._version, info.getVersion().toString());
    lucee.setEL(VERSION_NAME, info.getVersionName());
    lucee.setEL(VERSION_NAME_EXPLANATION, info.getVersionNameExplanation());
    lucee.setEL(KeyConstants._state, getStateAsString(info.getVersion()));
    lucee.setEL(RELEASE_DATE, new DateTimeImpl(info.getRealeaseTime(), false));
    lucee.setEL(LOADER_VERSION, Caster.toDouble(SystemUtil.getLoaderVersion()));
    lucee.setEL(LOADER_PATH, ClassUtil.getSourcePathForClass("lucee.loader.servlet.CFMLServlet", ""));
    lucee.setEL(ENVIRONMENT, jsr223 != null && jsr223.booleanValue() ? "jsr223" : "servlet");
    lucee.setReadOnly(true);
    super.setEL(KeyConstants._lucee, lucee);
    ReadOnlyStruct separator = new ReadOnlyStruct();
    separator.setEL(KeyConstants._path, System.getProperty("path.separator"));
    separator.setEL(KeyConstants._file, System.getProperty("file.separator"));
    separator.setEL(KeyConstants._line, System.getProperty("line.separator"));
    separator.setReadOnly(true);
    super.setEL(KeyConstants._separator, separator);
    ReadOnlyStruct java = new ReadOnlyStruct();
    java.setEL(KeyConstants._version, System.getProperty("java.version"));
    java.setEL(VENDOR, System.getProperty("java.vendor"));
    arch = SystemUtil.getJREArch();
    if (arch != SystemUtil.ARCH_UNKNOW)
        java.setEL(ARCH_MODEL, new Double(arch));
    Runtime rt = Runtime.getRuntime();
    java.setEL(FREE_MEMORY, new Double(rt.freeMemory()));
    java.setEL(TOTAL_MEMORY, new Double(rt.totalMemory()));
    java.setEL(MAX_MEMORY, new Double(rt.maxMemory()));
    java.setEL(JAVA_AGENT_SUPPORTED, Boolean.TRUE);
    if (jep == null) {
        String temp = System.getProperty("user.dir", "");
        if (!StringUtil.isEmpty(temp) && !temp.endsWith(File.separator))
            temp = temp + File.separator;
        jep = temp;
    }
    java.setEL(JAVA_EXECUTION_PATH, jep);
    java.setReadOnly(true);
    super.setEL(KeyConstants._java, java);
    ReadOnlyStruct servlet = new ReadOnlyStruct();
    String name = "";
    try {
        name = pc.getServletContext().getServerInfo();
    } catch (Throwable t) {
        ExceptionUtil.rethrowIfNecessary(t);
    }
    servlet.setEL(KeyConstants._name, name);
    servlet.setReadOnly(true);
    super.setEL(KeyConstants._servlet, servlet);
    ReadOnlyStruct system = new ReadOnlyStruct();
    system.setEL(KeyConstants._properties, SystemPropStruct.getInstance());
    system.setEL(KeyConstants._environment, EnvStruct.getInstance());
    system.setReadOnly(true);
    super.setEL(KeyConstants._system, system);
}
Also used : ReadOnlyStruct(lucee.runtime.type.ReadOnlyStruct) DateTimeImpl(lucee.runtime.type.dt.DateTimeImpl) Info(lucee.Info)

Example 3 with Info

use of lucee.Info in project Lucee by lucee.

the class RHExtension method readManifestConfig.

private void readManifestConfig(Element el, String label, String _img) throws ApplicationException {
    boolean isWeb = config instanceof ConfigWeb;
    type = isWeb ? "web" : "server";
    Log logger = ((ConfigImpl) config).getLog("deploy");
    Info info = ConfigWebUtil.getEngine(config).getInfo();
    readName(label, el.getAttribute("name"));
    label = name;
    readVersion(label, el.getAttribute("version"));
    label += " : " + version;
    readId(label, el.getAttribute("id"));
    readReleaseType(label, el.getAttribute("release-type"), isWeb);
    description = el.getAttribute("description");
    trial = Caster.toBooleanValue(el.getAttribute("trial"), false);
    if (_img == null)
        _img = el.getAttribute("image");
    image = _img;
    String cat = el.getAttribute("category");
    if (StringUtil.isEmpty(cat, true))
        cat = el.getAttribute("categories");
    readCategories(label, cat);
    readCoreVersion(label, el.getAttribute("lucee-core-version"), info);
    readLoaderVersion(label, el.getAttribute("lucee-loader-version"));
    startBundles = Caster.toBooleanValue(el.getAttribute("start-bundles"), true);
    readAMF(label, el.getAttribute("amf"), logger);
    readResource(label, el.getAttribute("resource"), logger);
    readSearch(label, el.getAttribute("search"), logger);
    readORM(label, el.getAttribute("orm"), logger);
    readMonitor(label, el.getAttribute("monitor"), logger);
    readCache(label, el.getAttribute("cache"), logger);
    readCacheHandler(label, el.getAttribute("cache-handler"), logger);
    readJDBC(label, el.getAttribute("jdbc"), logger);
    readMapping(label, el.getAttribute("mapping"), logger);
    readEventGatewayInstances(label, el.getAttribute("event-gateway-instance"), logger);
}
Also used : Log(lucee.commons.io.log.Log) Info(lucee.Info) BundleInfo(lucee.runtime.osgi.BundleInfo) ConfigWeb(lucee.runtime.config.ConfigWeb) ConfigImpl(lucee.runtime.config.ConfigImpl)

Aggregations

Info (lucee.Info)3 Log (lucee.commons.io.log.Log)2 ConfigImpl (lucee.runtime.config.ConfigImpl)2 ConfigWeb (lucee.runtime.config.ConfigWeb)2 BundleInfo (lucee.runtime.osgi.BundleInfo)2 Attributes (java.util.jar.Attributes)1 ReadOnlyStruct (lucee.runtime.type.ReadOnlyStruct)1 DateTimeImpl (lucee.runtime.type.dt.DateTimeImpl)1