Package org.scijava.platform
Class DefaultPlatformService
- java.lang.Object
-
- org.scijava.AbstractContextual
-
- org.scijava.plugin.AbstractRichPlugin
-
- org.scijava.service.AbstractService
-
- org.scijava.plugin.AbstractPTService<PT>
-
- org.scijava.plugin.AbstractSingletonService<Platform>
-
- org.scijava.platform.DefaultPlatformService
-
- All Implemented Interfaces:
Comparable<Prioritized>,Contextual,Disposable,Identifiable,Initializable,Locatable,Logged,PlatformService,HasPluginInfo,PTService<Platform>,RichPlugin,SciJavaPlugin,SingletonService<Platform>,Prioritized,SciJavaService,Service,Versioned
public final class DefaultPlatformService extends AbstractSingletonService<Platform> implements PlatformService
Default service for handling platform-specific deployment issues.- Author:
- Curtis Rueden
-
-
Constructor Summary
Constructors Constructor Description DefaultPlatformService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CommandServicecommandService()voiddispose()Performs any needed cleanup of the object's services, in preparation for the object being retired (e.g., to make garbage collection possible).EventServiceeventService()intexec(String... args)Executes a native program and waits for it to return.List<? extends Platform>filterInstances(List<Platform> list)Filters the given list of instances by this service's inclusion criteria.AppEventServicegetAppEventService()Class<Platform>getPluginType()Gets the type of plugins managed by this service.List<Platform>getTargetPlatforms()Gets the platform handlers applicable to this platform.voidinitialize()Performs any needed initialization when the service is first loaded.protected voidonEvent(AppMenusCreatedEvent event)voidopen(URL url)Opens a URL in a platform-dependent way.booleanregisterAppMenus(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, objectService, onEvent, onEvent
-
Methods inherited from class org.scijava.plugin.AbstractPTService
pluginService
-
Methods inherited from class org.scijava.service.AbstractService
getContext, setContext, toString
-
Methods inherited from class org.scijava.plugin.AbstractRichPlugin
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.Contextual
context, getContext, setContext
-
Methods inherited from interface org.scijava.plugin.HasPluginInfo
getInfo, setInfo
-
Methods inherited from interface org.scijava.Locatable
getLocation
-
Methods inherited from interface org.scijava.platform.PlatformService
getCommandService, getEventService
-
Methods inherited from interface org.scijava.Prioritized
compareTo, getPriority, setPriority
-
Methods inherited from interface org.scijava.plugin.PTService
getPlugins, getPluginService, pluginService
-
Methods inherited from interface org.scijava.plugin.RichPlugin
getIdentifier, log
-
Methods inherited from interface org.scijava.service.Service
registerEventHandlers
-
Methods inherited from interface org.scijava.plugin.SingletonService
create, getInstance, getInstances, objectService
-
Methods inherited from interface org.scijava.Versioned
getVersion
-
-
-
-
Method Detail
-
eventService
public EventService eventService()
- Specified by:
eventServicein interfacePlatformService
-
commandService
public CommandService commandService()
- Specified by:
commandServicein interfacePlatformService
-
getAppEventService
public AppEventService getAppEventService()
- Specified by:
getAppEventServicein interfacePlatformService
-
getTargetPlatforms
public List<Platform> getTargetPlatforms()
Description copied from interface:PlatformServiceGets the platform handlers applicable to this platform.- Specified by:
getTargetPlatformsin interfacePlatformService
-
open
public void open(URL url) throws IOException
Description copied from interface:PlatformServiceOpens 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:
openin interfacePlatformService- Throws:
IOException
-
exec
public int exec(String... args) throws IOException
Description copied from interface:PlatformServiceExecutes a native program and waits for it to return.- Specified by:
execin interfacePlatformService- Returns:
- the exit code of the execution.
- Throws:
IOException
-
registerAppMenus
public boolean registerAppMenus(Object menus)
Description copied from interface:PlatformServiceInforms 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:
registerAppMenusin interfacePlatformService- 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 interface:SingletonServiceFilters the given list of instances by this service's inclusion criteria.- Specified by:
filterInstancesin interfaceSingletonService<Platform>- Parameters:
list- the initial list of instances- Returns:
- the filtered list of instances
-
getPluginType
public Class<Platform> getPluginType()
Description copied from interface:PTServiceGets the type of plugins managed by this service.- Specified by:
getPluginTypein interfacePTService<Platform>
-
initialize
public void initialize()
Description copied from interface:ServicePerforms 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:
initializein interfaceInitializable- Specified by:
initializein interfaceService- Specified by:
initializein interfaceSingletonService<Platform>
-
dispose
public void dispose()
Description copied from interface:DisposablePerforms any needed cleanup of the object's services, in preparation for the object being retired (e.g., to make garbage collection possible).- Specified by:
disposein interfaceDisposable
-
onEvent
protected void onEvent(AppMenusCreatedEvent event)
-
-