Examples of ParcelDescriptor


Examples of com.sun.star.script.framework.container.ParcelDescriptor

    public String getParcelLanguage(File file) throws IOException {
        ZipFile zf = null;
        ZipEntry ze = null;
        InputStream is = null;
        ParcelDescriptor pd;

        try {
            zf = new ZipFile(file);
            ze = zf.getEntry(PARCEL_DESCRIPTOR_XML);

            if (ze == null)
                throw new IOException("Could not find Parcel Descriptor in parcel");

            is = zf.getInputStream(ze);
            pd = new ParcelDescriptor(is);
        }
        finally {
            if (zf != null)
                zf.close();

            if (is != null)
                is.close();
        }

        return pd.getLanguage().toLowerCase();
    }
View Full Code Here

Examples of com.sun.star.script.framework.container.ParcelDescriptor

                throw new Exception(parcelxml.getName() + " not found and language " +
                    "not specified");
            }

            if (language != null && parcelxml.exists() == true) {
                ParcelDescriptor desc;
                String desclang = "";

                desc = new ParcelDescriptor(parcelxml);
                desclang = desc.getLanguage().toLowerCase();

                if (!desclang.equals(language.toLowerCase()))
                    throw new Exception(parcelxml.getName() + " already exists, " +
                        "and has a different language attribute: " +
                        desc.getLanguage());
            }

            if (language != null && scripts == null) {
                if (finder == null)
                    throw new Exception("Extension list not specified for this language");

                log("Searching for " + language + " scripts");

                ScriptEntry[] entries = finder.findMethods(contents);
                for (int i = 0; i < entries.length; i++) {
                    addScript(entries[i]);
                    log("Found: " + entries[i].getLogicalName());
                }
            }

            if (scripts != null) {
                if (scripts.size() == 0)
                    throw new Exception("No valid scripts found");

                ParcelDescriptor desc = new ParcelDescriptor(parcelxml, language);
                desc.setScriptEntries((ScriptEntry[])scripts.toArray(new ScriptEntry[0]));
                if (properties.size() != 0) {
                    Enumeration enumer = properties.keys();

                    while (enumer.hasMoreElements()) {
                        String name = (String)enumer.nextElement();
                        String value = (String)properties.get(name);
                        log("Setting property: " +  name + " to " + value);

                        desc.setLanguageProperty(name, value);
                    }
                }
                desc.write();
            }
            else {
                if (parcelxml.exists() == false)
                    throw new Exception("No valid scripts found");
            }
View Full Code Here

Examples of com.sun.star.script.framework.container.ParcelDescriptor

        FileObject contents =
            recipe.getFileObject(ParcelZipper.CONTENTS_DIRNAME);

        if (contents != null) {
            File f = FileUtil.toFile(contents);
            ParcelDescriptor pd = ParcelDescriptor.createParcelDescriptor(f);
            pd.setLanguage(language);
            pd.write();

            DataFolder parent = DataFolder.findFolder(contents);
            ParcelContentsFolder.createEmptyScript(parent, language);
        }
       
View Full Code Here

Examples of com.sun.star.script.framework.container.ParcelDescriptor

    public ConfigurePanel(String basedir, Vector classpath)
        throws IOException {

        this.basedir = new File(basedir);
        this.classpath = classpath;
        this.descriptor = new ParcelDescriptor(new File(this.basedir,
            ParcelZipper.PARCEL_DESCRIPTOR_XML));
        initUI();
    }
View Full Code Here

Examples of com.sun.star.script.framework.container.ParcelDescriptor

            this.basedir = new File(basedir);

        if (classpath != null)
            this.classpath = classpath;

        this.descriptor = new ParcelDescriptor(new File(this.basedir,
            ParcelZipper.PARCEL_DESCRIPTOR_XML));

        methodPanel.reload(this.basedir, this.classpath,
            descriptor.getLanguage());
        scriptPanel.reload(descriptor.getScriptEntries());
View Full Code Here

Examples of com.sun.star.script.framework.container.ParcelDescriptor

    public ParcelFolderSupport(ParcelFolder parcelFolder) {
        this.parcelFolder = parcelFolder;
    }

    public String getLanguage() {
        ParcelDescriptor descriptor = getParcelDescriptor();

        if (descriptor == null) {
            return "";
        }
        else {
            return descriptor.getLanguage();
        }
    }
View Full Code Here

Examples of com.sun.star.script.framework.container.ParcelDescriptor

            return descriptor.getLanguage();
        }
    }

    public String getClasspath() {
        ParcelDescriptor descriptor = getParcelDescriptor();

        if (descriptor == null) {
            return "";
        }
        else {
            return descriptor.getLanguageProperty("classpath");
        }
    }
View Full Code Here

Examples of com.sun.star.script.framework.container.ParcelDescriptor

            return descriptor.getLanguageProperty("classpath");
        }
    }

    public void setClasspath(String value) {
        ParcelDescriptor descriptor = getParcelDescriptor();

        if (descriptor != null) {
            descriptor.setLanguageProperty("classpath", value);

            try {
                descriptor.write();
            }
            catch (IOException ioe) {
                ErrorManager.getDefault().notify(ioe);
            }
        }
View Full Code Here

Examples of com.sun.star.script.framework.container.ParcelDescriptor

        Vector classpath = getConfigureClasspath();
        classpath.addElement(contents.getAbsolutePath());
       
        try {
            ParcelDescriptor descriptor = getParcelDescriptor();
            if (descriptor == null) {
                descriptor = ParcelDescriptor.createParcelDescriptor(contents);
            }

            if (configuror == null) {
                configuror = new ConfigurePanel(contents.getAbsolutePath(),
                    classpath, descriptor);
            }
            else {
                configuror.reload(contents.getAbsolutePath(), classpath,
                    descriptor);
            }
        }
        catch (IOException ioe) {
            ErrorManager.getDefault().notify(ioe);
            return false;
        }

        DialogDescriptor dd = new DialogDescriptor(configuror,
            ConfigurePanel.DIALOG_TITLE);
       
        Dialog dialog = TopManager.getDefault().createDialog(dd);
        dialog.show();
       
        if (dd.getValue() == DialogDescriptor.OK_OPTION) {
            try {
                ParcelDescriptor descriptor = configuror.getConfiguration();
                descriptor.write();
            }
            catch (Exception e) {
                ErrorManager.getDefault().notify(e);
            }
        }
View Full Code Here

Examples of com.sun.star.script.framework.container.ParcelDescriptor

    public ConfigurePanel(String basedir, Vector classpath)
        throws IOException {

        this.basedir = new File(basedir);
        this.classpath = classpath;
        this.descriptor = new ParcelDescriptor(new File(this.basedir,
            ParcelZipper.PARCEL_DESCRIPTOR_XML));
        initUI();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.