use of org.cytoscape.view.presentation.RenderingEngineManager in project cytoscape-impl by cytoscape.
the class ViewUtils method getVisualLexicon.
public static VisualLexicon getVisualLexicon(final CyGroupManagerImpl groupMgr, final CyNetworkView netView) {
final RenderingEngineManager rendererMgr = groupMgr.getService(RenderingEngineManager.class);
final Collection<RenderingEngine<?>> renderingEngines = rendererMgr.getRenderingEngines(netView);
if (renderingEngines != null && !renderingEngines.isEmpty())
return renderingEngines.iterator().next().getVisualLexicon();
return rendererMgr.getDefaultVisualLexicon();
}
use of org.cytoscape.view.presentation.RenderingEngineManager in project cytoscape-impl by cytoscape.
the class AbstractNetworkReaderTest method setUp.
@Before
public void setUp() throws Exception {
taskMonitor = mock(TaskMonitor.class);
CyLayoutAlgorithm def = mock(CyLayoutAlgorithm.class);
Object context = new Object();
when(def.createLayoutContext()).thenReturn(context);
when(def.getDefaultLayoutContext()).thenReturn(context);
when(def.createTaskIterator(Mockito.any(CyNetworkView.class), Mockito.any(Object.class), Mockito.anySet(), Mockito.any(String.class))).thenReturn(new TaskIterator(new SimpleTask()));
layouts = mock(CyLayoutAlgorithmManager.class);
when(layouts.getDefaultLayout()).thenReturn(def);
NetworkTestSupport nts = new NetworkTestSupport();
netFactory = nts.getNetworkFactory();
netManager = nts.getNetworkManager();
rootNetManager = nts.getRootNetworkFactory();
netTableManager = nts.getNetworkTableManager();
TableTestSupport tblTestSupport = new TableTestSupport();
tableFactory = tblTestSupport.getTableFactory();
tableManager = mock(CyTableManager.class);
GroupTestSupport groupTestSupport = new GroupTestSupport();
groupManager = groupTestSupport.getGroupManager();
groupFactory = groupTestSupport.getGroupFactory();
properties = new Properties();
CyProperty<Properties> cyProperties = new SimpleCyProperty<>("Test", properties, Properties.class, SavePolicy.DO_NOT_SAVE);
NetworkViewTestSupport nvts = new NetworkViewTestSupport();
setViewThreshold(DEF_THRESHOLD);
viewFactory = nvts.getNetworkViewFactory();
readUtil = new ReadUtils(new StreamUtilImpl(serviceRegistrar));
defRenderer = mock(NetworkViewRenderer.class);
when(defRenderer.getNetworkViewFactory()).thenReturn(viewFactory);
lexicon = new BasicVisualLexicon(new NullVisualProperty("MINIMAL_ROOT", "Minimal Root Visual Property"));
renderingEngineManager = mock(RenderingEngineManager.class);
when(renderingEngineManager.getDefaultVisualLexicon()).thenReturn(lexicon);
applicationManager = mock(CyApplicationManager.class);
when(applicationManager.getDefaultNetworkViewRenderer()).thenReturn(defRenderer);
serviceRegistrar = mock(CyServiceRegistrar.class);
when(serviceRegistrar.getService(CyProperty.class, "(cyPropertyName=cytoscape3.props)")).thenReturn(cyProperties);
when(serviceRegistrar.getService(CyApplicationManager.class)).thenReturn(applicationManager);
when(serviceRegistrar.getService(CyNetworkFactory.class)).thenReturn(netFactory);
when(serviceRegistrar.getService(CyNetworkViewFactory.class)).thenReturn(viewFactory);
when(serviceRegistrar.getService(CyNetworkManager.class)).thenReturn(netManager);
when(serviceRegistrar.getService(CyNetworkTableManager.class)).thenReturn(netTableManager);
when(serviceRegistrar.getService(CyRootNetworkManager.class)).thenReturn(rootNetManager);
when(serviceRegistrar.getService(CyLayoutAlgorithmManager.class)).thenReturn(layouts);
when(serviceRegistrar.getService(CyTableManager.class)).thenReturn(tableManager);
when(serviceRegistrar.getService(CyTableFactory.class)).thenReturn(tableFactory);
when(serviceRegistrar.getService(CyGroupManager.class)).thenReturn(groupManager);
when(serviceRegistrar.getService(CyGroupFactory.class)).thenReturn(groupFactory);
when(serviceRegistrar.getService(RenderingEngineManager.class)).thenReturn(renderingEngineManager);
}
use of org.cytoscape.view.presentation.RenderingEngineManager in project cytoscape-impl by cytoscape.
the class VisualStyleSerializer method createVisualStyles.
/**
* This method creates a collection of VisualStyle objects based on the provided Vizmap object.
* @param vizmap A Vizmap object containing a representation of VisualStyles.
* @return A collection of VisualStyle objects.
*/
public Set<VisualStyle> createVisualStyles(final Vizmap vizmap) {
final Set<VisualStyle> styles = new HashSet<>();
final RenderingEngineManager renderingEngineManager = serviceRegistrar.getService(RenderingEngineManager.class);
lexicon = renderingEngineManager.getDefaultVisualLexicon();
if (lexicon == null) {
logger.warn("Cannot create visual styles because there is no default Visual Lexicon");
return styles;
}
if (vizmap != null) {
final VisualStyleFactory visualStyleFactory = serviceRegistrar.getService(VisualStyleFactory.class);
final List<org.cytoscape.io.internal.util.vizmap.model.VisualStyle> vsModelList = vizmap.getVisualStyle();
for (org.cytoscape.io.internal.util.vizmap.model.VisualStyle vsModel : vsModelList) {
final String styleName = vsModel.getName();
// Each new style should be created from the default one:
final VisualStyle vs = visualStyleFactory.createVisualStyle(styleName);
// Set the visual properties and mappings:
if (vsModel.getNetwork() != null)
createVisualProperties(vs, CyNetwork.class, vsModel.getNetwork().getVisualProperty());
if (vsModel.getNode() != null)
createVisualProperties(vs, CyNode.class, vsModel.getNode().getVisualProperty());
if (vsModel.getEdge() != null)
createVisualProperties(vs, CyEdge.class, vsModel.getEdge().getVisualProperty());
// Restore dependency
restoreDependencies(vs, vsModel);
styles.add(vs);
}
}
return styles;
}
use of org.cytoscape.view.presentation.RenderingEngineManager in project cytoscape-impl by cytoscape.
the class CyActivator method start.
@Override
public void start(BundleContext bc) {
CyServiceRegistrar serviceRegistrar = getService(bc, CyServiceRegistrar.class);
CyApplicationConfiguration cyApplicationConfigurationRef = getService(bc, CyApplicationConfiguration.class);
CyApplicationManager cyApplicationManagerRef = getService(bc, CyApplicationManager.class);
CyEventHelper cyEventHelperRef = getService(bc, CyEventHelper.class);
CyGroupAggregationManager cyGroupAggregationManagerRef = getService(bc, CyGroupAggregationManager.class);
CyGroupFactory cyGroupFactoryRef = getService(bc, CyGroupFactory.class);
CyGroupManager cyGroupManagerRef = getService(bc, CyGroupManager.class);
CyLayoutAlgorithmManager cyLayoutAlgorithmManagerRef = getService(bc, CyLayoutAlgorithmManager.class);
CyNetworkFactory cyNetworkFactoryRef = getService(bc, CyNetworkFactory.class);
CyNetworkManager cyNetworkManagerRef = getService(bc, CyNetworkManager.class);
CyNetworkViewFactory cyNetworkViewFactoryRef = getService(bc, CyNetworkViewFactory.class);
CyNetworkViewManager cyNetworkViewManagerRef = getService(bc, CyNetworkViewManager.class);
CyNetworkReaderManager cyNetworkViewReaderManagerRef = getService(bc, CyNetworkReaderManager.class);
CyNetworkViewWriterManager cyNetworkViewWriterManagerRef = getService(bc, CyNetworkViewWriterManager.class);
CyProperty<Properties> cyPropertyRef = getService(bc, CyProperty.class, "(cyPropertyName=cytoscape3.props)");
CyPropertyReaderManager cyPropertyReaderManagerRef = getService(bc, CyPropertyReaderManager.class);
CyPropertyWriterManager cyPropertyWriterManagerRef = getService(bc, CyPropertyWriterManager.class);
CyRootNetworkManager cyRootNetworkFactoryRef = getService(bc, CyRootNetworkManager.class);
CySessionManager cySessionManagerRef = getService(bc, CySessionManager.class);
CySessionReaderManager cySessionReaderManagerRef = getService(bc, CySessionReaderManager.class);
CySessionWriterManager cySessionWriterManagerRef = getService(bc, CySessionWriterManager.class);
CySwingApplication cySwingApplicationRef = getService(bc, CySwingApplication.class);
CyTableFactory cyTableFactoryRef = getService(bc, CyTableFactory.class);
CyTableManager cyTableManagerRef = getService(bc, CyTableManager.class);
CyTableReaderManager cyTableReaderManagerRef = getService(bc, CyTableReaderManager.class);
CyTableWriterManager cyTableWriterManagerRef = getService(bc, CyTableWriterManager.class);
PanelTaskManager panelTaskManagerRef = getService(bc, PanelTaskManager.class);
DialogTaskManager dialogTaskManagerRef = getService(bc, DialogTaskManager.class);
PresentationWriterManager presentationWriterManagerRef = getService(bc, PresentationWriterManager.class);
RenderingEngineManager renderingEngineManagerRef = getService(bc, RenderingEngineManager.class);
TaskManager taskManagerRef = getService(bc, TaskManager.class);
UndoSupport undoSupportRef = getService(bc, UndoSupport.class);
TunablePropertySerializerFactory tunablePropertySerializerFactoryRef = getService(bc, TunablePropertySerializerFactory.class);
VisualMappingManager visualMappingManagerRef = getService(bc, VisualMappingManager.class);
VisualStyleFactory visualStyleFactoryRef = getService(bc, VisualStyleFactory.class);
CyVersion cytoscapeVersionService = getService(bc, CyVersion.class);
CyApplicationConfiguration cyApplicationConfigurationServiceRef = getService(bc, CyApplicationConfiguration.class);
VisualMappingFunctionFactory vmfFactoryC = getService(bc, VisualMappingFunctionFactory.class, "(mapping.type=continuous)");
VisualMappingFunctionFactory vmfFactoryD = getService(bc, VisualMappingFunctionFactory.class, "(mapping.type=discrete)");
VisualMappingFunctionFactory vmfFactoryP = getService(bc, VisualMappingFunctionFactory.class, "(mapping.type=passthrough)");
DataSourceManager dataSourceManager = getService(bc, DataSourceManager.class);
// Start of core-task services
LoadVizmapFileTaskFactory loadVizmapFileTaskFactory = getService(bc, LoadVizmapFileTaskFactory.class);
LoadNetworkFileTaskFactory loadNetworkFileTaskFactory = getService(bc, LoadNetworkFileTaskFactory.class);
LoadNetworkURLTaskFactory loadNetworkURLTaskFactory = getService(bc, LoadNetworkURLTaskFactory.class);
DeleteSelectedNodesAndEdgesTaskFactory deleteSelectedNodesAndEdgesTaskFactory = getService(bc, DeleteSelectedNodesAndEdgesTaskFactory.class);
SelectAllTaskFactory selectAllTaskFactory = getService(bc, SelectAllTaskFactory.class);
SelectAllEdgesTaskFactory selectAllEdgesTaskFactory = getService(bc, SelectAllEdgesTaskFactory.class);
SelectAllNodesTaskFactory selectAllNodesTaskFactory = getService(bc, SelectAllNodesTaskFactory.class);
SelectAdjacentEdgesTaskFactory selectAdjacentEdgesTaskFactory = getService(bc, SelectAdjacentEdgesTaskFactory.class);
SelectConnectedNodesTaskFactory selectConnectedNodesTaskFactory = getService(bc, SelectConnectedNodesTaskFactory.class);
SelectFirstNeighborsTaskFactory selectFirstNeighborsTaskFactory = getService(bc, SelectFirstNeighborsTaskFactory.class, "(title=Undirected)");
SelectFirstNeighborsTaskFactory selectFirstNeighborsTaskFactoryInEdge = getService(bc, SelectFirstNeighborsTaskFactory.class, "(title=Directed: Incoming)");
SelectFirstNeighborsTaskFactory selectFirstNeighborsTaskFactoryOutEdge = getService(bc, SelectFirstNeighborsTaskFactory.class, "(title=Directed: Outgoing)");
DeselectAllTaskFactory deselectAllTaskFactory = getService(bc, DeselectAllTaskFactory.class);
DeselectAllEdgesTaskFactory deselectAllEdgesTaskFactory = getService(bc, DeselectAllEdgesTaskFactory.class);
DeselectAllNodesTaskFactory deselectAllNodesTaskFactory = getService(bc, DeselectAllNodesTaskFactory.class);
InvertSelectedEdgesTaskFactory invertSelectedEdgesTaskFactory = getService(bc, InvertSelectedEdgesTaskFactory.class);
InvertSelectedNodesTaskFactory invertSelectedNodesTaskFactory = getService(bc, InvertSelectedNodesTaskFactory.class);
SelectFromFileListTaskFactory selectFromFileListTaskFactory = getService(bc, SelectFromFileListTaskFactory.class);
SelectFirstNeighborsNodeViewTaskFactory selectFirstNeighborsNodeViewTaskFactory = getService(bc, SelectFirstNeighborsNodeViewTaskFactory.class);
HideSelectedTaskFactory hideSelectedTaskFactory = getService(bc, HideSelectedTaskFactory.class);
HideSelectedNodesTaskFactory hideSelectedNodesTaskFactory = getService(bc, HideSelectedNodesTaskFactory.class);
HideSelectedEdgesTaskFactory hideSelectedEdgesTaskFactory = getService(bc, HideSelectedEdgesTaskFactory.class);
UnHideAllTaskFactory unHideAllTaskFactory = getService(bc, UnHideAllTaskFactory.class);
UnHideAllNodesTaskFactory unHideAllNodesTaskFactory = getService(bc, UnHideAllNodesTaskFactory.class);
UnHideAllEdgesTaskFactory unHideAllEdgesTaskFactory = getService(bc, UnHideAllEdgesTaskFactory.class);
NewEmptyNetworkViewFactory newEmptyNetworkTaskFactory = getService(bc, NewEmptyNetworkViewFactory.class);
CloneNetworkTaskFactory cloneNetworkTaskFactory = getService(bc, CloneNetworkTaskFactory.class);
NewNetworkSelectedNodesAndEdgesTaskFactory newNetworkSelectedNodesEdgesTaskFactory = getService(bc, NewNetworkSelectedNodesAndEdgesTaskFactory.class);
NewNetworkSelectedNodesOnlyTaskFactory newNetworkSelectedNodesOnlyTaskFactory = getService(bc, NewNetworkSelectedNodesOnlyTaskFactory.class);
DestroyNetworkTaskFactory destroyNetworkTaskFactory = getService(bc, DestroyNetworkTaskFactory.class);
DestroyNetworkViewTaskFactory destroyNetworkViewTaskFactory = getService(bc, DestroyNetworkViewTaskFactory.class);
NewSessionTaskFactory newSessionTaskFactory = getService(bc, NewSessionTaskFactory.class);
OpenSessionTaskFactory openSessionTaskFactory = getService(bc, OpenSessionTaskFactory.class);
SaveSessionAsTaskFactory saveSessionAsTaskFactory = getService(bc, SaveSessionAsTaskFactory.class);
EditNetworkTitleTaskFactory editNetworkTitleTaskFactory = getService(bc, EditNetworkTitleTaskFactory.class);
CreateNetworkViewTaskFactory createNetworkViewTaskFactory = getService(bc, CreateNetworkViewTaskFactory.class);
ExportNetworkImageTaskFactory exportNetworkImageTaskFactory = getService(bc, ExportNetworkImageTaskFactory.class);
ExportNetworkViewTaskFactory exportNetworkViewTaskFactory = getService(bc, ExportNetworkViewTaskFactory.class);
ExportSelectedTableTaskFactory exportSelectedTableTaskFactory = getService(bc, ExportSelectedTableTaskFactory.class);
ExportTableTaskFactory exportTableTaskFactory = getService(bc, ExportTableTaskFactory.class);
ApplyPreferredLayoutTaskFactory applyPreferredLayoutTaskFactory = getService(bc, ApplyPreferredLayoutTaskFactory.class);
DeleteColumnTaskFactory deleteColumnTaskFactory = getService(bc, DeleteColumnTaskFactory.class);
RenameColumnTaskFactory renameColumnTaskFactory = getService(bc, RenameColumnTaskFactory.class);
DeleteTableTaskFactory deleteTableTaskFactory = getService(bc, DeleteTableTaskFactory.class);
ExportVizmapTaskFactory exportVizmapTaskFactory = getService(bc, ExportVizmapTaskFactory.class);
ConnectSelectedNodesTaskFactory connectSelectedNodesTaskFactory = getService(bc, ConnectSelectedNodesTaskFactory.class);
MapGlobalToLocalTableTaskFactory mapGlobal = getService(bc, MapGlobalToLocalTableTaskFactory.class);
ApplyVisualStyleTaskFactory applyVisualStyleTaskFactory = getService(bc, ApplyVisualStyleTaskFactory.class);
MapTableToNetworkTablesTaskFactory mapNetworkAttrTaskFactory = getService(bc, MapTableToNetworkTablesTaskFactory.class);
GroupNodesTaskFactory groupNodesTaskFactory = getService(bc, GroupNodesTaskFactory.class);
UnGroupTaskFactory unGroupTaskFactory = getService(bc, UnGroupTaskFactory.class);
CollapseGroupTaskFactory collapseGroupTaskFactory = getService(bc, CollapseGroupTaskFactory.class);
ExpandGroupTaskFactory expandGroupTaskFactory = getService(bc, ExpandGroupTaskFactory.class);
UnGroupNodesTaskFactory unGroupNodesTaskFactory = getService(bc, UnGroupNodesTaskFactory.class);
// End of core-task services
// Command execution services
CommandExecutorTaskFactory cyCommandExecutorTaskFactory = getService(bc, CommandExecutorTaskFactory.class);
AvailableCommands availableCommands = getService(bc, AvailableCommands.class);
StreamUtil streamUtilServiceRef = getService(bc, StreamUtil.class);
FileUtil fileUtilServiceRef = getService(bc, FileUtil.class);
CySwingAppAdapter cyAppAdapter = new CyAppAdapterImpl(cyApplicationConfigurationRef, cyApplicationManagerRef, cyEventHelperRef, cyGroupAggregationManagerRef, cyGroupFactoryRef, cyGroupManagerRef, cyLayoutAlgorithmManagerRef, cyNetworkFactoryRef, cyNetworkManagerRef, cyNetworkViewFactoryRef, cyNetworkViewManagerRef, cyNetworkViewReaderManagerRef, cyNetworkViewWriterManagerRef, cyPropertyRef, cyPropertyReaderManagerRef, cyPropertyWriterManagerRef, cyRootNetworkFactoryRef, serviceRegistrar, cySessionManagerRef, cySessionReaderManagerRef, cySessionWriterManagerRef, cySwingApplicationRef, cyTableFactoryRef, cyTableManagerRef, cyTableReaderManagerRef, cyTableWriterManagerRef, cytoscapeVersionService, dialogTaskManagerRef, panelTaskManagerRef, presentationWriterManagerRef, renderingEngineManagerRef, taskManagerRef, undoSupportRef, tunablePropertySerializerFactoryRef, vmfFactoryC, vmfFactoryD, vmfFactoryP, visualMappingManagerRef, visualStyleFactoryRef, dataSourceManager, // from core-task-api
loadVizmapFileTaskFactory, loadNetworkFileTaskFactory, loadNetworkURLTaskFactory, deleteSelectedNodesAndEdgesTaskFactory, selectAllTaskFactory, selectAllEdgesTaskFactory, selectAllNodesTaskFactory, selectAdjacentEdgesTaskFactory, selectConnectedNodesTaskFactory, selectFirstNeighborsTaskFactory, selectFirstNeighborsTaskFactoryInEdge, selectFirstNeighborsTaskFactoryOutEdge, deselectAllTaskFactory, deselectAllEdgesTaskFactory, deselectAllNodesTaskFactory, invertSelectedEdgesTaskFactory, invertSelectedNodesTaskFactory, selectFromFileListTaskFactory, selectFirstNeighborsNodeViewTaskFactory, hideSelectedTaskFactory, hideSelectedNodesTaskFactory, hideSelectedEdgesTaskFactory, unHideAllTaskFactory, unHideAllNodesTaskFactory, unHideAllEdgesTaskFactory, newEmptyNetworkTaskFactory, cloneNetworkTaskFactory, newNetworkSelectedNodesEdgesTaskFactory, newNetworkSelectedNodesOnlyTaskFactory, destroyNetworkTaskFactory, destroyNetworkViewTaskFactory, newSessionTaskFactory, openSessionTaskFactory, saveSessionAsTaskFactory, editNetworkTitleTaskFactory, createNetworkViewTaskFactory, exportNetworkImageTaskFactory, exportNetworkViewTaskFactory, exportSelectedTableTaskFactory, exportTableTaskFactory, applyPreferredLayoutTaskFactory, deleteColumnTaskFactory, renameColumnTaskFactory, deleteTableTaskFactory, exportVizmapTaskFactory, connectSelectedNodesTaskFactory, mapGlobal, applyVisualStyleTaskFactory, mapNetworkAttrTaskFactory, groupNodesTaskFactory, unGroupTaskFactory, collapseGroupTaskFactory, expandGroupTaskFactory, unGroupNodesTaskFactory, cyCommandExecutorTaskFactory, availableCommands);
registerService(bc, cyAppAdapter, CyAppAdapter.class);
registerService(bc, cyAppAdapter, CySwingAppAdapter.class);
WebQuerier webQuerier = new WebQuerier(streamUtilServiceRef, cytoscapeVersionService);
registerService(bc, webQuerier, WebQuerier.class);
StartLevel startLevel = getService(bc, StartLevel.class);
// Instantiate new manager
final AppManager appManager = new AppManager(cyAppAdapter, cyApplicationConfigurationServiceRef, cytoscapeVersionService, cyEventHelperRef, webQuerier, startLevel, bc);
registerService(bc, appManager, AppManager.class);
bc.addFrameworkListener(appManager);
final DownloadSitesManager downloadSitesManager = new DownloadSitesManager(cyPropertyRef);
final UpdateManager updateManager = new UpdateManager(appManager, downloadSitesManager);
registerService(bc, updateManager, AppsFinishedStartingListener.class);
final AppConflictHandlerFactory appConflictHandlerFactory = new AppConflictHandlerFactory();
registerService(bc, appConflictHandlerFactory, GUITunableHandlerFactory.class);
// AbstractCyAction implementation for updated app manager
AppManagerAction appManagerAction = new AppManagerAction(appManager, downloadSitesManager, updateManager, cySwingApplicationRef, fileUtilServiceRef, dialogTaskManagerRef, serviceRegistrar);
registerService(bc, appManagerAction, CyAction.class);
// Show citations dialog
final CitationsAction citationsAction = new CitationsAction(webQuerier, appManager, serviceRegistrar);
registerService(bc, citationsAction, CyAction.class);
// Start local server that reports app installation status to the app store when requested,
// also able to install an app when told by the app store
final AppGetResponder appGetResponder = new AppGetResponder(appManager, cytoscapeVersionService);
final CyHttpd httpd = (new CyHttpdFactoryImpl()).createHttpd(new LocalhostServerSocketFactory(2607));
httpd.addBeforeResponse(new ScreenOriginsBeforeResponse(WebQuerier.DEFAULT_APP_STORE_URL));
httpd.addBeforeResponse(new OriginOptionsBeforeResponse("x-csrftoken"));
httpd.addAfterResponse(new AddAllowOriginHeader());
httpd.addResponder(appGetResponder.new StatusResponder());
httpd.addResponder(appGetResponder.new InstallResponder());
httpd.start();
// Special case: handle yFiles app options
final OpenBrowser openBrowser = getService(bc, OpenBrowser.class);
YFilesChecker checker = new YFilesChecker(appManager, serviceRegistrar, openBrowser);
bc.addBundleListener(checker);
registerAllServices(bc, checker, new Properties());
{
AppStoreTaskFactory factory = new AppStoreTaskFactory(appManager, serviceRegistrar);
Properties props = new Properties();
props.setProperty(COMMAND_NAMESPACE, "apps");
props.setProperty(COMMAND, "open appstore");
props.setProperty(COMMAND_DESCRIPTION, "Open the app store page for an app");
props.setProperty(COMMAND_LONG_DESCRIPTION, "Open the app store page for an app.");
props.setProperty(COMMAND_SUPPORTS_JSON, "true");
props.setProperty(COMMAND_EXAMPLE_JSON, "{}");
registerService(bc, factory, TaskFactory.class, props);
}
{
DisableTaskFactory factory = new DisableTaskFactory(appManager);
Properties props = new Properties();
props.setProperty(COMMAND_NAMESPACE, "apps");
props.setProperty(COMMAND, "disable");
props.setProperty(COMMAND_DESCRIPTION, "Disable an app");
props.setProperty(COMMAND_LONG_DESCRIPTION, "Disable a currently installed app.");
props.setProperty(COMMAND_SUPPORTS_JSON, "true");
props.setProperty(COMMAND_EXAMPLE_JSON, "{\"appName\": \"appname\"}");
registerService(bc, factory, TaskFactory.class, props);
}
{
EnableTaskFactory factory = new EnableTaskFactory(appManager);
Properties props = new Properties();
props.setProperty(COMMAND_NAMESPACE, "apps");
props.setProperty(COMMAND, "enable");
props.setProperty(COMMAND_DESCRIPTION, "Enable a disabled app");
props.setProperty(COMMAND_LONG_DESCRIPTION, "Enable a currently disabled app.");
props.setProperty(COMMAND_SUPPORTS_JSON, "true");
props.setProperty(COMMAND_EXAMPLE_JSON, "{\"appName\": \"appname\"}");
registerService(bc, factory, TaskFactory.class, props);
}
{
InformationTaskFactory factory = new InformationTaskFactory(appManager);
Properties props = new Properties();
props.setProperty(COMMAND_NAMESPACE, "apps");
props.setProperty(COMMAND, "information");
props.setProperty(COMMAND_DESCRIPTION, "Get app information");
props.setProperty(COMMAND_LONG_DESCRIPTION, "Get information about an app.");
props.setProperty(COMMAND_SUPPORTS_JSON, "true");
props.setProperty(COMMAND_EXAMPLE_JSON, "{\"appName\": \"appname\"" + ", \"description\": \"App description\"" + ", \"version\": \"1.2.2\"}");
registerService(bc, factory, TaskFactory.class, props);
}
{
InstallTaskFactory factory = new InstallTaskFactory(appManager);
Properties props = new Properties();
props.setProperty(COMMAND_NAMESPACE, "apps");
props.setProperty(COMMAND, "install");
props.setProperty(COMMAND_DESCRIPTION, "Install an app");
props.setProperty(COMMAND_LONG_DESCRIPTION, "Install an app given an app name or file.");
props.setProperty(COMMAND_SUPPORTS_JSON, "true");
props.setProperty(COMMAND_EXAMPLE_JSON, "{}");
registerService(bc, factory, TaskFactory.class, props);
}
{
ListAvailableTaskFactory factory = new ListAvailableTaskFactory(appManager);
Properties props = new Properties();
props.setProperty(COMMAND_NAMESPACE, "apps");
props.setProperty(COMMAND, "list available");
props.setProperty(COMMAND_DESCRIPTION, "List the available apps");
props.setProperty(COMMAND_LONG_DESCRIPTION, "Return a list of the available apps in the app store");
props.setProperty(COMMAND_SUPPORTS_JSON, "true");
props.setProperty(COMMAND_EXAMPLE_JSON, "[{\"appName\":\"name\", " + "\"description\":\"descriptions\", " + "\"details\":\"app details\"}]");
registerService(bc, factory, TaskFactory.class, props);
}
{
ListAppsTaskFactory factory = new ListAppsTaskFactory(appManager, AppStatus.DISABLED);
Properties props = new Properties();
props.setProperty(COMMAND_NAMESPACE, "apps");
props.setProperty(COMMAND, "list disabled");
props.setProperty(COMMAND_DESCRIPTION, "List the disabled apps");
props.setProperty(COMMAND_LONG_DESCRIPTION, "Return a list of the disabled apps in the current installation.");
props.setProperty(COMMAND_SUPPORTS_JSON, "true");
props.setProperty(COMMAND_EXAMPLE_JSON, "[{ \"appName\": \"appname\"," + "\"version\": \"1.1.0\"," + "\"description\": \"descriptions\"," + "\"status\": \"Disabled\"}]");
registerService(bc, factory, TaskFactory.class, props);
}
{
ListAppsTaskFactory factory = new ListAppsTaskFactory(appManager, AppStatus.INSTALLED);
Properties props = new Properties();
props.setProperty(COMMAND_NAMESPACE, "apps");
props.setProperty(COMMAND, "list installed");
props.setProperty(COMMAND_DESCRIPTION, "List the installed apps");
props.setProperty(COMMAND_LONG_DESCRIPTION, "Return a list of the installed apps in the current installation.");
props.setProperty(COMMAND_SUPPORTS_JSON, "true");
props.setProperty(COMMAND_EXAMPLE_JSON, "[{\"appName\": \"appname\"," + "\"version\": \"1.1.0\"," + "\"description\": \"descriptions\"," + "\"status\": \"Installed\"}]");
registerService(bc, factory, TaskFactory.class, props);
}
{
ListAppsTaskFactory factory = new ListAppsTaskFactory(appManager, AppStatus.UNINSTALLED);
Properties props = new Properties();
props.setProperty(COMMAND_NAMESPACE, "apps");
props.setProperty(COMMAND, "list uninstalled");
props.setProperty(COMMAND_DESCRIPTION, "List the uninstalled apps");
props.setProperty(COMMAND_LONG_DESCRIPTION, "Return a list of the uninstalled apps in the current installation.");
props.setProperty(COMMAND_SUPPORTS_JSON, "true");
props.setProperty(COMMAND_EXAMPLE_JSON, "[{ \"appName\": \"appname\"," + "\"version\": \"1.1.0\"," + "\"description\": \"descriptions\"," + "\"status\": \"Uninstalled\"}]");
registerService(bc, factory, TaskFactory.class, props);
}
{
ListUpdatesTaskFactory factory = new ListUpdatesTaskFactory(appManager);
Properties props = new Properties();
props.setProperty(COMMAND_NAMESPACE, "apps");
props.setProperty(COMMAND, "list updates");
props.setProperty(COMMAND_DESCRIPTION, "List the apps available for updates");
props.setProperty(COMMAND_LONG_DESCRIPTION, "Return a list of the apps that have updates in the app store.");
props.setProperty(COMMAND_SUPPORTS_JSON, "true");
props.setProperty(COMMAND_EXAMPLE_JSON, "[{ \"appName\": \"appname\"," + "\"version\": \"1.1.10\"," + "\"information\": \"app information\"}]");
registerService(bc, factory, TaskFactory.class, props);
}
{
StatusTaskFactory factory = new StatusTaskFactory(appManager);
Properties props = new Properties();
props.setProperty(COMMAND_NAMESPACE, "apps");
props.setProperty(COMMAND, "status");
props.setProperty(COMMAND_DESCRIPTION, "Get the status of an app");
props.setProperty(COMMAND_LONG_DESCRIPTION, "Get the status of an app.");
props.setProperty(COMMAND_SUPPORTS_JSON, "true");
props.setProperty(COMMAND_EXAMPLE_JSON, "{\"appName\": \"appname\", \"status\": \"Installed\"}");
registerService(bc, factory, TaskFactory.class, props);
}
{
UninstallTaskFactory factory = new UninstallTaskFactory(appManager);
Properties props = new Properties();
props.setProperty(COMMAND_NAMESPACE, "apps");
props.setProperty(COMMAND, "uninstall");
props.setProperty(COMMAND_DESCRIPTION, "Uninstall an app");
props.setProperty(COMMAND_LONG_DESCRIPTION, "Uninstall a currently installed app.");
props.setProperty(COMMAND_SUPPORTS_JSON, "true");
props.setProperty(COMMAND_EXAMPLE_JSON, "{\"appName\": \"appname\"}");
registerService(bc, factory, TaskFactory.class, props);
}
{
UpdateTaskFactory factory = new UpdateTaskFactory(appManager, updateManager);
Properties props = new Properties();
props.setProperty(COMMAND_NAMESPACE, "apps");
props.setProperty(COMMAND, "update");
props.setProperty(COMMAND_DESCRIPTION, "Update an app or all apps");
props.setProperty(COMMAND_LONG_DESCRIPTION, "Update an app or all apps.");
props.setProperty(COMMAND_SUPPORTS_JSON, "true");
props.setProperty(COMMAND_EXAMPLE_JSON, "{}");
registerService(bc, factory, TaskFactory.class, props);
}
}
Aggregations