本文整理了Java中org.apache.polygene.api.configuration.Configuration.refresh()
方法的一些代码示例,展示了Configuration.refresh()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.refresh()
方法的具体详情如下:
包路径:org.apache.polygene.api.configuration.Configuration
类名称:Configuration
方法名:refresh
[英]Updates the values of the managed user ConfigurationComposite instance from the underlying org.apache.polygene.spi.entitystore.EntityStore. Any modified values in the current user configuration that has not been saved, via #save() method, will be lost.
[中]从基础组织更新托管用户ConfigurationComposite实例的值。阿帕奇。多基因。spi。实体店。实体店。当前用户配置中任何未通过#save()方法保存的修改值都将丢失。
代码示例来源:origin: apache/attic-polygene-java
public void doSomething()
{
// Refresh Configuration before reading it.
config.refresh();
TravelPlanConfiguration tpConf = config.get();
// ...
}
// END SNIPPET: refresh
代码示例来源:origin: apache/attic-polygene-java
@Override
public String findPrefix( Class type )
{
Map<String, String> mapping = config.get().mapping().get();
String prefix = mapping.get( type.getName() );
if( prefix == null )
{
config.refresh();
mapping = config.get().mapping().get();
prefix = Integer.toString( mapping.size() + 1 );
mapping.put( type.getName(), prefix );
config.get().mapping().set( mapping );
config.save();
}
actualClasses.put( type.getName(), type );
return prefix;
}
代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.jmx
@Override
public Object invoke( String s, Object[] objects, String[] strings )
throws MBeanException, ReflectionException
{
if( s.equals( "restart" ) )
{
try
{
// Refresh and restart
if( serviceRef.isActive() )
{
// Refresh configuration
CompositeInstance compositeInstance = PolygeneAPI.FUNCTION_COMPOSITE_INSTANCE_OF
.apply( (Composite) serviceRef.get() );
compositeInstance.newProxy( Configuration.class ).refresh();
( (Activation) serviceRef ).passivate();
( (Activation) serviceRef ).activate();
}
return "Service restarted";
}
catch( Exception e )
{
return "Could not restart service:" + e.getMessage();
}
}
return "Unknown operation";
}
}
代码示例来源:origin: apache/attic-polygene-java
@Override
public Object invoke( String s, Object[] objects, String[] strings )
throws MBeanException, ReflectionException
{
if( s.equals( "restart" ) )
{
try
{
// Refresh and restart
if( serviceRef.isActive() )
{
// Refresh configuration
CompositeInstance compositeInstance = PolygeneAPI.FUNCTION_COMPOSITE_INSTANCE_OF
.apply( (Composite) serviceRef.get() );
compositeInstance.newProxy( Configuration.class ).refresh();
( (Activation) serviceRef ).passivate();
( (Activation) serviceRef ).activate();
}
return "Service restarted";
}
catch( Exception e )
{
return "Could not restart service:" + e.getMessage();
}
}
return "Unknown operation";
}
}
代码示例来源:origin: apache/attic-polygene-java
@Override
public void reindex()
{
configuration.refresh();
ReindexerConfiguration conf = configuration.get();
Integer loadValue = conf.loadValue().get();
if( loadValue == null )
{
loadValue = 50;
}
ReindexerHelper helper = new ReindexerHelper( loadValue );
helper.reindex( store );
}
代码示例来源:origin: apache/attic-polygene-java
@Override
public void contextInitialized( ServletContextEvent sce )
{
configuration.refresh();
ShiroIniConfiguration config = configuration.get();
String iniResourcePath = config.iniResourcePath().get() == null ? "classpath:shiro.ini" : config.iniResourcePath().get();
sce.getServletContext().setInitParameter( "shiroConfigLocations", iniResourcePath );
WebEnvironment env = initEnvironment( sce.getServletContext() );
if ( realmsRefs != null && realmsRefs.iterator().hasNext() ) {
// Register Realms Services
RealmSecurityManager realmSecurityManager = ( RealmSecurityManager ) env.getSecurityManager();
Collection<Realm> iniRealms = new ArrayList<Realm>( realmSecurityManager.getRealms() );
for ( ServiceReference<Realm> realmRef : realmsRefs ) {
iniRealms.add( realmRef.get() );
LOG.debug( "Realm Service '{}' registered!", realmRef.identity() );
}
realmSecurityManager.setRealms( iniRealms );
}
}
代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.shiro-web
@Override
public void contextInitialized( ServletContextEvent sce )
{
configuration.refresh();
ShiroIniConfiguration config = configuration.get();
String iniResourcePath = config.iniResourcePath().get() == null ? "classpath:shiro.ini" : config.iniResourcePath().get();
sce.getServletContext().setInitParameter( "shiroConfigLocations", iniResourcePath );
WebEnvironment env = initEnvironment( sce.getServletContext() );
if ( realmsRefs != null && realmsRefs.iterator().hasNext() ) {
// Register Realms Services
RealmSecurityManager realmSecurityManager = ( RealmSecurityManager ) env.getSecurityManager();
Collection<Realm> iniRealms = new ArrayList<Realm>( realmSecurityManager.getRealms() );
for ( ServiceReference<Realm> realmRef : realmsRefs ) {
iniRealms.add( realmRef.get() );
LOG.debug( "Realm Service '{}' registered!", realmRef.identity() );
}
realmSecurityManager.setRealms( iniRealms );
}
}
代码示例来源:origin: apache/attic-polygene-java
@Override
protected void activateElasticSearch()
throws Exception
{
configuration.refresh();
ElasticSearchIndexingConfiguration config = configuration.get();
String clusterName = config.clusterName().get() == null ? DEFAULT_CLUSTER_NAME : config.clusterName().get();
index = config.index().get() == null ? DEFAULT_INDEX_NAME : config.index().get();
indexNonAggregatedAssociations = config.indexNonAggregatedAssociations().get();
Identity identity = hasIdentity.identity().get();
File homeDir = new File( new File( fileConfig.temporaryDirectory(), identity.toString() ), "home" );
File logsDir = new File( fileConfig.logDirectory(), identity.toString() );
File dataDir = new File( fileConfig.dataDirectory(), identity.toString() );
File confDir = new File( fileConfig.configurationDirectory(), identity.toString() );
Stream.of( homeDir, logsDir, dataDir, confDir ).forEach( File::mkdirs );
Settings settings = Settings.builder()
.put( "cluster.name", clusterName )
.put( "path.home", homeDir.getAbsolutePath() )
.put( "path.logs", logsDir.getAbsolutePath() )
.put( "path.data", dataDir.getAbsolutePath() )
.put( "path.conf", confDir.getAbsolutePath() )
.put( "transport.type", "local" )
.put( "http.enabled", false )
.build();
node = new Node( settings );
node.start();
client = node.client();
}
代码示例来源:origin: apache/attic-polygene-java
@Override
public Liquibase newConnectedLiquibase() throws SQLException, LiquibaseException
{
config.refresh();
DatabaseConnection dbConnection = new JdbcConnection( dataSource.get().getConnection() );
return new Liquibase( config.get().changeLog().get(),
new ClassLoaderResourceAccessor(),
dbConnection );
}
代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.sql-liquibase
@Override
public Liquibase newConnectedLiquibase() throws SQLException, LiquibaseException
{
config.refresh();
DatabaseConnection dbConnection = new JdbcConnection( dataSource.get().getConnection() );
return new Liquibase( config.get().changeLog().get(),
new ClassLoaderResourceAccessor(),
dbConnection );
}
代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.shiro-core
@Override
public void activateService()
throws Exception
{
configuration.refresh();
ShiroIniConfiguration config = configuration.get();
String iniResourcePath = config.iniResourcePath().get() == null
? Shiro.DEFAULT_INI_RESOURCE_PATH
: config.iniResourcePath().get();
setIni( Ini.fromResourcePath( iniResourcePath ) );
securityManager = getInstance();
if ( realmsRefs != null && realmsRefs.iterator().hasNext() ) {
// Register Realms Services
RealmSecurityManager realmSecurityManager = ( RealmSecurityManager ) securityManager;
Collection<Realm> iniRealms = new ArrayList<>( realmSecurityManager.getRealms() );
for ( ServiceReference<Realm> realmRef : realmsRefs ) {
iniRealms.add( realmRef.get() );
LOG.debug( "Realm Service '{}' registered!", realmRef.identity() );
}
realmSecurityManager.setRealms( iniRealms );
}
ThreadContext.bind( securityManager );
}
代码示例来源:origin: apache/attic-polygene-java
@Override
public void activateService()
throws Exception
{
configuration.refresh();
ShiroIniConfiguration config = configuration.get();
String iniResourcePath = config.iniResourcePath().get() == null
? Shiro.DEFAULT_INI_RESOURCE_PATH
: config.iniResourcePath().get();
setIni( Ini.fromResourcePath( iniResourcePath ) );
securityManager = getInstance();
if ( realmsRefs != null && realmsRefs.iterator().hasNext() ) {
// Register Realms Services
RealmSecurityManager realmSecurityManager = ( RealmSecurityManager ) securityManager;
Collection<Realm> iniRealms = new ArrayList<>( realmSecurityManager.getRealms() );
for ( ServiceReference<Realm> realmRef : realmsRefs ) {
iniRealms.add( realmRef.get() );
LOG.debug( "Realm Service '{}' registered!", realmRef.identity() );
}
realmSecurityManager.setRealms( iniRealms );
}
ThreadContext.bind( securityManager );
}
代码示例来源:origin: apache/attic-polygene-java
@Override
public void activateService()
throws Exception
{
config.refresh();
GeodeEntityStoreConfiguration configuration = config.get();
switch( configuration.topology().get() )
{
case EMBEDDED:
activateEmbedded( configuration );
break;
case CLIENT_SERVER:
activateClientServer( configuration );
break;
default:
throw new IllegalStateException( "Invalid/Unsupported Geode Topology: "
+ configuration.topology().get() );
}
}
代码示例来源:origin: apache/attic-polygene-java
@Override
protected void activateElasticSearch() throws Exception
{
configuration.refresh();
ElasticSearchIndexingConfiguration config = configuration.get();
index = config.index().get() == null ? DEFAULT_INDEX_NAME : config.index().get();
indexNonAggregatedAssociations = config.indexNonAggregatedAssociations().get();
client = descriptor.metaInfo( Client.class );
}
代码示例来源:origin: apache/attic-polygene-java
@Override
public void activateService()
throws Exception
{
configuration.refresh();
RedisEntityStoreConfiguration config = configuration.get();
String host = config.host().get() == null ? DEFAULT_HOST : config.host().get();
int port = config.port().get() == null ? Protocol.DEFAULT_PORT : config.port().get();
int timeout = config.timeout().get() == null ? Protocol.DEFAULT_TIMEOUT : config.timeout().get();
String password = config.password().get();
int database = config.database().get() == null ? Protocol.DEFAULT_DATABASE : config.database().get();
pool = new JedisPool( new JedisPoolConfig(), host, port, timeout, password, database );
}
代码示例来源:origin: apache/attic-polygene-java
@Override
public void activateService()
throws Exception
{
configuration.refresh();
PasswordRealmConfiguration config = configuration.get();
String algorithm = config.hashAlgorithmName().get();
Integer iterations = config.hashIterationsCount().get();
if( algorithm != null || iterations != null )
{
DefaultHashService hashService = (DefaultHashService) passwordService.getHashService();
if( algorithm != null )
{
hashService.setHashAlgorithmName( algorithm );
}
if( iterations != null )
{
hashService.setHashIterations( iterations );
}
}
}
代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.shiro-core
@Override
public void activateService()
throws Exception
{
configuration.refresh();
PasswordRealmConfiguration config = configuration.get();
String algorithm = config.hashAlgorithmName().get();
Integer iterations = config.hashIterationsCount().get();
if( algorithm != null || iterations != null )
{
DefaultHashService hashService = (DefaultHashService) passwordService.getHashService();
if( algorithm != null )
{
hashService.setHashAlgorithmName( algorithm );
}
if( iterations != null )
{
hashService.setHashIterations( iterations );
}
}
}
代码示例来源:origin: apache/attic-polygene-java
@Override
public void startServer()
throws Exception
{
configuration.refresh();
component = new Component();
component.getServers().add( Protocol.HTTP, configuration.get().port().get() );
RestApplication application = module.newObject( RestApplication.class, component.getContext() );
component.getDefaultHost().attach( application );
component.start();
}
代码示例来源:origin: apache/attic-polygene-java
@Override
public void sendMail( @Email String to, @MinLength( 8 ) String subject, String body )
{
config.refresh();
MailServiceConfiguration conf = config.get();
String hostName = conf.hostName().get();
int port = conf.port().get();
// END SNIPPET: read
// START SNIPPET: read
}
// END SNIPPET: read
代码示例来源:origin: apache/attic-polygene-java
@Override
public void activateService() throws Exception
configuration.refresh();
SQLEntityStoreConfiguration config = configuration.get();
内容来源于网络,如有侵权,请联系作者删除!