net.roboconf.core.utils.Utils.readPropertiesFile()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(105)

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

Utils.readPropertiesFile介绍

[英]Reads properties from a file.
[中]从文件中读取属性。

代码示例

代码示例来源:origin: roboconf/roboconf-platform

/**
 * Loads an application descriptor.
 * @param f a file
 * @return an application descriptor (not null)
 * @throws IOException if the file could not be read
 */
public static ApplicationDescriptor load( File f ) throws IOException {
  Properties properties = Utils.readPropertiesFile( f );
  return load( properties );
}

代码示例来源:origin: roboconf/roboconf-platform

/**
 * Constructor.
 * @param propertiesFile
 */
public TargetValidator( File propertiesFile ) {
  try {
    this.props = Utils.readPropertiesFile( propertiesFile );
    this.fileName = propertiesFile.getName();
  } catch( Exception e ) {
    this.failed = true;
    Utils.logException( this.logger, e );
  }
}

代码示例来源:origin: roboconf/roboconf-platform

/**
 * Reads properties from a file but does not throw any error in case of problem.
 * @param file a properties file (can be null)
 * @param logger a logger (not null)
 * @return a {@link Properties} instance (never null)
 */
public static Properties readPropertiesFileQuietly( File file, Logger logger ) {
  Properties result = new Properties();
  try {
    if( file != null && file.exists())
      result = readPropertiesFile( file );
  } catch( Exception e ) {
    logger.severe( "Properties file " + file + " could not be read." );
    logException( logger, e );
  }
  return result;
}

代码示例来源:origin: net.roboconf/roboconf-agent

/**
 * Changes the level of the Roboconf logger.
 * <p>
 * This method assumes the default log configuration for a Roboconf
 * distribution has a certain shape. If a user manually changed the log
 * configuration (not the level, but the logger name, as an example), then
 * this will not work.
 * </p>
 */
public static void changeRoboconfLogLevel( String logLevel, String etcDir )
throws IOException {
  if( ! Utils.isEmptyOrWhitespaces( etcDir )) {
    File f = new File( etcDir, AgentConstants.KARAF_LOG_CONF_FILE );
    if( f.exists()) {
      Properties props = Utils.readPropertiesFile( f );
      props.put( "log4j.logger.net.roboconf", logLevel + ", roboconf" );
      Utils.writePropertiesFile( props, f );
    }
  }
}

代码示例来源:origin: net.roboconf/roboconf-plugin-puppet

return;
Properties props = Utils.readPropertiesFile( modulesFile );
for( Map.Entry<Object,Object> entry : props.entrySet()) {

代码示例来源:origin: net.roboconf/roboconf-dm

TargetWrapperDescriptor build( File targetDirectory ) {
  TargetWrapperDescriptor tb = null;
  File targetPropertiesFile = new File( targetDirectory, Constants.TARGET_PROPERTIES_FILE_NAME );
  try {
    Properties props = Utils.readPropertiesFile( targetPropertiesFile );
    tb = new TargetWrapperDescriptor();
    tb.setId( targetDirectory.getName());
    tb.setName( props.getProperty( Constants.TARGET_PROPERTY_NAME ));
    tb.setDescription( props.getProperty( Constants.TARGET_PROPERTY_DESCRIPTION ));
    String handler = TargetHelpers.findTargetHandlerName( props );
    tb.setHandler( handler );
  } catch( IOException e ) {
    this.logger.severe( "Properties of the target #" + targetDirectory.getName() + " could not be read." );
    Utils.logException( this.logger, e );
  }
  return tb;
}

代码示例来源:origin: net.roboconf/roboconf-agent

result = AgentProperties.readIaasProperties(Utils.readPropertiesFile(propertiesFile));

相关文章