Package java.util.jar

Examples of java.util.jar.Attributes


          Logger.error(this, "could not load manifest from plugin file");
          pluginFile.delete();
          if(!downloaded) continue;
          throw new PluginNotFoundException("could not load manifest from plugin file");
        }
        Attributes mainAttributes = manifest.getMainAttributes();
        if(mainAttributes == null) {
          Logger.error(this, "manifest does not contain attributes");
          pluginFile.delete();
          if(!downloaded) continue;
          throw new PluginNotFoundException("manifest does not contain attributes");
        }
        pluginMainClassName = mainAttributes.getValue("Plugin-Main-Class");
        if(pluginMainClassName == null) {
          Logger.error(this, "manifest does not contain a Plugin-Main-Class attribute");
          pluginFile.delete();
          if(!downloaded) continue;
          throw new PluginNotFoundException("manifest does not contain a Plugin-Main-Class attribute");
View Full Code Here


    String specTitle = null, specVersion = null, specVendor = null;
    String implTitle = null, implVersion = null, implVendor = null;
    String sealed = null;
    URL sealBase = null;

    Attributes attr = man.getAttributes(path);
    if (attr != null) {
      specTitle = attr.getValue(Name.SPECIFICATION_TITLE);
      specVersion = attr.getValue(Name.SPECIFICATION_VERSION);
      specVendor = attr.getValue(Name.SPECIFICATION_VENDOR);
      implTitle = attr.getValue(Name.IMPLEMENTATION_TITLE);
      implVersion = attr.getValue(Name.IMPLEMENTATION_VERSION);
      implVendor = attr.getValue(Name.IMPLEMENTATION_VENDOR);
      sealed = attr.getValue(Name.SEALED);
    }
    attr = man.getMainAttributes();
    if (attr != null) {
      if (specTitle == null) {
        specTitle = attr.getValue(Name.SPECIFICATION_TITLE);
      }
      if (specVersion == null) {
        specVersion = attr.getValue(Name.SPECIFICATION_VERSION);
      }
      if (specVendor == null) {
        specVendor = attr.getValue(Name.SPECIFICATION_VENDOR);
      }
      if (implTitle == null) {
        implTitle = attr.getValue(Name.IMPLEMENTATION_TITLE);
      }
      if (implVersion == null) {
        implVersion = attr.getValue(Name.IMPLEMENTATION_VERSION);
      }
      if (implVendor == null) {
        implVendor = attr.getValue(Name.IMPLEMENTATION_VENDOR);
      }
      if (sealed == null) {
        sealed = attr.getValue(Name.SEALED);
      }
    }
    return definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase);
  }
