All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.crsn.maven.utils.osgirepo.osgi.OsgiDependency Maven / Gradle / Ivy

Go to download

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 + "]";
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy