com.plumtree.openfoundation.platform
Class XPVendor

java.lang.Object
  extended by com.plumtree.openfoundation.platform.XPVendor

public class XPVendor
extends java.lang.Object

Enumerated ordinal type for VM vendor. On Java, this is the JVM vendor (Sun, IBM, BEA); on .NET, this is the CLR vendor (currently just Microsoft).

The purpose of this class is to allow you to make assertions based on which vendor you're currently using. It allows you to write code like this:

   XPVendor v = XPVendor.GetVendor();
   if(v.equals(XPVendor.BEA)) { // ...
 
You can also use it to get the full name of the vendor as specified by the VM vendor itself, using the GetFullName() method.

Author:
DanielF

Field Summary
static XPVendor BEA
          Predefined VM vendor for beaJRE.
static XPVendor IBM
          Predefined VM vendor for ibmJRE.
 int m_id
          ID for each XPVendor instance.
 java.lang.String m_name
          Short name of platform.
static java.lang.String m_realName
          Vendor name for current OS using JVM's 'java.vendor' system property.
static XPVendor MICROSOFT
          Predefined VM vendor for .NET.
static XPVendor[] platformList
          Array of predefined XPVendor objects.
static XPVendor SUN
          Predefined VM vendor for sunJRE.
static XPVendor UNKNOWN
          Predefined VM vendor for unknown platform.
 
Constructor Summary
protected XPVendor()
           
 
Method Summary
protected static XPVendor computeVendor(java.lang.String vendor)
          Create JVM's vendor object using vendors' name.
 boolean equals(XPVendor vendor)
          Compare if two objects represent the same vendor using their ID's.
static java.lang.String GetFullName()
          Returns the full name of the JRE/CLR vendor.
 java.lang.String GetName()
          Return XPVendor object's platform name.
static XPVendor GetVendor()
          Returns the vendor object corresponding to the current VM vendor.
static XPVendor GetVendor(int id)
          Gets vendor by ID.
static java.lang.String GetVersion()
          Returns the name of the version of the JRE/CLR.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_id

public int m_id
ID for each XPVendor instance.


m_realName

public static java.lang.String m_realName
Vendor name for current OS using JVM's 'java.vendor' system property.


m_name

public java.lang.String m_name
Short name of platform.


UNKNOWN

public static final XPVendor UNKNOWN
Predefined VM vendor for unknown platform.


MICROSOFT

public static final XPVendor MICROSOFT
Predefined VM vendor for .NET.


SUN

public static final XPVendor SUN
Predefined VM vendor for sunJRE.


IBM

public static final XPVendor IBM
Predefined VM vendor for ibmJRE.


BEA

public static final XPVendor BEA
Predefined VM vendor for beaJRE.


platformList

public static XPVendor[] platformList
Array of predefined XPVendor objects.

Constructor Detail

XPVendor

protected XPVendor()
Method Detail

GetVendor

public static XPVendor GetVendor(int id)
Gets vendor by ID. Will return null for an ID not in our enumeration list.

Parameters:
id - ID for expected vendor.
Returns:
XPVendor object corresponds to id.

GetName

public java.lang.String GetName()
Return XPVendor object's platform name.

Returns:
the short name of the platform

equals

public boolean equals(XPVendor vendor)
Compare if two objects represent the same vendor using their ID's.

Parameters:
vendor - object to be compared with current instance.
Returns:
true if two objects represent the same vendor, false if otherwise.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

GetVendor

public static XPVendor GetVendor()
Returns the vendor object corresponding to the current VM vendor. If this cannot be determined, we'll return XPVendor.UNKNOWN

Returns:
XPVendor object of current OS.

computeVendor

protected static XPVendor computeVendor(java.lang.String vendor)
Create JVM's vendor object using vendors' name.

Parameters:
vendor - vendor name.
Returns:
JVM vendors' XPVendor objects.

GetVersion

public static java.lang.String GetVersion()
Returns the name of the version of the JRE/CLR. On Java this is the "java.vm.version" system property.

Returns:
JVM version number of current OS.

GetFullName

public static java.lang.String GetFullName()
Returns the full name of the JRE/CLR vendor. On Java this is the "java.vendor" system property.

Returns:
Full name of JRE/CLR vendor.


Copyright 2002, 2003, 2004 Plumtree Software Inc. All Rights Reserved.