本文整理了Java中net.roboconf.core.utils.Utils.writePropertiesFile()
方法的一些代码示例,展示了Utils.writePropertiesFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.writePropertiesFile()
方法的具体详情如下:
包路径:net.roboconf.core.utils.Utils
类名称:Utils
方法名:writePropertiesFile
[英]Writes Java properties into a file.
[中]将Java属性写入文件。
代码示例来源:origin: net.roboconf/roboconf-dm
private void writeProperties( Properties props, File file ) throws IOException {
if( props.isEmpty())
Utils.deleteFilesRecursivelyAndQuietly( file );
else
Utils.writePropertiesFile( props, file );
}
代码示例来源:origin: net.roboconf/roboconf-agent
/**
* Reconfigures the messaging.
* @param etcDir the KARAF_ETC directory
* @param msgData the messaging configuration parameters
*/
public void reconfigureMessaging( String etcDir, Map<String,String> msgData )
throws IOException {
String messagingType = msgData.get( MessagingConstants.MESSAGING_TYPE_PROPERTY );
Logger.getLogger( getClass().getName()).fine( "Messaging type for reconfiguration: " + messagingType );
if( ! Utils.isEmptyOrWhitespaces( etcDir )
&& ! Utils.isEmptyOrWhitespaces( messagingType )) {
// Write the messaging configuration
File f = new File( etcDir, "net.roboconf.messaging." + messagingType + ".cfg" );
Logger logger = Logger.getLogger( getClass().getName());
Properties props = Utils.readPropertiesFileQuietly( f, logger );
props.putAll( msgData );
props.remove( MessagingConstants.MESSAGING_TYPE_PROPERTY );
Utils.writePropertiesFile( props, f );
// Set the messaging type
f = new File( etcDir, Constants.KARAF_CFG_FILE_AGENT );
props = Utils.readPropertiesFileQuietly( f, Logger.getLogger( getClass().getName()));
if( messagingType != null ) {
props.put( Constants.MESSAGING_TYPE, messagingType );
Utils.writePropertiesFile( props, f );
}
}
}
代码示例来源: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: roboconf/roboconf-platform
Utils.writePropertiesFile( properties, f );
代码示例来源:origin: net.roboconf/roboconf-dm
Utils.writePropertiesFile( props, appBindingsFile );
代码示例来源:origin: net.roboconf/roboconf-dm-scheduler
Utils.writePropertiesFile( props, getJobFile( jobId ));
代码示例来源:origin: roboconf/roboconf-platform
/**
* Saves an application descriptor.
* @param f the file where the properties will be saved
* @param app an application (not null)
* @throws IOException if the file could not be written
*/
public static void save( File f, Application app ) throws IOException {
Properties properties = new Properties();
if( ! Utils.isEmptyOrWhitespaces( app.getDisplayName()))
properties.setProperty( APPLICATION_NAME, app.getDisplayName());
if( ! Utils.isEmptyOrWhitespaces( app.getDescription()))
properties.setProperty( APPLICATION_DESCRIPTION, app.getDescription());
if( app.getTemplate() != null ) {
if( ! Utils.isEmptyOrWhitespaces( app.getTemplate().getName()))
properties.setProperty( APPLICATION_TPL_NAME, app.getTemplate().getName());
if( ! Utils.isEmptyOrWhitespaces( app.getTemplate().getVersion()))
properties.setProperty( APPLICATION_TPL_VERSION, app.getTemplate().getVersion());
}
Utils.writePropertiesFile( properties, f );
}
}
代码示例来源:origin: roboconf/roboconf-platform
props.setProperty( ApplicationTemplateDescriptor.APPLICATION_DSL_ID, "roboconf-1.0" );
props.setProperty( ApplicationTemplateDescriptor.APPLICATION_GRAPH_EP, "main.graph" );
Utils.writePropertiesFile( props, new File( appDir, Constants.PROJECT_FILE_DESCRIPTOR ));
Utils.writePropertiesFile( props, new File( appDir, Constants.PROJECT_FILE_DESCRIPTOR ));
内容来源于网络,如有侵权,请联系作者删除!