public Attributes getManifestAttributes(boolean fixPackage) { Attributes a = new Attributes(); if (!isBundle()) { // this is a regular artifact a.putValue(PROCESSORPID, getProcessorPid()); } else { a.putValue(Constants.BUNDLE_SYMBOLICNAME, getSymbolicName()); a.putValue(Constants.BUNDLE_VERSION, getVersion()); // this is a bundle if (isCustomizer()) { a.putValue(CUSTOMIZER, "true"); } } if (!hasChanged() && fixPackage) { a.putValue("DeploymentPackage-Missing", "true"); } return a; }
@Override public int hashCode() { int result = 11; if (getSymbolicName() != null) { result = result ^ getSymbolicName().hashCode(); } result = result ^ getVersion().hashCode(); result = result ^ getUrl().hashCode(); return result; }
ArtifactDataImpl bundleDataVersionTo = (ArtifactDataImpl) it.next(); if (bundleDataVersionTo.isBundle()) { ArtifactData bundleDataVersionFrom = getBundleData(bundleDataVersionTo.getSymbolicName(), dataVersionFrom); bundleDataVersionTo.setChanged(!bundleDataVersionTo.equals(bundleDataVersionFrom)); ArtifactData bundleDataVersionFrom = getBundleData(bundleDataVersionTo.getUrl(), dataVersionFrom); bundleDataVersionTo.setChanged(bundleDataVersionFrom == null);
result.add(new ArtifactDataImpl(pair.getUrl(), directives, symbolicName, bundleVersion, true)); result.add(new ArtifactDataImpl(pair.getUrl(), directives, true));
public boolean isBundle() { return getSymbolicName() != null; }
/** * make a bundle with the given symbolic name and version in the given file. */ private ArtifactData generateBundle(File file, String symbolicName, String version) throws Exception { ArtifactData bundle = new ArtifactDataImpl(file.getName(), symbolicName, file.length(), version, file.toURI().toURL(), false); BundleStreamGenerator.generateBundle(bundle); return bundle; }
private ArtifactData generateBundle(File file, String symbolicName, String version) throws Exception { // create a mock bundle, which is only used to generate the bundle on disk, and not used for anything else... ArtifactData bundle = new ArtifactDataImpl(file.getName(), symbolicName, -1L, version, file.toURI().toURL(), false); System.out.println("GETVERSION: " + bundle.getVersion()); BundleStreamGenerator.generateBundle(bundle); return bundle; }
@Override public boolean equals(Object other) { if (!(other instanceof ArtifactDataImpl)) { return false; } ArtifactDataImpl jarFile2 = (ArtifactDataImpl) other; if (getSymbolicName() != null) { // this is a bundle return getSymbolicName().equals(jarFile2.getSymbolicName()) && getVersion().equals(jarFile2.getVersion()); } else { // this is another artifact. return m_url.equals(jarFile2.getUrl()); } }
/** * make a bundle with the given symbolic name and version in the given file. */ private ArtifactData generateBundle(File file, Map<String, String> directives, String symbolicName, String version, Map<String, String> additionalHeaders) throws Exception { // create a mock bundle, which is only used to generate the bundle on disk, and not used for anything else... ArtifactData bundle = new ArtifactDataImpl(file.toURI().toURL(), directives, symbolicName, -1L, version, false); if (additionalHeaders == null) { BundleStreamGenerator.generateBundle(bundle); } else { BundleStreamGenerator.generateBundle(bundle, additionalHeaders); } return bundle; }
/** * Create the testbundles in the tempdirectory */ private void setupSampleData() throws Exception { BUNDLE1 = generateBundle(FileUtils.createTempFile(m_tempDirectory), null, "Bundle1", "1.0.0", null); BUNDLE3 = generateBundle(FileUtils.createTempFile(m_tempDirectory), null, "Bundle3", "3.0.0", null); BUNDLE4 = generateBundle(FileUtils.createTempFile(m_tempDirectory), null, "Bundle4", "4.0.0", null); BUNDLE4_1 = generateBundle(FileUtils.createTempFile(m_tempDirectory), null, "Bundle4", "4.1.0", null); BUNDLE5 = generateBundle(FileUtils.createTempFile(m_tempDirectory), null, "Bundle5;singleton:=true", "5.0.0", null); BUNDLE3_2 = generateBundle(FileUtils.createTempFile(m_tempDirectory), null, "Bundle3", "3.0.0", null); BUNDLE4_2 = generateBundle(FileUtils.createTempFile(m_tempDirectory), null, "Bundle4", "5.0.0", null); Map<String, String> attr = new HashMap<>(); attr.put(DIRECTIVE_ISCUSTOMIZER, "true"); RESOURCEPROCESSOR1 = generateBundle(FileUtils.createTempFile(m_tempDirectory), attr, "Autoconf", "1.0.0", null); attr = new HashMap<>(); attr.put(DIRECTIVE_KEY_PROCESSORID, "my.processor.pid"); ARTIFACT1 = new ArtifactDataImpl(FileUtils.createTempFile(m_tempDirectory).toURI().toURL(), attr, false); attr = new HashMap<>(); attr.put(DIRECTIVE_KEY_PROCESSORID, "my.processor.pid"); attr.put(DIRECTIVE_KEY_RESOURCE_ID, "Artifact2"); ARTIFACT2 = new ArtifactDataImpl(FileUtils.createTempFile(m_tempDirectory).toURI().toURL(), attr, false); }