Package java.util.jar

Examples of java.util.jar.Manifest


    public Certificate[] getCertificates() {
        return null;
    }

    public Attributes getAttributes() throws IOException {
        Manifest m = getManifest();
        if (m == null) {
            return null;
        }

        String entry = getUrl().getFile();
        return m.getAttributes(entry);
    }
View Full Code Here


    private static void recursePathJars(String path, ArrayList paths) {
        try {
           
            // check class path information in jar file
            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 != '/') {
View Full Code Here

    public DefaultManifest getEffectiveManifest() {
        ContainedVersionAnalyzer analyzer = analyzerFactory.create();
        DefaultManifest effectiveManifest = new DefaultManifest(null);
        try {
            setAnalyzerProperties(analyzer);
            Manifest osgiManifest = analyzer.calcManifest();
            for (Map.Entry<Object, Object> entry : osgiManifest.getMainAttributes().entrySet()) {
                effectiveManifest.attributes(WrapUtil.toMap(entry.getKey().toString(), (String) entry.getValue()));
            }
            effectiveManifest.attributes(this.getAttributes());
            for(Map.Entry<String, Attributes> ent : getSections().entrySet()) {
                effectiveManifest.attributes(ent.getValue(), ent.getKey());
View Full Code Here

            one(analyzerMock).setProperty(Analyzer.BUNDLE_DOCURL, osgiManifest.getDocURL());
            one(analyzerMock).setProperty(Analyzer.EXPORT_PACKAGE, GUtil.join(osgiManifest.instructionValue(Analyzer.EXPORT_PACKAGE), ","));
            one(analyzerMock).setProperty(Analyzer.IMPORT_PACKAGE, GUtil.join(osgiManifest.instructionValue(Analyzer.IMPORT_PACKAGE), ","));
            one(analyzerMock).setJar(osgiManifest.getClassesDir());
            one(analyzerMock).setClasspath(osgiManifest.getClasspath().getFiles().toArray(new File[osgiManifest.getClasspath().getFiles().size()]));
            Manifest testManifest = new Manifest();
            testManifest.getMainAttributes().putValue(Analyzer.BUNDLE_SYMBOLICNAME, osgiManifest.getSymbolicName());
            testManifest.getMainAttributes().putValue(Analyzer.BUNDLE_NAME, osgiManifest.getName());
            testManifest.getMainAttributes().putValue(Analyzer.BUNDLE_DESCRIPTION, osgiManifest.getDescription());
            testManifest.getMainAttributes().putValue(Analyzer.BUNDLE_LICENSE, osgiManifest.getLicense());
            testManifest.getMainAttributes().putValue(Analyzer.BUNDLE_VENDOR, osgiManifest.getVendor());
            testManifest.getMainAttributes().putValue(Analyzer.BUNDLE_DOCURL, osgiManifest.getDocURL());
            testManifest.getMainAttributes().putValue(Analyzer.EXPORT_PACKAGE, GUtil.join(osgiManifest.instructionValue(Analyzer.EXPORT_PACKAGE), ","));
            testManifest.getMainAttributes().putValue(Analyzer.IMPORT_PACKAGE, GUtil.join(osgiManifest.instructionValue(Analyzer.IMPORT_PACKAGE), ","));
            allowing(analyzerMock).calcManifest();
            will(returnValue(testManifest));
        }});
    }
View Full Code Here

  
   <P>If none of these appear, simply return an empty String.
  */
  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);
      }
View Full Code Here

    try {
      jarFile = new JarFile(file);

      // Load the manifest
      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");
      }
View Full Code Here

    Attributes getAttributes() throws IOException
    {
        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);
                }
            }
View Full Code Here

  URL url = res.getCodeSourceURL();
  if (i != -1) {
      String pkgname = name.substring(0, i);
      // Check if package already loaded.
      Package pkg = getPackage(pkgname);
      Manifest man = res.getManifest();
      if (pkg != null) {
    // Package found, so check package sealing.
    if (pkg.isSealed()) {
        // Verify that code source URL is the same.
        if (!pkg.isSealed(url)) {
View Full Code Here

        }
    }
    // Convert to "."-separated package name
    name = name.substring(0, name.length() - 1).replace('/', '.');
    Package pkg;
    Manifest man = (Manifest)mans.get(fn);
    if (man != null) {
        pkg = new Package(name, man, url, null);
    } else {
        pkg = new Package(name, null, null, null,
              null, null, null, null, null);
View Full Code Here

     */
    private static Manifest loadManifest(String fn) {
  try {
      FileInputStream fis = new FileInputStream(fn);
      JarInputStream jis = new JarInputStream(fis, false);
      Manifest man = jis.getManifest();
      jis.close();
      return man;
  } catch (IOException e) {
      return null;
  }
View Full Code Here

TOP

Related Classes of java.util.jar.Manifest

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.