Example usage for org.apache.commons.configuration PropertiesConfiguration save

List of usage examples for org.apache.commons.configuration PropertiesConfiguration save

Introduction

In this page you can find the example usage for org.apache.commons.configuration PropertiesConfiguration save.

Prototype

public void save() throws ConfigurationException 

Source Link

Document

Save the configuration.

Usage

From source file:org.springframework.data.hadoop.admin.cli.commands.PropertyUtil.java

/**
 * set Spring Hadoop Admin service URL//from   w ww  .  j a v  a  2 s  . c  o m
 * 
 * @param targetUrl service URL
 * @throws ConfigurationException
 */
public static void setTargetUrl(String targetUrl) throws ConfigurationException {
    PropertiesConfiguration config = new PropertiesConfiguration(adminPropertyFileName);
    config.setProperty("targetUrl", targetUrl);
    config.save();
}

From source file:org.springframework.data.hadoop.admin.cli.commands.PropertyUtil.java

/**
 * set HDFS URL/*w w w.j  av a  2s  .  c om*/
 * 
 * @param dfsName HDFS URL
 * 
 * @throws ConfigurationException
 */
public static void setDfsName(String dfsName) throws ConfigurationException {
    PropertiesConfiguration config = new PropertiesConfiguration(adminPropertyFileName);
    config.setProperty("dfs.default.name", dfsName);
    config.save();
}

From source file:org.springframework.data.hadoop.admin.util.HadoopWorkflowDescriptorUtils.java

/**
 * replace jar file name with full path where the uploaded jar in the server.
 * /*from ww w  . java2  s.co m*/
 * @param workflowProperty workflow property file
 * 
 * @throws ConfigurationException 
 */
public void replaceJarPath(File workflowProperty) throws ConfigurationException {
    PropertiesConfiguration config = new PropertiesConfiguration(workflowProperty);
    String workflowFolder = workflowProperty.getParent();
    workflowFolder.replace("\\", "/");
    workflowFolder = HadoopWorkflowUtils.fileURLPrefix + workflowFolder;
    config.setProperty("jar.path", workflowFolder);
    config.save();
}

From source file:org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.core.AgentUtilOperations.java

private static void updateExistingTokens(String responseFromTokenEP) throws AgentCoreOperationException {
    JSONObject jsonTokenObject = new JSONObject(responseFromTokenEP);
    String newAccessToken = jsonTokenObject.get(APIManagerTokenUtils.ACCESS_TOKEN).toString();
    String newRefreshToken = jsonTokenObject.get(APIManagerTokenUtils.REFRESH_TOKEN).toString();

    if (newAccessToken == null || newRefreshToken == null) {
        String msg = "Neither Access-Token nor Refresh-Token was found in the response [" + responseFromTokenEP
                + "].";
        log.error(AgentConstants.LOG_APPENDER + msg);
        throw new AgentCoreOperationException(msg);
    }//from w w w  . ja  v a  2 s .  c  o m

    AgentManager.getInstance().getAgentConfigs().setAuthToken(newAccessToken);
    AgentManager.getInstance().getAgentConfigs().setRefreshToken(newRefreshToken);
    String deviceConfigFilePath = AgentManager.getInstance().getRootPath()
            + AgentConstants.AGENT_PROPERTIES_FILE_NAME;

    try {
        PropertiesConfiguration propertyFileConfiguration = new PropertiesConfiguration(deviceConfigFilePath);
        propertyFileConfiguration.setProperty(AgentConstants.AUTH_TOKEN_PROPERTY, newAccessToken);
        propertyFileConfiguration.setProperty(AgentConstants.REFRESH_TOKEN_PROPERTY, newRefreshToken);
        propertyFileConfiguration.save();
    } catch (ConfigurationException e) {
        String msg = "Error occurred whilst trying to update the [" + AgentConstants.AGENT_PROPERTIES_FILE_NAME
                + "] at: " + deviceConfigFilePath + " will the new tokens.";
        log.error(AgentConstants.LOG_APPENDER + msg);
        throw new AgentCoreOperationException(msg);
    }
}

From source file:org.xwiki.contrib.confluence.filter.internal.ConfluenceXMLPackage.java

private void savePageProperties(PropertiesConfiguration properties, long pageId) throws ConfigurationException {
    PropertiesConfiguration fileProperties = getPageProperties(pageId, true);

    fileProperties.copy(properties);//w  w  w  .  j  a  v a 2 s  .  c  om

    fileProperties.save();
}

From source file:org.xwiki.contrib.confluence.filter.internal.ConfluenceXMLPackage.java

private void saveObjectProperties(String folder, PropertiesConfiguration properties, long objectId)
        throws ConfigurationException {
    PropertiesConfiguration fileProperties = getObjectProperties(folder, objectId);

    fileProperties.copy(properties);// ww w  .j ava 2  s  .  c o m

    fileProperties.save();
}

From source file:org.xwiki.contrib.confluence.filter.internal.ConfluenceXMLPackage.java

private void saveAttachmentProperties(PropertiesConfiguration properties, long pageId, long attachmentId)
        throws ConfigurationException {
    PropertiesConfiguration fileProperties = getAttachmentProperties(pageId, attachmentId);

    fileProperties.copy(properties);//from  w  w w.j a va 2 s.  c om

    fileProperties.save();
}

From source file:org.xwiki.contrib.confluence.filter.internal.ConfluenceXMLPackage.java

private void saveSpacePermissionsProperties(PropertiesConfiguration properties, long spaceId, long permissionId)
        throws ConfigurationException {
    PropertiesConfiguration fileProperties = getSpacePermissionProperties(spaceId, permissionId);

    fileProperties.copy(properties);//from ww w  . jav  a2 s .c o m

    fileProperties.save();
}

From source file:org.xwiki.contrib.confluence.filter.internal.ConfluenceXMLPackage.java

private void saveSpaceProperties(PropertiesConfiguration properties, long spaceId)
        throws ConfigurationException {
    PropertiesConfiguration fileProperties = getSpaceProperties(spaceId);

    fileProperties.copy(properties);/*from   ww w .j ava2s.co m*/

    fileProperties.save();
}

From source file:org.xwiki.filter.confluence.xml.internal.ConfluenceXMLPackage.java

private void savePageProperties(PropertiesConfiguration properties, int pageId)
        throws IOException, ConfigurationException {
    PropertiesConfiguration fileProperties = getPageProperties(pageId);

    fileProperties.copy(properties);//from  www .  ja v a  2  s.  c  o  m

    fileProperties.save();
}