Package java.util.jar

Examples of java.util.jar.Attributes$Name


            JarFile jfile = new JarFile(path, false);
            Manifest mfst = jfile.getManifest();
            if (mfst != null) {
               
                // look for class path information from manifest
                Attributes attrs = mfst.getMainAttributes();
                String cpath = (String)attrs.get(Attributes.Name.CLASS_PATH);
                if (cpath != null) {
               
                    // set base path for all relative references
                    if (File.separatorChar != '/') {
                        path = path.replace('/', File.separatorChar);
View Full Code Here


  */
  private String fetchSpecNamesAndVersions(JarInputStream aJarStream) {
    StringBuffer result = new StringBuffer();
    Manifest manifest = aJarStream.getManifest();
    if ( manifest != null ){
      Attributes attrs = (Attributes)manifest.getMainAttributes();
      for (Iterator iter = attrs.keySet().iterator(); iter.hasNext(); ) {
        Attributes.Name attrName = (Attributes.Name)iter.next();
        addSpecAttrIfPresent(SPECIFICATION_TITLE, result, attrs, attrName);
        addSpecAttrIfPresent(SPECIFICATION_VERSION, result, attrs, attrName);
      }
      fLogger.fine("Specification-Version: " + result);
View Full Code Here

      InputStream in = jarFile.getInputStream(jarFile.getEntry("META-INF/MANIFEST.MF"));
      Manifest manifest = new Manifest(in);
      in.close();

      // Read the class names
      Attributes attributes = manifest.getMainAttributes();
      String classNameCsv = attributes.getValue("Preparator-Classes");
      if (classNameCsv == null) {
        throw new RegainException("The manifest in preparator file '" + file
            + "' has no 'Preparator-Classes' attribute");
      }
      String[] classNameArr = RegainToolkit.splitString(classNameCsv, ";", true);
View Full Code Here

        if (attributes == null)
        {
            final Manifest man = ((JarFile) getZipFile()).getManifest();
            if (man == null)
            {
                attributes = new Attributes(1);
            }
            else
            {
                attributes = man.getMainAttributes();
                if (attributes == null)
                {
                    attributes = new Attributes(1);
                }
            }
        }

        return attributes;
View Full Code Here

    Object getAttribute(Name attrName)
        throws FileSystemException
    {
        try
        {
            final Attributes attr = getAttributes();
            final String value = attr.getValue(attrName);
            return value;
        }
        catch (IOException ioe)
        {
            throw new FileSystemException(attrName.toString(), ioe);
View Full Code Here

    {
        if (attributes == null)
        {
            if (entry == null)
            {
                attributes = new Attributes(1);
            }
            else
            {
                attributes = ((JarEntry) entry).getAttributes();
                if (attributes == null)
                {
                    attributes = new Attributes(1);
                }
            }
        }

        return attributes;
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);
      }
  }
  if ("true".equalsIgnoreCase(sealed)) {
      sealBase = url;
  }
View Full Code Here

     * Returns true if the specified package name is sealed according to the
     * given manifest.
     */
    private boolean isSealed(String name, Manifest man) {
  String path = name.replace('.', '/').concat("/");
  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

      Connection conn = cf.createConnection();
      assertNotNull(conn);
      ConnectionMetaData meta = conn.getMetaData();
     
      // Compare the value from ConnectionMetaData and MANIFEST.MF
      Attributes attrs = manifest.getMainAttributes();
     
      log.info("META--> " + meta.getJMSMajorVersion());
      log.info("META--> " + meta.getJMSMinorVersion());
      log.info("META--> " + meta.getJMSProviderName());
      log.info("META--> " + meta.getJMSVersion());
      log.info("META--> " + meta.getProviderMajorVersion());
      log.info("META--> " + meta.getProviderMinorVersion());
      log.info("META--> " + meta.getProviderVersion());
     
      Iterator itr = attrs.entrySet().iterator();
      while (itr.hasNext()) {
         Object item = itr.next();
         System.out.println("MANIFEST--> " + item + " : " + attrs.get(item));
      }
     
      assertEquals(attrs.getValue("Implementation-Title"), meta.getJMSProviderName());
      String ver = attrs.getValue("Implementation-Version");
      assertTrue(-1 != ver.indexOf(meta.getProviderVersion()));
   }
View Full Code Here

    }

    private static void buildManifest(HashMap<String, String> argMap)
            throws Exception {
        Manifest m = new Manifest();
        Attributes a = m.getMainAttributes();
        a.put(Attributes.Name.MANIFEST_VERSION, "1.0");
        //a.put("Built-By", "manningr"); // argMap.get(BUILT_BY_KEY)
        a.put("Application-Version", argMap.get(VERSION_KEY));
        a.put(Attributes.Name.CLASS_PATH,
                "lib/antlr-2.7.5H3.jar "
                + "lib/commons-cli.jar "
                + "lib/commons-logging-1.0.4.jar "
                + "lib/forms.jar "
                + "lib/fw.jar "
                + "lib/hibernate3.jar "
                + "lib/jxl.jar "
                + "lib/log4j.jar "
                + "lib/nanoxml-2.1.jar "
                + "lib/openide.jar  "
                + "lib/openide-loaders.jar "
                + "lib/org-netbeans-modules-editor-fold.jar "
                + "lib/org-netbeans-modules-editor.jar "
                + "lib/org-netbeans-modules-editor-lib.jar "
                + "lib/org-netbeans-modules-editor-util.jar "
                + "lib/syntax.jar ");
        a.put(Attributes.Name.MAIN_CLASS,
              "net.sourceforge.squirrel_sql.client.Main");
        m.write(System.out);
    }
View Full Code Here

TOP

Related Classes of java.util.jar.Attributes$Name

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.