Package java.util.jar

Examples of java.util.jar.Attributes


  {
    try
    {

      Manifest manifest = new JarFile(f).getManifest();
      Attributes attr = manifest.getMainAttributes();

      String cl = attr.getValue("Class-Path");
      if (cl == null)
        return;
      String[] clArr = cl.split(" ");
      for (int i = 0; i < clArr.length; i++)
      {
View Full Code Here


      Attributes.Name CREATED_BY = new Name("Created-By");
      String WEAVER_CREATED_BY = "AspectJ Compiler";

      manifest = new Manifest();

      Attributes attributes = manifest.getMainAttributes();
      attributes.put(Name.MANIFEST_VERSION, WEAVER_MANIFEST_VERSION);
      attributes.put(CREATED_BY, WEAVER_CREATED_BY);
    }

    return manifest;
  }
View Full Code Here

          Manifest manifest = new JarFile(p).getManifest();
          if (manifest == null) {
            ret = "no manifest found in " + p.getAbsolutePath() + ", expected " + Version.text;
            continue;
          }
          Attributes attr = manifest.getAttributes("org/aspectj/lang/");
          if (null != attr) {
            version = attr.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
            if (null != version) {
              version = version.trim();
            }
          }
          // assume that users of development aspectjrt.jar know what they're doing
View Full Code Here

    if (_manifest == null)
      return null;
   
    Map<String,String> map = new TreeMap<String,String>();

    Attributes attr = _manifest.getMainAttributes();

    if (attr != null) {
      for (Map.Entry<Object,Object> entry : attr.entrySet()) {
        map.put(String.valueOf(entry.getKey()),
                String.valueOf(entry.getValue()));
      }
    }
View Full Code Here

    Manifest manifest = getManifest();

    if (manifest == null)
      return;

    Attributes main = manifest.getMainAttributes();

    if (main == null)
      return;

    String classPath = main.getValue("Class-Path");

    Path pwd = null;

    if (getArchivePath() != null)
      pwd = getArchivePath().getParent();
View Full Code Here

     * @return a default manifest; the Manifest-Version and Created-By attributes are initialized
     */
    protected Manifest createManifest()
    {
        Manifest mf = new Manifest();
        Attributes attrs = mf.getMainAttributes();
        attrs.putValue( Attributes.Name.MANIFEST_VERSION.toString(), "1.0" );
        attrs.putValue( "Created-By", "Apache Maven Bootstrap Mini" );
        return mf;
    }
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

            zipIs = new JarInputStream(is);
            boolean scanForRepos = true;

            Manifest manifest = zipIs.getManifest();
            if (manifest != null) {
                Attributes attr = manifest.getMainAttributes();
                String featureStartSt = (String)attr
                    .get(new Attributes.Name(MANIFEST_ATTR_KARAF_FEATURE_START));
                if ("false".equals(featureStartSt)) {
                    shouldInstallFeatures = false;
                }
                String featureReposAttr = (String)attr
                    .get(new Attributes.Name(MANIFEST_ATTR_KARAF_FEATURE_REPOS));
                if (featureReposAttr != null) {
                    featureRepos.add(new URI(featureReposAttr));
                    scanForRepos = false;
                }
View Full Code Here

            String extensionDirs) {
        if (mainClass == null) {
            return null;
        }
        Manifest manifest = new Manifest();
        Attributes mainAttributes = manifest.getMainAttributes();
        mainAttributes.putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
        if (mainClass != null) {
            mainAttributes.putValue(Attributes.Name.MAIN_CLASS.toString(), mainClass);
        }
        if (mainGBean != null) {
            mainAttributes.putValue(CommandLineManifest.MAIN_GBEAN.toString(), mainGBean);
        }
        if (mainMethod != null) {
            mainAttributes.putValue(CommandLineManifest.MAIN_METHOD.toString(), mainMethod);
        }
        if (manifestConfigurations != null) {
            mainAttributes.putValue(CommandLineManifest.CONFIGURATIONS.toString(), manifestConfigurations);
        }
        if (classPath != null) {
            mainAttributes.putValue(Attributes.Name.CLASS_PATH.toString(), classPath);
        }
        if (endorsedDirs != null) {
            mainAttributes.putValue(CommandLineManifest.ENDORSED_DIRS.toString(), endorsedDirs);
        }
        if (extensionDirs != null) {
            mainAttributes.putValue(CommandLineManifest.EXTENSION_DIRS.toString(), extensionDirs);
        }
        return manifest;
    }
View Full Code Here

        //
        // Build a simple Jar file to test with
        //
        manifest = new Manifest();
        Attributes mainAttributes = manifest.getMainAttributes();
        mainAttributes.put(Attributes.Name.MANIFEST_VERSION, "1.0");
        mainAttributes.putValue("food", "nacho");
        resourceAttributes = new Attributes();
        resourceAttributes.putValue("drink", "margarita");
        manifest.getEntries().put("resource", resourceAttributes);

        File targetDir = new File(BASEDIR, "target");
        jarFile = new File(targetDir, "resourceFinderTest.jar");
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.