Search in sources :

Example 1 with BundleDefinition

use of lucee.runtime.osgi.OSGiUtil.BundleDefinition in project Lucee by lucee.

the class Admin method doGetBundle.

private void doGetBundle() throws PageException {
    String symbolicName = getString("admin", "getBundle", "symbolicName", true);
    Version version = OSGiUtil.toVersion(getString("version", null), null);
    BundleDefinition bd;
    BundleFile bf = null;
    Bundle b = OSGiUtil.getBundleLoaded(symbolicName, version, null);
    if (b != null) {
        bd = new BundleDefinition(b);
    } else {
        try {
            bf = OSGiUtil.getBundleFile(symbolicName, version, null, false);
            bd = bf.toBundleDefinition();
            b = bd.getLoadedBundle();
        } catch (BundleException e) {
            throw Caster.toPageException(e);
        }
    }
    CFMLEngine engine = ConfigWebUtil.getEngine(config);
    BundleCollection coreBundles = engine.getBundleCollection();
    java.util.Collection<BundleDefinition> extBundles = config.getAllExtensionBundleDefintions();
    Struct sct = new StructImpl();
    pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
    sct.set(SYMBOLIC_NAME, bd.getName());
    sct.set(KeyConstants._title, bd.getName());
    sct.set(KeyConstants._version, bd.getVersionAsString());
    sct.set(USED_BY, _usedBy(bd.getName(), bd.getVersion(), coreBundles, extBundles));
    try {
        if (b != null) {
            sct.set(PATH, b.getLocation());
        } else {
            if (bf == null)
                bf = bd.getBundleFile(false);
            sct.set(PATH, bf.getFile());
        }
    } catch (Throwable t) {
        ExceptionUtil.rethrowIfNecessary(t);
    }
    Map<String, Object> headers = null;
    if (b != null) {
        sct.set(KeyConstants._version, bd.getVersion().toString());
        sct.set(KeyConstants._id, b.getBundleId());
        sct.set(KeyConstants._state, OSGiUtil.toState(b.getState(), null));
        sct.set(FRAGMENT, OSGiUtil.isFragment(b));
        headers = OSGiUtil.getHeaders(b);
    } else {
        sct.set(KeyConstants._state, "notinstalled");
        try {
            if (bf == null)
                bf = bd.getBundleFile(false);
            sct.set(KeyConstants._version, bf.getVersionAsString());
            sct.set(FRAGMENT, OSGiUtil.isFragment(bf));
            headers = bf.getHeaders();
        } catch (BundleException e) {
        }
    }
    if (headers != null) {
        Struct h = Caster.toStruct(headers, false);
        sct.set(HEADERS, h);
        // title
        String str = Caster.toString(h.get("Bundle-Title", null), null);
        if (StringUtil.isEmpty(str))
            str = Caster.toString(h.get("Implementation-Title", null), null);
        if (StringUtil.isEmpty(str))
            str = Caster.toString(h.get("Specification-Title", null), null);
        if (StringUtil.isEmpty(str))
            str = Caster.toString(h.get("Bundle-Name", null), null);
        if (!StringUtil.isEmpty(str))
            sct.set(KeyConstants._title, str);
        // description
        str = Caster.toString(h.get("Bundle-Description", null), null);
        if (StringUtil.isEmpty(str))
            str = Caster.toString(h.get("Implementation-Description", null), null);
        if (StringUtil.isEmpty(str))
            str = Caster.toString(h.get("Specification-Description", null), null);
        if (!StringUtil.isEmpty(str))
            sct.set(KeyConstants._description, str);
        // Vendor
        str = Caster.toString(h.get("Bundle-Vendor", null), null);
        if (StringUtil.isEmpty(str))
            str = Caster.toString(h.get("Implementation-Vendor", null), null);
        if (StringUtil.isEmpty(str))
            str = Caster.toString(h.get("Specification-Vendor", null), null);
        if (!StringUtil.isEmpty(str))
            sct.set(VENDOR, str);
    }
}
Also used : Bundle(org.osgi.framework.Bundle) Struct(lucee.runtime.type.Struct) BundleDefinition(lucee.runtime.osgi.OSGiUtil.BundleDefinition) BundleCollection(lucee.loader.osgi.BundleCollection) StructImpl(lucee.runtime.type.StructImpl) Version(org.osgi.framework.Version) BundleException(org.osgi.framework.BundleException) CFMLEngine(lucee.loader.engine.CFMLEngine) BundleFile(lucee.runtime.osgi.BundleFile)

