Package java.util.jar

Examples of java.util.jar.Manifest$WriteManifest


        runtime.getJRubyClassLoader().addURL(jarFile);

        try {
            JarInputStream in = new JarInputStream(new BufferedInputStream(jarFile.openStream()));

            Manifest mf = in.getManifest();
            if (mf != null) {
                String rubyInit = mf.getMainAttributes().getValue("Ruby-Init");
                if (rubyInit != null) {
                    JarEntry entry = in.getNextJarEntry();
                    while (entry != null && !entry.getName().equals(rubyInit)) {
                        entry = in.getNextJarEntry();
                    }
View Full Code Here


  /*
   * If we are writing to an output directory copy the manifest but only if we already have one
   */
  private void writeManifest() throws IOException {
    Manifest manifest = getWeaver().getManifest(false);
    if (manifest != null && zos == null) {
      File outputDir = buildConfig.getOutputDir();
      if (buildConfig.getCompilationResultDestinationManager() != null) {
        // Manifests are only written if we have a jar on the inpath. Therefore,
        // we write the manifest to the defaultOutputLocation because this is
        // where we sent the classes that were on the inpath
        outputDir = buildConfig.getCompilationResultDestinationManager().getDefaultOutputLocation();
      }
      if (outputDir == null) {
        return;
      }
      File outputLocation = new File(outputDir, MANIFEST_NAME);
      OutputStream fos = FileUtil.makeOutputStream(outputLocation);
      manifest.write(fos);
      fos.close();
      if (buildConfig.getCompilationResultDestinationManager() != null) {
        buildConfig.getCompilationResultDestinationManager().reportFileWrite(outputLocation.getPath(),
            CompilationResultDestinationManager.FILETYPE_RESOURCE);
      }
View Full Code Here

      // pr112830, allow variations on aspectjrt.jar of the form aspectjrtXXXXXX.jar
      if (p.isFile() && p.getName().startsWith("aspectjrt") && p.getName().endsWith(".jar")) {

        try {
          String version = null;
          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();
            }
View Full Code Here

    Path path = getRootDirectory().lookup("META-INF/MANIFEST.MF");
    if (path.canRead()) {
      ReadStream is = path.openRead();
     
      try {
        _manifest = new Manifest(is);
      } catch (IOException e) {
        log.warning(L.l("{0} Manifest file cannot be read for '{1}'.\n  {2}",
                        this, getRootDirectory(), e));

        log.log(Level.FINE, e.toString(), e);
View Full Code Here

    DynamicClassLoader loader = Environment.getDynamicClassLoader();

    if (loader == null)
      return;

    Manifest manifest = getManifest();

    if (manifest == null)
      return;

    Attributes main = manifest.getMainAttributes();

    if (main == null)
      return;

    String classPath = main.getValue("Class-Path");
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

            }
            String karPath = storage + File.separator + repoName + ".kar";
            File karFile = new File(karPath);
            karFile.getParentFile().mkdirs();
            fos = new FileOutputStream(karFile);
            Manifest manifest = createNonAutoStartManifest(repo.getURI());
            jos = new JarOutputStream(new BufferedOutputStream(fos, 100000), manifest);
           
            Map<URI, Integer> locationMap = new HashMap<URI, Integer>();
            copyResourceToJar(jos, repo.getURI(), locationMap);
       
View Full Code Here

    private Manifest createNonAutoStartManifest(URI repoUri) throws UnsupportedEncodingException, IOException {
        String manifestSt = "Manifest-Version: 1.0\n" +
            Kar.MANIFEST_ATTR_KARAF_FEATURE_START +": false\n" +
            Kar.MANIFEST_ATTR_KARAF_FEATURE_REPOS + ": " + repoUri.toString() + "\n";
        InputStream manifestIs = new ByteArrayInputStream(manifestSt.getBytes("UTF-8"));
        Manifest manifest = new Manifest(manifestIs);
        return manifest;
    }
View Full Code Here

            LOGGER.debug("Uncompress the KAR file {} into directory {}", karUri, repoDir);
            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;
                }
View Full Code Here

            if (manifestFile.isFile() && manifestFile.canRead()) {
                FileInputStream in = null;
                try {
                    in = new FileInputStream(manifestFile);
                    manifest = new Manifest(in);
                } finally {
                    IoUtil.close(in);
                }
            }
            manifestLoaded = true;
View Full Code Here

TOP

Related Classes of java.util.jar.Manifest$WriteManifest

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.