com.virtuosotechnologies.lib.platform
Class PlatformManager

java.lang.Object
  extended bycom.virtuosotechnologies.lib.platform.PlatformManager

public final class PlatformManager
extends Object

Manager for PlatformProviders and PlatformEvents. This class is a general low-level class intended to be platform-agnostic. That is, we don't expect to have to modify this API in the future. Platform-specific helper methods and constants should be added to the PlatformUtils class.


Method Summary
static void addPlatformListener(PlatformListener listener)
          Add a listener for platform events
static boolean addPlatformProvider(String name, ClassLoader loader)
          Add a platform provider.
static void firePlatformEvent(PlatformEvent event)
          Fire a platform event
static PlatformProvider getNamedPlatformProvider(String name)
          Returns the platform provider with the given name if it is available, or null if it is not.
static void removePlatformListener(PlatformListener listener)
          Remove a listener for platform events
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addPlatformProvider

public static boolean addPlatformProvider(String name,
                                          ClassLoader loader)
Add a platform provider. Returns true if the provider was successfully loaded and initialized. Returns false if the provider could not be found or could not be initialized. Does nothing and returns false if a PlatformProvider with the given name is already added.

Parameters:
name - name of the provider
loader - ClassLoader from which to load the provider, or null to use the default ClassLoader.
Returns:
true if the provider was successfully added, or false if not

getNamedPlatformProvider

public static PlatformProvider getNamedPlatformProvider(String name)
Returns the platform provider with the given name if it is available, or null if it is not.

Note that even if we're running on that platform, this may still return null if the platform provider wasn't compiled in by whoever built this program-- in such a case, functionality specific to that platform will still not be available.

Returns:
a PlatformProvider

addPlatformListener

public static void addPlatformListener(PlatformListener listener)
Add a listener for platform events

Parameters:
listener - listener to add

removePlatformListener

public static void removePlatformListener(PlatformListener listener)
Remove a listener for platform events

Parameters:
listener - listener to remove

firePlatformEvent

public static void firePlatformEvent(PlatformEvent event)
Fire a platform event

Parameters:
event - the event to fire