use of org.pentaho.platform.api.repository2.unified.IUnifiedRepository in project pentaho-platform by pentaho.
the class ActionSequenceParameterUiContentGenerator method createContent.
@Override
public void createContent(OutputStream outputStream) throws Exception {
IParameterProvider requestParams = getRequestParameters();
IParameterProvider pathParams = getPathParameters();
if ((requestParams != null) && (requestParams.getStringParameter("path", null) != null)) {
path = URLDecoder.decode(requestParams.getStringParameter("path", ""), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"UTF-8");
} else if ((pathParams != null) && (pathParams.getStringParameter("path", null) != null)) {
// $NON-NLS-1$
path = URLDecoder.decode(pathParams.getStringParameter("path", ""), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"UTF-8");
}
if (path != null && path.length() > 0) {
IUnifiedRepository unifiedRepository = PentahoSystem.get(IUnifiedRepository.class, null);
RepositoryFile file = unifiedRepository.getFile(path);
// $NON-NLS-1$
HttpServletRequest httpRequest = (HttpServletRequest) pathParams.getParameter("httprequest");
// $NON-NLS-1$
HttpServletResponse httpResponse = (HttpServletResponse) pathParams.getParameter("httpresponse");
String buffer = XactionUtil.executeScheduleUi(file, httpRequest, httpResponse, PentahoSessionHolder.getSession(), outputHandler.getMimeTypeListener());
outputStream.write(buffer.toString().getBytes(LocaleHelper.getSystemEncoding()));
}
}
use of org.pentaho.platform.api.repository2.unified.IUnifiedRepository in project pentaho-platform by pentaho.
the class MondrianCatalogHelper method generateInMemoryDatasourcesXml.
public String generateInMemoryDatasourcesXml(IUnifiedRepository unifiedRepository) {
String etcMondrian = ClientRepositoryPaths.getEtcFolderPath() + RepositoryFile.SEPARATOR + MONDRIAN_DATASOURCE_FOLDER;
RepositoryFile etcMondrianFolder = unifiedRepository.getFile(etcMondrian);
if (etcMondrianFolder == null) {
return null;
}
StringBuffer datasourcesXML = new StringBuffer();
// $NON-NLS-1$
datasourcesXML.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
// $NON-NLS-1$
datasourcesXML.append("<DataSources>\n");
// $NON-NLS-1$
datasourcesXML.append("<DataSource>\n");
if (useLegacyDbName) {
// $NON-NLS-1$
datasourcesXML.append("<DataSourceName>Provider=Mondrian</DataSourceName>\n");
} else {
// $NON-NLS-1$
datasourcesXML.append("<DataSourceName>Pentaho Mondrian</DataSourceName>\n");
}
datasourcesXML.append(// $NON-NLS-1$
"<DataSourceDescription>Pentaho BI Platform Datasources</DataSourceDescription>\n");
datasourcesXML.append(// $NON-NLS-1$
"<URL>" + contextPathFromRequestContextHolder() + "Xmla</URL>\n");
// $NON-NLS-1$
datasourcesXML.append("<DataSourceInfo>Provider=Mondrian</DataSourceInfo>\n");
// $NON-NLS-1$
datasourcesXML.append("<ProviderName>PentahoXMLA</ProviderName>\n");
// $NON-NLS-1$
datasourcesXML.append("<ProviderType>MDP</ProviderType>\n");
// $NON-NLS-1$
datasourcesXML.append("<AuthenticationMode>Unauthenticated</AuthenticationMode>\n");
appendCatalogsSection(unifiedRepository, etcMondrian, etcMondrianFolder, datasourcesXML);
// $NON-NLS-1$
datasourcesXML.append("</DataSource>\n");
// $NON-NLS-1$
datasourcesXML.append("</DataSources>\n");
return datasourcesXML.toString();
}
use of org.pentaho.platform.api.repository2.unified.IUnifiedRepository in project data-access by pentaho.
the class AnalysisServiceTest method initPlatform.
@BeforeClass
public static void initPlatform() throws Exception {
MicroPlatform platform = new MicroPlatform();
metadataRepository = mock(IMetadataDomainRepository.class);
platform.defineInstance(IMetadataDomainRepository.class, metadataRepository);
importer = mock(IPlatformImporter.class);
platform.defineInstance(IPlatformImporter.class, importer);
policy = mock(IAuthorizationPolicy.class);
platform.defineInstance(IAuthorizationPolicy.class, policy);
catalogService = mock(IAclAwareMondrianCatalogService.class);
platform.defineInstance(IMondrianCatalogService.class, catalogService);
permissionHandler = mock(IDataAccessPermissionHandler.class);
platform.defineInstance(IDataAccessPermissionHandler.class, permissionHandler);
final IUnifiedRepository unifiedRepository = new FileSystemBackedUnifiedRepository("target/test-classes/solution1");
platform.defineInstance(IUnifiedRepository.class, unifiedRepository);
platform.start();
acl.setOwner("owner");
acl.setOwnerType(RepositoryFileSid.Type.USER.ordinal());
}
use of org.pentaho.platform.api.repository2.unified.IUnifiedRepository 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.repository2.unified.IUnifiedRepository in project data-access by pentaho.
the class SerializeMultiTableServiceIT method createMetadataDomainRepository.
public PentahoMetadataDomainRepository createMetadataDomainRepository() throws Exception {
IUnifiedRepository repository = new FileSystemBackedUnifiedRepository("target/test-classes/solution1");
booter.defineInstance(IUnifiedRepository.class, repository);
Assert.assertNotNull(new RepositoryUtils(repository).getFolder("/etc/metadata", true, true, null));
Assert.assertNotNull(new RepositoryUtils(repository).getFolder("/etc/mondrian", true, true, null));
Assert.assertNotNull(new RepositoryUtils(repository).getFolder("/savetest", true, true, null));
PentahoMetadataDomainRepository pentahoMetadataDomainRepository = new PentahoMetadataDomainRepository(repository);
return pentahoMetadataDomainRepository;
}
Aggregations