Example 2 with BundleDefinition

use of lucee.runtime.osgi.OSGiUtil.BundleDefinition in project Lucee by lucee.

the class XMLConfigAdmin method updateRHExtension.

public void updateRHExtension(Config config, RHExtension rhext, boolean reload) throws PageException {
    ConfigImpl ci = (ConfigImpl) config;
    Log logger = ci.getLog("deploy");
    String type = ci instanceof ConfigWeb ? "web" : "server";
    // load already installed previous version and uninstall the parts no longer needed
    RHExtension existingRH = getRHExtension(ci, rhext.getId(), null);
    if (existingRH != null) {
        // same version
        if (existingRH.getVersion().compareTo(rhext.getVersion()) == 0) {
            removeRHExtension(config, existingRH, rhext, false);
        } else
            removeRHExtension(config, existingRH, rhext, true);
    }
    // INSTALL
    try {
        // boolean clearTags=false,clearFunction=false;
        boolean reloadNecessary = false;
        // store to xml
        BundleDefinition[] existing = _updateExtension(ci, rhext);
        // _storeAndReload();
        // this must happen after "store"
        // clean after populating the new ones
        cleanBundles(rhext, ci, existing);
        // ConfigWebAdmin.updateRHExtension(ci,rhext);
        ZipInputStream zis = new ZipInputStream(IOUtil.toBufferedInputStream(rhext.getExtensionFile().getInputStream()));
        ZipEntry entry;
        String path;
        String fileName;
        while ((entry = zis.getNextEntry()) != null) {
            path = entry.getName();
            fileName = fileName(entry);
            // jars
            if (!entry.isDirectory() && (startsWith(path, type, "jars") || startsWith(path, type, "jar") || startsWith(path, type, "bundles") || startsWith(path, type, "bundle") || startsWith(path, type, "lib") || startsWith(path, type, "libs")) && StringUtil.endsWithIgnoreCase(path, ".jar")) {
                Object obj = XMLConfigAdmin.installBundle(config, zis, fileName, rhext.getVersion(), false, false);
                // jar is not a bundle, only a regular jar
                if (!(obj instanceof BundleFile)) {
                    Resource tmp = (Resource) obj;
                    Resource tmpJar = tmp.getParentResource().getRealResource(ListUtil.last(path, "\\/"));
                    tmp.moveTo(tmpJar);
                    XMLConfigAdmin.updateJar(config, tmpJar, false);
                }
            }
            // flds
            if (!entry.isDirectory() && startsWith(path, type, "flds") && (StringUtil.endsWithIgnoreCase(path, ".fld") || StringUtil.endsWithIgnoreCase(path, ".fldx"))) {
                logger.log(Log.LEVEL_INFO, "extension", "deploy fld " + fileName);
                updateFLD(zis, fileName, false);
                reloadNecessary = true;
            }
            // tlds
            if (!entry.isDirectory() && startsWith(path, type, "tlds") && (StringUtil.endsWithIgnoreCase(path, ".tld") || StringUtil.endsWithIgnoreCase(path, ".tldx"))) {
                logger.log(Log.LEVEL_INFO, "extension", "deploy tld/tldx " + fileName);
                updateTLD(zis, fileName, false);
                reloadNecessary = true;
            }
            // tags
            if (!entry.isDirectory() && startsWith(path, type, "tags")) {
                String sub = subFolder(entry);
                logger.log(Log.LEVEL_INFO, "extension", "deploy tag " + sub);
                updateTag(zis, sub, false);
                // clearTags=true;
                reloadNecessary = true;
            }
            // functions
            if (!entry.isDirectory() && startsWith(path, type, "functions")) {
                String sub = subFolder(entry);
                logger.log(Log.LEVEL_INFO, "extension", "deploy function " + sub);
                updateFunction(zis, sub, false);
                // clearFunction=true;
                reloadNecessary = true;
            }
            // mappings
            if (!entry.isDirectory() && (startsWith(path, type, "archives") || startsWith(path, type, "mappings"))) {
                String sub = subFolder(entry);
                logger.log(Log.LEVEL_INFO, "extension", "deploy mapping " + sub);
                updateArchive(zis, sub, false);
                reloadNecessary = true;
            // clearFunction=true;
            }
            // event-gateway
            if (!entry.isDirectory() && (startsWith(path, type, "event-gateways") || startsWith(path, type, "eventGateways")) && (StringUtil.endsWithIgnoreCase(path, "." + Constants.getCFMLComponentExtension()) || StringUtil.endsWithIgnoreCase(path, "." + Constants.getLuceeComponentExtension()))) {
                String sub = subFolder(entry);
                logger.log(Log.LEVEL_INFO, "extension", "deploy event-gateway " + sub);
                updateEventGateway(zis, sub, false);
            }
            // context
            String realpath;
            if (!entry.isDirectory() && startsWith(path, type, "context") && !StringUtil.startsWith(fileName(entry), '.')) {
                realpath = path.substring(8);
                logger.log(Log.LEVEL_INFO, "extension", "deploy context " + realpath);
                updateContext(zis, realpath, false, false);
            }
            // web contextS
            boolean first;
            if (!entry.isDirectory() && ((first = startsWith(path, type, "webcontexts")) || startsWith(path, type, "web.contexts")) && !StringUtil.startsWith(fileName(entry), '.')) {
                realpath = path.substring(first ? 12 : 13);
                logger.log(Log.LEVEL_INFO, "extension", "deploy webcontext " + realpath);
                updateWebContexts(zis, realpath, false, false);
            }
            // applications
            if (!entry.isDirectory() && (startsWith(path, type, "applications") || startsWith(path, type, "web.applications") || startsWith(path, type, "web")) && !StringUtil.startsWith(fileName(entry), '.')) {
                int index;
                if (startsWith(path, type, "applications"))
                    index = 13;
                else if (startsWith(path, type, "web.applications"))
                    index = 17;
                else
                    // web
                    index = 4;
                realpath = path.substring(index);
                logger.log(Log.LEVEL_INFO, "extension", "deploy application " + realpath);
                updateApplication(zis, realpath, false);
            }
            // configs
            if (!entry.isDirectory() && (startsWith(path, type, "config")) && !StringUtil.startsWith(fileName(entry), '.')) {
                realpath = path.substring(7);
                logger.log(Log.LEVEL_INFO, "extension", "deploy config " + realpath);
                updateConfigs(zis, realpath, false, false);
            }
            // components
            if (!entry.isDirectory() && (startsWith(path, type, "components")) && !StringUtil.startsWith(fileName(entry), '.')) {
                realpath = path.substring(11);
                logger.log(Log.LEVEL_INFO, "extension", "deploy component " + realpath);
                updateComponent(zis, realpath, false, false);
            }
            // plugins
            if (!entry.isDirectory() && (startsWith(path, type, "plugins")) && !StringUtil.startsWith(fileName(entry), '.')) {
                realpath = path.substring(8);
                logger.log(Log.LEVEL_INFO, "extension", "deploy plugin " + realpath);
                updatePlugin(zis, realpath, false);
            }
            zis.closeEntry();
        }
        // load the bundles
        if (rhext.getStartBundles()) {
            rhext.deployBundles(ci);
            BundleInfo[] bfs = rhext.getBundles();
            for (BundleInfo bf : bfs) {
                OSGiUtil.loadBundleFromLocal(bf.getSymbolicName(), bf.getVersion(), false, null);
            }
        }
        // update cache
        if (!ArrayUtil.isEmpty(rhext.getCaches())) {
            Iterator<Map<String, String>> itl = rhext.getCaches().iterator();
            Map<String, String> map;
            while (itl.hasNext()) {
                map = itl.next();
                ClassDefinition cd = RHExtension.toClassDefinition(config, map, null);
                if (cd != null && cd.isBundle()) {
                    _updateCache(cd);
                    reloadNecessary = true;
                }
                logger.info("extension", "update cache [" + cd + "] from extension [" + rhext.getName() + ":" + rhext.getVersion() + "]");
            }
        }
        // update cache handler
        if (!ArrayUtil.isEmpty(rhext.getCacheHandlers())) {
            Iterator<Map<String, String>> itl = rhext.getCacheHandlers().iterator();
            Map<String, String> map;
            while (itl.hasNext()) {
                map = itl.next();
                ClassDefinition cd = RHExtension.toClassDefinition(config, map, null);
                String _id = map.get("id");
                if (!StringUtil.isEmpty(_id) && cd != null && cd.hasClass()) {
                    _updateCacheHandler(_id, cd);
                    reloadNecessary = true;
                }
                logger.info("extension", "update cache handler [" + cd + "] from extension [" + rhext.getName() + ":" + rhext.getVersion() + "]");
            }
        }
        // update AMF
        if (!ArrayUtil.isEmpty(rhext.getAMFs())) {
            Iterator<Map<String, String>> itl = rhext.getAMFs().iterator();
            Map<String, String> map;
            while (itl.hasNext()) {
                map = itl.next();
                ClassDefinition cd = RHExtension.toClassDefinition(config, map, null);
                if (cd != null && cd.hasClass()) {
                    _updateAMFEngine(cd, map.get("caster"), map.get("configuration"));
                    reloadNecessary = true;
                }
                logger.info("extension", "update AMF engine [" + cd + "] from extension [" + rhext.getName() + ":" + rhext.getVersion() + "]");
            }
        }
        // update Search
        if (!ArrayUtil.isEmpty(rhext.getSearchs())) {
            Iterator<Map<String, String>> itl = rhext.getSearchs().iterator();
            Map<String, String> map;
            while (itl.hasNext()) {
                map = itl.next();
                ClassDefinition cd = RHExtension.toClassDefinition(config, map, null);
                if (cd != null && cd.hasClass()) {
                    _updateSearchEngine(cd);
                    reloadNecessary = true;
                }
                logger.info("extension", "update search engine [" + cd + "] from extension [" + rhext.getName() + ":" + rhext.getVersion() + "]");
            }
        }
        // update Resource
        if (!ArrayUtil.isEmpty(rhext.getResources())) {
            Iterator<Map<String, String>> itl = rhext.getResources().iterator();
            Map<String, String> map;
            while (itl.hasNext()) {
                map = itl.next();
                ClassDefinition cd = RHExtension.toClassDefinition(config, map, null);
                String scheme = map.get("scheme");
                if (cd != null && cd.hasClass() && !StringUtil.isEmpty(scheme)) {
                    Struct args = new StructImpl();
                    copyButIgnoreClassDef(map, args);
                    args.remove("scheme");
                    _updateResourceProvider(scheme, cd, args);
                    reloadNecessary = true;
                }
                logger.info("extension", "update resource provider [" + scheme + "] from extension [" + rhext.getName() + ":" + rhext.getVersion() + "]");
            }
        }
        // update orm
        if (!ArrayUtil.isEmpty(rhext.getOrms())) {
            Iterator<Map<String, String>> itl = rhext.getOrms().iterator();
            Map<String, String> map;
            while (itl.hasNext()) {
                map = itl.next();
                ClassDefinition cd = RHExtension.toClassDefinition(config, map, null);
                if (cd != null && cd.hasClass()) {
                    _updateORMEngine(cd);
                    reloadNecessary = true;
                }
                logger.info("extension", "update orm engine [" + cd + "] from extension [" + rhext.getName() + ":" + rhext.getVersion() + "]");
            }
        }
        // update monitor
        if (!ArrayUtil.isEmpty(rhext.getMonitors())) {
            Iterator<Map<String, String>> itl = rhext.getMonitors().iterator();
            Map<String, String> map;
            while (itl.hasNext()) {
                map = itl.next();
                ClassDefinition cd = RHExtension.toClassDefinition(config, map, null);
                if (cd != null && cd.hasClass()) {
                    _updateMonitorEnabled(true);
                    _updateMonitor(cd, map.get("type"), map.get("name"), true);
                    reloadNecessary = true;
                }
                logger.info("extension", "update monitor engine [" + cd + "] from extension [" + rhext.getName() + ":" + rhext.getVersion() + "]");
            }
        }
        // update jdbc
        if (!ArrayUtil.isEmpty(rhext.getJdbcs())) {
            Iterator<Map<String, String>> itl = rhext.getJdbcs().iterator();
            Map<String, String> map;
            while (itl.hasNext()) {
                map = itl.next();
                ClassDefinition cd = RHExtension.toClassDefinition(config, map, null);
                String _label = map.get("label");
                if (cd != null && cd.isBundle()) {
                    _updateJDBCDriver(_label, cd);
                    reloadNecessary = true;
                }
                logger.info("extension", "update JDBC Driver [" + _label + ":" + cd + "] from extension [" + rhext.getName() + ":" + rhext.getVersion() + "]");
            }
        }
        // update mapping
        if (!ArrayUtil.isEmpty(rhext.getMappings())) {
            Iterator<Map<String, String>> itl = rhext.getMappings().iterator();
            Map<String, String> map;
            String virtual, physical, archive, primary;
            short inspect;
            int lmode, ltype;
            boolean toplevel, readonly;
            while (itl.hasNext()) {
                map = itl.next();
                virtual = map.get("virtual");
                physical = map.get("physical");
                archive = map.get("archive");
                primary = map.get("primary");
                inspect = ConfigWebUtil.inspectTemplate(map.get("inspect"), Config.INSPECT_UNDEFINED);
                lmode = ConfigWebUtil.toListenerMode(map.get("listener-mode"), -1);
                ltype = ConfigWebUtil.toListenerType(map.get("listener-type"), -1);
                toplevel = Caster.toBooleanValue(map.get("toplevel"), false);
                readonly = Caster.toBooleanValue(map.get("readonly"), false);
                _updateMapping(virtual, physical, archive, primary, inspect, toplevel, lmode, ltype, readonly);
                reloadNecessary = true;
                logger.info("extension", "update Mapping [" + virtual + "]");
            }
        }
        if (!ArrayUtil.isEmpty(rhext.getEventGatewayInstances())) {
            Iterator<Map<String, Object>> itl = rhext.getEventGatewayInstances().iterator();
            Map<String, Object> map;
            while (itl.hasNext()) {
                map = itl.next();
                // id
                String id = Caster.toString(map.get("id"), null);
                // class
                ClassDefinition cd = RHExtension.toClassDefinition(config, map, null);
                // component path
                String cfcPath = Caster.toString(map.get("cfc-path"), null);
                if (StringUtil.isEmpty(cfcPath))
                    cfcPath = Caster.toString(map.get("component-path"), null);
                // listener component path
                String listenerCfcPath = Caster.toString(map.get("listener-cfc-path"), null);
                if (StringUtil.isEmpty(listenerCfcPath))
                    listenerCfcPath = Caster.toString(map.get("listener-component-path"), null);
                // startup mode
                String strStartupMode = Caster.toString(map.get("startup-mode"), "automatic");
                int startupMode = GatewayEntryImpl.toStartup(strStartupMode, GatewayEntryImpl.STARTUP_MODE_AUTOMATIC);
                // read only
                boolean readOnly = Caster.toBooleanValue(map.get("read-only"), false);
                // custom
                Struct custom = Caster.toStruct(map.get("custom"), null);
                if (!StringUtil.isEmpty(id) && (!StringUtil.isEmpty(cfcPath) || (cd != null && cd.hasClass()))) {
                    _updateGatewayEntry(id, cd, cfcPath, listenerCfcPath, startupMode, custom, readOnly);
                }
                logger.info("extension", "update event gateway entry [" + id + "] from extension [" + rhext.getName() + ":" + rhext.getVersion() + "]");
            }
        }
        // reload
        // if(reloadNecessary){
        reloadNecessary = true;
        if (reload && reloadNecessary)
            _storeAndReload();
        else
            _store();
    // }
    } catch (Throwable t) {
        ExceptionUtil.rethrowIfNecessary(t);
        DeployHandler.moveToFailedFolder(rhext.getExtensionFile().getParentResource(), rhext.getExtensionFile());
        try {
            XMLConfigAdmin.removeRHExtension((ConfigImpl) config, rhext.getId(), false);
        } catch (Throwable t2) {
            ExceptionUtil.rethrowIfNecessary(t2);
        }
        throw Caster.toPageException(t);
    }
}
Also used : ZipEntry(java.util.zip.ZipEntry) ClassDefinition(lucee.runtime.db.ClassDefinition) Struct(lucee.runtime.type.Struct) BundleInfo(lucee.runtime.osgi.BundleInfo) BundleFile(lucee.runtime.osgi.BundleFile) Log(lucee.commons.io.log.Log) Resource(lucee.commons.io.res.Resource) BundleDefinition(lucee.runtime.osgi.OSGiUtil.BundleDefinition) RHExtension(lucee.runtime.extension.RHExtension) ZipInputStream(java.util.zip.ZipInputStream) StructImpl(lucee.runtime.type.StructImpl) CreateObject(lucee.runtime.functions.other.CreateObject) Map(java.util.Map) HashMap(java.util.HashMap)

