com.crsn.maven.utils.osgirepo.osgi.OsgiDependency Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kar-packager Show documentation
Show all versions of kar-packager Show documentation
The kar-packager is a small Maven Plugin to create Apache Karaf Archives (.kar) from a given folder. Everything the
folder needs to contain are the bundles to make up the archive.
The newest version!
package com.crsn.maven.utils.osgirepo.osgi;
public class OsgiDependency {
private final String name;
private final VersionRange versionRange;
public OsgiDependency( String name, VersionRange versionRange ) {
if( name == null ) {
throw new NullPointerException( "Null name." );
}
if( versionRange == null ) {
throw new NullPointerException( "Null version." );
}
this.name = name;
this.versionRange = versionRange;
}
public String getName() {
return name;
}
public VersionRange getVersionRange() {
return versionRange;
}
public boolean isResolvedBy( OsgiBundle osgiBundle ) {
if( osgiBundle == null ) {
throw new NullPointerException( "Null osgi bundle." );
}
String pluginName = osgiBundle.getName();
if( !pluginName.equals( name ) ) {
return false;
}
return versionRange.contains( osgiBundle.getVersion() );
}
@Override
public String toString() {
return "OsgiDependency [name=" + name + ", versionRange=" + versionRange + "]";
}
}