Search in sources :

Example 96 with IUnifiedRepository

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();
}
Also used : IParameterProvider(org.pentaho.platform.api.engine.IParameterProvider) IPdiContentProvider(org.pentaho.platform.api.util.IPdiContentProvider) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository)

Example 97 with IUnifiedRepository

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;
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) ActionExecutionException(org.pentaho.platform.api.engine.ActionExecutionException) StringObjectId(org.pentaho.di.repository.StringObjectId) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository)

Example 98 with IUnifiedRepository

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;
}
Also used : TransMeta(org.pentaho.di.trans.TransMeta) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) ActionExecutionException(org.pentaho.platform.api.engine.ActionExecutionException) StringObjectId(org.pentaho.di.repository.StringObjectId) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository)

Example 99 with IUnifiedRepository

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;
}
Also used : RepositoryUtils(org.pentaho.platform.repository2.unified.RepositoryUtils) PentahoMetadataDomainRepository(org.pentaho.platform.plugin.services.metadata.PentahoMetadataDomainRepository) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository) FileSystemBackedUnifiedRepository(org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository)

Example 100 with IUnifiedRepository

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();
}
Also used : IAuthorizationPolicy(org.pentaho.platform.api.engine.IAuthorizationPolicy) GeoContextPropertiesProvider(org.pentaho.agilebi.modeler.geo.GeoContextPropertiesProvider) IMetadataDomainRepository(org.pentaho.metadata.repository.IMetadataDomainRepository) IMondrianCatalogService(org.pentaho.platform.plugin.action.mondrian.catalog.IMondrianCatalogService) IPluginResourceLoader(org.pentaho.platform.api.engine.IPluginResourceLoader) GeoContext(org.pentaho.agilebi.modeler.geo.GeoContext) IAclAwareMondrianCatalogService(org.pentaho.platform.plugin.action.mondrian.catalog.IAclAwareMondrianCatalogService) MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) IPlatformImporter(org.pentaho.platform.plugin.services.importer.IPlatformImporter) IUserRoleListService(org.pentaho.platform.api.engine.IUserRoleListService) IUnifiedRepository(org.pentaho.platform.api.repository2.unified.IUnifiedRepository) FileSystemBackedUnifiedRepository(org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository) Before(org.junit.Before)

Aggregations

IUnifiedRepository (org.pentaho.platform.api.repository2.unified.IUnifiedRepository)88 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)61 Test (org.junit.Test)51 Matchers.anyString (org.mockito.Matchers.anyString)37 ArrayList (java.util.ArrayList)18 List (java.util.List)10 StringObjectId (org.pentaho.di.repository.StringObjectId)10 Serializable (java.io.Serializable)9 DatabaseDialectService (org.pentaho.database.service.DatabaseDialectService)7 RepositoryFileTree (org.pentaho.platform.api.repository2.unified.RepositoryFileTree)7 DataNode (org.pentaho.platform.api.repository2.unified.data.node.DataNode)7 InputStream (java.io.InputStream)6 JobMeta (org.pentaho.di.job.JobMeta)6 SimpleRepositoryFileData (org.pentaho.platform.api.repository2.unified.data.simple.SimpleRepositoryFileData)6 FileSystemBackedUnifiedRepository (org.pentaho.platform.repository2.unified.fs.FileSystemBackedUnifiedRepository)6 HashMap (java.util.HashMap)5 ObjectId (org.pentaho.di.repository.ObjectId)5 IDatasourceMgmtService (org.pentaho.platform.api.repository.datasource.IDatasourceMgmtService)5 Properties (java.util.Properties)4 Log (org.apache.commons.logging.Log)4