use of org.pentaho.platform.api.repository2.unified.IUnifiedRepository in project pdi-platform-plugin by pentaho.
the class ParameterContentGenerator method createContent.
@Override
public void createContent(OutputStream out) throws Exception {
IParameterProvider pathParams = parameterProviders.get(PATH);
IParameterProvider requestParams = parameterProviders.get(IParameterProvider.SCOPE_REQUEST);
RepositoryFile file = null;
if (pathParams != null) {
file = (RepositoryFile) pathParams.getParameter(FILE);
} else {
IUnifiedRepository repo = PentahoSystem.get(IUnifiedRepository.class, null);
String path = URLDecoder.decode(requestParams.getStringParameter(PATH, StringUtils.EMPTY), LocaleHelper.UTF_8);
file = repo.getFile(idTopath(path));
}
IPdiContentProvider provider = (IPdiContentProvider) PentahoSystem.get(IPluginManager.class).getBean(IPdiContentProvider.class.getSimpleName());
String[] userParams = provider.getUserParameters(file.getPath());
ParametersBean paramBean = new ParametersBean(userParams, requestParameterToStringMap(requestParams));
String response = paramBean.getParametersXmlString();
out.write(response.getBytes(LocaleHelper.getSystemEncoding()));
out.flush();
}
use of org.pentaho.platform.api.repository2.unified.IUnifiedRepository in project pdi-platform-plugin by pentaho.
the class PdiAction method createJobMetaJCR.
private JobMeta createJobMetaJCR(Repository repository) throws ActionExecutionException {
JobMeta jobMeta = new JobMeta();
try {
IUnifiedRepository unifiedRepository = PentahoSystem.get(IUnifiedRepository.class, null);
RepositoryFile jobFile = unifiedRepository.getFile(idTopath(job));
jobMeta = repository.loadJob(new StringObjectId((String) jobFile.getId()), null);
} catch (Throwable e) {
throw new ActionExecutionException(org.pentaho.platform.plugin.kettle.messages.Messages.getInstance().getErrorString("PdiAction.ERROR_0006_FAILED_TRANSMETA_CREATION", directory, transformation), // $NON-NLS-1$
e);
}
if (arguments != null) {
jobMeta.setArguments(arguments);
}
if (logLevel != null) {
jobMeta.setLogLevel(LogLevel.getLogLevelForCode(logLevel));
}
populateInputs(jobMeta, jobMeta);
return jobMeta;
}
use of org.pentaho.platform.api.repository2.unified.IUnifiedRepository in project pdi-platform-plugin by pentaho.
the class PdiAction method createTransMetaJCR.
private TransMeta createTransMetaJCR(Repository repository) throws ActionExecutionException {
TransMeta transMeta = new TransMeta();
try {
IUnifiedRepository unifiedRepository = PentahoSystem.get(IUnifiedRepository.class, null);
RepositoryFile transFile = unifiedRepository.getFile(idTopath(transformation));
transMeta = repository.loadTransformation(new StringObjectId((String) transFile.getId()), null);
} catch (Throwable e) {
throw new ActionExecutionException(org.pentaho.platform.plugin.kettle.messages.Messages.getInstance().getErrorString("PdiAction.ERROR_0006_FAILED_TRANSMETA_CREATION", directory, transformation), // $NON-NLS-1$
e);
}
if (arguments != null) {
transMeta.setArguments(arguments);
}
if (logLevel != null) {
transMeta.setLogLevel(LogLevel.getLogLevelForCode(logLevel));
}
populateInputs(transMeta, transMeta);
return transMeta;
}
use of org.pentaho.platform.api.repository2.unified.IUnifiedRepository in project data-access by pentaho.
the class DatasourceResourceIT method createMetadataDomainRepository.
private static PentahoMetadataDomainRepository createMetadataDomainRepository() throws Exception {
IUnifiedRepository repository = new FileSystemBackedUnifiedRepository("target/test-classes/dsw");
mp.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));
PentahoMetadataDomainRepository pentahoMetadataDomainRepository = new PentahoMetadataDomainRepository(repository);
return pentahoMetadataDomainRepository;
}
use of org.pentaho.platform.api.repository2.unified.IUnifiedRepository in project data-access by pentaho.
the class DataAccessServiceTestBase method setUp.
@Before
public void setUp() throws Exception {
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);
userRoleListService = mock(IUserRoleListService.class);
platform.defineInstance(IUserRoleListService.class, userRoleListService);
pluginResourceLoader = mock(IPluginResourceLoader.class);
platform.defineInstance(IPluginResourceLoader.class, pluginResourceLoader);
mondrianCatalogService = mock(IMondrianCatalogService.class);
platform.defineInstance(IMondrianCatalogService.class, mondrianCatalogService);
final IUnifiedRepository unifiedRepository = new FileSystemBackedUnifiedRepository("target/test-classes/solution1");
platform.defineInstance(IUnifiedRepository.class, unifiedRepository);
platform.defineInstance(String.class, "admin");
config = new GeoContextPropertiesProvider(getGeoProps());
GeoContext geo = GeoContextFactory.create(config);
platform.start();
acl.setOwner("owner");
acl.setOwnerType(RepositoryFileSid.Type.USER.ordinal());
modelerService = new ModelerService();
datasourceService = mock(DSWDatasourceServiceImpl.class);
when(datasourceService.getGeoContext()).thenReturn(geo);
modelerService.setDatasourceService(datasourceService);
domain = getDomain();
}
Aggregations