Logo Search packages:      
Sourcecode: icedtea-web version File versions  Download package

ResourcesDesc net::sourceforge::jnlp::Parser::getResourcesDesc ( Node  node,
boolean  j2se 
) throws ParseException [inline]

Returns the ResourcesDesc element at the specified node.

Parameters:
node the resources node
j2se true if the resources are located under a j2se or java node
Exceptions:
ParseException if the JNLP file is invalid

Definition at line 264 of file Parser.java.

References net::sourceforge::jnlp::ResourcesDesc::addResource(), file, getAttribute(), getChildNode(), getExtension(), net::sourceforge::jnlp::Node::getFirstChild(), getJAR(), getJRE(), getLocales(), net::sourceforge::jnlp::Node::getNextSibling(), net::sourceforge::jnlp::Node::getNodeName(), getPackage(), getProperty(), net::sourceforge::jnlp::JARDesc::isMain(), isTrustedEnvironment(), root, splitString(), and strict.

Referenced by getResources().

                                                                                         {
        boolean mainFlag = false; // if found a main tag

        // create resources
        ResourcesDesc resources =
            new ResourcesDesc(file,
                              getLocales(node),
                              splitString(getAttribute(node, "os", null)),
                              splitString(getAttribute(node, "arch", null)));

        // step through the elements
        Node child = node.getFirstChild();
        while (child != null) {
            String name = child.getNodeName();

            // check for nativelib but no trusted environment
            if ("nativelib".equals(name))
                if (!isTrustedEnvironment())
                    throw new ParseException(R("PUntrustedNative"));

            if ("j2se".equals(name) || "java".equals(name)) {
                if (getChildNode(root, "component-desc") != null)
                    if (strict)
                        throw new ParseException(R("PExtensionHasJ2SE"));
                if (!j2se)
                    resources.addResource( getJRE(child) );
                else
                    throw new ParseException(R("PInnerJ2SE"));
            }

            if ("jar".equals(name) || "nativelib".equals(name)) {
                JARDesc jar = getJAR(child);

                // check for duplicate main entries
                if (jar.isMain()) {
                    if (mainFlag == true)
                        if (strict)
                            throw new ParseException(R("PTwoMains"));
                    mainFlag = true;
                }

                resources.addResource(jar);
            }

            if ("extension".equals(name))
                resources.addResource( getExtension(child) );

            if ("property".equals(name))
                resources.addResource( getProperty(child) );

            if ("package".equals(name))
                resources.addResource( getPackage(child) );

            child = child.getNextSibling();
        }

        return resources;
    }


Generated by  Doxygen 1.6.0   Back to index