org.scijava.platform
Class DefaultPlatformService

java.lang.Object
  extended by org.scijava.AbstractContextual
      extended by org.scijava.plugin.AbstractRichPlugin
          extended by org.scijava.service.AbstractService
              extended by org.scijava.plugin.AbstractPTService<PT>
                  extended by org.scijava.plugin.AbstractSingletonService<Platform>
                      extended by org.scijava.platform.DefaultPlatformService
All Implemented Interfaces:
Comparable<Prioritized>, Contextual, Disposable, PlatformService, HasPluginInfo, PTService<Platform>, RichPlugin, SciJavaPlugin, SingletonService<Platform>, Prioritized, SciJavaService, Service

public final class DefaultPlatformService
extends AbstractSingletonService<Platform>
implements PlatformService

Default service for handling platform-specific deployment issues.

Author:
Curtis Rueden

Constructor Summary
DefaultPlatformService()
           
 
Method Summary
 void dispose()
          Performs any needed cleanup of the object's services, in preparation for the object being retired (e.g., to make garbage collection possible).
 int exec(String... args)
          Executes a native program and waits for it to return.
 List<? extends Platform> filterInstances(List<Platform> list)
          Allows subclasses to exclude instances.
 AppEventService getAppEventService()
           
 CommandService getCommandService()
           
 EventService getEventService()
           
 Class<Platform> getPluginType()
          Gets the type of plugins managed by this service.
 List<Platform> getTargetPlatforms()
          Gets the platform handlers applicable to this platform.
 void initialize()
          Performs any needed initialization when the service is first loaded.
protected  void onEvent(AppMenusCreatedEvent event)
           
 void open(URL url)
          Opens a URL in a platform-dependent way.
 boolean registerAppMenus(Object menus)
          Informs the active platform handlers of a UI's newly created application menu structure.
 
Methods inherited from class org.scijava.plugin.AbstractSingletonService
getInstance, getInstances
 
Methods inherited from class org.scijava.plugin.AbstractPTService
getPlugins, getPluginService
 
Methods inherited from class org.scijava.service.AbstractService
getContext, registerEventHandlers, setContext, toString
 
Methods inherited from class org.scijava.plugin.AbstractRichPlugin
compareTo, getInfo, getPriority, setInfo, setPriority
 
Methods inherited from class org.scijava.AbstractContextual
context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.scijava.plugin.SingletonService
getInstance, getInstances
 
Methods inherited from interface org.scijava.plugin.PTService
getPlugins, getPluginService
 
Methods inherited from interface org.scijava.service.Service
registerEventHandlers
 
Methods inherited from interface org.scijava.Contextual
context, getContext, setContext
 
Methods inherited from interface org.scijava.Prioritized
getPriority, setPriority
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface org.scijava.plugin.HasPluginInfo
getInfo, setInfo
 

Constructor Detail

DefaultPlatformService

public DefaultPlatformService()
Method Detail

getEventService

public EventService getEventService()
Specified by:
getEventService in interface PlatformService

getCommandService

public CommandService getCommandService()
Specified by:
getCommandService in interface PlatformService

getAppEventService

public AppEventService getAppEventService()
Specified by:
getAppEventService in interface PlatformService

getTargetPlatforms

public List<Platform> getTargetPlatforms()
Description copied from interface: PlatformService
Gets the platform handlers applicable to this platform.

Specified by:
getTargetPlatforms in interface PlatformService

open

public void open(URL url)
          throws IOException
Description copied from interface: PlatformService
Opens a URL in a platform-dependent way. Typically the URL is opened in an external web browser instance, but the behavior is ultimately defined by the available platform handler implementations.

Specified by:
open in interface PlatformService
Throws:
IOException

exec

public int exec(String... args)
         throws IOException
Description copied from interface: PlatformService
Executes a native program and waits for it to return.

Specified by:
exec in interface PlatformService
Returns:
the exit code of the execution.
Throws:
IOException

registerAppMenus

public boolean registerAppMenus(Object menus)
Description copied from interface: PlatformService
Informs the active platform handlers of a UI's newly created application menu structure. Each active platform handler may choose to do something platform-specific with the menus.

Specified by:
registerAppMenus in interface PlatformService
Parameters:
menus - The UI's newly created menu structure
Returns:
true iff the menus should not be added to the UI as normal because a platform handler did something platform-specific with them instead.

filterInstances

public List<? extends Platform> filterInstances(List<Platform> list)
Description copied from class: AbstractSingletonService
Allows subclasses to exclude instances.

Overrides:
filterInstances in class AbstractSingletonService<Platform>
Parameters:
list - the initial list of instances
Returns:
the filtered list of instances

getPluginType

public Class<Platform> getPluginType()
Description copied from interface: PTService
Gets the type of plugins managed by this service.

Specified by:
getPluginType in interface PTService<Platform>

initialize

public void initialize()
Description copied from interface: Service
Performs any needed initialization when the service is first loaded.

NB: This method is not intended to be called directly. It is called by the service framework itself (specifically by the ServiceHelper) when initializing the service. It should not be called a second time.

Specified by:
initialize in interface Service
Overrides:
initialize in class AbstractSingletonService<Platform>

dispose

public void dispose()
Description copied from interface: Disposable
Performs any needed cleanup of the object's services, in preparation for the object being retired (e.g., to make garbage collection possible).

Specified by:
dispose in interface Disposable
Overrides:
dispose in class AbstractService

onEvent

protected void onEvent(AppMenusCreatedEvent event)


Copyright © 2009–2014 SciJava. All rights reserved.