• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Version类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.equinox.p2.metadata.Version的典型用法代码示例。如果您正苦于以下问题:Java Version类的具体用法?Java Version怎么用?Java Version使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Version类属于org.eclipse.equinox.p2.metadata包,在下文中一共展示了Version类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: makeVersion

import org.eclipse.equinox.p2.metadata.Version; //导入依赖的package包/类
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 );
    }

}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:26,代码来源:DefaultMavenMapping.java


示例2: findUnit

import org.eclipse.equinox.p2.metadata.Version; //导入依赖的package包/类
/**
 * Finds the latest version of an installable unit in a repository.
 * 
 * @param spec Version specification
 * @return Installable unit or <code>null</code>.
 * @throws CoreException on failure
 */
public IInstallableUnit findUnit(IVersionedId spec) {
	String id = spec.getId();
	Version version = spec.getVersion();
	VersionRange range = VersionRange.emptyRange;
	if (version != null && !version.equals(Version.emptyVersion))
		range = new VersionRange(version, true, version, true);
	
	IQuery<IInstallableUnit> query = QueryUtil.createIUQuery(id, range);
	IQueryResult<IInstallableUnit> queryResult = getRepository().query(query, new NullProgressMonitor());
	
	Iterator<IInstallableUnit> matches = queryResult.iterator();
	// pick the newest match
	IInstallableUnit newest = null;
	while (matches.hasNext()) {
		IInstallableUnit candidate = matches.next();
		if (newest == null || (newest.getVersion().compareTo(candidate.getVersion()) < 0))
			newest = candidate;
	}
	
	return newest;
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:29,代码来源:RepositoryAdapter.java


示例3: createIuDescription

import org.eclipse.equinox.p2.metadata.Version; //导入依赖的package包/类
/**
 * Creates an IU description.
 * 
 * @param id IU identifier
 * @param version IU version
 * @param singleton <code>true</code> if singleton
 * @param properties IU properties or <code>null</code>
 * @return IU description
 */
public static InstallableUnitDescription createIuDescription(String id, Version version, boolean singleton, 
		Map<String, String> properties) {
	InstallableUnitDescription iuDesc = new MetadataFactory.InstallableUnitDescription();
	iuDesc.setId(id);
	iuDesc.setVersion(version);
	iuDesc.setSingleton(singleton);
	iuDesc.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor(id, new VersionRange(null), IUpdateDescriptor.NORMAL, ""));

	// Set provided capability
	iuDesc.setCapabilities(new IProvidedCapability[] { MetadataFactory
			.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, id, version) });
	
	// Set properties
	if (properties != null) {
		Iterator<Entry<String, String>> propertiesIter = properties.entrySet().iterator();
		while (propertiesIter.hasNext()) {
			Entry<String, String> property = propertiesIter.next();
			iuDesc.setProperty(property.getKey(), property.getValue());
		}
	}
	
	return iuDesc;
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:33,代码来源:InstallUtils.java


示例4: findUnitAll

import org.eclipse.equinox.p2.metadata.Version; //导入依赖的package包/类
/**
 * Finds the latest version of an installable unit in all repositories.
 * 
 * @param spec Version specification
 * @return Installable unit or <code>null</code>.
 * @throws CoreException on failure
 */
