Java Code Examples for org.eclipse.equinox.p2.metadata.IInstallableUnit#getProperty()
The following examples show how to use
org.eclipse.equinox.p2.metadata.IInstallableUnit#getProperty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultMavenMapping.java From neoscada with Eclipse Public License 1.0 | 6 votes |
public String makeVersion ( final IInstallableUnit iu, final boolean withQualifier ) throws Exception { Version version; final String tychoVersion = iu.getProperty ( "maven-version" ); if ( !IGNORE_TYCHO && tychoVersion != null ) { final IVersionFormat format = Version.compile ( "n[.n=0;[.n=0;[.n=0;]]][[-.]S='';]" ); version = format.parse ( tychoVersion ); } else { version = iu.getVersion (); } if ( withQualifier ) { return toString ( version ); } else { return withoutQualifier ( version ); } }
Example 2
Source File: DefaultMavenMapping.java From neoscada with Eclipse Public License 1.0 | 6 votes |
public String makeVersion ( final IInstallableUnit iu, final boolean withQualifier ) throws Exception { Version version; final String tychoVersion = iu.getProperty ( "maven-version" ); if ( !IGNORE_TYCHO && tychoVersion != null ) { final IVersionFormat format = Version.compile ( "n[.n=0;[.n=0;[.n=0;]]][[-.]S='';]" ); version = format.parse ( tychoVersion ); } else { version = iu.getVersion (); } if ( withQualifier ) { return toString ( version ); } else { return withoutQualifier ( version ); } }
Example 3
Source File: DefaultMavenMapping.java From neoscada with Eclipse Public License 1.0 | 5 votes |
public String makeArtifactId ( final IInstallableUnit iu ) { final String name = iu.getProperty ( "maven-artifactId" ); if ( name != null ) { return name; } return getName ( iu ); }
Example 4
Source File: Processor.java From neoscada with Eclipse Public License 1.0 | 5 votes |
private String makeProjectUrl ( final IInstallableUnit iu ) { String url = iu.getProperty ( "org.eclipse.equinox.p2.doc.url", null ); if ( url == null || url.isEmpty () ) { url = this.properties.getProperty ( "default.project.url" ); } return url; }
Example 5
Source File: DefaultMavenMapping.java From neoscada with Eclipse Public License 1.0 | 5 votes |
public String makeArtifactId ( final IInstallableUnit iu ) { final String name = iu.getProperty ( "maven-artifactId" ); if ( name != null ) { return name; } return getName ( iu ); }
Example 6
Source File: Processor.java From neoscada with Eclipse Public License 1.0 | 5 votes |
private void makePom ( final MavenReference ref, final Path versionBase, final Set<MavenDependency> deps, final IInstallableUnit iu ) throws Exception { final Document doc = this.documentBuilder.newDocument (); final Element project = doc.createElementNS ( "http://maven.apache.org/POM/4.0.0", "project" ); project.setAttributeNS ( "http://www.w3.org/2001/XMLSchema-instance", "xsi:schemaLocation", "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" ); doc.appendChild ( project ); addElement ( project, "modelVersion", "4.0.0" ); addElement ( project, "groupId", ref.getGroupId () ); addElement ( project, "artifactId", ref.getArtifactId () ); addElement ( project, "version", ref.getVersion () ); addElement ( project, "url", makeProjectUrl ( iu ) ); // name and description String name = iu.getProperty ( "org.eclipse.equinox.p2.name", null ); if ( name == null ) { name = String.format ( "%s:%s", ref.getGroupId (), ref.getArtifactId () ); } String description = iu.getProperty ( "org.eclipse.equinox.p2.description", null ); if ( description == null ) { description = name; } addElement ( project, "name", name ); addElement ( project, "description", description ); addOrganization ( project ); addDevelopers ( project ); // license final List<License> lics = this.licenseProvider.getLicenses ( iu ); if ( lics != null ) { addLicense ( project, lics ); } else if ( ref.getArtifactId ().startsWith ( "org.eclipse." ) ) { addLicense ( project, singletonList ( EPL ) ); } else { this.errors.add ( String.format ( "%s: no license information", ref ) ); } makeScm ( iu, doc, project, versionBase, ref ); if ( !deps.isEmpty () ) { final Element depsEle = doc.createElement ( "dependencies" ); project.appendChild ( depsEle ); for ( final MavenDependency dep : deps ) { final Element depEle = doc.createElement ( "dependency" ); depsEle.appendChild ( depEle ); addElement ( depEle, "groupId", dep.getGroupId () ); addElement ( depEle, "artifactId", dep.getArtifactId () ); addElement ( depEle, "version", dep.getVersion () ); if ( dep.isOptional () ) { addElement ( depEle, "optional", "true" ); } } } final Path pomFile = versionBase.resolve ( ref.getArtifactId () + "-" + ref.getVersion () + ".pom" ); saveXml ( doc, pomFile ); makeChecksum ( "MD5", pomFile, versionBase.resolve ( ref.getArtifactId () + "-" + ref.getVersion () + ".pom.md5" ) ); makeChecksum ( "SHA1", pomFile, versionBase.resolve ( ref.getArtifactId () + "-" + ref.getVersion () + ".pom.sha1" ) ); addMetaDataVersion ( ref ); }
Example 7
Source File: Processor.java From neoscada with Eclipse Public License 1.0 | 5 votes |
private String makeProjectUrl ( final IInstallableUnit iu ) { String url = iu.getProperty ( "org.eclipse.equinox.p2.doc.url", null ); if ( url == null || url.isEmpty () ) { url = this.properties.getProperty ( "default.project.url" ); } return url; }
Example 8
Source File: Feature.java From developer-studio with Apache License 2.0 | 5 votes |
public Feature(IInstallableUnit iu){ setId(iu.getId()); this.label = iu.getProperty(IInstallableUnit.PROP_NAME); this.version = iu.getVersion().toString(); this.provider = iu.getProperty(IInstallableUnit.PROP_PROVIDER); this.descriptionURL = iu.getProperty(IInstallableUnit.PROP_DESCRIPTION_URL); this.description = iu.getProperty(IInstallableUnit.PROP_DESCRIPTION); this.iu = iu; }
Example 9
Source File: DefaultMavenMapping.java From neoscada with Eclipse Public License 1.0 | 4 votes |
private String makeClassifier ( final IInstallableUnit iu ) { return iu.getProperty ( "maven-classifier" ); }
Example 10
Source File: DefaultMavenMapping.java From neoscada with Eclipse Public License 1.0 | 4 votes |
private String makeGroupIdFromTycho ( final IInstallableUnit iu ) { return iu.getProperty ( "maven-groupId" ); }
Example 11
Source File: Processor.java From neoscada with Eclipse Public License 1.0 | 4 votes |
private void makePom ( final MavenReference ref, final Path versionBase, final Set<MavenDependency> deps, final IInstallableUnit iu ) throws Exception { final Document doc = this.documentBuilder.newDocument (); final Element project = doc.createElementNS ( "http://maven.apache.org/POM/4.0.0", "project" ); project.setAttributeNS ( "http://www.w3.org/2001/XMLSchema-instance", "xsi:schemaLocation", "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" ); doc.appendChild ( project ); addElement ( project, "modelVersion", "4.0.0" ); addElement ( project, "groupId", ref.getGroupId () ); addElement ( project, "artifactId", ref.getArtifactId () ); addElement ( project, "version", ref.getVersion () ); addElement ( project, "url", makeProjectUrl ( iu ) ); // name and description String name = iu.getProperty ( "org.eclipse.equinox.p2.name", null ); if ( name == null ) { name = String.format ( "%s:%s", ref.getGroupId (), ref.getArtifactId () ); } String description = iu.getProperty ( "org.eclipse.equinox.p2.description", null ); if ( description == null ) { description = name; } addElement ( project, "name", name ); addElement ( project, "description", description ); addOrganization ( project ); addDevelopers ( project ); // license final List<License> lics = this.licenseProvider.getLicenses ( iu ); if ( lics != null ) { addLicense ( project, lics ); } else if ( ref.getArtifactId ().startsWith ( "org.eclipse." ) ) { addLicense ( project, singletonList ( EPL ) ); } else { this.errors.add ( String.format ( "%s: no license information", ref ) ); } makeScm ( iu, doc, project, versionBase, ref ); if ( !deps.isEmpty () ) { final Element depsEle = doc.createElement ( "dependencies" ); project.appendChild ( depsEle ); for ( final MavenDependency dep : deps ) { final Element depEle = doc.createElement ( "dependency" ); depsEle.appendChild ( depEle ); addElement ( depEle, "groupId", dep.getGroupId () ); addElement ( depEle, "artifactId", dep.getArtifactId () ); addElement ( depEle, "version", dep.getVersion () ); if ( dep.isOptional () ) { addElement ( depEle, "optional", "true" ); } } } final Path pomFile = versionBase.resolve ( ref.getArtifactId () + "-" + ref.getVersion () + ".pom" ); saveXml ( doc, pomFile ); makeChecksum ( "MD5", pomFile, versionBase.resolve ( ref.getArtifactId () + "-" + ref.getVersion () + ".pom.md5" ) ); makeChecksum ( "SHA1", pomFile, versionBase.resolve ( ref.getArtifactId () + "-" + ref.getVersion () + ".pom.sha1" ) ); addMetaDataVersion ( ref ); }
Example 12
Source File: DefaultMavenMapping.java From neoscada with Eclipse Public License 1.0 | 4 votes |
private String makeClassifier ( final IInstallableUnit iu ) { return iu.getProperty ( "maven-classifier" ); }
Example 13
Source File: DefaultMavenMapping.java From neoscada with Eclipse Public License 1.0 | 4 votes |
private String makeGroupIdFromTycho ( final IInstallableUnit iu ) { return iu.getProperty ( "maven-groupId" ); }