use of org.pentaho.platform.api.engine.IPluginManager in project pentaho-platform by pentaho.
the class UserConsoleResource method getMantleSettings.
/**
* Return the current user console settings
*
* @return current settings
*/
@GET
@Path("/settings")
@Produces({ APPLICATION_JSON, APPLICATION_XML })
@Facet(name = "Unsupported")
public List<Setting> getMantleSettings() {
ArrayList<Setting> settings = new ArrayList<Setting>();
settings.add(// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
new Setting("login-show-users-list", PentahoSystem.getSystemSetting("login-show-users-list", "")));
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
settings.add(new Setting("documentation-url", PentahoSystem.getSystemSetting("documentation-url", "")));
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
settings.add(new Setting("submit-on-enter-key", PentahoSystem.getSystemSetting("submit-on-enter-key", "true")));
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
settings.add(new Setting("user-console-revision", PentahoSystem.getSystemSetting("user-console-revision", "")));
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
settings.add(new Setting("startupPerspective", PentahoSystem.getSystemSetting("startup-perspective", "")));
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
settings.add(new Setting("showOnlyPerspective", PentahoSystem.getSystemSetting("show-only-perspective", "")));
int startupUrls = Integer.parseInt(PentahoSystem.getSystemSetting("num-startup-urls", "0"));
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
settings.add(new Setting("num-startup-urls", PentahoSystem.getSystemSetting("num-startup-urls", "0")));
for (int i = 1; i <= startupUrls; i++) {
// $NON-NLS-1$
settings.add(new Setting("startup-url-" + i, PentahoSystem.getSystemSetting("startup-url-" + i, "")));
// $NON-NLS-1$
settings.add(new Setting("startup-name-" + i, PentahoSystem.getSystemSetting("startup-name-" + i, "")));
}
// Check for override of New Analysis View via pentaho.xml
// Poked in via pentaho.xml entries
// <new-analysis-view>
// <command-url>http://www.google.com</command-url>
// <command-title>Marc Analysis View</command-title>
// </new-analysis-view>
// <new-report>
// <command-url>http://www.yahoo.com</command-url>
// <command-title>Marc New Report</command-title>
// </new-report>
//
// $NON-NLS-1$
String overrideNewAnalysisViewCommmand = PentahoSystem.getSystemSetting("new-analysis-view/command-url", null);
// $NON-NLS-1$
String overrideNewAnalysisViewTitle = PentahoSystem.getSystemSetting("new-analysis-view/command-title", null);
if ((overrideNewAnalysisViewCommmand != null) && (overrideNewAnalysisViewTitle != null)) {
// $NON-NLS-1$
settings.add(new Setting("new-analysis-view-command-url", overrideNewAnalysisViewCommmand));
// $NON-NLS-1$
settings.add(new Setting("new-analysis-view-command-title", overrideNewAnalysisViewTitle));
}
// $NON-NLS-1$
String overrideNewReportCommmand = PentahoSystem.getSystemSetting("new-report/command-url", null);
// $NON-NLS-1$
String overrideNewReportTitle = PentahoSystem.getSystemSetting("new-report/command-title", null);
if ((overrideNewReportCommmand != null) && (overrideNewReportTitle != null)) {
// $NON-NLS-1$
settings.add(new Setting("new-report-command-url", overrideNewReportCommmand));
// $NON-NLS-1$
settings.add(new Setting("new-report-command-title", overrideNewReportTitle));
}
// $NON-NLS-1$
IPluginManager pluginManager = PentahoSystem.get(IPluginManager.class, UserConsoleService.getPentahoSession());
if (pluginManager != null) {
// load content types from IPluginSettings
int i = 0;
for (String contentType : pluginManager.getContentTypes()) {
IContentInfo info = pluginManager.getContentTypeInfo(contentType);
if (info != null) {
// $NON-NLS-1$ //$NON-NLS-2$
settings.add(new Setting("plugin-content-type-" + i, "." + contentType));
// $NON-NLS-1$
settings.add(new Setting("plugin-content-type-icon-" + i, info.getIconUrl()));
int j = 0;
for (IPluginOperation operation : info.getOperations()) {
// $NON-NLS-1$
settings.add(new Setting("plugin-content-type-" + i + "-command-" + j, operation.getId()));
settings.add(new Setting("plugin-content-type-" + i + "-command-perspective-" + j, // $NON-NLS-1$
operation.getPerspective()));
j++;
}
i++;
}
}
}
return settings;
}
use of org.pentaho.platform.api.engine.IPluginManager in project pentaho-platform by pentaho.
the class PluginManagerResource method getOverlays.
/**
* Retrieve the list of XUL overlays for the provided id
*
* @param id
* @return list of <code> Overlay </code>
*/
@GET
@Path("/overlays")
@Produces({ APPLICATION_JSON })
@Facet(name = "Unsupported")
public List<Overlay> getOverlays(@QueryParam("id") @DefaultValue("") String id) {
// $NON-NLS-1$
IPluginManager pluginManager = PentahoSystem.get(IPluginManager.class, PentahoSessionHolder.getSession());
List<XulOverlay> overlays = pluginManager.getOverlays();
ArrayList<Overlay> result = new ArrayList<Overlay>();
for (XulOverlay overlay : overlays) {
if (!id.isEmpty() && !overlay.getId().equals(id)) {
continue;
}
Overlay tempOverlay = new Overlay(overlay.getId(), overlay.getOverlayUri(), overlay.getSource(), overlay.getResourceBundleUri(), overlay.getPriority());
result.add(tempOverlay);
}
return result;
}
use of org.pentaho.platform.api.engine.IPluginManager in project pentaho-platform by pentaho.
the class PluginManagerResource method getPluginSettings.
/**
* Retrieve the list of setting of a selected setting name from all registered plugins.
*
* @param settingName (name of the plugin setting)
* @return list of <code> Setting </code>
*/
@GET
@Path("/settings/{settingName}")
@Produces({ APPLICATION_JSON })
@Facet(name = "Unsupported")
public Response getPluginSettings(@PathParam("settingName") String settingName) {
// A non-admin still require this setting. All other settings should be admin only
if (!NEW_TOOLBAR_BUTTON_SETTING.equals(settingName)) {
if (!canAdminister()) {
return Response.status(UNAUTHORIZED).build();
}
}
// $NON-NLS-1$
IPluginManager pluginManager = PentahoSystem.get(IPluginManager.class, PentahoSessionHolder.getSession());
ArrayList<Setting> settings = new ArrayList<Setting>();
for (String id : pluginManager.getRegisteredPlugins()) {
Setting s = new Setting(id, (String) pluginManager.getPluginSetting(id, settingName, null));
if (!StringUtils.isEmpty(s.getValue())) {
settings.add(s);
}
}
return Response.ok(new JaxbList<Setting>(settings), MediaType.APPLICATION_JSON).build();
}
use of org.pentaho.platform.api.engine.IPluginManager in project pdi-platform-plugin by pentaho.
the class ParameterUIContentGenerator method createContent.
@Override
public void createContent(OutputStream outputStream) throws Exception {
IPluginResourceLoader resourceLoader = PentahoSystem.get(IPluginResourceLoader.class);
IPluginManager pluginManager = PentahoSystem.get(IPluginManager.class);
ClassLoader classLoader = pluginManager.getClassLoader(pluginId);
String filePath = !viewerFilePath.startsWith("/") ? "/" + viewerFilePath : viewerFilePath;
String viewer = IOUtils.toString(resourceLoader.getResourceAsStream(classLoader, filePath), LocaleHelper.getSystemEncoding());
viewer = doResourceReplacement(viewer);
InputStream is = IOUtils.toInputStream(viewer, LocaleHelper.getSystemEncoding());
IOUtils.copy(is, outputStream);
outputStream.flush();
}
Aggregations