org.apache.polygene.api.configuration.Configuration.get()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中org.apache.polygene.api.configuration.Configuration.get()方法的一些代码示例,展示了Configuration.get()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.get()方法的具体详情如下:
包路径:org.apache.polygene.api.configuration.Configuration
类名称:Configuration
方法名:get

Configuration.get介绍

[英]Retrieves the user configuration instance managed by this Configuration.

Even if the user configuration is initialized from properties file, the consistency rules of Polygene composites still applies. If the the properties file is missing a value, then the initialization will fail with a RuntimeException. If Constraints has been defined, those will need to be satisfied as well. The user configuration instance returned will fulfill the constraints and consistency normal to all composites, and can therefor safely be used with additional checks.
[中]检索由此配置管理的用户配置实例。
即使用户配置是从属性文件初始化的,Polygene composites的一致性规则仍然适用。如果属性文件缺少值,则初始化将失败,并出现RuntimeException。如果已经定义了约束,那么也需要满足这些约束。返回的用户配置实例将满足所有组合的常规约束和一致性,因此可以安全地与其他检查一起使用。

代码示例

代码示例来源:origin: apache/attic-polygene-java

@Override
protected JettyConfiguration configuration()
{
  return configuration.get();
}

代码示例来源:origin: apache/attic-polygene-java

public String tableName()
{
  CassandraEntityStoreConfiguration config = configuration.get();
  String tableName = config.entityTableName().get();
  if( tableName == null || tableName.isEmpty() )
  {
    tableName = CassandraEntityStoreService.DEFAULT_TABLE_NAME;
  }
  return tableName;
}

代码示例来源:origin: org.apache.polygene.extensions/org.apache.polygene.extension.entitystore-jdbm

private Properties getProperties()
{
  JdbmEntityStoreConfiguration config = this.config.get();
  Properties properties = new Properties();
  properties.put( RecordManagerOptions.AUTO_COMMIT, config.autoCommit().get().toString() );
  properties.put( RecordManagerOptions.DISABLE_TRANSACTIONS, config.disableTransactions().get().toString() );
  return properties;
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Override
  public String name()
  {
    return config.get().name().get();
  }
}

代码示例来源:origin: apache/attic-polygene-java

@Override
  public String name()
  {
    return config.get().name().get();
  }
}

代码示例来源:origin: apache/attic-polygene-java

@Override
public int debugLevel()
{
  return configuration.get().debugLevel().get();
}

代码示例来源:origin: apache/attic-polygene-java

private void foo()
  {
    TravelPlanConfiguration tpConf = config.get();
    String hostName = tpConf.hostName().get();
    // ...
  }
// END SNIPPET: mixin

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Override
public Integer hostPort()
{
  return config.get().host().get().port().get();
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport

@Override
public String hostIp()
{
  return config.get().host().get().ip().get();
}

代码示例来源:origin: apache/attic-polygene-java

@Override
public String osName()
{
  return config.get().osName().get();
}

代码示例来源:origin: apache/attic-polygene-java

@Override
public String home()
{
  return config.get().home().get();
}

代码示例来源:origin: apache/attic-polygene-java

@Override
public String path()
{
  return config.get().path().get();
}

代码示例来源:origin: apache/attic-polygene-java

@SuppressWarnings( "unchecked" )
  public boolean isAvailable()
  {
    // Check Enabled in configuration first
    if( hasEnabledConfiguration && !( (Configuration<Enabled>) proxy() ).get().enabled().get() )
    {
      return false;
    }

    // Ask service if it's available
    return !implementsServiceAvailable || ( (Availability) proxy() ).isAvailable();
  }
}

代码示例来源: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: apache/attic-polygene-java

@Override
  public void test()
  {
    assertThat( config.get().constrained().get(), equalTo( "constrained" ) );
  }
}

代码示例来源: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 changeExternalMailService( String hostName, int port )
{
  MailServiceConfiguration conf = config.get();
  conf.hostName().set( hostName );
  conf.port().set( port );
  config.save();
}
// START SNIPPET: write

代码示例来源:origin: apache/attic-polygene-java

@Override
public void initialize()
  throws RepositoryException
{
  RdbmsRepositoryConfiguration conf = configuration.get();
  String jdbcDriver = conf.jdbcDriver().get();
  String jdbcUrl = conf.jdbcUrl().get();
  String user = conf.user().get();
  String password = conf.password().get();
  repo = new SailRepository( new RdbmsStore( jdbcDriver, jdbcUrl, user, password ) );
  repo.initialize();
}

代码示例来源: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

相关文章