本文整理汇总了Java中org.pentaho.platform.engine.core.system.PentahoSystem类的典型用法代码示例。如果您正苦于以下问题:Java PentahoSystem类的具体用法?Java PentahoSystem怎么用?Java PentahoSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PentahoSystem类属于org.pentaho.platform.engine.core.system包,在下文中一共展示了PentahoSystem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initUserRoleListService
import org.pentaho.platform.engine.core.system.PentahoSystem; //导入依赖的package包/类
protected void initUserRoleListService() {
//If SAML is selected, default to the native user role list service
if( getSelectedAuthorizationProvider().equals( getSamlId() ) ) {
setService( getSamlUserRoleListService() );
return;
}
Map<String, String> props = new HashMap<>();
props.put( PROVIDER_NAME, getSelectedAuthorizationProvider() );
IUserRoleListService userRoleListService;
if ( ( userRoleListService = PentahoSystem.get( IUserRoleListService.class, null, props ) ) != null ) {
setService( userRoleListService );
} else {
logger.error( "No IUserRoleListService found for providerName '" + getSelectedAuthorizationProvider() + "'" );
}
}
开发者ID:pentaho,项目名称:pentaho-engineering-samples,代码行数:22,代码来源:PentahoSamlUserRoleListService.java
示例2: testCreateProxy
import org.pentaho.platform.engine.core.system.PentahoSystem; //导入依赖的package包/类
@Test
public void testCreateProxy() throws Exception {
ProxyFactoryImpl proxyFactory = new ProxyFactoryImpl( null );
IProxyCreator<String> creator = mock( IProxyCreator.class );
when( creator.supports( String.class )).thenReturn( true );
String target = "Hello World";
when( creator.create( target ) ).thenReturn( "Good Night" );
proxyFactory.setCreators( Collections.<IProxyCreator<?>>singletonList( creator ) );
IProxyRegistration proxy = proxyFactory
.createAndRegisterProxy( target, Collections.<Class<?>>singletonList( CharSequence.class ),
Collections.<String, Object>singletonMap( "key", "master" ) );
assertNotNull( proxy );
CharSequence registeredString = PentahoSystem.get( CharSequence.class, null, Collections.singletonMap( "key", "master" ) );
assertEquals( "Good Night", registeredString );
// Test plain create
String plainProxy = proxyFactory.createProxy( target );
assertNotNull( proxy );
assertEquals( "Good Night", plainProxy );
}
开发者ID:pentaho,项目名称:pentaho-osgi-bundles,代码行数:25,代码来源:ProxyFactoryImplTest.java
示例3: getNamedDataSourceFromService
import org.pentaho.platform.engine.core.system.PentahoSystem; //导入依赖的package包/类
protected <T extends IDBDatasourceService> DataSource getNamedDataSourceFromService(
Class<T> dataSourceServiceInterface, String dataSourceName ) throws DataSourceNamingException {
T datasourceService = PentahoSystem.get( dataSourceServiceInterface, null );
IDBDatasourceService service =
( datasourceService == null ) ? PentahoSystem.get( IDBDatasourceService.class, null ) : datasourceService;
if ( service != null ) {
try {
return service.getDataSource( dataSourceName );
} catch ( DBDatasourceServiceException ex ) {
throw new DataSourceNamingException( ex );
}
}
return null;
}
开发者ID:pentaho,项目名称:pdi-platform-plugin,代码行数:17,代码来源:PlatformKettleDataSourceProvider.java
示例4: createTransMetaJCR
import org.pentaho.platform.engine.core.system.PentahoSystem; //导入依赖的package包/类
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 ), e ); //$NON-NLS-1$
}
if ( arguments != null ) {
transMeta.setArguments( arguments );
}
if ( logLevel != null ) {
transMeta.setLogLevel( LogLevel.getLogLevelForCode( logLevel ) );
}
populateInputs( transMeta, transMeta );
return transMeta;
}
开发者ID:pentaho,项目名称:pdi-platform-plugin,代码行数:23,代码来源:PdiAction.java
示例5: createJobMetaJCR
import org.pentaho.platform.engine.core.system.PentahoSystem; //导入依赖的package包/类
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 ), e ); //$NON-NLS-1$
}
if ( arguments != null ) {
jobMeta.setArguments( arguments );
}
if ( logLevel != null ) {
jobMeta.setLogLevel( LogLevel.getLogLevelForCode( logLevel ) );
}
populateInputs( jobMeta, jobMeta );
return jobMeta;
}
开发者ID:pentaho,项目名称:pdi-platform-plugin,代码行数:23,代码来源:PdiAction.java
示例6: createContent
import org.pentaho.platform.engine.core.system.PentahoSystem; //导入依赖的package包/类
@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();
}
开发者ID:pentaho,项目名称:pdi-platform-plugin,代码行数:20,代码来源:ParameterUIContentGenerator.java
示例7: connect
import org.pentaho.platform.engine.core.system.PentahoSystem; //导入依赖的package包/类
@Override
public Repository connect( String repositoryName ) throws KettleException {
IPentahoSession session = PentahoSessionHolder.getSession();
if ( session == null ) {
logger.debug( "No active Pentaho Session, attempting to load PDI repository unauthenticated." );
throw new KettleException( "Attempting to create PDI Repository with no Active PentahoSession. "
+ "This is not allowed." );
}
ICacheManager cacheManager = PentahoSystem.getCacheManager( session );
String sessionName = session.getName();
Repository repository = (Repository) cacheManager.getFromRegionCache( REGION, sessionName );
if ( repository == null ) {
logger.debug( "Repository not cached for user: " + sessionName + ". Creating new Repository." );
repository = delegate.connect( repositoryName );
if ( !cacheManager.cacheEnabled( REGION ) ) {
cacheManager.addCacheRegion( REGION );
}
cacheManager.putInRegionCache( REGION, sessionName, repository );
} else {
logger.debug( "Repository was cached for user: " + sessionName );
}
return repository;
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:26,代码来源:IRepositoryFactory.java
示例8: testCachingFactoryConnect
import org.pentaho.platform.engine.core.system.PentahoSystem; //导入依赖的package包/类
@Test
public void testCachingFactoryConnect() throws Exception {
ICacheManager cacheManager = mock( ICacheManager.class );
PentahoSystem.registerObject( cacheManager );
IPentahoSession session = new StandaloneSession( "joe" );
PentahoSessionHolder.setSession( session );
// Delegate is just a mock. connect will be a cache miss
IRepositoryFactory mockFactory = mock( IRepositoryFactory.class );
IRepositoryFactory.CachingRepositoryFactory cachingRepositoryFactory =
new IRepositoryFactory.CachingRepositoryFactory( mockFactory );
cachingRepositoryFactory.connect( "foo" );
verify( mockFactory, times( 1 ) ).connect( "foo" );
// Test with Cache Hit
Repository mockRepository = mock( Repository.class );
when( cacheManager.cacheEnabled( IRepositoryFactory.CachingRepositoryFactory.REGION ) ).thenReturn( true );
when( cacheManager.getFromRegionCache( IRepositoryFactory.CachingRepositoryFactory.REGION, "joe" ) ).thenReturn(
mockRepository );
Repository repo = cachingRepositoryFactory.connect( "foo" );
assertThat( repo, sameInstance( mockRepository ) );
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:26,代码来源:RepositoryFactoryTest.java
示例9: clearMondrianCache
import org.pentaho.platform.engine.core.system.PentahoSystem; //导入依赖的package包/类
private boolean clearMondrianCache() {
try {
// @see org.pentaho.platform.web.http.api.resources.SystemRefreshResource.flushMondrianSchemaCache();
IPentahoSession session = PentahoSessionHolder.getSession();
// Flush the catalog helper (legacy)
IMondrianCatalogService
mondrianCatalogService =
PentahoSystem.get( IMondrianCatalogService.class, "IMondrianCatalogService", session ); //$NON-NLS-1$
mondrianCatalogService.reInit( session );
// Flush the IOlapService
IOlapService olapService = PentahoSystem.get( IOlapService.class, IOlapService.class.getSimpleName(), session );
olapService.flushAll( session );
} catch ( Throwable t ) {
logger.error( t.getMessage(), t );
/* Do nothing.
* <p/>
* This is a simple 'nice-to-have' feature, where we actually clear mondrian cache after the user
* makes a successful mondrian file change, so that he can immediately see its changes applied.
* <p/>
* In some off-chance this doesn't work, user can always do it via PUC > Tools > Refresh > Mondrian Cache.
*/
}
return true;
}
开发者ID:webdetails,项目名称:cte,代码行数:31,代码来源:MondrianSchemaProvider.java
示例10: getSystemRoles
import org.pentaho.platform.engine.core.system.PentahoSystem; //导入依赖的package包/类
@Override
public List<String> getSystemRoles() {
if ( systemRoles == null ) {
systemRoles = PentahoSystem.get( ArrayList.class, "singleTenantSystemAuthorities", null );
}
return systemRoles;
}
开发者ID:pentaho,项目名称:pentaho-engineering-samples,代码行数:8,代码来源:PentahoSamlNativeUserRoleListService.java
示例11: getDefaultRole
import org.pentaho.platform.engine.core.system.PentahoSystem; //导入依赖的package包/类
public static GrantedAuthority getDefaultRole() {
if ( defaultRole == null ) {
String defaultRoleAsString = PentahoSystem.get( String.class, "defaultRole", null );
if ( defaultRoleAsString != null && defaultRoleAsString.length() > 0 ) {
defaultRole = new SimpleGrantedAuthority( defaultRoleAsString );
}
}
return defaultRole;
}
开发者ID:pentaho,项目名称:pentaho-engineering-samples,代码行数:10,代码来源:Utils.java
示例12: KarafFeatureWatcherImpl
import org.pentaho.platform.engine.core.system.PentahoSystem; //导入依赖的package包/类
public KarafFeatureWatcherImpl( BundleContext bundleContext ) {
this.bundleContext = bundleContext;
// Default timeout of 2 minutes can be overridden in server.properties
timeout =
PentahoSystem.getApplicationContext().getProperty( KARAF_TIMEOUT_PROPERTY ) == null ? 2 * 60 * 1000L : Long
.valueOf( PentahoSystem.getApplicationContext().getProperty( KARAF_TIMEOUT_PROPERTY ) );
}
开发者ID:pentaho,项目名称:pentaho-osgi-bundles,代码行数:9,代码来源:KarafFeatureWatcherImpl.java
示例13: KarafBlueprintWatcherImpl
import org.pentaho.platform.engine.core.system.PentahoSystem; //导入依赖的package包/类
public KarafBlueprintWatcherImpl( BundleContext bundleContext ) {
this.bundleContext = bundleContext;
// Default timeout of 2 minutes can be overridden in server.properties
timeout =
PentahoSystem.getApplicationContext().getProperty( KARAF_TIMEOUT_PROPERTY ) == null ? 2 * 60 * 1000L : Long
.valueOf( PentahoSystem.getApplicationContext().getProperty( KARAF_TIMEOUT_PROPERTY ) );
}
开发者ID:pentaho,项目名称:pentaho-osgi-bundles,代码行数:9,代码来源:KarafBlueprintWatcherImpl.java
示例14: testStart
import org.pentaho.platform.engine.core.system.PentahoSystem; //导入依赖的package包/类
@Test
@SuppressWarnings( "unchecked" )
public void testStart() throws Exception {
BundleContext bundleContext = mock( BundleContext.class );
ServiceReference<ConfigurationAdmin> adminRef = (ServiceReference<ConfigurationAdmin>) mock( ServiceReference.class);
when( bundleContext.getServiceReference( ConfigurationAdmin.class )).thenReturn( adminRef );
ConfigurationAdmin configurationAdmin = mock(ConfigurationAdmin.class);
when( bundleContext.getService( adminRef )).thenReturn( configurationAdmin );
Configuration config = mock( Configuration.class );
when(configurationAdmin.getConfiguration( "org.pentaho.requirejs", null )).thenReturn( config );
IApplicationContext applicationContext = mock(IApplicationContext.class);
PentahoSystem.init(applicationContext);
when(applicationContext.getFullyQualifiedServerURL()).thenReturn("http://localhost:8080/pentaho");
when(applicationContext.getContext()).thenReturn( mock( ServletContext.class ) );
ArgumentCaptor<Dictionary> params = ArgumentCaptor.forClass( Dictionary.class );
PentahoOSGIActivator activator = new PentahoOSGIActivator();
activator.start( bundleContext );
verify( config, times( 1 ) ).update( params.capture() );
assertEquals("/pentaho/osgi/", params.getValue().get( "context.root" ));
reset(config);
when(applicationContext.getFullyQualifiedServerURL()).thenReturn("http://localhost:8080/");
activator.start( bundleContext );
verify( config, times( 1 ) ).update( params.capture() );
assertEquals("/osgi/", params.getValue().get( "context.root" ));
activator.stop( bundleContext );
}
开发者ID:pentaho,项目名称:pentaho-osgi-bundles,代码行数:38,代码来源:PentahoOSGIActivatorTest.java
示例15: createAndRegisterProxy
import org.pentaho.platform.engine.core.system.PentahoSystem; //导入依赖的package包/类
@Override
@SuppressWarnings( "unchecked" )
public <T, K> IProxyRegistration createAndRegisterProxy( T target, List<Class<?>> publishedClasses,
Map<String, Object> properties )
throws ProxyException {
publishedClasses = new ArrayList<>( publishedClasses );
K proxyWrapper = createProxy( target );
Class<K> proxyWrapperClass = (Class<K>) proxyWrapper.getClass();
Class parent = proxyWrapperClass;
while ( parent != null ) {
publishedClasses.add( parent );
parent = parent.getSuperclass();
}
for ( Class<?> aClass : proxyWrapperClass.getInterfaces() ) {
publishedClasses.add( aClass );
}
IPentahoObjectReference reference =
new SingletonPentahoObjectReference.Builder<K>( proxyWrapperClass ).object( proxyWrapper )
.attributes( properties ).build();
IPentahoObjectRegistration iPentahoObjectRegistration = PentahoSystem
.registerReference( reference, publishedClasses.toArray( new Class<?>[ publishedClasses.size() ] ) );
return new ProxyRegistration( iPentahoObjectRegistration, proxyWrapper );
}
开发者ID:pentaho,项目名称:pentaho-osgi-bundles,代码行数:30,代码来源:ProxyFactoryImpl.java
示例16: testProxyRegistration
import org.pentaho.platform.engine.core.system.PentahoSystem; //导入依赖的package包/类
@Test
public void testProxyRegistration() throws ProxyException {
ProxyFactoryImpl proxyFactory = new ProxyFactoryImpl( null );
IProxyCreator<String> creator = mock( IProxyCreator.class );
when( creator.supports( String.class )).thenReturn( true );
String target = "Hello World";
when( creator.create( target ) ).thenReturn( "Good Night" );
proxyFactory.setCreators( Collections.<IProxyCreator<?>>singletonList( creator ) );
IProxyRegistration proxy = proxyFactory
.createAndRegisterProxy( target, Collections.<Class<?>>singletonList( CharSequence.class ),
Collections.<String, Object>singletonMap( "key", "master" ) );
assertNotNull( proxy );
assertEquals( "Good Night", proxy.getProxyObject() );
// Found in PentahoSystem
CharSequence registeredString = PentahoSystem.get( CharSequence.class, null,
Collections.singletonMap( "key", "master" ) );
assertEquals( "Good Night", registeredString );
// De-register then make sure removed from PentahoSystem.
proxy.getPentahoObjectRegistration().remove();
registeredString = PentahoSystem.get( CharSequence.class, null,
Collections.singletonMap( "key", "master" ) );
assertNull( registeredString );
}
开发者ID:pentaho,项目名称:pentaho-osgi-bundles,代码行数:29,代码来源:ProxyFactoryImplTest.java
示例17: get
import org.pentaho.platform.engine.core.system.PentahoSystem; //导入依赖的package包/类
public static Object get(IPentahoSession session, String key) {
Object value = null;
ICacheManager manager = PentahoSystem.getCacheManager(session);
if (manager != null) {
value = manager.getFromSessionCache(session, key);
}
return value;
}
开发者ID:inquidia,项目名称:KettleDynamicSchemaProcessor,代码行数:12,代码来源:CacheUtils.java
示例18: remove
import org.pentaho.platform.engine.core.system.PentahoSystem; //导入依赖的package包/类
public static void remove(IPentahoSession session, String key) {
ICacheManager manager = PentahoSystem.getCacheManager(session);
if (manager != null) {
manager.removeFromSessionCache(session, key);
}
}
开发者ID:inquidia,项目名称:KettleDynamicSchemaProcessor,代码行数:9,代码来源:CacheUtils.java
示例19: getOutputStream
import org.pentaho.platform.engine.core.system.PentahoSystem; //导入依赖的package包/类
protected OutputStream getOutputStream(String mimeType) throws Exception {
if (outputHandler == null) {
throw new Exception("No output handler");
}
IContentItem contentItem = outputHandler.getOutputContentItem("response", "content", instanceId, mimeType);
if (contentItem == null) {
throw new Exception("No content item");
}
OutputStream outputStream = contentItem.getOutputStream(null);
if (outputStream == null || !PentahoSystem.getInitializedOK() ) {
throw new Exception("No output stream"); //$NON-NLS-1$
}
return outputStream;
}
开发者ID:rpbouman,项目名称:pedis,代码行数:15,代码来源:PedisContentGenerator.java
示例20: init
import org.pentaho.platform.engine.core.system.PentahoSystem; //导入依赖的package包/类
/**
* Called just prior to the plugin being registered
* with the platform. Note: This event does *not*
* precede the detection of the plugin by any {@link IPluginProvider}s
* @throws PluginLifecycleException if an error occurred
*/
public void init() throws PluginLifecycleException {
try {
PedisLifecycleListener.instance = this;
resourceLoader = PentahoSystem.get(IPluginResourceLoader.class, null);
initPluginDir();
initPermissions();
defaultContentType = getPluginSetting(DEFAULT_CONTENT_TYPE_SETTINGS, defaultContentType);
debugEnabled = getPluginSetting(DEBUG_ENABLED_SETTINGS, debugEnabled);
} catch (Exception exception) {
throw new PluginLifecycleException("An error occurred while loading the plugin.", exception);
}
}
开发者ID:rpbouman,项目名称:pedis,代码行数:19,代码来源:PedisLifecycleListener.java
注:本文中的org.pentaho.platform.engine.core.system.PentahoSystem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论