mirror of https://github.com/apache/ant-ivy
IVY-1241: Cleanup of the code and make the unit tests pass
git-svn-id: https://svn.apache.org/repos/asf/ant/ivy/core/trunk@1040596 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8cc389ea41
commit
29507b64c3
|
|
@ -427,13 +427,11 @@
|
|||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="prepare-test" depends="resolve" unless="skip.test">
|
||||
<target name="prepare-osgi-tests" depends="resolve" unless="skip.test">
|
||||
<ant dir="${basedir}/test/test-repo" target="generate-bundles" />
|
||||
<ant dir="${basedir}/test/test-bundles" target="build-all" />
|
||||
<ant dir="${basedir}/test/test-bundles" target="ivy" />
|
||||
</target>
|
||||
|
||||
<target name="test-internal" depends="build-test, init-tests" unless="skip.test">
|
||||
<target name="test-internal" depends="build-test, init-tests, prepare-osgi-tests" unless="skip.test">
|
||||
<mkdir dir="${test.xml.dir}" />
|
||||
|
||||
<junit
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ vsftp = org.apache.ivy.plugins.resolver.VsftpResolver
|
|||
vfs = org.apache.ivy.plugins.resolver.VfsResolver
|
||||
cache = org.apache.ivy.plugins.resolver.CacheResolver
|
||||
packager = org.apache.ivy.plugins.resolver.packager.PackagerResolver
|
||||
obr = org.apache.ivy.osgi.obr.OBRResolver
|
||||
|
||||
latest-revision = org.apache.ivy.plugins.latest.LatestRevisionStrategy
|
||||
latest-lexico = org.apache.ivy.plugins.latest.LatestLexicographicStrategy
|
||||
|
|
|
|||
|
|
@ -1,121 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package org.apache.ivy.osgi.ivy;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.ivy.core.module.descriptor.Artifact;
|
||||
import org.apache.ivy.core.module.descriptor.DefaultArtifact;
|
||||
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
|
||||
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||
import org.apache.ivy.core.resolve.ResolveData;
|
||||
import org.apache.ivy.osgi.ivy.internal.FilePackageScanner;
|
||||
import org.apache.ivy.osgi.ivy.internal.JarEntryResource;
|
||||
import org.apache.ivy.osgi.ivy.internal.JarFileRepository;
|
||||
import org.apache.ivy.osgi.util.ZipUtil;
|
||||
import org.apache.ivy.plugins.repository.Resource;
|
||||
import org.apache.ivy.plugins.repository.file.FileRepository;
|
||||
import org.apache.ivy.plugins.repository.file.FileResource;
|
||||
import org.apache.ivy.plugins.resolver.FileSystemResolver;
|
||||
import org.apache.ivy.plugins.resolver.util.ResolvedResource;
|
||||
import org.apache.ivy.util.Message;
|
||||
|
||||
/**
|
||||
* An OSGi file system resolver.
|
||||
*/
|
||||
public class OsgiFileResolver extends FileSystemResolver {
|
||||
|
||||
private final FilePackageScanner packageScanner = new FilePackageScanner();
|
||||
|
||||
public OsgiFileResolver() {
|
||||
setRepository(new JarFileRepository());
|
||||
}
|
||||
|
||||
public ResolvedResource findArtifactRef(Artifact artifact, Date date) {
|
||||
Message.debug("\tfind artifact ref: artifact=" + artifact + ", date=" + date);
|
||||
|
||||
final ModuleRevisionId newMrid = artifact.getModuleRevisionId();
|
||||
ResolvedResource resolvedResource = findResourceUsingPatterns(newMrid,
|
||||
getArtifactPatterns(), artifact, getDefaultRMDParser(artifact.getModuleRevisionId()
|
||||
.getModuleId()), date);
|
||||
|
||||
Message.debug("\t\tfind artifact ref: mrid=" + newMrid + ", resource=" + resolvedResource);
|
||||
|
||||
if (resolvedResource == null) {
|
||||
Message.debug("\t\tfind artifact file ref: resource was null");
|
||||
return null;
|
||||
}
|
||||
|
||||
final Resource resource = resolvedResource.getResource();
|
||||
if ((resource instanceof FileResource) && ((FileResource) resource).getFile().isDirectory()) {
|
||||
FileResource dirResource = (FileResource) resource;
|
||||
try {
|
||||
final File bundleZipFile = File.createTempFile("ivy-osgi-" + newMrid, ".zip");
|
||||
ZipUtil.zip(dirResource.getFile(), new FileOutputStream(bundleZipFile));
|
||||
Message.debug("\t\tfind artifact ref: zip file=" + bundleZipFile);
|
||||
return new ResolvedResource(new FileResource(dirResource.getRepository(),
|
||||
bundleZipFile), resolvedResource.getRevision());
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException("Failed to create temp zip file for bundle:"
|
||||
+ newMrid);
|
||||
}
|
||||
}
|
||||
|
||||
Message.debug("\t\tfind artifact ref: resource=" + resolvedResource);
|
||||
return resolvedResource;
|
||||
}
|
||||
|
||||
public ResolvedResource findIvyFileRef(DependencyDescriptor dd, ResolveData data) {
|
||||
packageScanner.scanAllPackageExportHeaders(getIvyPatterns(), getSettings());
|
||||
|
||||
Message.debug("\tfind ivy file ref: dd=" + dd + ", data=" + data);
|
||||
|
||||
final ModuleRevisionId newMrid = dd.getDependencyRevisionId();
|
||||
final ResolvedResource bundleResolvedResource = findResourceUsingPatterns(newMrid,
|
||||
getIvyPatterns(), DefaultArtifact.newIvyArtifact(newMrid, data.getDate()),
|
||||
getRMDParser(dd, data), data.getDate());
|
||||
|
||||
if (bundleResolvedResource == null) {
|
||||
Message.debug("\tfind ivy file ref: resource was null");
|
||||
return null;
|
||||
}
|
||||
|
||||
final Resource bundleResource = bundleResolvedResource.getResource();
|
||||
|
||||
Resource res = null;
|
||||
if ((bundleResource instanceof FileResource)
|
||||
&& ((FileResource) bundleResource).getFile().isDirectory()) {
|
||||
final FileResource fileResource = (FileResource) bundleResource;
|
||||
res = new FileResource((FileRepository) getRepository(), new File(
|
||||
fileResource.getFile(), "META-INF/MANIFEST.MF"));
|
||||
} else if (bundleResource.getName().toUpperCase().endsWith(".JAR")) {
|
||||
res = new JarEntryResource(bundleResource, "META-INF/MANIFEST.MF");
|
||||
}
|
||||
|
||||
ResolvedResource resolvedResource = new ResolvedResource(res,
|
||||
bundleResolvedResource.getRevision());
|
||||
|
||||
Message.debug("\tfind ivy file ref: resource=" + bundleResolvedResource);
|
||||
|
||||
return resolvedResource;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,197 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package org.apache.ivy.osgi.ivy;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.text.ParseException;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.ivy.core.module.descriptor.Artifact;
|
||||
import org.apache.ivy.core.module.descriptor.Configuration;
|
||||
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
|
||||
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
|
||||
import org.apache.ivy.core.module.descriptor.ExcludeRule;
|
||||
import org.apache.ivy.core.module.descriptor.License;
|
||||
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
||||
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||
import org.apache.ivy.plugins.parser.ModuleDescriptorParser;
|
||||
import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry;
|
||||
import org.apache.ivy.plugins.parser.ParserSettings;
|
||||
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
|
||||
import org.apache.ivy.plugins.repository.url.URLResource;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public class OsgiIvyParser extends XmlModuleDescriptorParser {
|
||||
|
||||
public static class OsgiParser extends Parser {
|
||||
|
||||
private ModuleDescriptor manifestMD = null;
|
||||
|
||||
public OsgiParser(ModuleDescriptorParser parser, ParserSettings ivySettings) {
|
||||
super(parser, ivySettings);
|
||||
}
|
||||
|
||||
protected void infoStarted(Attributes attributes) {
|
||||
String manifest = attributes.getValue("manifest");
|
||||
if (manifest != null) {
|
||||
try {
|
||||
manifestMD = parseManifest(manifest);
|
||||
includeMdInfo(getMd(), manifestMD);
|
||||
} catch (SAXException e) {
|
||||
// it is caught in the startElement method
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
super.infoStarted(attributes);
|
||||
}
|
||||
|
||||
public ModuleDescriptor parseManifest(String manifest) throws SAXException {
|
||||
if (getDescriptorURL() == null) {
|
||||
throw new SAXException(
|
||||
"A reference to a manifest is only supported on module descriptors which are parsed from an URL");
|
||||
}
|
||||
URL includedUrl;
|
||||
try {
|
||||
includedUrl = getSettings().getRelativeUrlResolver().getURL(getDescriptorURL(),
|
||||
manifest);
|
||||
} catch (MalformedURLException e) {
|
||||
SAXException pe = new SAXException("Incorrect relative url of the include in '"
|
||||
+ getDescriptorURL() + "' (" + e.getMessage() + ")");
|
||||
pe.initCause(e);
|
||||
throw pe;
|
||||
}
|
||||
URLResource includeResource = new URLResource(includedUrl);
|
||||
ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(
|
||||
includeResource);
|
||||
ModuleDescriptor manifestMd;
|
||||
try {
|
||||
manifestMd = parser.parseDescriptor(getSettings(), includeResource.getURL(),
|
||||
includeResource, isValidate());
|
||||
} catch (ParseException e) {
|
||||
SAXException pe = new SAXException("Incorrect included md '" + includeResource
|
||||
+ "' in '" + getDescriptorURL() + "' (" + e.getMessage() + ")");
|
||||
pe.initCause(e);
|
||||
throw pe;
|
||||
} catch (IOException e) {
|
||||
SAXException pe = new SAXException("Unreadable included md '" + includeResource
|
||||
+ "' in '" + getDescriptorURL() + "' (" + e.getMessage() + ")");
|
||||
pe.initCause(e);
|
||||
throw pe;
|
||||
}
|
||||
return manifestMd;
|
||||
}
|
||||
|
||||
public void endDocument() throws SAXException {
|
||||
if (manifestMD != null) {
|
||||
includeMdDepedencies(getMd(), manifestMD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected Parser newParser(ParserSettings ivySettings) {
|
||||
return new OsgiParser(this, ivySettings);
|
||||
}
|
||||
|
||||
private static void includeMdInfo(DefaultModuleDescriptor md, ModuleDescriptor include) {
|
||||
ModuleRevisionId mrid = include.getModuleRevisionId();
|
||||
if (mrid != null) {
|
||||
md.setModuleRevisionId(mrid);
|
||||
}
|
||||
|
||||
ModuleRevisionId resolvedMrid = include.getResolvedModuleRevisionId();
|
||||
if (resolvedMrid != null) {
|
||||
md.setResolvedModuleRevisionId(resolvedMrid);
|
||||
}
|
||||
|
||||
String description = include.getDescription();
|
||||
if (description != null) {
|
||||
md.setDescription(description);
|
||||
}
|
||||
|
||||
String homePage = include.getHomePage();
|
||||
if (homePage != null) {
|
||||
md.setHomePage(homePage);
|
||||
}
|
||||
|
||||
long lastModified = include.getLastModified();
|
||||
if (lastModified > md.getLastModified()) {
|
||||
md.setLastModified(lastModified);
|
||||
}
|
||||
|
||||
String status = include.getStatus();
|
||||
if (status != null) {
|
||||
md.setStatus(status);
|
||||
}
|
||||
|
||||
Map/* <String, String> */extraInfo = include.getExtraInfo();
|
||||
if (extraInfo != null) {
|
||||
Iterator itInfo = extraInfo.entrySet().iterator();
|
||||
while (itInfo.hasNext()) {
|
||||
Entry/* <String, String> */info = (Entry) itInfo.next();
|
||||
md.addExtraInfo((String) info.getKey(), (String) info.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
License[] licenses = include.getLicenses();
|
||||
if (licenses != null) {
|
||||
for (int i = 0; i < licenses.length; i++) {
|
||||
md.addLicense(licenses[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Configuration[] configurations = include.getConfigurations();
|
||||
if (configurations != null) {
|
||||
for (int i = 0; i < configurations.length; i++) {
|
||||
md.addConfiguration(configurations[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void includeMdDepedencies(DefaultModuleDescriptor md, ModuleDescriptor include) {
|
||||
Artifact[] artifacts = include.getAllArtifacts();
|
||||
if (artifacts != null) {
|
||||
for (int i = 0; i < artifacts.length; i++) {
|
||||
String[] artifactConfs = artifacts[i].getConfigurations();
|
||||
for (int j = 0; j < artifactConfs.length; j++) {
|
||||
md.addArtifact(artifactConfs[j], artifacts[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DependencyDescriptor[] dependencies = include.getDependencies();
|
||||
if (dependencies != null) {
|
||||
for (int i = 0; i < dependencies.length; i++) {
|
||||
md.addDependency(dependencies[i]);
|
||||
}
|
||||
}
|
||||
|
||||
ExcludeRule[] excludeRules = include.getAllExcludeRules();
|
||||
if (excludeRules != null) {
|
||||
for (int i = 0; i < excludeRules.length; i++) {
|
||||
md.addExcludeRule(excludeRules[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,261 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package org.apache.ivy.osgi.ivy;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.jar.JarInputStream;
|
||||
import java.util.jar.Manifest;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.ivy.core.module.descriptor.Configuration;
|
||||
import org.apache.ivy.core.module.descriptor.DefaultArtifact;
|
||||
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
|
||||
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
|
||||
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
||||
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||
import org.apache.ivy.osgi.core.BundleInfo;
|
||||
import org.apache.ivy.osgi.core.BundleRequirement;
|
||||
import org.apache.ivy.osgi.core.ExportPackage;
|
||||
import org.apache.ivy.osgi.core.ManifestParser;
|
||||
import org.apache.ivy.osgi.ivy.internal.PackageRegistry;
|
||||
import org.apache.ivy.osgi.util.NameUtil;
|
||||
import org.apache.ivy.osgi.util.NameUtil.OrgAndName;
|
||||
import org.apache.ivy.plugins.parser.AbstractModuleDescriptorParser;
|
||||
import org.apache.ivy.plugins.parser.ModuleDescriptorParser;
|
||||
import org.apache.ivy.plugins.parser.ParserSettings;
|
||||
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorWriter;
|
||||
import org.apache.ivy.plugins.repository.Resource;
|
||||
import org.apache.ivy.plugins.repository.file.FileResource;
|
||||
import org.apache.ivy.util.Message;
|
||||
|
||||
/**
|
||||
* An parser for OSGi Manifest descriptor.
|
||||
*/
|
||||
public class OsgiManifestParser extends AbstractModuleDescriptorParser {
|
||||
|
||||
public static final String PACKAGE = ".package";
|
||||
|
||||
protected static final Pattern PATH_REGEX = Pattern
|
||||
.compile("(.*/)?([\\w\\.]+)[\\-_](\\d\\.\\d\\.\\d)[\\.]?([\\w]+)?");
|
||||
|
||||
private static final OsgiManifestParser INSTANCE = new OsgiManifestParser();
|
||||
|
||||
public static OsgiManifestParser getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public boolean accept(Resource res) {
|
||||
if (res == null || res.getName() == null || res.getName().trim().equals("")) {
|
||||
return false;
|
||||
}
|
||||
return res.getName().toUpperCase().endsWith("META-INF/MANIFEST.MF")
|
||||
|| res.getName().toUpperCase().endsWith(".JAR")
|
||||
|| res.getName().toUpperCase().endsWith(".PKGREF");
|
||||
}
|
||||
|
||||
public ModuleDescriptor parseDescriptor(ParserSettings ivySettings, URL descriptorURL,
|
||||
Resource res, boolean validate) throws ParseException, IOException {
|
||||
|
||||
Message.debug("\tparse descriptor: resource=" + res);
|
||||
|
||||
final InternalParser parser = new InternalParser(this);
|
||||
parser.parse(res, ivySettings);
|
||||
return parser.getModuleDescriptor();
|
||||
}
|
||||
|
||||
public ModuleDescriptor parseExports(Resource res) throws ParseException, IOException {
|
||||
|
||||
Message.debug("\tparse descriptor: resource=" + res);
|
||||
|
||||
final InternalParser parser = new InternalParser(this);
|
||||
parser.parse(res, true);
|
||||
return parser.getModuleDescriptor();
|
||||
}
|
||||
|
||||
public void toIvyFile(InputStream is, Resource res, File destFile, ModuleDescriptor md)
|
||||
throws ParseException, IOException {
|
||||
try {
|
||||
XmlModuleDescriptorWriter.write(md, destFile);
|
||||
} finally {
|
||||
if (is != null) {
|
||||
is.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class InternalParser extends AbstractParser {
|
||||
|
||||
protected InternalParser(ModuleDescriptorParser parser) {
|
||||
super(parser);
|
||||
}
|
||||
|
||||
public void parse(Resource res, ParserSettings ivySettings) throws IOException {
|
||||
parse(res, false);
|
||||
}
|
||||
|
||||
public void parse(Resource res, boolean useExports) throws IOException {
|
||||
Manifest manifest;
|
||||
if ((res instanceof FileResource) && ((FileResource) res).getFile().isDirectory()) {
|
||||
manifest = new Manifest(
|
||||
new FileInputStream(res.getName() + "/META-INF/MANIFEST.MF"));
|
||||
} else if (res.getName().toUpperCase().endsWith(".JAR")) {
|
||||
manifest = new JarInputStream(res.openStream()).getManifest();
|
||||
} else {
|
||||
manifest = new Manifest(res.openStream());
|
||||
}
|
||||
|
||||
if (manifest == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
BundleInfo info;
|
||||
try {
|
||||
info = ManifestParser.parseManifest(manifest);
|
||||
} catch (ParseException e) {
|
||||
IOException ioe = new IOException();
|
||||
ioe.initCause(e);
|
||||
throw ioe;
|
||||
}
|
||||
|
||||
setResource(res);
|
||||
|
||||
// Set Info
|
||||
OrgAndName orgAndName = NameUtil.instance().asOrgAndName(info.getSymbolicName());
|
||||
final ModuleRevisionId mrid = ModuleRevisionId.newInstance(orgAndName.org,
|
||||
orgAndName.name, info.getVersion().toString());
|
||||
|
||||
getMd().setDescription(info.getDescription());
|
||||
getMd().setResolvedPublicationDate(new Date(res.getLastModified()));
|
||||
getMd().setModuleRevisionId(mrid);
|
||||
getMd().addConfiguration(new Configuration("default"));
|
||||
getMd().addConfiguration(new Configuration("optional"));
|
||||
getMd().addConfiguration(new Configuration("source"));
|
||||
getMd().setStatus("release");
|
||||
getMd().addArtifact(
|
||||
"default",
|
||||
new DefaultArtifact(mrid, getDefaultPubDate(), info.getSymbolicName(), "jar", "jar"));
|
||||
getMd().addArtifact(
|
||||
"source",
|
||||
new DefaultArtifact(mrid, getDefaultPubDate(), info.getSymbolicName() + ".source",
|
||||
"src", "jar"));
|
||||
|
||||
if (useExports) {
|
||||
addExports(getMd(), info.getExports());
|
||||
} else {
|
||||
Set/* <ModuleRevisionId> */processedDeps = new HashSet/* <ModuleRevisionId> */();
|
||||
processedDeps.add(mrid);
|
||||
|
||||
addRequiredBundles(getMd(), info.getRequires(), processedDeps);
|
||||
addImports(getMd(), info.getImports(), processedDeps);
|
||||
}
|
||||
|
||||
Message.debug("\t\tparse: bundle info: " + info);
|
||||
}
|
||||
|
||||
protected void addExports(DefaultModuleDescriptor parent,
|
||||
Set/* <ExportPackage> */bundleDependencies) {
|
||||
Iterator itDeps = bundleDependencies.iterator();
|
||||
while (itDeps.hasNext()) {
|
||||
ExportPackage dep = (ExportPackage) itDeps.next();
|
||||
String rev = "";
|
||||
if (dep.getVersion() != null) {
|
||||
rev = dep.getVersion().toString();
|
||||
}
|
||||
|
||||
final ModuleRevisionId depMrid = ModuleRevisionId.newInstance(PACKAGE,
|
||||
dep.getName(), rev);
|
||||
final DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(parent,
|
||||
depMrid, false, false, true);
|
||||
dd.addDependencyConfiguration("default", "default");
|
||||
parent.addDependency(dd);
|
||||
}
|
||||
}
|
||||
|
||||
protected void addRequiredBundles(DefaultModuleDescriptor parent,
|
||||
Set/* <BundleRequirement> */bundleDependencies,
|
||||
Set/* <ModuleRevisionId> */processedDeps) {
|
||||
Iterator itDeps = bundleDependencies.iterator();
|
||||
while (itDeps.hasNext()) {
|
||||
BundleRequirement dep = (BundleRequirement) itDeps.next();
|
||||
String rev = "";
|
||||
if (dep.getVersion() != null) {
|
||||
rev = dep.getVersion().toIvyRevision();
|
||||
}
|
||||
|
||||
OrgAndName orgAndName = NameUtil.instance().asOrgAndName(dep.getName());
|
||||
final ModuleRevisionId depMrid = ModuleRevisionId.newInstance(orgAndName.org,
|
||||
orgAndName.name, rev);
|
||||
|
||||
if (processedDeps.contains(depMrid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
processedDeps.add(depMrid);
|
||||
|
||||
final DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(parent,
|
||||
depMrid, false, false, true);
|
||||
if (dep.getResolution() == null) {
|
||||
dd.addDependencyConfiguration("default", "default");
|
||||
} else {
|
||||
dd.addDependencyConfiguration(dep.getResolution(), dep.getResolution());
|
||||
}
|
||||
parent.addDependency(dd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void addImports(DefaultModuleDescriptor parent,
|
||||
Set/* <BundleRequirement> */bundleDependencies,
|
||||
Set/* <ModuleRevisionId> */processedDeps) {
|
||||
Iterator itDeps = bundleDependencies.iterator();
|
||||
while (itDeps.hasNext()) {
|
||||
BundleRequirement dep = (BundleRequirement) itDeps.next();
|
||||
final ModuleRevisionId pkgMrid = PackageRegistry.getInstance().processImports(
|
||||
dep.getName(), dep.getVersion());
|
||||
|
||||
if (processedDeps.contains(pkgMrid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
processedDeps.add(pkgMrid);
|
||||
|
||||
if (pkgMrid != null) {
|
||||
final DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(parent,
|
||||
pkgMrid, false, false, true);
|
||||
if (dep.getResolution() == null) {
|
||||
dd.addDependencyConfiguration("default", "default");
|
||||
} else {
|
||||
dd.addDependencyConfiguration(dep.getResolution(), dep.getResolution());
|
||||
}
|
||||
parent.addDependency(dd);
|
||||
} else {
|
||||
Message.error("Failed to resolve imported package: " + dep);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,235 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package org.apache.ivy.osgi.ivy;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.ivy.core.IvyContext;
|
||||
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||
import org.apache.ivy.plugins.latest.ArtifactInfo;
|
||||
import org.apache.ivy.plugins.latest.ComparatorLatestStrategy;
|
||||
import org.apache.ivy.plugins.version.VersionMatcher;
|
||||
|
||||
public class OsgiRevisionStrategy extends ComparatorLatestStrategy {
|
||||
|
||||
private static final Pattern ALPHA_NUM_REGEX = Pattern.compile("([a-zA-Z])(\\d)");
|
||||
|
||||
private static final Pattern NUM_ALPHA_REGEX = Pattern.compile("(\\d)([a-zA-Z])");
|
||||
|
||||
private static final Pattern LABEL_REGEX = Pattern.compile("[_\\-\\+]");
|
||||
|
||||
/**
|
||||
* Compares two ModuleRevisionId by their revision. Revisions are compared using an algorithm
|
||||
* inspired by PHP version_compare one.
|
||||
*/
|
||||
final class MridComparator implements Comparator/* <ModuleRevisionId> */{
|
||||
|
||||
public int compare(Object o1, Object o2) {
|
||||
return compare((ModuleRevisionId) o1, (ModuleRevisionId) o2);
|
||||
}
|
||||
|
||||
public int compare(ModuleRevisionId o1, ModuleRevisionId o2) {
|
||||
String rev1 = o1.getRevision();
|
||||
String rev2 = o2.getRevision();
|
||||
|
||||
String[] outerParts1 = rev1.split("[\\.]");
|
||||
String[] outerParts2 = rev2.split("[\\.]");
|
||||
|
||||
for (int i = 0; i < outerParts1.length && i < outerParts2.length; i++) {
|
||||
String outerPart1 = outerParts1[i];
|
||||
String outerPart2 = outerParts2[i];
|
||||
|
||||
if (outerPart1.equals(outerPart2)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
outerPart1 = ALPHA_NUM_REGEX.matcher(outerPart1).replaceAll("$1_$2");
|
||||
outerPart1 = NUM_ALPHA_REGEX.matcher(outerPart1).replaceAll("$1_$2");
|
||||
outerPart2 = ALPHA_NUM_REGEX.matcher(outerPart2).replaceAll("$1_$2");
|
||||
outerPart2 = NUM_ALPHA_REGEX.matcher(outerPart2).replaceAll("$1_$2");
|
||||
|
||||
String[] innerParts1 = LABEL_REGEX.split(outerPart1);
|
||||
String[] innerParts2 = LABEL_REGEX.split(outerPart2);
|
||||
|
||||
for (int j = 0; j < innerParts1.length && j < innerParts2.length; j++) {
|
||||
if (innerParts1[j].equals(innerParts2[j])) {
|
||||
continue;
|
||||
}
|
||||
boolean is1Number = isNumber(innerParts1[j]);
|
||||
boolean is2Number = isNumber(innerParts2[j]);
|
||||
if (is1Number && !is2Number) {
|
||||
return 1;
|
||||
}
|
||||
if (is2Number && !is1Number) {
|
||||
return -1;
|
||||
}
|
||||
if (is1Number && is2Number) {
|
||||
return Long.valueOf(innerParts1[j]).compareTo(Long.valueOf(innerParts2[j]));
|
||||
}
|
||||
// both are strings, we compare them taking into account special meaning
|
||||
Map/* <String, Integer> */meanings = getSpecialMeanings();
|
||||
Integer sm1 = (Integer) meanings.get(innerParts1[j].toLowerCase(Locale.US));
|
||||
Integer sm2 = (Integer) meanings.get(innerParts2[j].toLowerCase(Locale.US));
|
||||
if (sm1 != null) {
|
||||
sm2 = sm2 == null ? new Integer(0) : sm2;
|
||||
return sm1.compareTo(sm2);
|
||||
}
|
||||
if (sm2 != null) {
|
||||
return new Integer(0).compareTo(sm2);
|
||||
}
|
||||
return innerParts1[j].compareTo(innerParts2[j]);
|
||||
}
|
||||
if (i < innerParts1.length) {
|
||||
return isNumber(innerParts1[i]) ? 1 : -1;
|
||||
}
|
||||
if (i < innerParts2.length) {
|
||||
return isNumber(innerParts2[i]) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (outerParts1.length > outerParts2.length) {
|
||||
return 1;
|
||||
} else if (outerParts1.length < outerParts2.length) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private boolean isNumber(String str) {
|
||||
return str.matches("\\d+");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares two ArtifactInfo by their revision. Revisions are compared using an algorithm
|
||||
* inspired by PHP version_compare one, unless a dynamic revision is given, in which case the
|
||||
* version matcher is used to perform the comparison.
|
||||
*/
|
||||
final class ArtifactInfoComparator implements Comparator/* <ArtifactInfo> */{
|
||||
|
||||
public int compare(Object o1, Object o2) {
|
||||
return compare((ArtifactInfo) o1, (ArtifactInfo) o2);
|
||||
}
|
||||
|
||||
public int compare(ArtifactInfo o1, ArtifactInfo o2) {
|
||||
String rev1 = o1.getRevision();
|
||||
String rev2 = o2.getRevision();
|
||||
|
||||
/*
|
||||
* The revisions can still be not resolved, so we use the current version matcher to
|
||||
* know if one revision is dynamic, and in this case if it should be considered greater
|
||||
* or lower than the other one. Note that if the version matcher compare method returns
|
||||
* 0, it's because it's not possible to know which revision is greater. In this case we
|
||||
* consider the dynamic one to be greater, because most of the time it will then be
|
||||
* actually resolved and a real comparison will occur.
|
||||
*/
|
||||
VersionMatcher vmatcher = IvyContext.getContext().getSettings().getVersionMatcher();
|
||||
ModuleRevisionId mrid1 = ModuleRevisionId.newInstance("", "", rev1);
|
||||
ModuleRevisionId mrid2 = ModuleRevisionId.newInstance("", "", rev2);
|
||||
if (vmatcher.isDynamic(mrid1)) {
|
||||
int c = vmatcher.compare(mrid1, mrid2, mridComparator);
|
||||
return c >= 0 ? 1 : -1;
|
||||
} else if (vmatcher.isDynamic(mrid2)) {
|
||||
int c = vmatcher.compare(mrid2, mrid1, mridComparator);
|
||||
return c >= 0 ? -1 : 1;
|
||||
}
|
||||
|
||||
return mridComparator.compare(mrid1, mrid2);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SpecialMeaning {
|
||||
private String name;
|
||||
|
||||
private Integer value;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public void validate() {
|
||||
if (name == null) {
|
||||
throw new IllegalStateException("a special meaning should have a name");
|
||||
}
|
||||
if (value == null) {
|
||||
throw new IllegalStateException("a special meaning should have a value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final Map/* <String, Integer> */DEFAULT_SPECIAL_MEANINGS;
|
||||
static {
|
||||
DEFAULT_SPECIAL_MEANINGS = new HashMap/* <String, Integer> */();
|
||||
DEFAULT_SPECIAL_MEANINGS.put("dev", new Integer(-1));
|
||||
DEFAULT_SPECIAL_MEANINGS.put("rc", new Integer(1));
|
||||
DEFAULT_SPECIAL_MEANINGS.put("final", new Integer(2));
|
||||
}
|
||||
|
||||
private final Comparator/* <ModuleRevisionId> */mridComparator = new MridComparator();
|
||||
|
||||
private final Comparator/* <ArtifactInfo> */artifactInfoComparator = new ArtifactInfoComparator();
|
||||
|
||||
private Map/* <String, Integer> */specialMeanings = null;
|
||||
|
||||
private boolean usedefaultspecialmeanings = true;
|
||||
|
||||
public OsgiRevisionStrategy() {
|
||||
setComparator(artifactInfoComparator);
|
||||
setName("latest-revision");
|
||||
}
|
||||
|
||||
public void addConfiguredSpecialMeaning(SpecialMeaning meaning) {
|
||||
meaning.validate();
|
||||
getSpecialMeanings().put(meaning.getName().toLowerCase(Locale.US), meaning.getValue());
|
||||
}
|
||||
|
||||
public synchronized Map/* <String, Integer> */getSpecialMeanings() {
|
||||
if (specialMeanings == null) {
|
||||
specialMeanings = new HashMap/* <String, Integer> */();
|
||||
if (isUsedefaultspecialmeanings()) {
|
||||
specialMeanings.putAll(DEFAULT_SPECIAL_MEANINGS);
|
||||
}
|
||||
}
|
||||
return specialMeanings;
|
||||
}
|
||||
|
||||
public boolean isUsedefaultspecialmeanings() {
|
||||
return usedefaultspecialmeanings;
|
||||
}
|
||||
|
||||
public void setUsedefaultspecialmeanings(boolean usedefaultspecialmeanings) {
|
||||
this.usedefaultspecialmeanings = usedefaultspecialmeanings;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package org.apache.ivy.osgi.ivy.internal;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ivy.core.cache.DefaultRepositoryCacheManager;
|
||||
import org.apache.ivy.plugins.repository.file.FileResource;
|
||||
import org.apache.ivy.plugins.resolver.ResolverSettings;
|
||||
import org.apache.ivy.util.Message;
|
||||
|
||||
public class FilePackageScanner {
|
||||
|
||||
private final Map/* <String, Collection<File>> */patternFiles = new HashMap/*
|
||||
* <String,
|
||||
* Collection<File>>
|
||||
*/();
|
||||
|
||||
private final boolean useFileCache = false;
|
||||
|
||||
public void scanAllPackageExportHeaders(List/* <String> */ivyPatterns, ResolverSettings settings) {
|
||||
final DefaultRepositoryCacheManager cacheManager = (DefaultRepositoryCacheManager) settings
|
||||
.getDefaultRepositoryCacheManager();
|
||||
|
||||
Iterator itPatterns = ivyPatterns.iterator();
|
||||
while (itPatterns.hasNext()) {
|
||||
String ivyPattern = (String) itPatterns.next();
|
||||
Collection/* <File> */fileList = null;
|
||||
fileList = (Collection) patternFiles.get(ivyPattern);
|
||||
if (fileList == null || !useFileCache) {
|
||||
fileList = new ArrayList/* <File> */();
|
||||
patternFiles.put(ivyPattern, fileList);
|
||||
final File rootDir = new File(ivyPattern.split("\\[[\\w]+\\]")[0]);
|
||||
scanDir(rootDir, fileList);
|
||||
}
|
||||
|
||||
Iterator itFile = fileList.iterator();
|
||||
while (itFile.hasNext()) {
|
||||
File currFile = (File) itFile.next();
|
||||
try {
|
||||
PackageRegistry.getInstance().processExports(cacheManager.getBasedir(),
|
||||
new FileResource(null, currFile));
|
||||
} catch (IOException e) {
|
||||
Message.error("Failed to process exports for file: " + currFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void scanDir(File currFile, Collection/* <File> */fileList) {
|
||||
if (!currFile.canRead()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (currFile.isDirectory()) {
|
||||
List/* <File> */files = new ArrayList/* <File> */();
|
||||
File[] listFiles = currFile.listFiles();
|
||||
for (int i = 0; i < listFiles.length; i++) {
|
||||
File file = listFiles[i];
|
||||
files.add(file);
|
||||
// pre-process to check if we have recursed into an exploded bundle
|
||||
if (file.getPath().endsWith("META-INF")) {
|
||||
fileList.add(new File(file, "MANIFEST.MF"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
// continue scanning...
|
||||
Iterator itFile = files.iterator();
|
||||
while (itFile.hasNext()) {
|
||||
File file = (File) itFile.next();
|
||||
scanDir(file, fileList);
|
||||
}
|
||||
} else if (currFile.isFile()) {
|
||||
final String path = currFile.getPath();
|
||||
if (path.toUpperCase().endsWith("META-INF/MANIFEST.MF")
|
||||
|| path.toUpperCase().endsWith(".JAR")) {
|
||||
fileList.add(currFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package org.apache.ivy.osgi.ivy.internal;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import org.apache.ivy.plugins.repository.Resource;
|
||||
import org.apache.ivy.plugins.repository.file.FileRepository;
|
||||
import org.apache.ivy.plugins.repository.file.FileResource;
|
||||
|
||||
/**
|
||||
* A resource decorator that handles extracting jar file entries using the bang(!) notation to
|
||||
* separate the internal entry name.
|
||||
*/
|
||||
public class JarEntryResource implements Resource {
|
||||
|
||||
private final String entryName;
|
||||
|
||||
private final Resource resource;
|
||||
|
||||
public JarEntryResource(String name) {
|
||||
final String[] tokens = name.split("[!]");
|
||||
final String path = tokens[0];
|
||||
resource = new FileResource(new FileRepository(), new File(path));
|
||||
entryName = tokens[1];
|
||||
}
|
||||
|
||||
public JarEntryResource(Resource resource, String entryName) {
|
||||
this.resource = resource;
|
||||
this.entryName = entryName;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "resource:" + resource + ", jarEntry=" + entryName;
|
||||
}
|
||||
|
||||
public Resource clone(String cloneName) {
|
||||
return resource.clone(cloneName);
|
||||
}
|
||||
|
||||
public boolean exists() {
|
||||
return resource.exists();
|
||||
}
|
||||
|
||||
public long getContentLength() {
|
||||
return resource.getContentLength();
|
||||
}
|
||||
|
||||
public long getLastModified() {
|
||||
return resource.getLastModified();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return resource.getName() + "!" + entryName;
|
||||
}
|
||||
|
||||
public boolean isLocal() {
|
||||
return resource.isLocal();
|
||||
}
|
||||
|
||||
public InputStream openStream() throws IOException {
|
||||
final ZipInputStream zis = new ZipInputStream(resource.openStream());
|
||||
ZipEntry entry = null;
|
||||
while ((entry = zis.getNextEntry()) != null) {
|
||||
if (entry.getName().equalsIgnoreCase(entryName)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (entry == null) {
|
||||
throw new IllegalStateException("Jar entry: " + entryName + ", not in resource:"
|
||||
+ resource);
|
||||
}
|
||||
return zis;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package org.apache.ivy.osgi.ivy.internal;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.ivy.plugins.repository.Resource;
|
||||
import org.apache.ivy.plugins.repository.file.FileRepository;
|
||||
|
||||
/**
|
||||
* A file repository that handles extracting jar file entries using the bang(!) notation to separate
|
||||
* the internal entry name.
|
||||
*/
|
||||
public class JarFileRepository extends FileRepository {
|
||||
|
||||
private final RepositoryJarHandler jarHandler = new RepositoryJarHandler();
|
||||
|
||||
public void get(String source, File destination) throws IOException {
|
||||
if (jarHandler.canHandle(source)) {
|
||||
this.jarHandler.get(source, destination);
|
||||
return;
|
||||
}
|
||||
super.get(source, destination);
|
||||
}
|
||||
|
||||
public Resource getResource(String source) throws IOException {
|
||||
if (jarHandler.canHandle(source)) {
|
||||
return this.jarHandler.getResource(source);
|
||||
}
|
||||
return super.getResource(source);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,148 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package org.apache.ivy.osgi.ivy.internal;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
|
||||
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
||||
import org.apache.ivy.core.module.id.ModuleId;
|
||||
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||
import org.apache.ivy.osgi.ivy.OsgiManifestParser;
|
||||
import org.apache.ivy.osgi.util.Version;
|
||||
import org.apache.ivy.osgi.util.VersionComparator;
|
||||
import org.apache.ivy.osgi.util.VersionRange;
|
||||
import org.apache.ivy.plugins.repository.Resource;
|
||||
import org.apache.ivy.util.Message;
|
||||
|
||||
public class PackageRegistry {
|
||||
|
||||
private final static PackageRegistry instance = new PackageRegistry();
|
||||
|
||||
public static PackageRegistry getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private static final String PKGREF = ".pkgref";
|
||||
|
||||
private final OsgiManifestParser osgiManifestParser = new OsgiManifestParser();
|
||||
|
||||
private final Set/* <String> */processedEntries = new HashSet/* <String> */();
|
||||
|
||||
private File cacheDir;
|
||||
|
||||
private PackageRegistry() {
|
||||
// nothing to initialize
|
||||
}
|
||||
|
||||
public void processExports(File cacheDirectory, Resource res) throws IOException {
|
||||
this.cacheDir = cacheDirectory;
|
||||
|
||||
if (processedEntries.contains(res.getName()) || !osgiManifestParser.accept(res)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ModuleDescriptor md;
|
||||
try {
|
||||
md = osgiManifestParser.parseExports(res);
|
||||
} catch (Exception e) {
|
||||
Message.error("\t\tFailed to parse package resource descriptor: " + res);
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
if (md == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final ModuleRevisionId mrid = md.getResolvedModuleRevisionId();
|
||||
|
||||
final File pkgRootDir = new File(cacheDir, OsgiManifestParser.PACKAGE);
|
||||
pkgRootDir.mkdirs();
|
||||
|
||||
DependencyDescriptor[] deps = md.getDependencies();
|
||||
for (int i = 0; i < deps.length; i++) {
|
||||
DependencyDescriptor dep = deps[i];
|
||||
final ModuleRevisionId depMrid = dep.getDependencyRevisionId();
|
||||
if (depMrid.getOrganisation().equalsIgnoreCase(OsgiManifestParser.PACKAGE)) {
|
||||
final File pkgDir = new File(pkgRootDir,
|
||||
(depMrid.getName().replace('.', '/') + "/"));
|
||||
pkgDir.mkdirs();
|
||||
final File file = new File(pkgDir, mrid + PKGREF);
|
||||
if (!file.exists()) {
|
||||
Message.debug("\t\tWriting pkg ref: " + file);
|
||||
file.createNewFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processedEntries.add(res.getName());
|
||||
}
|
||||
|
||||
public ModuleRevisionId processImports(final String pkgName, final VersionRange importRange) {
|
||||
final File pkgRootDir = new File(cacheDir, OsgiManifestParser.PACKAGE);
|
||||
if (!pkgRootDir.canRead() || !pkgRootDir.isDirectory()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final File pkgDir = new File(pkgRootDir, pkgName.replace('.', '/') + "/");
|
||||
|
||||
final TreeMap/* <Version, ModuleRevisionId> */pkgMrids = new TreeMap/*
|
||||
* <Version,
|
||||
* ModuleRevisionId>
|
||||
*/(
|
||||
VersionComparator.DESCENDING);
|
||||
pkgDir.listFiles(new FilenameFilter() {
|
||||
public boolean accept(File dir, String name) {
|
||||
if (name.endsWith(PKGREF)) {
|
||||
final String baseName = name.substring(0, (name.length() - PKGREF.length()));
|
||||
final int hashIdx = baseName.indexOf('#');
|
||||
final int semicolIdx = baseName.indexOf(';');
|
||||
final String mridOrg = baseName.substring(0, hashIdx);
|
||||
final String[] tokens = baseName.substring(hashIdx + 1, semicolIdx)
|
||||
.split("[#]");
|
||||
final String mridName = tokens[0];
|
||||
final String mridBranch = (tokens.length > 1 ? tokens[1] : null);
|
||||
final String mridRev = baseName.substring(semicolIdx + 1);
|
||||
pkgMrids.put(new Version(mridRev), new ModuleRevisionId(new ModuleId(mridOrg,
|
||||
mridName), mridBranch, mridRev));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
ModuleRevisionId matchingMrid = null;
|
||||
Iterator itMrid = pkgMrids.entrySet().iterator();
|
||||
while (itMrid.hasNext()) {
|
||||
Entry/* <Version, ModuleRevisionId> */entry = (Entry) itMrid.next();
|
||||
if (importRange == null || importRange.contains((String) entry.getKey())) {
|
||||
matchingMrid = (ModuleRevisionId) entry.getValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return matchingMrid;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package org.apache.ivy.osgi.ivy.internal;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.apache.ivy.plugins.repository.Resource;
|
||||
import org.apache.ivy.util.FileUtil;
|
||||
|
||||
public class RepositoryJarHandler {
|
||||
|
||||
public boolean canHandle(String source) {
|
||||
return source.toUpperCase().contains(".JAR!");
|
||||
}
|
||||
|
||||
public void get(String source, File destination) throws IOException {
|
||||
final InputStream inputStream = new JarEntryResource(source).openStream();
|
||||
FileUtil.copy(inputStream, destination, null);
|
||||
inputStream.close();
|
||||
}
|
||||
|
||||
public Resource getResource(String source) {
|
||||
return new JarEntryResource(source);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package org.apache.ivy.osgi.obr;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.text.ParseException;
|
||||
|
||||
import org.apache.ivy.osgi.obr.xml.OBRXMLParser;
|
||||
import org.apache.ivy.osgi.repo.BundleRepoResolver;
|
||||
import org.apache.ivy.osgi.repo.RelativeURLRepository;
|
||||
import org.apache.ivy.plugins.repository.file.FileRepository;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public class OBRResolver extends BundleRepoResolver {
|
||||
|
||||
private String repoXmlURL;
|
||||
|
||||
private String repoXmlFile;
|
||||
|
||||
public void setRepoXmlFile(String repositoryXmlFile) {
|
||||
this.repoXmlFile = repositoryXmlFile;
|
||||
}
|
||||
|
||||
public void setRepoXmlURL(String repositoryXmlURL) {
|
||||
this.repoXmlURL = repositoryXmlURL;
|
||||
}
|
||||
|
||||
protected void ensureInit() {
|
||||
if (repoXmlFile != null && repoXmlURL != null) {
|
||||
throw new RuntimeException("The OBR repository resolver " + getName()
|
||||
+ " couldn't be configured: repoXmlFile and repoXmlUrl cannot be set both");
|
||||
}
|
||||
if (repoXmlFile != null) {
|
||||
File f = new File(repoXmlFile);
|
||||
setRepository(new FileRepository(f.getParentFile()));
|
||||
FileInputStream in;
|
||||
try {
|
||||
in = new FileInputStream(f);
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new RuntimeException("The OBR repository resolver " + getName()
|
||||
+ " couldn't be configured: the file " + repoXmlFile + " was not found");
|
||||
}
|
||||
try {
|
||||
setRepoDescriptor(OBRXMLParser.parse(in));
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException("The OBR repository resolver " + getName()
|
||||
+ " couldn't be configured: the file " + repoXmlFile
|
||||
+ " is incorrectly formed (" + e.getMessage() + ")");
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("The OBR repository resolver " + getName()
|
||||
+ " couldn't be configured: the file " + repoXmlFile
|
||||
+ " could not be read (" + e.getMessage() + ")");
|
||||
} catch (SAXException e) {
|
||||
throw new RuntimeException("The OBR repository resolver " + getName()
|
||||
+ " couldn't be configured: the file " + repoXmlFile
|
||||
+ " has incorrect XML (" + e.getMessage() + ")");
|
||||
}
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
// don't care
|
||||
}
|
||||
} else if (repoXmlURL != null) {
|
||||
URL url;
|
||||
try {
|
||||
url = new URL(repoXmlURL);
|
||||
} catch (MalformedURLException e) {
|
||||
throw new RuntimeException("The OBR repository resolver " + getName()
|
||||
+ " couldn't be configured: repoXmlURL '" + repoXmlURL + "' is not an URL");
|
||||
}
|
||||
URL baseUrl;
|
||||
String basePath = "/";
|
||||
int i = url.getPath().lastIndexOf("/");
|
||||
if (i > 0) {
|
||||
basePath = url.getPath().substring(0, i + 1);
|
||||
}
|
||||
try {
|
||||
baseUrl = new URL(url.getProtocol(), url.getHost(), url.getPort(), basePath);
|
||||
} catch (MalformedURLException e) {
|
||||
throw new RuntimeException(
|
||||
"The OBR repository resolver "
|
||||
+ getName()
|
||||
+ " couldn't be configured: the base url couldn'd be extracted from the url "
|
||||
+ url + " (" + e.getMessage() + ")");
|
||||
}
|
||||
setRepository(new RelativeURLRepository(baseUrl));
|
||||
InputStream in;
|
||||
try {
|
||||
in = url.openStream();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("The OBR repository resolver " + getName()
|
||||
+ " couldn't be configured: the file " + repoXmlURL + " couldn't be read ("
|
||||
+ e.getMessage() + ")");
|
||||
}
|
||||
try {
|
||||
setRepoDescriptor(OBRXMLParser.parse(in));
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException("The OBR repository resolver " + getName()
|
||||
+ " couldn't be configured: the file " + repoXmlURL
|
||||
+ " is incorrectly formed (" + e.getMessage() + ")");
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("The OBR repository resolver " + getName()
|
||||
+ " couldn't be configured: the file " + repoXmlURL
|
||||
+ " could not be read (" + e.getMessage() + ")");
|
||||
} catch (SAXException e) {
|
||||
throw new RuntimeException("The OBR repository resolver " + getName()
|
||||
+ " couldn't be configured: the file " + repoXmlURL
|
||||
+ " has incorrect XML (" + e.getMessage() + ")");
|
||||
}
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
// don't care
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("The OBR repository resolver " + getName()
|
||||
+ " couldn't be configured: repoXmlFile or repoXmlUrl is missing");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -18,12 +18,7 @@
|
|||
package org.apache.ivy.osgi.repo;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
|
@ -70,10 +65,6 @@ public class BundleRepoResolver extends BasicResolver {
|
|||
|
||||
private Repository repository = null;
|
||||
|
||||
private String repoXmlURL;
|
||||
|
||||
private String repoXmlFile;
|
||||
|
||||
private BundleRepo repoDescriptor = null;
|
||||
|
||||
private ExecutionEnvironmentProfileProvider profileProvider;
|
||||
|
|
@ -106,113 +97,23 @@ public class BundleRepoResolver extends BasicResolver {
|
|||
setImportPackageStrategy(RequirementStrategy.valueOf(strategy));
|
||||
}
|
||||
|
||||
public void setRepoXmlFile(String repositoryXmlFile) {
|
||||
this.repoXmlFile = repositoryXmlFile;
|
||||
}
|
||||
|
||||
public void setRepoXmlURL(String repositoryXmlURL) {
|
||||
this.repoXmlURL = repositoryXmlURL;
|
||||
}
|
||||
|
||||
public void add(ExecutionEnvironmentProfileProvider pp) {
|
||||
this.profileProvider = pp;
|
||||
}
|
||||
|
||||
private void ensureInit() {
|
||||
if (repoDescriptor != null && repository != null) {
|
||||
return;
|
||||
}
|
||||
protected void setRepository(Repository repository) {
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
protected void setRepoDescriptor(BundleRepo repoDescriptor) {
|
||||
this.repoDescriptor = repoDescriptor;
|
||||
}
|
||||
|
||||
protected void ensureInit() {
|
||||
if (repoDescriptor != null || repository != null) {
|
||||
throw new IllegalStateException("The osgi repository resolver " + getName()
|
||||
+ " wasn't correctly configured, see previous error in the logs");
|
||||
}
|
||||
if (repoXmlFile != null && repoXmlURL != null) {
|
||||
throw new RuntimeException("The osgi repository resolver " + getName()
|
||||
+ " couldn't be configured: repoXmlFile and repoXmlUrl cannot be set both");
|
||||
}
|
||||
if (repoXmlFile != null) {
|
||||
File f = new File(repoXmlFile);
|
||||
repository = new FileRepository(f.getParentFile());
|
||||
FileInputStream in;
|
||||
try {
|
||||
in = new FileInputStream(f);
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new RuntimeException("The osgi repository resolver " + getName()
|
||||
+ " couldn't be configured: the file " + repoXmlFile + " was not found");
|
||||
}
|
||||
try {
|
||||
repoDescriptor = OBRXMLParser.parse(in);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException("The osgi repository resolver " + getName()
|
||||
+ " couldn't be configured: the file " + repoXmlFile
|
||||
+ " is incorrectly formed (" + e.getMessage() + ")");
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("The osgi repository resolver " + getName()
|
||||
+ " couldn't be configured: the file " + repoXmlFile
|
||||
+ " could not be read (" + e.getMessage() + ")");
|
||||
} catch (SAXException e) {
|
||||
throw new RuntimeException("The osgi repository resolver " + getName()
|
||||
+ " couldn't be configured: the file " + repoXmlFile
|
||||
+ " has incorrect XML (" + e.getMessage() + ")");
|
||||
}
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
// don't care
|
||||
}
|
||||
} else {
|
||||
URL url;
|
||||
try {
|
||||
url = new URL(repoXmlURL);
|
||||
} catch (MalformedURLException e) {
|
||||
throw new RuntimeException("The osgi repository resolver " + getName()
|
||||
+ " couldn't be configured: repoXmlURL '" + repoXmlURL + "' is not an URL");
|
||||
}
|
||||
URL baseUrl;
|
||||
String basePath = "/";
|
||||
int i = url.getPath().lastIndexOf("/");
|
||||
if (i > 0) {
|
||||
basePath = url.getPath().substring(0, i + 1);
|
||||
}
|
||||
try {
|
||||
baseUrl = new URL(url.getProtocol(), url.getHost(), url.getPort(), basePath);
|
||||
} catch (MalformedURLException e) {
|
||||
throw new RuntimeException(
|
||||
"The osgi repository resolver "
|
||||
+ getName()
|
||||
+ " couldn't be configured: the base url couldn'd be extracted from the url "
|
||||
+ url + " (" + e.getMessage() + ")");
|
||||
}
|
||||
repository = new RelativeURLRepository(baseUrl);
|
||||
InputStream in;
|
||||
try {
|
||||
in = url.openStream();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("The osgi repository resolver " + getName()
|
||||
+ " couldn't be configured: the file " + repoXmlURL + " couldn't be read ("
|
||||
+ e.getMessage() + ")");
|
||||
}
|
||||
try {
|
||||
repoDescriptor = OBRXMLParser.parse(in);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException("The osgi repository resolver " + getName()
|
||||
+ " couldn't be configured: the file " + repoXmlURL
|
||||
+ " is incorrectly formed (" + e.getMessage() + ")");
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("The osgi repository resolver " + getName()
|
||||
+ " couldn't be configured: the file " + repoXmlURL
|
||||
+ " could not be read (" + e.getMessage() + ")");
|
||||
} catch (SAXException e) {
|
||||
throw new RuntimeException("The osgi repository resolver " + getName()
|
||||
+ " couldn't be configured: the file " + repoXmlURL
|
||||
+ " has incorrect XML (" + e.getMessage() + ")");
|
||||
}
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
// don't care
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Repository getRepository() {
|
||||
|
|
|
|||
|
|
@ -1,113 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package org.apache.ivy.osgi.util;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Provides a bundle name conversion utility.
|
||||
*/
|
||||
public class NameUtil {
|
||||
|
||||
private static final NameUtil instance = new NameUtil();
|
||||
|
||||
public static NameUtil instance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private final Set/* <String> */tlds = new HashSet/* <String> */();
|
||||
|
||||
private NameUtil() {
|
||||
final InputStream inputStream = getClass().getClassLoader()
|
||||
.getResourceAsStream("orgs.list");
|
||||
if (inputStream == null) {
|
||||
throw new IllegalStateException("Unable to find required file in classpath: orgs.list");
|
||||
}
|
||||
final BufferedReader bis = new BufferedReader(new InputStreamReader(inputStream));
|
||||
try {
|
||||
String line = null;
|
||||
while ((line = bis.readLine()) != null) {
|
||||
line = line.trim();
|
||||
if (line.equals("") || line.startsWith("#")) {
|
||||
continue;
|
||||
}
|
||||
tlds.add(line);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public OrgAndName asOrgAndName(String qname) {
|
||||
final String[] tokens = qname.split("\\.");
|
||||
if ((tokens == null) || (tokens.length == 0)) {
|
||||
throw new IllegalStateException("Qualified name is empty or invalid: " + qname);
|
||||
}
|
||||
|
||||
String org = null;
|
||||
String name = null;
|
||||
|
||||
if (tlds.contains(tokens[0])) {
|
||||
org = append(tokens, 0, 1);
|
||||
name = append(tokens, 2, tokens.length);
|
||||
} else if (tokens.length == 1) {
|
||||
org = tokens[0];
|
||||
name = tokens[0];
|
||||
} else if (tokens.length >= 2) {
|
||||
org = tokens[0];
|
||||
name = append(tokens, 1, tokens.length);
|
||||
}
|
||||
|
||||
if (org == null || name == null) {
|
||||
throw new IllegalStateException("Null org/name: org=" + org + ", name=" + name
|
||||
+ ", qname=" + qname);
|
||||
}
|
||||
|
||||
return new OrgAndName(org, name);
|
||||
}
|
||||
|
||||
private String append(String[] strs, int start, int end) {
|
||||
final StringBuffer sbuf = new StringBuffer();
|
||||
boolean dot = false;
|
||||
for (int i = start; i <= end && i < strs.length; i++) {
|
||||
if (dot) {
|
||||
sbuf.append('.');
|
||||
}
|
||||
sbuf.append(strs[i]);
|
||||
dot = true;
|
||||
}
|
||||
return sbuf.toString();
|
||||
}
|
||||
|
||||
public static class OrgAndName {
|
||||
public final String org;
|
||||
|
||||
public final String name;
|
||||
|
||||
private OrgAndName(String org, String name) {
|
||||
this.org = org;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,269 +0,0 @@
|
|||
ac
|
||||
ad
|
||||
ae
|
||||
aero
|
||||
af
|
||||
ag
|
||||
ai
|
||||
al
|
||||
am
|
||||
an
|
||||
ao
|
||||
aq
|
||||
ar
|
||||
arpa
|
||||
as
|
||||
asia
|
||||
at
|
||||
au
|
||||
aw
|
||||
ax
|
||||
az
|
||||
ba
|
||||
bb
|
||||
bd
|
||||
be
|
||||
bf
|
||||
bg
|
||||
bh
|
||||
bi
|
||||
biz
|
||||
bj
|
||||
bm
|
||||
bn
|
||||
bo
|
||||
br
|
||||
bs
|
||||
bt
|
||||
bv
|
||||
bw
|
||||
by
|
||||
bz
|
||||
ca
|
||||
cat
|
||||
cc
|
||||
cd
|
||||
cf
|
||||
cg
|
||||
ch
|
||||
ci
|
||||
ck
|
||||
cl
|
||||
cm
|
||||
cn
|
||||
co
|
||||
com
|
||||
coop
|
||||
cr
|
||||
cu
|
||||
cv
|
||||
cx
|
||||
cy
|
||||
cz
|
||||
de
|
||||
dj
|
||||
dk
|
||||
dm
|
||||
do
|
||||
dz
|
||||
ec
|
||||
edu
|
||||
ee
|
||||
eg
|
||||
er
|
||||
es
|
||||
et
|
||||
eu
|
||||
fi
|
||||
fj
|
||||
fk
|
||||
fm
|
||||
fo
|
||||
fr
|
||||
ga
|
||||
gb
|
||||
gd
|
||||
ge
|
||||
gf
|
||||
gg
|
||||
gh
|
||||
gi
|
||||
gl
|
||||
gm
|
||||
gn
|
||||
gov
|
||||
gp
|
||||
gq
|
||||
gr
|
||||
gs
|
||||
gt
|
||||
gu
|
||||
gw
|
||||
gy
|
||||
hk
|
||||
hm
|
||||
hn
|
||||
hr
|
||||
ht
|
||||
hu
|
||||
id
|
||||
ie
|
||||
il
|
||||
im
|
||||
in
|
||||
info
|
||||
int
|
||||
io
|
||||
iq
|
||||
ir
|
||||
is
|
||||
it
|
||||
je
|
||||
jm
|
||||
jo
|
||||
jobs
|
||||
jp
|
||||
ke
|
||||
kg
|
||||
kh
|
||||
ki
|
||||
km
|
||||
kn
|
||||
kp
|
||||
kr
|
||||
kw
|
||||
ky
|
||||
kz
|
||||
la
|
||||
lb
|
||||
lc
|
||||
li
|
||||
lk
|
||||
lr
|
||||
ls
|
||||
lt
|
||||
lu
|
||||
lv
|
||||
ly
|
||||
ma
|
||||
mc
|
||||
md
|
||||
me
|
||||
mg
|
||||
mh
|
||||
mil
|
||||
mk
|
||||
ml
|
||||
mm
|
||||
mn
|
||||
mo
|
||||
mobi
|
||||
mp
|
||||
mq
|
||||
mr
|
||||
ms
|
||||
mt
|
||||
mu
|
||||
museum
|
||||
mv
|
||||
mw
|
||||
mx
|
||||
my
|
||||
mz
|
||||
na
|
||||
name
|
||||
nc
|
||||
ne
|
||||
net
|
||||
nf
|
||||
ng
|
||||
ni
|
||||
nl
|
||||
no
|
||||
np
|
||||
nr
|
||||
nu
|
||||
nz
|
||||
om
|
||||
org
|
||||
pa
|
||||
pe
|
||||
pf
|
||||
pg
|
||||
ph
|
||||
pk
|
||||
pl
|
||||
pm
|
||||
pn
|
||||
pr
|
||||
pro
|
||||
ps
|
||||
pt
|
||||
pw
|
||||
py
|
||||
qa
|
||||
re
|
||||
ro
|
||||
rs
|
||||
ru
|
||||
rw
|
||||
sa
|
||||
sb
|
||||
sc
|
||||
sd
|
||||
se
|
||||
sg
|
||||
sh
|
||||
si
|
||||
sj
|
||||
sk
|
||||
sl
|
||||
sm
|
||||
sn
|
||||
so
|
||||
sr
|
||||
st
|
||||
su
|
||||
sv
|
||||
sy
|
||||
sz
|
||||
tc
|
||||
td
|
||||
tel
|
||||
tf
|
||||
tg
|
||||
th
|
||||
tj
|
||||
tk
|
||||
tl
|
||||
tm
|
||||
tn
|
||||
to
|
||||
tp
|
||||
tr
|
||||
travel
|
||||
tt
|
||||
tv
|
||||
tw
|
||||
tz
|
||||
ua
|
||||
ug
|
||||
uk
|
||||
us
|
||||
uy
|
||||
uz
|
||||
va
|
||||
vc
|
||||
ve
|
||||
vg
|
||||
vi
|
||||
vn
|
||||
vu
|
||||
wf
|
||||
ws
|
||||
ye
|
||||
yt
|
||||
yu
|
||||
za
|
||||
zm
|
||||
zw
|
||||
|
|
@ -29,8 +29,8 @@ public class ManifestParserTest extends TestCase {
|
|||
public void testParseManifest() throws Exception {
|
||||
BundleInfo bundleInfo;
|
||||
|
||||
bundleInfo = ManifestParser.parseJarManifest(getClass().getClassLoader()
|
||||
.getResourceAsStream("com.acme.alpha-1.0.0.20080101.jar"));
|
||||
bundleInfo = ManifestParser.parseJarManifest(getClass().getResourceAsStream(
|
||||
"com.acme.alpha-1.0.0.20080101.jar"));
|
||||
assertEquals("com.acme.alpha", bundleInfo.getSymbolicName());
|
||||
assertEquals("1.0.0", bundleInfo.getVersion().numbersAsString());
|
||||
assertEquals("20080101", bundleInfo.getVersion().qualifier());
|
||||
|
|
@ -49,8 +49,8 @@ public class ManifestParserTest extends TestCase {
|
|||
assertTrue(importsList.contains("com.acme.bravo"));
|
||||
assertTrue(importsList.contains("com.acme.delta"));
|
||||
|
||||
bundleInfo = ManifestParser.parseJarManifest(getClass().getClassLoader()
|
||||
.getResourceAsStream("com.acme.bravo-2.0.0.20080202.jar"));
|
||||
bundleInfo = ManifestParser.parseJarManifest(getClass().getResourceAsStream(
|
||||
"com.acme.bravo-2.0.0.20080202.jar"));
|
||||
assertNotNull(bundleInfo);
|
||||
assertEquals("com.acme.bravo", bundleInfo.getSymbolicName());
|
||||
assertEquals("2.0.0", bundleInfo.getVersion().numbersAsString());
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package org.apache.ivy.osgi.ivy;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.ivy.Ivy;
|
||||
import org.apache.ivy.core.module.id.ModuleId;
|
||||
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||
import org.apache.ivy.core.report.ResolveReport;
|
||||
import org.apache.ivy.core.resolve.IvyNode;
|
||||
import org.apache.ivy.core.resolve.ResolveOptions;
|
||||
import org.apache.ivy.plugins.parser.AbstractModuleDescriptorParserTester;
|
||||
|
||||
public class IvyIntegrationTest extends AbstractModuleDescriptorParserTester {
|
||||
|
||||
private URL getTestResource(String resource) throws MalformedURLException {
|
||||
return new File("test/test-ivy/" + resource).toURI().toURL();
|
||||
}
|
||||
|
||||
public void testAcmeResolveAlpha() throws Exception {
|
||||
final Ivy ivy = Ivy.newInstance();
|
||||
ivy.configure(getTestResource("acme-ivysettings.xml"));
|
||||
|
||||
final ModuleRevisionId mrid = new ModuleRevisionId(new ModuleId("com.acme", "alpha"),
|
||||
"1.0+");
|
||||
// final ModuleRevisionId mrid = new ModuleRevisionId(new ModuleId("com.acme", "delta"),
|
||||
// "4+");
|
||||
// final ModuleRevisionId mrid = new ModuleRevisionId(new ModuleId("com.acme", "echo"),
|
||||
// "5+");
|
||||
final ResolveOptions options = new ResolveOptions();
|
||||
options.setConfs(new String[] {"default"});
|
||||
|
||||
final ResolveReport report = ivy.resolve(mrid, options, false);
|
||||
assertEquals(5, report.getDependencies().size());
|
||||
|
||||
final String[] names = new String[] {"com.acme#alpha;1.0.0.20080101",
|
||||
"com.acme#bravo;2.0.0.20080202", "com.acme#charlie;3.0.0.20080303",
|
||||
"com.acme#delta;4.0.0", "com.acme#echo;5.0.0"};
|
||||
final Set/* <String> */nodeNames = new HashSet/* <String> */(Arrays.asList(names));
|
||||
Iterator itNode = ((Collection/* <IvyNode> */) report.getDependencies()).iterator();
|
||||
while (itNode.hasNext()) {
|
||||
IvyNode node = (IvyNode) itNode.next();
|
||||
assertTrue(" Contains: " + node, nodeNames.contains(node.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package org.apache.ivy.osgi.ivy;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.ivy.osgi.ivy.internal.JarEntryResource;
|
||||
|
||||
public class JarHandlingRepositoryTest extends TestCase {
|
||||
|
||||
public void test() throws IOException {
|
||||
final JarEntryResource resource = new JarEntryResource(
|
||||
"test/test-bundles/jars/com.acme.alpha-1.0.0.20080101.jar!META-INF/MANIFEST.MF");
|
||||
assertNotNull(resource.openStream());
|
||||
assertTrue(resource.isLocal());
|
||||
assertTrue(resource.exists());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package org.apache.ivy.osgi.ivy;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
||||
import org.apache.ivy.core.settings.IvySettings;
|
||||
import org.apache.ivy.plugins.parser.ModuleDescriptorParser;
|
||||
import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry;
|
||||
import org.apache.ivy.plugins.repository.url.URLResource;
|
||||
|
||||
public class OsgiIvyParserTest extends TestCase {
|
||||
|
||||
public void testSimple() throws Exception {
|
||||
IvySettings settings = new IvySettings();
|
||||
settings.load(new File("test/test-ivy/include/ivysettings.xml"));
|
||||
|
||||
URLResource includingResource = new URLResource(
|
||||
new File("test/test-ivy/include/ivy.xml").toURL());
|
||||
ModuleDescriptorParser includingParser = ModuleDescriptorParserRegistry.getInstance()
|
||||
.getParser(includingResource);
|
||||
assertTrue(includingParser instanceof OsgiIvyParser);
|
||||
ModuleDescriptor includingMd = includingParser.parseDescriptor(settings,
|
||||
includingResource.getURL(), false);
|
||||
|
||||
assertNotNull(includingMd);
|
||||
|
||||
URLResource resultResource = new URLResource(new File(
|
||||
"test/test-ivy/include/ivy-result.xml").toURL());
|
||||
ModuleDescriptorParser resultParser = ModuleDescriptorParserRegistry.getInstance()
|
||||
.getParser(resultResource);
|
||||
ModuleDescriptor resultMd = resultParser.parseDescriptor(settings, resultResource.getURL(),
|
||||
false);
|
||||
|
||||
assertEquals(resultMd.getModuleRevisionId(), includingMd.getModuleRevisionId());
|
||||
assertEquals(resultMd.getResolvedModuleRevisionId(),
|
||||
includingMd.getResolvedModuleRevisionId());
|
||||
assertEquals(resultMd.getDescription(), includingMd.getDescription());
|
||||
assertEquals(resultMd.getHomePage(), includingMd.getHomePage());
|
||||
// assertEquals(resultMd.getLastModified(), includingMd.getLastModified());
|
||||
assertEquals(resultMd.getStatus(), includingMd.getStatus());
|
||||
assertEquals(resultMd.getExtraInfo(), includingMd.getExtraInfo());
|
||||
assertArrayEquals((Object[]) resultMd.getLicenses(), (Object[]) includingMd.getLicenses());
|
||||
assertArrayEquals(resultMd.getConfigurations(), includingMd.getConfigurations());
|
||||
assertArrayEquals((Object[]) resultMd.getAllArtifacts(),
|
||||
(Object[]) includingMd.getAllArtifacts());
|
||||
assertEquals(resultMd.getDependencies().length, includingMd.getDependencies().length);
|
||||
for (int i = 0; i < resultMd.getDependencies().length; i++) {
|
||||
assertEquals(resultMd.getDependencies()[i].getDependencyRevisionId(),
|
||||
includingMd.getDependencies()[i].getDependencyRevisionId());
|
||||
assertArrayEquals((Object[]) resultMd.getDependencies()[i].getModuleConfigurations(),
|
||||
(Object[]) includingMd.getDependencies()[i].getModuleConfigurations());
|
||||
}
|
||||
}
|
||||
|
||||
private static/* <T1,T2> */void assertArrayEquals(Object/* T1 */[] expected,
|
||||
Object/* T2 */[] actual) {
|
||||
assertSetEquals(Arrays.asList(expected), Arrays.asList(actual));
|
||||
}
|
||||
|
||||
private static/* <T1,T2> */void assertSetEquals(List/* <T1> */expected, List/* <T2> */actual) {
|
||||
assertEquals(new HashSet/* <T1> */(expected), new HashSet/* <T2> */(actual));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,150 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package org.apache.ivy.osgi.ivy;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.ivy.core.module.descriptor.Artifact;
|
||||
import org.apache.ivy.core.module.descriptor.DefaultArtifact;
|
||||
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
|
||||
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
|
||||
import org.apache.ivy.core.module.id.ModuleId;
|
||||
import org.apache.ivy.core.module.id.ModuleRevisionId;
|
||||
import org.apache.ivy.core.settings.IvySettings;
|
||||
import org.apache.ivy.plugins.parser.AbstractModuleDescriptorParserTester;
|
||||
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParserTest;
|
||||
import org.apache.ivy.plugins.repository.url.URLResource;
|
||||
import org.apache.ivy.util.FileUtil;
|
||||
|
||||
public class OsgiManifestParserTest extends AbstractModuleDescriptorParserTester {
|
||||
|
||||
private URL getTestResource(String resource) throws MalformedURLException {
|
||||
return new File("test/test-ivy/" + resource).toURI().toURL();
|
||||
}
|
||||
|
||||
public void testAccept() throws Exception {
|
||||
assertTrue(OsgiManifestParser.getInstance().accept(
|
||||
new URLResource(
|
||||
getTestResource("osgi/eclipse/plugins/test-simple/META-INF/MANIFEST.MF"))));
|
||||
assertFalse(OsgiManifestParser.getInstance().accept(
|
||||
new URLResource(XmlModuleDescriptorParserTest.class.getResource("test.xml"))));
|
||||
}
|
||||
|
||||
public void testSimple() throws Exception {
|
||||
final ModuleDescriptor md = OsgiManifestParser.getInstance().parseDescriptor(
|
||||
new IvySettings(),
|
||||
getTestResource("osgi/eclipse/plugins/test-simple/META-INF/MANIFEST.MF"), false);
|
||||
assertNotNull(md);
|
||||
assertSimpleModuleDescriptor(md);
|
||||
}
|
||||
|
||||
public void testSimpleFromJar() throws Exception {
|
||||
final ModuleDescriptor md = OsgiManifestParser.getInstance().parseDescriptor(
|
||||
new IvySettings(), getTestResource("test-simple.jar"), false);
|
||||
assertNotNull(md);
|
||||
assertSimpleModuleDescriptor(md);
|
||||
}
|
||||
|
||||
public void testFull() throws Exception {
|
||||
final ModuleDescriptor md = OsgiManifestParser.getInstance().parseDescriptor(
|
||||
new IvySettings(),
|
||||
getTestResource("osgi/eclipse/plugins/test-full/META-INF/MANIFEST.MF"), false);
|
||||
assertNotNull(md);
|
||||
assertSimpleModuleDescriptor(md);
|
||||
assertDependencies(md);
|
||||
}
|
||||
|
||||
public void testFullFromJar() throws Exception {
|
||||
final ModuleDescriptor md = OsgiManifestParser.getInstance().parseDescriptor(
|
||||
new IvySettings(), getTestResource("test-full.jar"), false);
|
||||
assertNotNull(md);
|
||||
assertSimpleModuleDescriptor(md);
|
||||
assertDependencies(md);
|
||||
}
|
||||
|
||||
public void testJB() throws Exception {
|
||||
final ModuleRevisionId mrid = new ModuleRevisionId(new ModuleId("org", "name"),
|
||||
"revisionId");
|
||||
final Artifact artifact = new DefaultArtifact(mrid, new Date(), "META-INF/MANIFEST",
|
||||
"manifest", "MF", true);
|
||||
System.out.println(artifact);
|
||||
}
|
||||
|
||||
private void assertSimpleModuleDescriptor(ModuleDescriptor md) throws Exception {
|
||||
final ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.eclipse",
|
||||
"datatools.connectivity.ui", "1.0.1.200708231");
|
||||
assertEquals(mrid, md.getModuleRevisionId());
|
||||
|
||||
assertNotNull(md.getConfigurations());
|
||||
assertEquals(3, md.getConfigurations().length);
|
||||
assertNotNull(md.getConfiguration("default"));
|
||||
|
||||
assertNotNull(md.getAllArtifacts());
|
||||
assertEquals(2, md.getAllArtifacts().length);
|
||||
final Artifact[] artifact = md.getArtifacts("default");
|
||||
assertEquals(1, artifact.length);
|
||||
assertEquals(mrid, artifact[0].getModuleRevisionId());
|
||||
assertEquals("org.eclipse.datatools.connectivity.ui", artifact[0].getName());
|
||||
assertEquals("jar", artifact[0].getExt());
|
||||
assertEquals("jar", artifact[0].getType());
|
||||
|
||||
}
|
||||
|
||||
private void assertDependencies(ModuleDescriptor md) throws Exception {
|
||||
final DependencyDescriptor[] dds = md.getDependencies();
|
||||
assertNotNull(dds);
|
||||
Set/* <ModuleRevisionId> */actual = new HashSet/* <ModuleRevisionId> */();
|
||||
DependencyDescriptor[] deps = md.getDependencies();
|
||||
for (int i = 0; i < deps.length; i++) {
|
||||
DependencyDescriptor dd = deps[i];
|
||||
actual.add(dd.getDependencyRevisionId());
|
||||
}
|
||||
Set/* <ModuleRevisionId> */expected = new HashSet/* <ModuleRevisionId> */();
|
||||
expected.add(ModuleRevisionId.newInstance("org.eclipse", "core.runtime", "[3.2.0,4.0.0)"));
|
||||
expected.add(ModuleRevisionId.newInstance("org.eclipse", "core.resources", "[3.2.0,4.0.0)"));
|
||||
expected.add(ModuleRevisionId.newInstance("org.eclipse", "ui", "[3.2.0,4.0.0)"));
|
||||
expected.add(ModuleRevisionId.newInstance("org.eclipse", "ui.views", "[3.2.0,4.0.0)"));
|
||||
expected.add(ModuleRevisionId.newInstance("org.eclipse", "datatools.connectivity",
|
||||
"[0.9.1,1.5.0)"));
|
||||
expected.add(ModuleRevisionId.newInstance("org.eclipse", "ui.navigator", "[3.2.0,4.0.0)"));
|
||||
expected.add(ModuleRevisionId.newInstance("org.eclipse", "core.expressions",
|
||||
"[3.2.0,4.0.0)"));
|
||||
expected.add(ModuleRevisionId.newInstance("com.ibm", "icu", "[3.4.0,4.0.0)"));
|
||||
expected.add(ModuleRevisionId.newInstance("org.eclipse", "ltk.core.refactoring",
|
||||
"[3.2.0,4.0.0)"));
|
||||
expected.add(ModuleRevisionId.newInstance("org.eclipse", "datatools.help", "[1.0.0,2.0.0)"));
|
||||
expected.add(ModuleRevisionId.newInstance("org.eclipse", "help", "[3.2.0,4.0.0)"));
|
||||
expected.add(ModuleRevisionId.newInstance("org.eclipse", "help.base", "[3.2.0,4.0.0)"));
|
||||
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
private String readEntirely(String resource) throws IOException {
|
||||
return FileUtil.readEntirely(new BufferedReader(new InputStreamReader(ClassLoader
|
||||
.getSystemResource(resource).openStream())));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package org.apache.ivy.osgi.repo;
|
||||
package org.apache.ivy.osgi.obr;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
|
@ -46,15 +46,17 @@ import org.apache.ivy.core.resolve.ResolvedModuleRevision;
|
|||
import org.apache.ivy.core.settings.IvySettings;
|
||||
import org.apache.ivy.osgi.core.BundleInfo;
|
||||
import org.apache.ivy.osgi.core.ManifestParser;
|
||||
import org.apache.ivy.osgi.obr.OBRResolver;
|
||||
import org.apache.ivy.osgi.repo.BundleInfoAdapter;
|
||||
import org.apache.ivy.osgi.repo.BundleRepoResolver.RequirementStrategy;
|
||||
import org.apache.ivy.plugins.resolver.DependencyResolver;
|
||||
import org.apache.ivy.plugins.resolver.DualResolver;
|
||||
import org.apache.ivy.plugins.resolver.FileSystemResolver;
|
||||
|
||||
public class BundleRepoResolverTest extends TestCase {
|
||||
public class OBRResolverTest extends TestCase {
|
||||
|
||||
private static final ModuleRevisionId MRID_TEST_BUNDLE = ModuleRevisionId.newInstance("",
|
||||
"org.apache.ivy.osgitestbundle", "1.2.3", BundleInfoAdapter.OSGI_BUNDLE);
|
||||
"org.apache.ivy.osgi.testbundle", "1.2.3", BundleInfoAdapter.OSGI_BUNDLE);
|
||||
|
||||
private static final ModuleRevisionId MRID_TEST_BUNDLE_IMPORTING = ModuleRevisionId
|
||||
.newInstance("", "org.apache.ivy.osgi.testbundle.importing", "3.2.1",
|
||||
|
|
@ -83,23 +85,23 @@ public class BundleRepoResolverTest extends TestCase {
|
|||
|
||||
private Ivy ivy;
|
||||
|
||||
private BundleRepoResolver bundleResolver;
|
||||
private OBRResolver bundleResolver;
|
||||
|
||||
private BundleRepoResolver bundleUrlResolver;
|
||||
private OBRResolver bundleUrlResolver;
|
||||
|
||||
private DualResolver dualResolver;
|
||||
|
||||
public void setUp() throws Exception {
|
||||
settings = new IvySettings();
|
||||
|
||||
bundleResolver = new BundleRepoResolver();
|
||||
bundleResolver = new OBRResolver();
|
||||
bundleResolver.setRepoXmlFile(new File("test/test-repo/bundlerepo/repo.xml")
|
||||
.getAbsolutePath());
|
||||
bundleResolver.setName("bundle");
|
||||
bundleResolver.setSettings(settings);
|
||||
settings.addResolver(bundleResolver);
|
||||
|
||||
bundleUrlResolver = new BundleRepoResolver();
|
||||
bundleUrlResolver = new OBRResolver();
|
||||
bundleUrlResolver.setRepoXmlURL(new File("test/test-repo/bundlerepo/repo.xml").toURI()
|
||||
.toURL().toExternalForm());
|
||||
bundleUrlResolver.setName("bundleurl");
|
||||
|
|
@ -107,8 +109,8 @@ public class BundleRepoResolverTest extends TestCase {
|
|||
settings.addResolver(bundleUrlResolver);
|
||||
|
||||
dualResolver = new DualResolver();
|
||||
BundleRepoResolver resolver = new BundleRepoResolver();
|
||||
resolver.setRepoXmlFile("test/test-repo/ivyrepo/repo.xml");
|
||||
OBRResolver resolver = new OBRResolver();
|
||||
resolver.setRepoXmlFile(new File("test/test-repo/ivyrepo/repo.xml").getAbsolutePath());
|
||||
resolver.setName("dual-bundle");
|
||||
resolver.setSettings(settings);
|
||||
dualResolver.add(resolver);
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package org.apache.ivy.osgi.util;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.ivy.osgi.util.NameUtil.OrgAndName;
|
||||
|
||||
public class NameUtilTest extends TestCase {
|
||||
|
||||
public void testAsOrgAndName() {
|
||||
OrgAndName oan;
|
||||
|
||||
oan = NameUtil.instance().asOrgAndName("foo");
|
||||
assertEquals("foo", oan.org);
|
||||
assertEquals("foo", oan.name);
|
||||
|
||||
oan = NameUtil.instance().asOrgAndName("java.foo");
|
||||
assertEquals("java", oan.org);
|
||||
assertEquals("foo", oan.name);
|
||||
|
||||
oan = NameUtil.instance().asOrgAndName("java.foo.bar");
|
||||
assertEquals("java", oan.org);
|
||||
assertEquals("foo.bar", oan.name);
|
||||
|
||||
oan = NameUtil.instance().asOrgAndName("javax.foo");
|
||||
assertEquals("javax", oan.org);
|
||||
assertEquals("foo", oan.name);
|
||||
|
||||
oan = NameUtil.instance().asOrgAndName("javax.foo.bar");
|
||||
assertEquals("javax", oan.org);
|
||||
assertEquals("foo.bar", oan.name);
|
||||
|
||||
oan = NameUtil.instance().asOrgAndName("org.eclipse.foo");
|
||||
assertEquals("org.eclipse", oan.org);
|
||||
assertEquals("foo", oan.name);
|
||||
|
||||
oan = NameUtil.instance().asOrgAndName("org.eclipse.foo.bar");
|
||||
assertEquals("org.eclipse", oan.org);
|
||||
assertEquals("foo.bar", oan.name);
|
||||
|
||||
oan = NameUtil.instance().asOrgAndName("com.eclipse.foo.bar");
|
||||
assertEquals("com.eclipse", oan.org);
|
||||
assertEquals("foo.bar", oan.name);
|
||||
|
||||
oan = NameUtil.instance().asOrgAndName("net.eclipse.foo.bar");
|
||||
assertEquals("net.eclipse", oan.org);
|
||||
assertEquals("foo.bar", oan.name);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
# ***************************************************************
|
||||
# * Licensed to the Apache Software Foundation (ASF) under one
|
||||
# * or more contributor license agreements. See the NOTICE file
|
||||
# * distributed with this work for additional information
|
||||
# * regarding copyright ownership. The ASF licenses this file
|
||||
# * to you under the Apache License, Version 2.0 (the
|
||||
# * "License"); you may not use this file except in compliance
|
||||
# * with the License. You may obtain a copy of the License at
|
||||
# *
|
||||
# * http://www.apache.org/licenses/LICENSE-2.0
|
||||
# *
|
||||
# * Unless required by applicable law or agreed to in writing,
|
||||
# * software distributed under the License is distributed on an
|
||||
# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# * KIND, either express or implied. See the License for the
|
||||
# * specific language governing permissions and limitations
|
||||
# * under the License.
|
||||
# ***************************************************************
|
||||
#Thu Aug 07 12:00:41 BST 2008
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
# ***************************************************************
|
||||
# * Licensed to the Apache Software Foundation (ASF) under one
|
||||
# * or more contributor license agreements. See the NOTICE file
|
||||
# * distributed with this work for additional information
|
||||
# * regarding copyright ownership. The ASF licenses this file
|
||||
# * to you under the Apache License, Version 2.0 (the
|
||||
# * "License"); you may not use this file except in compliance
|
||||
# * with the License. You may obtain a copy of the License at
|
||||
# *
|
||||
# * http://www.apache.org/licenses/LICENSE-2.0
|
||||
# *
|
||||
# * Unless required by applicable law or agreed to in writing,
|
||||
# * software distributed under the License is distributed on an
|
||||
# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# * KIND, either express or implied. See the License for the
|
||||
# * specific language governing permissions and limitations
|
||||
# * under the License.
|
||||
# ***************************************************************
|
||||
#Thu Aug 07 12:00:50 BST 2008
|
||||
eclipse.preferences.version=1
|
||||
pluginProject.equinox=false
|
||||
pluginProject.extensions=false
|
||||
resolve.requirebundle=false
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package com.acme.alpha;
|
||||
|
||||
public class Alpha {
|
||||
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
# ***************************************************************
|
||||
# * Licensed to the Apache Software Foundation (ASF) under one
|
||||
# * or more contributor license agreements. See the NOTICE file
|
||||
# * distributed with this work for additional information
|
||||
# * regarding copyright ownership. The ASF licenses this file
|
||||
# * to you under the Apache License, Version 2.0 (the
|
||||
# * "License"); you may not use this file except in compliance
|
||||
# * with the License. You may obtain a copy of the License at
|
||||
# *
|
||||
# * http://www.apache.org/licenses/LICENSE-2.0
|
||||
# *
|
||||
# * Unless required by applicable law or agreed to in writing,
|
||||
# * software distributed under the License is distributed on an
|
||||
# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# * KIND, either express or implied. See the License for the
|
||||
# * specific language governing permissions and limitations
|
||||
# * under the License.
|
||||
# ***************************************************************
|
||||
#Thu Aug 07 12:01:28 BST 2008
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
# ***************************************************************
|
||||
# * Licensed to the Apache Software Foundation (ASF) under one
|
||||
# * or more contributor license agreements. See the NOTICE file
|
||||
# * distributed with this work for additional information
|
||||
# * regarding copyright ownership. The ASF licenses this file
|
||||
# * to you under the Apache License, Version 2.0 (the
|
||||
# * "License"); you may not use this file except in compliance
|
||||
# * with the License. You may obtain a copy of the License at
|
||||
# *
|
||||
# * http://www.apache.org/licenses/LICENSE-2.0
|
||||
# *
|
||||
# * Unless required by applicable law or agreed to in writing,
|
||||
# * software distributed under the License is distributed on an
|
||||
# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# * KIND, either express or implied. See the License for the
|
||||
# * specific language governing permissions and limitations
|
||||
# * under the License.
|
||||
# ***************************************************************
|
||||
#Thu Aug 07 12:01:28 BST 2008
|
||||
eclipse.preferences.version=1
|
||||
pluginProject.equinox=false
|
||||
pluginProject.extensions=false
|
||||
resolve.requirebundle=false
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package com.acme.bravo;
|
||||
|
||||
public class Bravo {
|
||||
|
||||
}
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<project xmlns:ivy="antlib:org.apache.ivy.ant" default="build-all">
|
||||
|
||||
<property name="jars.dir" value="${basedir}/jars" />
|
||||
<property name="dirs.dir" value="${basedir}/dirs" />
|
||||
|
||||
<target name="build-all">
|
||||
<mkdir dir="${jars.dir}" />
|
||||
<mkdir dir="${dirs.dir}" />
|
||||
|
||||
<antcall target="build" inheritall="false">
|
||||
<param name="bundle.name" value="alpha" />
|
||||
<param name="bundle.version" value="1.0.0.20080101" />
|
||||
</antcall>
|
||||
|
||||
<antcall target="build" inheritall="false">
|
||||
<param name="bundle.name" value="bravo" />
|
||||
<param name="bundle.version" value="2.0.0.20080202" />
|
||||
</antcall>
|
||||
|
||||
<antcall target="build" inheritall="false">
|
||||
<param name="bundle.name" value="charlie" />
|
||||
<param name="bundle.version" value="3.0.0.20080303" />
|
||||
</antcall>
|
||||
|
||||
<antcall target="build" inheritall="false">
|
||||
<param name="bundle.name" value="delta" />
|
||||
<param name="bundle.version" value="4.0.0" />
|
||||
</antcall>
|
||||
|
||||
<antcall target="build" inheritall="false">
|
||||
<param name="bundle.name" value="echo" />
|
||||
<param name="bundle.version" value="5.0.0" />
|
||||
</antcall>
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
<delete>
|
||||
<fileset dir="${jars.dir}">
|
||||
<include name="**/*" />
|
||||
</fileset>
|
||||
<fileset dir="${dirs.dir}">
|
||||
<include name="**/*" />
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<target name="build">
|
||||
<fail message="Requires 'bundle.name'." unless="bundle.name" />
|
||||
<fail message="Requires 'bundle.version'." unless="bundle.version" />
|
||||
|
||||
<property name="bundle.dir" value="${basedir}/${bundle.name}" />
|
||||
<property name="bundle.src" value="${bundle.dir}/src" />
|
||||
<property name="bundle.bin" value="${bundle.dir}/bin" />
|
||||
<property name="bundle.manifest" value="${bundle.dir}/META-INF/MANIFEST.MF" />
|
||||
|
||||
<mkdir dir="${bundle.bin}" />
|
||||
<javac destdir="${bundle.bin}" srcdir="${bundle.src}" />
|
||||
|
||||
<jar destfile="${jars.dir}/com.acme.${bundle.name}-${bundle.version}.jar" basedir="${bundle.bin}" manifest="${bundle.manifest}" />
|
||||
<jar destfile="${jars.dir}/com.acme.${bundle.name}.source-${bundle.version}.jar" basedir="${bundle.src}" manifest="${bundle.manifest}" />
|
||||
|
||||
<mkdir dir="${dirs.dir}/com.acme.${bundle.name}-${bundle.version}/"/>
|
||||
<copy todir="${dirs.dir}/com.acme.${bundle.name}-${bundle.version}">
|
||||
<fileset dir="${bundle.bin}" includes="**/*"/>
|
||||
<fileset dir="${bundle.dir}" includes="META-INF/*"/>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant">
|
||||
<classpath>
|
||||
<pathelement location="${basedir}/../../build/classes/core" />
|
||||
<pathelement location="${basedir}/../../build/classes/bootstrap" />
|
||||
</classpath>
|
||||
</taskdef>
|
||||
|
||||
<target name="ivy">
|
||||
<ivy:settings file="${basedir}/../test-ivy/acme-ivysettings.xml" />
|
||||
<ivy:resolve file="${basedir}/../test-ivy/acme-ivy.xml" />
|
||||
<ivy:retrieve pattern="${basedir}/../../build/test-data/bundles/[artifact]-[revision].[ext]"/>
|
||||
</target>
|
||||
</project>
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
# ***************************************************************
|
||||
# * Licensed to the Apache Software Foundation (ASF) under one
|
||||
# * or more contributor license agreements. See the NOTICE file
|
||||
# * distributed with this work for additional information
|
||||
# * regarding copyright ownership. The ASF licenses this file
|
||||
# * to you under the Apache License, Version 2.0 (the
|
||||
# * "License"); you may not use this file except in compliance
|
||||
# * with the License. You may obtain a copy of the License at
|
||||
# *
|
||||
# * http://www.apache.org/licenses/LICENSE-2.0
|
||||
# *
|
||||
# * Unless required by applicable law or agreed to in writing,
|
||||
# * software distributed under the License is distributed on an
|
||||
# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# * KIND, either express or implied. See the License for the
|
||||
# * specific language governing permissions and limitations
|
||||
# * under the License.
|
||||
# ***************************************************************
|
||||
#Thu Aug 07 12:01:53 BST 2008
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
# ***************************************************************
|
||||
# * Licensed to the Apache Software Foundation (ASF) under one
|
||||
# * or more contributor license agreements. See the NOTICE file
|
||||
# * distributed with this work for additional information
|
||||
# * regarding copyright ownership. The ASF licenses this file
|
||||
# * to you under the Apache License, Version 2.0 (the
|
||||
# * "License"); you may not use this file except in compliance
|
||||
# * with the License. You may obtain a copy of the License at
|
||||
# *
|
||||
# * http://www.apache.org/licenses/LICENSE-2.0
|
||||
# *
|
||||
# * Unless required by applicable law or agreed to in writing,
|
||||
# * software distributed under the License is distributed on an
|
||||
# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# * KIND, either express or implied. See the License for the
|
||||
# * specific language governing permissions and limitations
|
||||
# * under the License.
|
||||
# ***************************************************************
|
||||
#Thu Aug 07 12:01:53 BST 2008
|
||||
eclipse.preferences.version=1
|
||||
pluginProject.equinox=false
|
||||
pluginProject.extensions=false
|
||||
resolve.requirebundle=false
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package com.acme.charlie;
|
||||
|
||||
public class Charlie {
|
||||
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
# ***************************************************************
|
||||
# * Licensed to the Apache Software Foundation (ASF) under one
|
||||
# * or more contributor license agreements. See the NOTICE file
|
||||
# * distributed with this work for additional information
|
||||
# * regarding copyright ownership. The ASF licenses this file
|
||||
# * to you under the Apache License, Version 2.0 (the
|
||||
# * "License"); you may not use this file except in compliance
|
||||
# * with the License. You may obtain a copy of the License at
|
||||
# *
|
||||
# * http://www.apache.org/licenses/LICENSE-2.0
|
||||
# *
|
||||
# * Unless required by applicable law or agreed to in writing,
|
||||
# * software distributed under the License is distributed on an
|
||||
# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# * KIND, either express or implied. See the License for the
|
||||
# * specific language governing permissions and limitations
|
||||
# * under the License.
|
||||
# ***************************************************************
|
||||
#Thu Aug 07 12:02:12 BST 2008
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
# ***************************************************************
|
||||
# * Licensed to the Apache Software Foundation (ASF) under one
|
||||
# * or more contributor license agreements. See the NOTICE file
|
||||
# * distributed with this work for additional information
|
||||
# * regarding copyright ownership. The ASF licenses this file
|
||||
# * to you under the Apache License, Version 2.0 (the
|
||||
# * "License"); you may not use this file except in compliance
|
||||
# * with the License. You may obtain a copy of the License at
|
||||
# *
|
||||
# * http://www.apache.org/licenses/LICENSE-2.0
|
||||
# *
|
||||
# * Unless required by applicable law or agreed to in writing,
|
||||
# * software distributed under the License is distributed on an
|
||||
# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# * KIND, either express or implied. See the License for the
|
||||
# * specific language governing permissions and limitations
|
||||
# * under the License.
|
||||
# ***************************************************************
|
||||
#Thu Aug 07 12:02:12 BST 2008
|
||||
eclipse.preferences.version=1
|
||||
pluginProject.equinox=false
|
||||
pluginProject.extensions=false
|
||||
resolve.requirebundle=false
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package com.acme.delta;
|
||||
|
||||
public class Delta {
|
||||
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
# ***************************************************************
|
||||
# * Licensed to the Apache Software Foundation (ASF) under one
|
||||
# * or more contributor license agreements. See the NOTICE file
|
||||
# * distributed with this work for additional information
|
||||
# * regarding copyright ownership. The ASF licenses this file
|
||||
# * to you under the Apache License, Version 2.0 (the
|
||||
# * "License"); you may not use this file except in compliance
|
||||
# * with the License. You may obtain a copy of the License at
|
||||
# *
|
||||
# * http://www.apache.org/licenses/LICENSE-2.0
|
||||
# *
|
||||
# * Unless required by applicable law or agreed to in writing,
|
||||
# * software distributed under the License is distributed on an
|
||||
# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# * KIND, either express or implied. See the License for the
|
||||
# * specific language governing permissions and limitations
|
||||
# * under the License.
|
||||
# ***************************************************************
|
||||
#Thu Aug 07 12:02:35 BST 2008
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
# ***************************************************************
|
||||
# * Licensed to the Apache Software Foundation (ASF) under one
|
||||
# * or more contributor license agreements. See the NOTICE file
|
||||
# * distributed with this work for additional information
|
||||
# * regarding copyright ownership. The ASF licenses this file
|
||||
# * to you under the Apache License, Version 2.0 (the
|
||||
# * "License"); you may not use this file except in compliance
|
||||
# * with the License. You may obtain a copy of the License at
|
||||
# *
|
||||
# * http://www.apache.org/licenses/LICENSE-2.0
|
||||
# *
|
||||
# * Unless required by applicable law or agreed to in writing,
|
||||
# * software distributed under the License is distributed on an
|
||||
# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# * KIND, either express or implied. See the License for the
|
||||
# * specific language governing permissions and limitations
|
||||
# * under the License.
|
||||
# ***************************************************************
|
||||
#Thu Aug 07 12:02:35 BST 2008
|
||||
eclipse.preferences.version=1
|
||||
pluginProject.equinox=false
|
||||
pluginProject.extensions=false
|
||||
resolve.requirebundle=false
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
package com.acme.echo;
|
||||
|
||||
public class Echo {
|
||||
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<ivysettings>
|
||||
<typedef name="osgi-parser" classname="org.apache.ivy.osgi.ivy.OsgiManifestParser" />
|
||||
<typedef name="osgi-file-resolver" classname="org.apache.ivy.osgi.ivy.OsgiFileResolver" />
|
||||
<typedef name="osgi-latest" classname="org.apache.ivy.osgi.ivy.OsgiRevisionStrategy" />
|
||||
<settings defaultResolver="default" defaultLatestStrategy="osgi-latest-revision" />
|
||||
<parsers>
|
||||
<osgi-parser />
|
||||
</parsers>
|
||||
<caches default="localcache">
|
||||
<cache name="localcache" basedir="${ivy.settings.dir}/../../build/test-data/cache">
|
||||
<ttl duration="0d" />
|
||||
</cache>
|
||||
</caches>
|
||||
<resolvers>
|
||||
<chain name="default" returnFirst="true">
|
||||
<osgi-file-resolver name="repo1">
|
||||
<ivy pattern="test/test-bundles/dirs/[organisation].[module]-[revision]" />
|
||||
<artifact pattern="test/test-bundles/dirs/[organisation].[module]-[revision]" />
|
||||
</osgi-file-resolver>
|
||||
<osgi-file-resolver name="repo2">
|
||||
<ivy pattern="test/test-bundles/jars/[organisation].[module]-[revision].jar" />
|
||||
<artifact pattern="test/test-bundles/jars/[organisation].[module]-[revision].jar" />
|
||||
</osgi-file-resolver>
|
||||
</chain>
|
||||
</resolvers>
|
||||
<latest-strategies>
|
||||
<osgi-latest name="osgi-latest-revision" />
|
||||
</latest-strategies>
|
||||
</ivysettings>
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-SymbolicName: org.apache.ivy.osgi.testbundle
|
||||
Bundle-Version: 1.2.3
|
||||
Export-Package: org.apache.ivy.osgi.testbundle;version="1.2.3",org.apache.ivy.osgi.testbundle.util;version="1.2.3"
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<ivy-module version="2.0">
|
||||
<info organisation="" module="org.apache.ivy.osgi.testbundle" revision="1.2.3" osgi="bundle">
|
||||
</info>
|
||||
<configurations>
|
||||
<conf name="default" />
|
||||
<conf name="optional" extends="default" />
|
||||
<conf name="transitive-optional" extends="default" />
|
||||
<conf name="use_org.apache.ivy.osgi.testbundle.util" extends="default" />
|
||||
<conf name="use_org.apache.ivy.osgi.testbundle" extends="default" />
|
||||
<conf name="specificconf" exends="default" />
|
||||
</configurations>
|
||||
<publications>
|
||||
</publications>
|
||||
<dependencies>
|
||||
<dependency org="org2" name="mod2" rev="3.4" conf="specificconf->default" />
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<ivy-module version="2.0">
|
||||
<info manifest="MANIFEST.MF" />
|
||||
<configurations>
|
||||
<conf name="specificconf" exends="default" />
|
||||
</configurations>
|
||||
<publications>
|
||||
</publications>
|
||||
<dependencies>
|
||||
<dependency org="org2" name="mod2" rev="3.4" conf="specificconf->default" />
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<ivysettings>
|
||||
<typedef name="include-parser" classname="org.apache.ivy.osgi.ivy.OsgiIvyParser" />
|
||||
<typedef name="manifest-parser" classname="org.apache.ivy.osgi.repo.ManifestMDParser" />
|
||||
<parsers>
|
||||
<include-parser />
|
||||
<manifest-parser />
|
||||
</parsers>
|
||||
</ivysettings>
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<ivysettings>
|
||||
<!--<classpath url/file="${ivy.custom.lib.dir}/osgi-resolver.jar"/> -->
|
||||
<typedef name="osgi-parser" classname="org.apache.ivy.osgi.ivy.OsgiManifestParser" />
|
||||
<typedef name="osgi-file-resolver" classname="org.apache.ivy.osgi.ivy.OsgiFileResolver" />
|
||||
<parsers>
|
||||
<osgi-parser />
|
||||
</parsers>
|
||||
<caches default="localcache">
|
||||
<cache name="localcache" basedir="${ivy.settings.dir}/../../build/test-data/cache">
|
||||
<ttl duration="0d" />
|
||||
</cache>
|
||||
</caches>
|
||||
<resolvers>
|
||||
<osgi-file-resolver name="osgi-rep">
|
||||
<ivy pattern="test/test-ivy/osgi/eclipse/plugins/[organisation].[module]" />
|
||||
<ivy pattern="test/test-ivy/osgi/eclipse/features/[organisation].[module]" />
|
||||
</osgi-file-resolver>
|
||||
</resolvers>
|
||||
</ivysettings>
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<ivy-module version="1.0">
|
||||
<info organisation="org.eclipse"
|
||||
module="datatools.connectivity.ui"
|
||||
revision="1.0.1.200708231"
|
||||
status="release"
|
||||
publication="19700101011640"
|
||||
/>
|
||||
<configurations>
|
||||
<conf name="default" visibility="public"/>
|
||||
<conf name="optional" visibility="public"/>
|
||||
</configurations>
|
||||
<publications>
|
||||
<artifact name="datatools.connectivity.ui" type="jar" ext="jar" conf="default"/>
|
||||
</publications>
|
||||
<dependencies>
|
||||
<dependency org="org.eclipse" name="core.runtime" rev="[3.2.0,4.0.0)" conf="default->default"/>
|
||||
<dependency org="org.eclipse" name="core.resources" rev="[3.2.0,4.0.0)" conf="default->default"/>
|
||||
<dependency org="org.eclipse" name="ui" rev="[3.2.0,4.0.0)" conf="default->default"/>
|
||||
<dependency org="org.eclipse" name="ui.views" rev="[3.2.0,4.0.0)" conf="default->default"/>
|
||||
<dependency org="org.eclipse" name="datatools.connectivity" rev="[0.9.1,1.5.0)" conf="default->default"/>
|
||||
<dependency org="org.eclipse" name="ui.navigator" rev="[3.2.0,4.0.0)" conf="default->default"/>
|
||||
<dependency org="org.eclipse" name="core.expressions" rev="[3.2.0,4.0.0)" conf="optional->optional"/>
|
||||
<dependency org="com.ibm" name="icu" rev="[3.4.0,4.0.0)" conf="default->default"/>
|
||||
<dependency org="org.eclipse" name="ltk.core.refactoring" rev="[3.2.0,4.0.0)" conf="default->default"/>
|
||||
<dependency org="org.eclipse" name="datatools.help" rev="[1.0.0,2.0.0)" conf="default->default"/>
|
||||
<dependency org="org.eclipse" name="help" rev="[3.2.0,4.0.0)" conf="default->default"/>
|
||||
<dependency org="org.eclipse" name="help.base" rev="[3.2.0,4.0.0)" conf="default->default"/>
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
Binary file not shown.
Binary file not shown.
|
|
@ -16,7 +16,7 @@
|
|||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->org.apache.ivy.osgi
|
||||
-->
|
||||
<repository>
|
||||
<resource symbolicname="org.apache.ivy.osgi.testbundle" version="1.2.3" uri="org.apache.ivy.osgi.testbundle_1.2.3.jar">
|
||||
<capability name="package">
|
||||
|
|
|
|||
Loading…
Reference in New Issue