Example 3 with BundleDefinition

use of lucee.runtime.osgi.OSGiUtil.BundleDefinition in project Lucee by lucee.

the class XMLConfigAdmin method _updateExtension.

/**
 * @param config
 * @param ext
 * @return the bundles used before when this was a update, if it is a new extension then null is returned
 * @throws IOException
 * @throws BundleException
 * @throws ApplicationException
 */
public BundleDefinition[] _updateExtension(ConfigImpl config, RHExtension ext) throws IOException, BundleException, ApplicationException {
    if (!Decision.isUUId(ext.getId()))
        throw new IOException("id [" + ext.getId() + "] is invalid, it has to be a UUID");
    Element extensions = _getRootElement("extensions");
    // LuceeHandledExtensions
    Element[] children = XMLConfigWebFactory.getChildren(extensions, "rhextension");
    // Update
    Element el;
    String id;
    BundleDefinition[] old;
    for (int i = 0; i < children.length; i++) {
        el = children[i];
        // provider=el.getAttribute("provider");
        id = el.getAttribute("id");
        if (ext.getId().equalsIgnoreCase(id)) {
            // get existing bundles before populate new ones
            old = RHExtension.toBundleDefinitions(el.getAttribute("bundles"));
            ext.populate(el);
            old = minus(old, OSGiUtil.toBundleDefinitions(ext.getBundles()));
            return old;
        }
    }
    // Insert
    el = doc.createElement("rhextension");
    ext.populate(el);
    extensions.appendChild(el);
    return null;
}
Also used : BundleDefinition(lucee.runtime.osgi.OSGiUtil.BundleDefinition) Element(org.w3c.dom.Element) IOException(java.io.IOException)

