Package helma.framework.repository

Examples of helma.framework.repository.Resource


     *  other locations or database stored skins. If parentName and
     *  subName are defined, the skin may be a subskin of another skin.
     */
    public Skin getSkin(Prototype proto, String skinname, String subskin, Object[] skinpath)
            throws IOException {
        Resource res = skinMap.getResource(skinname);
        while (res != null) {
            Skin skin = Skin.getSkin(res, app);
            if (subskin == null && skin.hasMainskin()) {
                return skin;
            } else if (subskin != null && skin.hasSubskin(subskin)) {
                return skin.getSubskin(subskin);
            }
            String baseskin = skin.getExtends();
            if (baseskin != null && !baseskin.equalsIgnoreCase(skinname)) {
                // we need to call SkinManager.getSkin() to fetch overwritten
                // base skins from skinpath
                return app.skinmgr.getSkin(proto, baseskin, subskin, skinpath);
            }
            res = res.getOverloadedResource();
        }
        return null;
    }
View Full Code Here


        public ScriptableSkinMap(Map wrapped) {
            super(wrapped);
        }

        public Object get(Object key) {
            Resource res = (Resource) super.get(key);

            if (res == null || !res.exists()) {
                return null;
            }

            try {
                return res.getContent();
            } catch (IOException iox) {
                return null;
            }
        }
View Full Code Here

            checkForUpdates();
            return super.equals(obj);
        }

        public Skin getSkin(Object key) throws IOException {
            Resource res = (Resource) get(key);

            if (res != null) {
                return Skin.getSkin(res, app);
            } else {
                return null;
View Full Code Here

            super.clear();

            // load Skins
            for (Iterator i = skins.iterator(); i.hasNext();) {
                Resource res = (Resource) i.next();
                Resource prev = (Resource) super.put(res.getBaseName(), res);
                res.setOverloadedResource(prev);
            }

            // if skinpath is not null, overload/add skins from there
            if (skinpath != null) {
View Full Code Here

            for (int i = 0; i < skinNames.length; i++) {
                String name = skinNames[i].substring(0, skinNames[i].length() - 5);
                File file = new File(dir, skinNames[i]);

                Resource res = new FileResource(file);
                Resource prev = (Resource) super.put(name, res);
                res.setOverloadedResource(prev);
            }

        }
View Full Code Here

        }

        Iterator resources = repository.getResources();
        while (resources.hasNext()) {
            // check for jar files to add to class loader
            Resource resource = (Resource) resources.next();
            String name = resource.getName();
            if (name.endsWith(".jar")) {
                if (!jarfiles.contains(name)) {
                    jarfiles.add(name);
                    try {
                        loader.addURL(resource.getUrl());
                    } catch (UnsupportedOperationException x) {
                        // not implemented by all kinds of resources
                    }
                }
            }
View Full Code Here

    ////////////////////////////////////////////////
    private synchronized void evaluate(Context cx, TypeInfo type, Resource code) {
        String sourceName = code.getName();
        Reader reader = null;

        Resource previousCurrentResource = app.getCurrentCodeResource();
        app.setCurrentCodeResource(code);

        String encoding = app.getProperty("sourceCharset");

        try {
View Full Code Here

        RhinoEngine engine = RhinoEngine.getRhinoEngine();
        Prototype prototype = engine.core.app.getPrototypeByName(protoName);
        while (prototype != null) {
            Resource[] resources = prototype.getResources();
            for (int i = resources.length - 1; i >= 0; i--) {
                Resource resource = resources[i];
                if (resource.exists() && resource.getShortName().equals(resourceName))
                    return Context.toObject(resource, core.global);
            }
            prototype =  prototype.getParentPrototype();
        }
        return null;
View Full Code Here

        Prototype prototype = engine.core.app.getPrototypeByName(protoName);
        ArrayList a = new ArrayList();
        while (prototype != null) {
            Resource[] resources = prototype.getResources();
            for (int i = resources.length - 1; i >= 0; i--) {
                Resource resource = resources[i];
                if (resource.exists() && resource.getShortName().equals(resourceName))
                    a.add(Context.toObject(resource, core.global));
            }
            prototype =  prototype.getParentPrototype();
        }
        return Context.getCurrentContext().newArray(core.global, a.toArray());
View Full Code Here

            if (resourceName != null) {
                Iterator iterator = app.getRepositories().iterator();
                while (iterator.hasNext()) {
                    try {
                        Repository repository = (Repository) iterator.next();
                        Resource res = repository.getResource(resourceName);
                        if (res != null && res.exists()) {
                            InputStream in = res.getInputStream();
                            temp.load(in);
                            in.close();
                        }
                    } catch (IOException iox) {
                        iox.printStackTrace();
                    }
                }
            }

            // if these are subproperties, reload them from the parent properties
            if (parentProperties != null && prefix != null) {
                parentProperties.update();
                Iterator it = parentProperties.entrySet().iterator();
                int prefixLength = prefix.length();
                while (it.hasNext()) {
                    Map.Entry entry = (Map.Entry) it.next();
                    String key = entry.getKey().toString();
                    if (key.regionMatches(ignoreCase, 0, prefix, 0, prefixLength)) {
                        temp.put(key.substring(prefixLength), entry.getValue());
                    }
                }

            }

            // at last we try to load properties from the resource list
            if (resources != null) {
                Iterator iterator = resources.iterator();
                while (iterator.hasNext()) {
                    try {
                        Resource res = (Resource) iterator.next();
                        if (res.exists()) {
                            InputStream in = res.getInputStream();
                            temp.load(in);
                            in.close();
                        }
                    } catch (IOException iox) {
                        iox.printStackTrace();
View Full Code Here

TOP

Related Classes of helma.framework.repository.Resource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.