當前位置: 首頁>>代碼示例>>Java>>正文


Java Version類代碼示例

本文整理匯總了Java中org.osgi.framework.Version的典型用法代碼示例。如果您正苦於以下問題:Java Version類的具體用法?Java Version怎麽用?Java Version使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Version類屬於org.osgi.framework包,在下文中一共展示了Version類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readFromManifest

import org.osgi.framework.Version; //導入依賴的package包/類
private Bundle readFromManifest ( final String location, final Manifest m ) throws IOException
{
    final Object sn = m.getMainAttributes ().getValue ( Constants.BUNDLE_SYMBOLICNAME );
    if ( ! ( sn instanceof String ) )
    {
        return null;
    }

    final Object version = m.getMainAttributes ().getValue ( Constants.BUNDLE_VERSION );
    if ( ! ( version instanceof String ) )
    {
        return null;
    }

    String symName = (String)sn;
    symName = symName.split ( ";", 2 )[0];

    return new Bundle ( symName, new Version ( (String)version ), location );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:20,代碼來源:Starter.java

示例2: extractFeatureFromDependency

import org.osgi.framework.Version; //導入依賴的package包/類
protected Feature extractFeatureFromDependency(final Dependency dependency) throws Exception {
    Feature[] features = featuresService.listFeatures();
    VersionRange range = org.apache.karaf.features.internal.model.Feature.DEFAULT_VERSION.equals(dependency
            .getVersion()) ? VersionRange.ANY_VERSION : new VersionRange(dependency.getVersion(), true, true);
    Feature fi = null;
    for (Feature f : features) {
        if (f.getName().equals(dependency.getName())) {
            Version version = VersionTable.getVersion(f.getVersion());
            if (range.contains(version) && (fi == null || VersionTable.getVersion(fi.getVersion())
                    .compareTo(version) < 0)) {
                fi = f;
                break;
            }
        }
    }
    return fi;
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:18,代碼來源:ChildAwareFeatureWrapper.java

示例3: makeQualifiedVersion

import org.osgi.framework.Version; //導入依賴的package包/類
private Version makeQualifiedVersion() {
    try {
        final ReactorProject rp = (ReactorProject) this.project.getContextValue(ReactorProject.CTX_REACTOR_PROJECT);
        if (rp != null) {
            return new Version(rp.getExpandedVersion());
        }
    } catch (final Exception e) {
        getLog().debug("Failed to get qualified tycho version", e);
    }

    String version = this.project.getVersion();
    if (version.endsWith("-SNAPSHOT")) {
        version = version.replaceAll("-SNAPSHOT$", "." + TIMESTAMP_FORMAT.format(this.session.getStartTime()));
    }

    return new Version(version);
}
 
開發者ID:ctron,項目名稱:osgi-dp,代碼行數:18,代碼來源:AbstractDpMojo.java

示例4: test1

import org.osgi.framework.Version; //導入依賴的package包/類
@Test
public void test1 ()
{
    final FeatureInformation fi = new FeatureInformation ();

    fi.setId ( "f1" );
    fi.setVersion ( Version.parseVersion ( "1.2.3" ) );
    fi.setQualifiers ( new Qualifiers () );

    fi.getRequirements ().add ( new Requirement ( Type.FEATURE, "f2", null, MatchRule.DEFAULT ) );
    fi.getRequirements ().add ( new Requirement ( Type.PLUGIN, "b1", null, MatchRule.DEFAULT ) );

    final List<InstallableUnit> ius = InstallableUnit.fromFeature ( fi );

    assertEquals ( 2, ius.size () );

    assertFeatureGroup1 ( ius.get ( 0 ) );
    assertFeatureJar1 ( ius.get ( 1 ) );
}
 
開發者ID:eclipse,項目名稱:packagedrone,代碼行數:20,代碼來源:InstallableUnitTest.java

示例5: rebuildProjectIfPluginVersionChanged

import org.osgi.framework.Version; //導入依賴的package包/類
private static void rebuildProjectIfPluginVersionChanged(IProject project) {
  // We're only worried about GWT projects
  if (GWTNature.isGWTProject(project.getProject())) {
    // Find the last plugin version that know the project was built with
    Version lastForcedRebuildAt = GdtPreferences.getVersionForLastForcedRebuild(project);
    Version currentPluginVersion = GdtPlugin.getVersion();

    if (!lastForcedRebuildAt.equals(currentPluginVersion)) {
      GdtPreferences.setVersionForLastForcedRebuild(project, currentPluginVersion);

      BuilderUtilities.scheduleRebuild(project);
      CorePluginLog.logInfo("Scheduled rebuild of project " + project.getName()
          + " because of plugin update (current version: " + currentPluginVersion.toString() + ")");
    }
  }
}
 
開發者ID:gwt-plugins,項目名稱:gwt-eclipse-plugin,代碼行數:17,代碼來源:GdtPlugin.java

示例6: writeFilterProfile_10_Root

import org.osgi.framework.Version; //導入依賴的package包/類
private static XMLMemento writeFilterProfile_10_Root() {

		final XMLMemento xmlRoot = XMLMemento.createWriteRoot(TAG_ROOT);

		// date/time
		xmlRoot.putString(Util.ATTR_ROOT_DATETIME, TimeTools.now().toString());

		// plugin version
		final Version version = _bundle.getVersion();
		xmlRoot.putInteger(Util.ATTR_ROOT_VERSION_MAJOR, version.getMajor());
		xmlRoot.putInteger(Util.ATTR_ROOT_VERSION_MINOR, version.getMinor());
		xmlRoot.putInteger(Util.ATTR_ROOT_VERSION_MICRO, version.getMicro());
		xmlRoot.putString(Util.ATTR_ROOT_VERSION_QUALIFIER, version.getQualifier());

		// layer structure version
		xmlRoot.putInteger(ATTR_TOUR_FILTER_VERSION, TOUR_FILTER_VERSION);

		return xmlRoot;
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:20,代碼來源:TourFilterManager.java

示例7: isCompatibleVersionsRegex

import org.osgi.framework.Version; //導入依賴的package包/類
private static boolean isCompatibleVersionsRegex(Map<String, Version> installed, String required)
{
	// compile the regex.
	Pattern pattern = null;
	try
	{
		pattern = Pattern.compile(required);
	}
	catch (PatternSyntaxException e)
	{
		IdeLog.logError(CorePlugin.getDefault(), MessageFormat.format(
				"The required version '{0}' should be defined as a regular-expression", required)); //$NON-NLS-1$
		return false;
	}

	// Do a match on the installed-versions original String values
	for (String installedVersion : installed.keySet())
	{
		Matcher matcher = pattern.matcher(installedVersion);
		if (matcher.find())
		{
			return true;
		}
	}
	return false;
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:27,代碼來源:VersionUtil.java

示例8: update

import org.osgi.framework.Version; //導入依賴的package包/類
@Override
public void update(ILaunchConfigurationWorkingCopy launchConfig,
    IJavaProject javaProject, List<String> programArgs, List<String> vmArgs)
    throws CoreException {

  // As of Eclipse Kepler(4.3), the use of -XStartOnFirstThread is a built-in launch config
  // attribute so it is not necessary to make it an explicit argument. This prevents issues when
  // sharing a launch config file across multiple OS platforms.
  Bundle bundle = Platform.getBundle("org.eclipse.platform");
  if (bundle != null) {
    Version bundleVersion = bundle.getVersion();
    if (bundleVersion.getMajor() == 4 && bundleVersion.getMinor() >= 3) {
      updateEclipse43(launchConfig, javaProject, programArgs, vmArgs);
    } else {
      updateNonEclipse43(launchConfig, javaProject, programArgs, vmArgs);
    }
  }
}
 
開發者ID:gwt-plugins,項目名稱:gwt-eclipse-plugin,代碼行數:19,代碼來源:XStartOnFirstThreadArgumentProcessor.java

示例9: loadBundleFromLocal

import org.osgi.framework.Version; //導入依賴的package包/類
public static Bundle loadBundleFromLocal(BundleContext bc,String name, Version version, boolean loadIfNecessary, Bundle defaultValue) {
name=name.trim();
  	Bundle[] bundles = bc.getBundles();
  	for(Bundle b:bundles){
  		if(name.equalsIgnoreCase(b.getSymbolicName())) {
  			if(version==null || version.equals(b.getVersion())) {
  				return b;
  			}
  		}
  	}
  	if(!loadIfNecessary) return defaultValue;
  	
  	// is it in jar directory but not loaded
  	
  	CFMLEngine engine = ConfigWebUtil.getEngine(ThreadLocalPageContext.getConfig());
CFMLEngineFactory factory = engine.getCFMLEngineFactory();
BundleFile bf = _getBundleFile(factory, name, version, null);
if(bf!=null) {
	try {
		return _loadBundle(bc, bf.getFile());
	} 
	catch (Exception e) {}
}

  	return defaultValue;
  }
 
開發者ID:lucee,項目名稱:Lucee,代碼行數:27,代碼來源:OSGiUtil.java

示例10: create_Root

import org.osgi.framework.Version; //導入依賴的package包/類
private static XMLMemento create_Root() {

		final XMLMemento xmlRoot = XMLMemento.createWriteRoot(TAG_ROOT);

		// date/time
		xmlRoot.putString(Util.ATTR_ROOT_DATETIME, TimeTools.now().toString());

		// plugin version
		final Version version = _bundle.getVersion();
		xmlRoot.putInteger(Util.ATTR_ROOT_VERSION_MAJOR, version.getMajor());
		xmlRoot.putInteger(Util.ATTR_ROOT_VERSION_MINOR, version.getMinor());
		xmlRoot.putInteger(Util.ATTR_ROOT_VERSION_MICRO, version.getMicro());
		xmlRoot.putString(Util.ATTR_ROOT_VERSION_QUALIFIER, version.getQualifier());

		// config version
		xmlRoot.putInteger(ATTR_CONFIG_VERSION, CONFIG_VERSION);

		return xmlRoot;
	}
 
開發者ID:wolfgang-ch,項目名稱:mytourbook,代碼行數:20,代碼來源:MapBookmarkManager.java

示例11: checkForUpdates

import org.osgi.framework.Version; //導入依賴的package包/類
@Override
public void checkForUpdates() throws PluginException {
	boolean updatesFound = false;
	synchronized (pluginUpdates) {
		pluginUpdates.clear();
		for (PluginSite pluginSite : pluginSiteManager.getPluginSites()) {
			List<PluginVersions> plugins = pluginSiteManager.getPlugins(pluginSite);
			for (PluginVersions plugin : plugins) {
				if (installedPlugins.containsKey(plugin.getId())) {
					Plugin installedPlugin = installedPlugins.get(plugin.getId());
					if (installedPlugin.getFile().toFile().canWrite()) {
						Version latestVersion = Version.parseVersion(plugin.getLatestVersion()
								.getVersion());
						if (latestVersion.compareTo(installedPlugin.getVersion()) > 0) {
							pluginUpdates.put(plugin.getId(), plugin);
							updatesFound = true;
						}
					}
				}
			}
		}
	}
	if (updatesFound) {
		postEvent(PluginManager.UPDATES_AVAILABLE);
	}
}
 
開發者ID:apache,項目名稱:incubator-taverna-osgi,代碼行數:27,代碼來源:PluginManagerImpl.java

示例12: runTest

import org.osgi.framework.Version; //導入依賴的package包/類
private void runTest(Map<String, Bundle> installed, DataInputStream input, DataOutputStream output) throws Exception {
   	String symbolicName = input.readUTF();
	Version version = Version.parseVersion(input.readUTF());
	String testClass = input.readUTF();
	String testName = input.readUTF();
	
	Bundle testBundle = getTestBundle(installed, input, output, symbolicName, version);
	
	Class<?> testClazz = testBundle.loadClass(testClass);
	
	Result result = new JUnitCore().run(Request.method(testClazz, testName));
	
	if(result.wasSuccessful()) {
		output.writeUTF(SUCCESS);
	} else {
		Failure failure = result.getFailures().get(0);
		output.writeUTF(FAIL);
		output.writeUTF(failure.getMessage());
	}
	
	output.flush();
}
 
開發者ID:osgi,項目名稱:osgi.security-tests,代碼行數:23,代碼來源:TestServer.java

示例13: getVersion

import org.osgi.framework.Version; //導入依賴的package包/類
/**
 * Loads the version information to this instance.
 */
public Version getVersion() {
	if (version==null) {
		Bundle bundle = Platform.getBundle(this.plugInID);
		version = bundle.getVersion();
	}
	return version;
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:11,代碼來源:VersionInfo.java

示例14: setup

import org.osgi.framework.Version; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Before
public void setup() throws Exception {
	
	when(punit.getPersistenceUnitName()).thenReturn("test-props");
	when(punit.getPersistenceProviderClassName())
		.thenReturn(ECLIPSE_PERSISTENCE_PROVIDER);
	when(punit.getTransactionType()).thenReturn(PersistenceUnitTransactionType.JTA);
	when(punit.getBundle()).thenReturn(punitBundle);
	when(punit.getProperties()).thenReturn(punitProperties);
	
	when(punitBundle.getBundleContext()).thenReturn(punitContext);
	when(punitBundle.getVersion()).thenReturn(Version.parseVersion("1.2.3"));
	
	when(containerContext.registerService(eq(ManagedService.class), 
			any(ManagedService.class), any(Dictionary.class))).thenReturn(msReg);
	when(containerContext.getService(dsfRef)).thenReturn(dsf);
	when(containerContext.getService(dsRef)).thenReturn(ds);
	when(containerContext.createFilter(Mockito.anyString()))
		.thenAnswer(new Answer<Filter>() {
			@Override
			public Filter answer(InvocationOnMock i) throws Throwable {
				return FrameworkUtil.createFilter(i.getArguments()[0].toString());
			}
		});
	
	when(punitContext.registerService(eq(EntityManagerFactory.class), any(EntityManagerFactory.class), 
			any(Dictionary.class))).thenReturn(emfReg);
	
	when(emf.isOpen()).thenReturn(true);
	
	
	Properties jdbcProps = new Properties();
	jdbcProps.setProperty("url", JDBC_URL);
	jdbcProps.setProperty("user", JDBC_USER);
	jdbcProps.setProperty("password", JDBC_PASSWORD);
	
	when(dsf.createDataSource(jdbcProps)).thenReturn(ds);
	
}
 
開發者ID:apache,項目名稱:aries-jpa,代碼行數:41,代碼來源:PropsConfigurationTest.java

示例15: readQualifier

import org.osgi.framework.Version; //導入依賴的package包/類
private static String readQualifier ( final Path jarFile ) throws IOException
{
    final String version = readManifest ( jarFile ).getMainAttributes ().getValue ( Constants.BUNDLE_VERSION );
    if ( version == null )
    {
        return version;
    }

    return Version.parseVersion ( version ).getQualifier ();
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:11,代碼來源:Processor.java


注:本文中的org.osgi.framework.Version類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。