Example 4 with BundleDefinition

use of lucee.runtime.osgi.OSGiUtil.BundleDefinition in project Lucee by lucee.

the class XMLConfigAdmin method _removeExtension.

public BundleDefinition[] _removeExtension(ConfigImpl config, String extensionID, boolean removePhysical) throws IOException, PageException, SAXException, BundleException {
    if (!Decision.isUUId(extensionID))
        throw new IOException("id [" + extensionID + "] is invalid, it has to be a UUID");
    Element extensions = _getRootElement("extensions");
    // LuceeHandledExtensions
    Element[] children = XMLConfigWebFactory.getChildren(extensions, "rhextension");
    // Update
    Element el;
    String id;
    String[] arr;
    boolean storeChildren = false;
    BundleDefinition[] bundles;
    for (int i = 0; i < children.length; i++) {
        el = children[i];
        id = el.getAttribute("id");
        if (extensionID.equalsIgnoreCase(id)) {
            // get existing bundles before populate new ones
            bundles = RHExtension.toBundleDefinitions(el.getAttribute("bundles"));
            // bundles
            arr = _removeExtensionCheckOtherUsage(children, el, "bundles");
            // removeBundles(arr,removePhysical);
            // flds
            arr = _removeExtensionCheckOtherUsage(children, el, "flds");
            removeFLDs(arr);
            // tlds
            arr = _removeExtensionCheckOtherUsage(children, el, "tlds");
            removeTLDs(arr);
            // contexts
            arr = _removeExtensionCheckOtherUsage(children, el, "contexts");
            storeChildren = removeContext(config, false, arr);
            // webcontexts
            arr = _removeExtensionCheckOtherUsage(children, el, "webcontexts");
            storeChildren = removeWebContexts(config, false, arr);
            // applications
            arr = _removeExtensionCheckOtherUsage(children, el, "applications");
            removeApplications(config, arr);
            // components
            arr = _removeExtensionCheckOtherUsage(children, el, "components");
            removeComponents(config, false, arr);
            // configs
            arr = _removeExtensionCheckOtherUsage(children, el, "config");
            removeConfigs(config, false, arr);
            // plugins
            arr = _removeExtensionCheckOtherUsage(children, el, "plugins");
            removePlugins(config, arr);
            extensions.removeChild(el);
            return bundles;
        }
    }
    return null;
}
Also used : BundleDefinition(lucee.runtime.osgi.OSGiUtil.BundleDefinition) Element(org.w3c.dom.Element) IOException(java.io.IOException)

