use of org.pentaho.platform.api.engine.IPluginResourceLoader in project data-access by pentaho.
the class SimpleDataAccessViewPermissionHandler method getDefaultAcls.
public int getDefaultAcls(IPentahoSession session) {
IPluginResourceLoader resLoader = PentahoSystem.get(IPluginResourceLoader.class, null);
String defaultAclsAsString = null;
int defaultAcls = -1;
try {
defaultAclsAsString = // $NON-NLS-1$
resLoader.getPluginSetting(getClass(), "settings/data-access-default-view-acls");
} catch (Exception e) {
logger.debug("Error getting plugin setting", e);
}
if (defaultAclsAsString != null && defaultAclsAsString.length() > 0) {
defaultAcls = Integer.parseInt(defaultAclsAsString);
}
return defaultAcls;
}
use of org.pentaho.platform.api.engine.IPluginResourceLoader in project data-access by pentaho.
the class DataSourcePublishIT method setUp.
@Before
public void setUp() throws Exception {
repositoryBase.setUp();
repositoryBase.loginAsRepositoryAdmin();
defaultTenant = repositoryBase.createTenant(repositoryBase.getSystemTenant(), TenantUtils.getDefaultTenant());
singleTenantAdminUserName = (String) applicationContext.getBean("singleTenantAdminUserName");
repositoryBase.createUser(defaultTenant, singleTenantAdminUserName, PASSWORD, new String[] { repositoryBase.getTenantAdminRoleName() });
final String singleTenantAuthenticatedAuthorityName = (String) applicationContext.getBean("singleTenantAuthenticatedAuthorityName");
repositoryBase.createUser(defaultTenant, USERNAME_SUZY, PASSWORD, new String[] { singleTenantAuthenticatedAuthorityName });
repositoryBase.createUser(defaultTenant, USERNAME_TIFFANY, PASSWORD, new String[] { singleTenantAuthenticatedAuthorityName });
repositoryBase.login(singleTenantAdminUserName, defaultTenant, new String[] { repositoryBase.getTenantAdminRoleName() });
final IUnifiedRepository repo = PentahoSystem.get(IUnifiedRepository.class);
String etcID = String.valueOf(repo.getFile(ClientRepositoryPaths.getEtcFolderPath()).getId());
repo.createFolder(etcID, new RepositoryFile.Builder(MondrianCatalogHelper.MONDRIAN_DATASOURCE_FOLDER).folder(true).build(), "initialization");
repo.createFolder(etcID, new RepositoryFile.Builder(PentahoMetadataDomainRepositoryInfo.getMetadataFolderName()).folder(true).build(), "initialization");
final MicroPlatform mp = repositoryBase.getMp();
mp.define(IMondrianCatalogService.class, MondrianCatalogHelper.class);
mp.define(ISystemConfig.class, SystemConfig.class);
mp.defineInstance(IPlatformMimeResolver.class, applicationContext.getBean("IPlatformImportMimeResolver"));
mp.defineInstance(IPlatformImporter.class, applicationContext.getBean("IPlatformImporter"));
mp.defineInstance(ICacheManager.class, applicationContext.getBean("ICacheManager"));
mp.defineInstance(IMetadataDomainRepository.class, applicationContext.getBean("IMetadataDomainRepository"));
final PluginResourceLoader pluginResourceLoader = (PluginResourceLoader) applicationContext.getBean("IPluginResourceLoader");
pluginResourceLoader.setRootDir(new File("target/test-classes/solutionACL/system/data-access"));
mp.defineInstance(IPluginResourceLoader.class, pluginResourceLoader);
mp.define(IDataAccessPermissionHandler.class, SimpleDataAccessPermissionHandler.class);
mp.define(IDataAccessViewPermissionHandler.class, SimpleDataAccessViewPermissionHandler.class);
mp.defineInstance(IAclVoter.class, new PentahoAllowAllAclVoter());
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_GLOBAL);
super.setUp();
}
use of org.pentaho.platform.api.engine.IPluginResourceLoader in project pentaho-platform by pentaho.
the class GwtRpcPluginProxyServlet method getSerializationPolicyUrl.
/**
* The request path is broken up for processing like so: Ex: given a request for serialization file at
* '/pentaho/content/data-access/resources/gwt/{strongName}'
*
* @param serializationPolicyFilename
* the name of the serialization policy file that GWT is looking for
* @param appContextPath
* according to the example url, this would be '/pentaho'
* @param servletContextPath
* according the the example url, this would be '/content/data-access/resources/gwt/{strongName}'
* @return a URL to the serialization policy file, or <code>null</code> if none applies, in which case the default
* serialization policy will apply
*/
protected URL getSerializationPolicyUrl(String serializationPolicyFilename, String appContextPath, String servletContextPath) {
// We will use the pluginContextPath to determine the service plugin for the serialization policy file
//
ClassLoader serviceClassloader = PluginUtil.getClassLoaderForService(servletContextPath);
if (serviceClassloader == null) {
// if we get here, then the service is not supplied by a plugin and thus we cannot hope to find
// the appropriate serialization policy
logger.error(Messages.getInstance().getErrorString("GwtRpcPluginProxyServlet.ERROR_0005_FAILED_TO_FIND_PLUGIN", // $NON-NLS-1$
appContextPath));
}
// We know what plugin is supposed to have the serialization policy file, now go find it
// in the plugin's filesystem
//
IPluginResourceLoader resLoader = PentahoSystem.get(IPluginResourceLoader.class, PentahoSessionHolder.getSession());
List<URL> urls = resLoader.findResources(serviceClassloader, serializationPolicyFilename);
if (urls.size() < 1) {
logger.error(Messages.getInstance().getErrorString("GwtRpcPluginProxyServlet.ERROR_0006_FAILED_TO_FIND_FILE", // $NON-NLS-1$
serializationPolicyFilename));
return null;
}
if (urls.size() > 1) {
logger.warn(Messages.getInstance().getString("GwtRpcPluginProxyServlet.WARN_MULTIPLE_RESOURCES_FOUND", // $NON-NLS-1$
serializationPolicyFilename));
}
return urls.get(0);
}
use of org.pentaho.platform.api.engine.IPluginResourceLoader in project pentaho-platform by pentaho.
the class DefaultPluginManager method getPluginSetting.
@Override
public Object getPluginSetting(String pluginId, String key, String defaultValue) {
IPluginResourceLoader resLoader = PentahoSystem.get(IPluginResourceLoader.class, null);
ClassLoader classLoader = classLoaderMap.get(pluginId);
return resLoader.getPluginSetting(classLoader, key, defaultValue);
}
use of org.pentaho.platform.api.engine.IPluginResourceLoader in project pentaho-platform by pentaho.
the class DefaultPluginManager method getStaticResource.
@Deprecated
public InputStream getStaticResource(String path) {
for (IPlatformPlugin plugin : registeredPlugins.values()) {
Map<String, String> resourceMap = plugin.getStaticResourceMap();
for (String url : resourceMap.keySet()) {
if (isRequested(url, path)) {
IPluginResourceLoader resLoader = PentahoSystem.get(IPluginResourceLoader.class, null);
ClassLoader classLoader = classLoaderMap.get(plugin.getId());
String resourcePath = path.replace(url, resourceMap.get(url));
return resLoader.getResourceAsStream(classLoader, resourcePath);
}
}
}
return null;
}
Aggregations