Refine search
public void addManifestV0(final String embulkPluginMainClass) { final Attributes attributes = this.manifest.getMainAttributes(); attributes.put(Attributes.Name.MANIFEST_VERSION, "1.0"); attributes.putValue(MANIFEST_PLUGIN_SPI_VERSION, "0"); attributes.putValue(MANIFEST_PLUGIN_MAIN_CLASS, embulkPluginMainClass); }
Manifest input = jar.getManifest(); Manifest output = new Manifest(); Attributes main = output.getMainAttributes(); if (input != null) { main.putAll(input.getMainAttributes()); main.putValue("Manifest-Version", "1.0"); main.putValue("Created-By", "1.6.0_21 (d2j-" + AbstractJarSign.class.getPackage().getImplementationVersion() + ")"); attr.putValue(digName, encodeBase64(md.digest())); output.getEntries().put(name, attr);
OutputManifestFile manifest) { Manifest sf = new Manifest(); Attributes mainAttrs = sf.getMainAttributes(); mainAttrs.put(Attributes.Name.SIGNATURE_VERSION, ATTRIBUTE_VALUE_SIGNATURE_VERSION); mainAttrs.put(ATTRIBUTE_NAME_CREATED_BY, ATTRIBUTE_DEFALT_VALUE_CREATED_BY); mainAttrs.putValue( getManifestDigestAttributeName(manifestDigestAlgorithm), Base64.getEncoder().encodeToString(md.digest(manifest.contents))); byte[] sectionDigest = md.digest(sectionContents); Attributes attrs = new Attributes(); attrs.putValue( entryDigestAttributeName, Base64.getEncoder().encodeToString(sectionDigest));
mainAttrs.putAll(sourceManifest.getMainAttributes()); } else { mainAttrs.put(Attributes.Name.MANIFEST_VERSION, ATTRIBUTE_VALUE_MANIFEST_VERSION); byte[] entryDigest = jarEntryDigests.get(entryName); Attributes entryAttrs = new Attributes(); entryAttrs.putValue( entryDigestAttributeName, Base64.getEncoder().encodeToString(entryDigest));
GeneralSecurityException { Manifest sf = new Manifest(); Attributes main = sf.getMainAttributes(); main.putValue("Signature-Version", "1.0"); main.putValue("Created-By", "1.6.0_21 (d2j-" + AbstractJarSign.class.getPackage().getImplementationVersion() + ")"); main.putValue(digestAlg + "-Digest-Manifest", encodeBase64(md.digest())); m2.getMainAttributes().putAll(manifest.getMainAttributes()); m2.write(print); main.putValue(digestAlg + "-Digest-Manifest-Main-Attributes", encodeBase64(md.digest())); sfAttr.putValue(digName, encodeBase64(md.digest())); sf.getEntries().put(entry.getKey(), sfAttr);
private void enqueueDownload(String pluginKey, String pluginHash) throws IOException { File jar = temp.newFile(); Manifest manifest = new Manifest(); manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0"); manifest.getMainAttributes().putValue("Plugin-Key", pluginKey); try (JarOutputStream output = new JarOutputStream(FileUtils.openOutputStream(jar), manifest)) { } doReturn(Optional.of(jar)).when(pluginFiles).get(argThat(p -> pluginKey.equals(p.key) && pluginHash.equals(p.hash))); }
jarManifest.getMainAttributes().putValue( Attributes.Name.MANIFEST_VERSION.toString(), "1.0"); jarManifest.getMainAttributes().putValue( Attributes.Name.CLASS_PATH.toString(), jarClassPath);
@Test public void singleManifest() throws Exception { Manifest mf = new Manifest(); mf.getMainAttributes().putValue("foo", "bar"); mf.getMainAttributes().putValue("other", "value"); File jar = createJar(mf, "singleManifest.jar"); URLClassLoader classloader = new URLClassLoader(FileUtils.toURLs(new File[]{jar})); List<String> values = ManifestUtils.getPropertyValues(classloader, "foo"); assertThat(values).containsOnly("bar"); }
@Test public void manyManifests() throws Exception { Manifest mf1 = new Manifest(); mf1.getMainAttributes().putValue("foo", "bar"); File jar1 = createJar(mf1, "manyManifests-one.jar"); Manifest mf2 = new Manifest(); mf2.getMainAttributes().putValue("foo", "otherbar"); File jar2 = createJar(mf2, "manyManifests-two.jar"); URLClassLoader classloader = new URLClassLoader(FileUtils.toURLs(new File[]{jar1, jar2})); List<String> values = ManifestUtils.getPropertyValues(classloader, "foo"); assertThat(values).containsOnly("bar", "otherbar"); }
final Attributes attributes = manifest.getMainAttributes(); attributes.putValue(CREATED_BY, "Apache Ant " + getProject().getProperty(MagicNames.ANT_VERSION));
public JarEmitter(File outFile) throws IOException { Manifest m = new Manifest(); m.getMainAttributes().putValue("Created-By", RequestFactoryJarExtractor.class.getCanonicalName()); m.getMainAttributes(); out = new JarOutputStream(new FileOutputStream(outFile), m); }
public static java.util.jar.Manifest getDefaultManifest() throws ArchiverException { final java.util.jar.Manifest defaultManifest = new java.util.jar.Manifest(); defaultManifest.getMainAttributes().putValue( "Manifest-Version", "1.0" ); String createdBy = "Plexus Archiver"; final String plexusArchiverVersion = getArchiverVersion(); if ( plexusArchiverVersion != null ) { createdBy += " " + plexusArchiverVersion; } defaultManifest.getMainAttributes().putValue( "Created-By", createdBy ); return defaultManifest; }
private void createJarFromClassPathResources(final FileOutputStream fos, final String location) throws IOException { final Manifest m = new Manifest(); m.clear(); final Attributes global = m.getMainAttributes(); if (global.getValue(Attributes.Name.MANIFEST_VERSION) == null) { global.put(Attributes.Name.MANIFEST_VERSION, "1.0"); } final File mylocation = new File(location); global.putValue(BOOT_CLASSPATH, getBootClassPath(mylocation)); global.putValue(PREMAIN_CLASS, AGENT_CLASS_NAME); global.putValue(CAN_REDEFINE_CLASSES, "true"); global.putValue(CAN_SET_NATIVE_METHOD, "true"); try (JarOutputStream jos = new JarOutputStream(fos, m)) { addClass(HotSwapAgent.class, jos); addClass(CodeCoverageStore.class, jos); addClass(InvokeReceiver.class, jos); } }
Attributes attributes = manifest.getMainAttributes(); attributes.putValue("Agent-Class", Agent.class.getName()); attributes.put(Attributes.Name.MANIFEST_VERSION, "1.0"); attributes.put(Attributes.Name.CLASS_PATH, buffer.toString());
public static Manifest createManifest() { Manifest mf = new Manifest(); Attributes attrs = mf.getMainAttributes(); attrs.putValue("Bundle-SymbolicName", "org.nuxeo.osgi.app"); attrs.putValue("Bundle-Name", "Nuxeo App System Bundle"); attrs.putValue("Bundle-Vendor", "Nuxeo"); attrs.putValue("Bundle-Version", "1.0.0"); return mf; }
/** * Set the symbolic name of the bundle * @param name * @return */ public ManifestFixture symbolicName(String name) { mf.getMainAttributes().putValue(Constants.BUNDLE_SYMBOLICNAME, name); return this; }
/** * Add a custom attribute to the manifest. Use the more specific methods for symbolic name and version. * @param name * @param value * @return */ public ManifestFixture attribute(String name, String value) { mf.getMainAttributes().putValue(name, value); return this; }
public DirectoryBizArchive(String className, String methodName, URL[] urls) { this.className = (className == null ? MOCK_IDE_ARK_BIZ_MAIN_CLASS : className); this.methodName = methodName; manifest.getMainAttributes().putValue(MAIN_CLASS_ATTRIBUTE, this.className); manifest.getMainAttributes().putValue(PRIORITY_ATTRIBUTE, String.valueOf(MOCK_IDE_BIZ_STARTUP_PRIORITY)); manifest.getMainAttributes().putValue(ARK_BIZ_NAME, MOCK_IDE_ARK_BIZ_NAME); manifest.getMainAttributes().putValue(ARK_BIZ_VERSION, MOCK_IDE_ARK_BIZ_VERSION); this.urls = urls; }
/** * Set the version of the bundle * @param version * @return */ public ManifestFixture version(String version) { mf.getMainAttributes().putValue(Constants.BUNDLE_VERSION, version); return this; }
public DirectoryBizArchive(String className, String methodName, String methodDescription, URL[] urls) { this.className = (className == null ? MOCK_IDE_ARK_BIZ_MAIN_CLASS : className); this.methodName = methodName; this.methodDescription = methodDescription; manifest.getMainAttributes().putValue(MAIN_CLASS_ATTRIBUTE, this.className); manifest.getMainAttributes().putValue(PRIORITY_ATTRIBUTE, String.valueOf(MOCK_IDE_BIZ_STARTUP_PRIORITY)); manifest.getMainAttributes().putValue(ARK_BIZ_NAME, MOCK_IDE_ARK_BIZ_NAME); manifest.getMainAttributes().putValue(ARK_BIZ_VERSION, MOCK_IDE_ARK_BIZ_VERSION); this.urls = urls; }