Example 5 with BundleDefinition

use of lucee.runtime.osgi.OSGiUtil.BundleDefinition in project Lucee by lucee.

the class XMLConfigAdmin method minus.

private BundleDefinition[] minus(BundleDefinition[] oldBD, BundleDefinition[] newBD) {
    List<BundleDefinition> list = new ArrayList<>();
    boolean has;
    for (BundleDefinition o : oldBD) {
        has = false;
        for (BundleDefinition n : newBD) {
            if (o.equals(n)) {
                has = true;
                break;
            }
        }
        if (!has)
            list.add(o);
    }
    return list.toArray(new BundleDefinition[list.size()]);
}
Also used : BundleDefinition(lucee.runtime.osgi.OSGiUtil.BundleDefinition) ArrayList(java.util.ArrayList)

Aggregations

BundleDefinition (lucee.runtime.osgi.OSGiUtil.BundleDefinition)15 HashMap (java.util.HashMap)4 BundleFile (lucee.runtime.osgi.BundleFile)4 Struct (lucee.runtime.type.Struct)4 Bundle (org.osgi.framework.Bundle)4 BundleException (org.osgi.framework.BundleException)4 IOException (java.io.IOException)3 Resource (lucee.commons.io.res.Resource)3 BundleCollection (lucee.loader.osgi.BundleCollection)3 RHExtension (lucee.runtime.extension.RHExtension)3 BundleInfo (lucee.runtime.osgi.BundleInfo)3 StructImpl (lucee.runtime.type.StructImpl)3 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 ZipEntry (java.util.zip.ZipEntry)2 ZipInputStream (java.util.zip.ZipInputStream)2 Log (lucee.commons.io.log.Log)2 CFMLEngine (lucee.loader.engine.CFMLEngine)2 ClassDefinition (lucee.runtime.db.ClassDefinition)2 ApplicationException (lucee.runtime.exp.ApplicationException)2