View Full Code Here

                    debug(url.toString());

                    JarFile jarFile = conn.getJarFile();
                    Manifest manifest = jarFile.getManifest();
                    if (manifest != null) {
                        Attributes mainAttributes = manifest
                                .getMainAttributes();
                        if (mainAttributes.getValue("Vaadin-Widgetsets") != null) {
                            return true;
                        }
                        if (mainAttributes.getValue("Vaadin-Stylesheets") != null) {
                            return true;
                        }
                    }
                } catch (MalformedURLException e) {
                    if (debug) {
View Full Code Here

    // get class name from MANIFEST
    String className = null;
    try {
      URL u = new URL("jar:file:" + jarFileName + "!/");
      JarURLConnection uc = (JarURLConnection) u.openConnection();
      Attributes attr = uc.getMainAttributes();

      if (attr != null) {
        className = attr.getValue(Attributes.Name.MAIN_CLASS);
      }
    } catch (IOException ioe) {
    }

    if (className == null) {
View Full Code Here

    // get class name from MANIFEST
    String className = null;
    try {
      URL u = new URL("jar:file:" + jarFileName + "!/");
      JarURLConnection uc = (JarURLConnection) u.openConnection();
      Attributes attr = uc.getMainAttributes();

      if (attr != null)
        className = attr.getValue(Attributes.Name.MAIN_CLASS);
    } catch (IOException ioe) {
    }

    if (className == null) {
      System.err.println("No " + Attributes.Name.MAIN_CLASS
View Full Code Here

    
      deploymentMap.put(AppConstants.APPLICATION_VERSION, app.getApplicationMetadata().getApplicationVersion().toString());
     
     
      Manifest man = new Manifest();
      Attributes att = man.getMainAttributes();
      att.putValue(Attributes.Name.MANIFEST_VERSION.toString(), AppConstants.MANIFEST_VERSION);
      for (Map.Entry<String, String> entry : deploymentMap.entrySet()) {
        att.putValue(entry.getKey(),  entry.getValue());
      }
      return man;
    }
View Full Code Here

     * given manifest.
     */
    protected boolean isPackageSealed(String name, Manifest man) {

        String path = name.replace('.', '/') + '/';
        Attributes attr = man.getAttributes(path);
        String sealed = null;
        if (attr != null) {
            sealed = attr.getValue(Name.SEALED);
        }
        if (sealed == null) {
            if ((attr = man.getMainAttributes()) != null) {
                sealed = attr.getValue(Name.SEALED);
            }
        }
        return "true".equalsIgnoreCase(sealed);

    }
View Full Code Here

     * @return List of required extensions, or null if the application
     * does not require any extensions
     */
    private ArrayList getRequiredExtensions(Manifest manifest) {

        Attributes attributes = manifest.getMainAttributes();
        String names = attributes.getValue("Extension-List");
        if (names == null)
            return null;

        ArrayList extensionList = new ArrayList();
        names += " ";

        while (true) {

            int space = names.indexOf(' ');
            if (space < 0)
                break;
            String name = names.substring(0, space).trim();
            names = names.substring(space + 1);

            String value =
                attributes.getValue(name + "-Extension-Name");
            if (value == null)
                continue;
            Extension extension = new Extension();
            extension.setExtensionName(value);
            extension.setImplementationURL
                (attributes.getValue(name + "-Implementation-URL"));
            extension.setImplementationVendorId
                (attributes.getValue(name + "-Implementation-Vendor-Id"));
            String version = attributes.getValue(name + "-Implementation-Version");
            extension.setImplementationVersion(version);
            extension.setSpecificationVersion
                (attributes.getValue(name + "-Specification-Version"));
            extensionList.add(extension);
        }
        return extensionList;
    }
View Full Code Here

     * @return List of available extensions, or null if the web application
     * does not bundle any extensions
     */
    private ArrayList getAvailableExtensions(Manifest manifest) {

        Attributes attributes = manifest.getMainAttributes();
        String name = attributes.getValue("Extension-Name");
        if (name == null)
            return null;

        ArrayList extensionList = new ArrayList();

        Extension extension = new Extension();
        extension.setExtensionName(name);
        extension.setImplementationURL(
            attributes.getValue("Implementation-URL"));
        extension.setImplementationVendor(
            attributes.getValue("Implementation-Vendor"));
        extension.setImplementationVendorId(
            attributes.getValue("Implementation-Vendor-Id"));
        extension.setImplementationVersion(
            attributes.getValue("Implementation-Version"));
        extension.setSpecificationVersion(
            attributes.getValue("Specification-Version"));

        extensionList.add(extension);

        return extensionList;
    }
View Full Code Here

    static void addClasspathFromManifest(StringBuilder classPath, File file)
        throws URISyntaxException, IOException {
       
        JarFile jar = new JarFile(file);
        Attributes attr = null;
        if (jar.getManifest() != null) {
            attr = jar.getManifest().getMainAttributes();
        }
        if (attr != null) {
            String cp = attr.getValue("Class-Path");
            while (cp != null) {
                String fileName = cp;
                int idx = fileName.indexOf(' ');
                if (idx != -1) {
                    fileName = fileName.substring(0, idx);
View Full Code Here

TOP

Related Classes of java.util.jar.Attributes

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.