public IInstallableUnit findUnitAll(IVersionedId spec) throws CoreException {
	String id = spec.getId();
	if (id == null) {
		Installer.fail(InstallMessages.Error_NoId);
	}
	Version version = spec.getVersion();
	VersionRange range = VersionRange.emptyRange;
	if (version != null && !version.equals(Version.emptyVersion))
		range = new VersionRange(version, true, version, true);
	IQuery<IInstallableUnit> query = QueryUtil.createIUQuery(id, range);
	Iterator<IInstallableUnit> matches = getManager().query(query, null).iterator();
	// pick the newest match
	IInstallableUnit newest = null;
	while (matches.hasNext()) {
		IInstallableUnit candidate = matches.next();
		if (newest == null || (newest.getVersion().compareTo(candidate.getVersion()) < 0))
			newest = candidate;
	}
	if (newest == null)
	{
		Installer.fail(InstallMessages.Error_IUNotFound + id);
	}
	return newest;
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:32,代码来源:RepositoryManagerAdapter.java


示例5: getSegments

import org.eclipse.equinox.p2.metadata.Version; //导入依赖的package包/类
private Object[] getSegments ( final Version version )
{
    final Object[] result = new Object[version.getSegmentCount ()];

    for ( int i = 0; i < version.getSegmentCount (); i++ )
    {
        result[i] = version.getSegment ( i );
    }
    return result;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:11,代码来源:DefaultMavenMapping.java


示例6: withoutQualifier

import org.eclipse.equinox.p2.metadata.Version; //导入依赖的package包/类
protected String withoutQualifier ( final Version version )
{
    if ( version.getSegmentCount () >= 4 )
    {
        return String.format ( "%s.%s.%s", version.getSegment ( 0 ), version.getSegment ( 1 ), version.getSegment ( 2 ) );
    }
    else
    {
        return toString ( version );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:12,代码来源:DefaultMavenMapping.java


示例7: findUnit

import org.eclipse.equinox.p2.metadata.Version; //导入依赖的package包/类
/**
 * Finds the latest version of an installable unit in local repositories.
 * 
 * @param spec Version specification
 * @return Installable unit or <code>null</code>.
 * @throws CoreException on failure
 */
public IInstallableUnit findUnit(IVersionedId spec) throws CoreException {
	String id = spec.getId();
	if (id == null) {
		Installer.fail(InstallMessages.Error_NoId);
	}
	Version version = spec.getVersion();
	VersionRange range = VersionRange.emptyRange;
	if (version != null && !version.equals(Version.emptyVersion))
		range = new VersionRange(version, true, version, true);
	
	URI[] locations = manager.getKnownRepositories(IRepositoryManager.REPOSITORIES_LOCAL);
	List<IMetadataRepository> queryables = new ArrayList<IMetadataRepository>(locations.length);
	for (URI location : locations) {
		queryables.add(getManager().loadRepository(location, new NullProgressMonitor()));
	}

	IQuery<IInstallableUnit> query = QueryUtil.createIUQuery(id, range);
	IQueryable<IInstallableUnit> compoundQueryable = QueryUtil.compoundQueryable(queryables);
	IQueryResult<IInstallableUnit> queryResult = compoundQueryable.query(query, new NullProgressMonitor());
	
	Iterator<IInstallableUnit> matches = queryResult.iterator();
	// pick the newest match
	IInstallableUnit newest = null;
	while (matches.hasNext()) {
		IInstallableUnit candidate = matches.next();
		if (newest == null || (newest.getVersion().compareTo(candidate.getVersion()) < 0))
			newest = candidate;
	}

	return newest;
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:39,代码来源:RepositoryManagerAdapter.java


示例8: createOptions

import org.eclipse.equinox.p2.metadata.Version; //导入依赖的package包/类
@Override
protected void createOptions() {
	// Product version
	Version productVersion = Installer.getDefault().getInstallManager().getInstallDescription().getProductVersion();
	
	// Update installation
	if (productVersion.equals(getProduct().getVersion())) {
		// Change
		addOption(new Option(
				UpdateOption.UPDATE, 
				getImage(IInstallerImages.UPDATE_ADD), 
				InstallMessages.SetupPrompter_Change,
				InstallMessages.SetupPrompter_ChangeDescription));
		
		// Remove (only if uninstaller found)
		if (getProduct().getUninstaller() != null) {
			addOption(new Option(
					UpdateOption.UNINSTALL,
					getImage(IInstallerImages.UPDATE_REMOVE), 
					InstallMessages.SetupPrompter_Remove, 
					InstallMessages.SetupPrompter_RemoveDescription));
		}
	}
	// Upgrade installation
	else {
		String upgradeDescription = NLS.bind(InstallMessages.SetupPrompter_UpgradeDescription0, productVersion);
		addOption(new Option(
				UpdateOption.UPGRADE,
				getImage(IInstallerImages.UPDATE_INSTALL), 
				InstallMessages.SetupPrompter_Upgrade, 
				upgradeDescription));
	}
	// Install to a different location
	addOption(new Option(
			UpdateOption.INSTALL,
			getImage(IInstallerImages.UPDATE_FOLDER), 
			InstallMessages.SetupPrompter_Install, 
			InstallMessages.SetupPrompter_InstallDescription));
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:40,代码来源:SetupPage.java


示例9: getExistingRequiredRootIUs

import org.eclipse.equinox.p2.metadata.Version; //导入依赖的package包/类
/**
 * Checks the requirements of a specified IU and returns any that are already installed as a root IU.
 * 
 * @param unit IU to check for requirements.
 * @param requiredRoots Filled with root IU's that are required by the IU.
 */
private void getExistingRequiredRootIUs(IInstallableUnit unit, ArrayList<IInstallableUnit> requiredRoots) {
	try {
		// Get requirements for the IU
		IQueryResult<IInstallableUnit> requirements = getMetadataRepositoryManager().query(new RequiredIUsQuery(unit), new NullProgressMonitor());
		Iterator<IInstallableUnit> iter = requirements.iterator();
		ProfileAdapter profileAdapter = new ProfileAdapter(getInstallProfile());
		RepositoryManagerAdapter repositoryAdapter = new RepositoryManagerAdapter(getMetadataRepositoryManager());
		while (iter.hasNext()) {
			IInstallableUnit required = iter.next();
			// Check if the required IU is already present in the profile
			IInstallableUnit existingRequired = profileAdapter.findUnit(required.getId());
			if (existingRequired != null) {
				// See if the required IU is present in the repository
				IInstallableUnit installingUnit = repositoryAdapter.findUnit(new VersionedId(existingRequired.getId(), Version.emptyVersion));
				if ((installingUnit != null) && !requiredRoots.contains(installingUnit)) {
					// Is the required IU a root
					String root = getInstallProfile().getInstallableUnitProperties(existingRequired).get(IProfile.PROP_PROFILE_ROOT_IU);
					boolean newerVersion = (required.getVersion().compareTo(existingRequired.getVersion()) > 0);
					
					// If the required IU is an existing root then add it
					if (Boolean.TRUE.toString().equals(root) && newerVersion) {
						if (!requiredRoots.contains(existingRequired)) {
							requiredRoots.add(existingRequired);
							getExistingRequiredRootIUs(required, requiredRoots);
						}
					}
				}
			}
		}
	}
	catch (Exception e) {
		Installer.log(e);
	}
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:41,代码来源:RepositoryManager.java


示例10: checkIfFeatureExist

import org.eclipse.equinox.p2.metadata.Version; //导入依赖的package包/类
private boolean checkIfFeatureExist(String featureID, Iterator<IInstallableUnit> iterator) {
	System.out.println("Received Feature ID with Version : " + featureID);
	String[] featureInfo = featureID.split("_");
	String updatedFeatureID = featureInfo[0];
	System.out.println("The version being tested : " + featureInfo[1]);
	Version featureVersion = generateOSGIVersion(featureInfo[1]);
	updatedFeatureID = updatedFeatureID + "." + FEATURE_JAR_IU_ID_SFX;
	System.out.println("Checking Availability of " + updatedFeatureID + "Version  : " + featureVersion
			+ " in the given repository");
	while (iterator.hasNext()) {
		IInstallableUnit iu = iterator.next();
		String featureIuId = iu.getId();
		Version IUVersion = iu.getVersion();
		if (featureIuId != null && featureIuId.startsWith(WSO2_FEATURE_PREFIX)
				&& featureIuId.endsWith(FEATURE_JAR_IU_ID_SFX)) {
			if (featureIuId.equals(updatedFeatureID)) {
				if (IUVersion.compareTo(featureVersion) == 0) {
					System.out.println(
							"\n===========================xxxxxxxxxxxxxxxxxxx==================================\n");
					System.out.println("-------------------------P2 Structure is valid----------------- \n \n ");
					System.out.println("\n=====================================================================\n");
					System.out.println("\n=====================================================================\n");
					System.out.println("===========          " + featureID + " Version  : " + featureVersion
							+ "   is Available in the Updates Repository          =============\n");
					System.out.println("\n=====================================================================\n");
					return true;
				}
			}
		}
	}
	System.out.println("\n=====================================================================\n");
	System.out.println("\n=====================================================================\n");
	System.out.println("=========== " + updatedFeatureID + "Version  : " + featureVersion
			+ " is not available in the given repository, Exiting system with error code ======================");
	return false;
}
 
开发者ID:wso2,项目名称:developer-studio,代码行数:37,代码来源:CheckUpdatesManager.java


示例11: generateOSGIVersion

import org.eclipse.equinox.p2.metadata.Version; //导入依赖的package包/类
private Version generateOSGIVersion(String installedVersion) {
	System.out.println("\n Generationg version Object with " + installedVersion);
	String[] majorMinorUpperLmit = installedVersion.split("\\.");
	Version upperLimit = Version.createOSGi(Integer.parseInt(majorMinorUpperLmit[0]),
			Integer.parseInt(majorMinorUpperLmit[1]), Integer.parseInt(majorMinorUpperLmit[2]),
			majorMinorUpperLmit[3]);
	System.out.println("\n Genrated version : \n" + upperLimit.toString());
	return upperLimit;
}
 
开发者ID:wso2,项目名称:developer-studio,代码行数:10,代码来源:CheckUpdatesManager.java


示例12: checkIfUpdatesAvailable

import org.eclipse.equinox.p2.metadata.Version; //导入依赖的package包/类
private IStatus checkIfUpdatesAvailable(IProgressMonitor monitor) {
	SubMonitor progress = SubMonitor.convert(monitor, Messages.UpdateCheckerJob_1, SUB_MONITOR_INDEX);
	Collection<IInstallableUnit> installedWSO2Features = updateManager
			.getInstalledWSO2Features(progress.newChild(1));
	BufferedReader buffReader = downloadMetaFile();
	// read the meta file
	if (buffReader == null) {
		promptUserError(Messages.UpdateMetaFileReaderJob_3, ERROR_TITLE);
		return Status.CANCEL_STATUS;
	}
	Map<String, String> availaleDevStudioFeatureVerions = new HashMap<String, String>();
	availaleDevStudioFeatureVerions = readMetaDataFiletoMap(buffReader);
	deleteDownloadedTempFile();
	if (availaleDevStudioFeatureVerions.isEmpty()) {
		log.error(Messages.UpdateCheckerJob_4);
		return Status.CANCEL_STATUS;
	}
	for (IInstallableUnit iInstallableUnit : installedWSO2Features) {
		if (availaleDevStudioFeatureVerions.containsKey(iInstallableUnit.getId())) {
			Version availableVersion = generateVersionFromString(
					availaleDevStudioFeatureVerions.get(iInstallableUnit.getId()));
			Version upperLimit = generateUpperLimitforUpdates(iInstallableUnit.getVersion());
			if (availableVersion != null
					&& availableVersion.compareTo(iInstallableUnit.getVersion()) == AVAILABLE_VERSION_GREATER
					&& availableVersion.compareTo(upperLimit) == AVAILABLE_VERSION_LESS) {
				updateCount = updateCount + 1;
			} else if (availableVersion == null) {
				log.error(Messages.UpdateCheckerJob_4);
				promptUserError(ERROR_MESSAGE, ERROR_TITLE);
				return Status.CANCEL_STATUS;
			}
		}
	}
	if (updateCount > 0) {
		return Status.OK_STATUS; // OK if there are updates
	}
	return Status.CANCEL_STATUS;
}
 
开发者ID:wso2,项目名称:developer-studio,代码行数:39,代码来源:UpdateMetaFileReaderJob.java


示例13: generateUpperLimitforUpdates

import org.eclipse.equinox.p2.metadata.Version; //导入依赖的package包/类
private Version generateUpperLimitforUpdates(Version version) {
	String installedVersion = version.toString();
	String[] majorMinorUpperLmit = installedVersion.split("\\.");
	int currentMinorVerions = Integer.parseInt(majorMinorUpperLmit[1]);
	int nextMinorVersion = currentMinorVerions + 1;
	Version upperLimit = Version.createOSGi(Integer.parseInt(majorMinorUpperLmit[0]),
			Integer.parseInt(String.valueOf(nextMinorVersion)), Integer.parseInt(majorMinorUpperLmit[2]),
			majorMinorUpperLmit[3]);
	return upperLimit;
}
 
开发者ID:wso2,项目名称:developer-studio,代码行数:11,代码来源:UpdateMetaFileReaderJob.java


示例14: generateVersionFromString

import org.eclipse.equinox.p2.metadata.Version; //导入依赖的package包/类
/**
 * version would come as 4.0.0-201512221344 we need to create the
 * installable unit version object from the version string
 * 
 * @param versionString
 */
private Version generateVersionFromString(String versionString) {
	String[] minorMajorNumbers = versionString.split("\\."); // . is \\. in
	Version availableVersion = Version.createOSGi(Integer.parseInt(minorMajorNumbers[0]),
			Integer.parseInt(minorMajorNumbers[1]), Integer.parseInt(minorMajorNumbers[2]), minorMajorNumbers[3]);
	return availableVersion;
}
 
开发者ID:wso2,项目名称:developer-studio,代码行数:13,代码来源:UpdateMetaFileReaderJob.java


示例15: isNewVersionCompatible

import org.eclipse.equinox.p2.metadata.Version; //导入依赖的package包/类
private boolean isNewVersionCompatible(String currVersion, Version availableVerion) {
	Version upperLimit = generateUpperLimitforUpdates(currVersion);
	if (availableVerion.compareTo(upperLimit) == LESS_THAN) {
		return true;
	}
	return false;
}
 
开发者ID:wso2,项目名称:developer-studio,代码行数:8,代码来源:UpdateManager.java


示例16: generateUpperLimitforUpdates

import org.eclipse.equinox.p2.metadata.Version; //导入依赖的package包/类
private Version generateUpperLimitforUpdates(String installedVersion) {
	String[] majorMinorUpperLmit = installedVersion.split("\\.");
	int currentMinorVerions = Integer.parseInt(majorMinorUpperLmit[1]);
	int nextMinorVersion = currentMinorVerions + 1;
	Version upperLimit = Version.createOSGi(Integer.parseInt(majorMinorUpperLmit[0]),
			Integer.parseInt(String.valueOf(nextMinorVersion)), Integer.parseInt(majorMinorUpperLmit[2]),
			majorMinorUpperLmit[3]);
	return upperLimit;
}
 
开发者ID:wso2,项目名称:developer-studio,代码行数:10,代码来源:UpdateManager.java


示例17: getUnitDescription

import org.eclipse.equinox.p2.metadata.Version; //导入依赖的package包/类
private String getUnitDescription(IInstallableUnit unit) {
  String name = unit.getProperty(IInstallableUnit.PROP_NAME);
  Version version = unit.getVersion();
  String versionValue = version.getOriginal();

  return name + " " + versionValue; //$NON-NLS-1$
}
 
开发者ID:agusevas,项目名称:logan,代码行数:8,代码来源:UpdateService.java


示例18: readResolve

import org.eclipse.equinox.p2.metadata.Version; //导入依赖的package包/类
private Object readResolve() {
	Version v = this;
	if (equals(MAX_VERSION))
		v = MAX_VERSION;
	else if (equals(emptyVersion))
		v = emptyVersion;
	return v;
}
 
开发者ID:digimead,项目名称:sbt-osgi-manager,代码行数:9,代码来源:OmniVersion.java


示例19: toString

import org.eclipse.equinox.p2.metadata.Version; //导入依赖的package包/类
private String toString ( final Version version )
{
    return version.getOriginal ();
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:5,代码来源:DefaultMavenMapping.java


示例20: getVersion

import org.eclipse.equinox.p2.metadata.Version; //导入依赖的package包/类
@Override
public Version getVersion() {
	return version;
}
 
开发者ID:MentorEmbedded,项目名称:p2-installer,代码行数:5,代码来源:InstallProduct.java



注:本文中的org.eclipse.equinox.p2.metadata.Version类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FOAF类代码示例发布时间:2022-05-22
下一篇:
Java BindingInfo类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap