Search in sources :

Example 21 with LocalizedMessage

use of com.sun.identity.install.tools.util.LocalizedMessage in project OpenAM by OpenRock.

the class FileSystemValidator method isFileWritable.

/**
     * Method isFileWritable
     *
     *
     * @param filename File path
     * @param props Map for name value pairs
     * @param state IStateAccess 
     *
     * @return ValidationResult
     *
     */
public ValidationResult isFileWritable(String filename, Map props, IStateAccess state) {
    ValidationResultStatus validRes = ValidationResultStatus.STATUS_FAILED;
    LocalizedMessage returnMessage = null;
    if (isStringValid(filename)) {
        File file = new File(filename);
        if (file.exists() && file.isFile() && file.canWrite()) {
            returnMessage = LocalizedMessage.get(LOC_VA_MSG_FILE_READ_WRITE, new Object[] { filename });
            validRes = ValidationResultStatus.STATUS_SUCCESS;
        }
    }
    if (validRes.getIntValue() == ValidationResultStatus.INT_STATUS_FAILED) {
        returnMessage = LocalizedMessage.get(LOC_VA_WRN_FILE_NOT_READ_WRITE, new Object[] { filename });
    }
    Debug.log("FileSystemValidator : Is file : " + filename + " writable ? " + validRes.isSuccessful());
    return new ValidationResult(validRes, null, returnMessage);
}
Also used : File(java.io.File) LocalizedMessage(com.sun.identity.install.tools.util.LocalizedMessage)

Example 22 with LocalizedMessage

use of com.sun.identity.install.tools.util.LocalizedMessage in project OpenAM by OpenRock.

the class FileSystemValidator method isFileReadable.

/**
     * Method isFileReadable
     *
     *
     * @param filename File path
     * @param props Map for name value pairs
     * @param IStateAccess 
     *
     * @return ValidationResult
     *
     */
public ValidationResult isFileReadable(String filename, Map props, IStateAccess state) {
    ValidationResultStatus validRes = ValidationResultStatus.STATUS_FAILED;
    LocalizedMessage returnMessage = null;
    if (isStringValid(filename)) {
        File file = new File(filename);
        if (file.exists() && file.isFile() && file.canRead()) {
            returnMessage = LocalizedMessage.get(LOC_VA_MSG_FILE_READ, new Object[] { filename });
            validRes = ValidationResultStatus.STATUS_SUCCESS;
        }
    }
    if (validRes.getIntValue() == ValidationResultStatus.INT_STATUS_FAILED) {
        returnMessage = LocalizedMessage.get(LOC_VA_WRN_FILE_NOT_READ, new Object[] { filename });
    }
    Debug.log("FileSystemValidator : Is File : " + filename + " readable ? " + validRes.isSuccessful());
    return new ValidationResult(validRes, null, returnMessage);
}
Also used : File(java.io.File) LocalizedMessage(com.sun.identity.install.tools.util.LocalizedMessage)

Example 23 with LocalizedMessage

use of com.sun.identity.install.tools.util.LocalizedMessage in project OpenAM by OpenRock.

the class BackupFileTask method getExecutionMessage.

public LocalizedMessage getExecutionMessage(IStateAccess stateAccess, Map properties) {
    String fileName = getFileName(stateAccess, properties);
    Object[] args = { fileName };
    LocalizedMessage message = LocalizedMessage.get(LOC_TSK_MSG_BACKUP_FILE_EXECUTE, args);
    return message;
}
Also used : LocalizedMessage(com.sun.identity.install.tools.util.LocalizedMessage)

Example 24 with LocalizedMessage

use of com.sun.identity.install.tools.util.LocalizedMessage in project OpenAM by OpenRock.

the class InstallDriver method getAgentConfigFilePathMessage.

public LocalizedMessage getAgentConfigFilePathMessage() {
    String agentConfigFilePath = (String) getInstallState().getStateAccess().get(STR_CONFIG_AGENT_CONFIG_FILE_PATH_TAG);
    Object[] args = { agentConfigFilePath };
    LocalizedMessage message = LocalizedMessage.get(LOC_DR_MSG_PRODUCT_AGENT_CONFIG_FILE_NAME, args);
    return message;
}
Also used : LocalizedMessage(com.sun.identity.install.tools.util.LocalizedMessage)

Example 25 with LocalizedMessage

use of com.sun.identity.install.tools.util.LocalizedMessage in project OpenAM by OpenRock.

the class InstallDriver method displayAndLogInstallSummary.

public void displayAndLogInstallSummary(InstallLogger installLog) {
    ArrayList messageList = new ArrayList();
    messageList.add(getSummaryInfoHeaderMessage());
    messageList.add(getSummaryInfoHeaderMessageFmtLine());
    messageList.add(getProductInstanceNameMessage());
    messageList.add(getProductConfigFilePathMessage());
    messageList.add(getAgentConfigFilePathMessage());
    messageList.add(getProductAuditLogsPathMessage());
    messageList.add(getProductDebugLogsPathMessage());
    int count = messageList.size();
    printConsoleEmptyLine();
    printConsoleEmptyLine();
    installLog.getLogger().logEmptyLine();
    for (int i = 0; i < count; i++) {
        LocalizedMessage message = (LocalizedMessage) messageList.get(i);
        printConsoleMessage(message);
        installLog.getLogger().log(message);
    }
}
Also used : ArrayList(java.util.ArrayList) LocalizedMessage(com.sun.identity.install.tools.util.LocalizedMessage)

Aggregations

LocalizedMessage (com.sun.identity.install.tools.util.LocalizedMessage)73 Map (java.util.Map)9 File (java.io.File)8 ArrayList (java.util.ArrayList)8 IOException (java.io.IOException)6 HashMap (java.util.HashMap)5 Iterator (java.util.Iterator)5 ConnectException (java.net.ConnectException)4 UnknownHostException (java.net.UnknownHostException)4 StringTokenizer (java.util.StringTokenizer)4 FileNotFoundException (java.io.FileNotFoundException)3 RESTUtils (com.sun.identity.install.tools.util.RESTUtils)2 BufferedReader (java.io.BufferedReader)2 MalformedURLException (java.net.MalformedURLException)2 URL (java.net.URL)2 URLConnection (java.net.URLConnection)2 TreeMap (java.util.TreeMap)2 Audit (com.sun.identity.install.tools.util.Audit)1 FileReader (java.io.FileReader)1 InputStream (java.io.InputStream)1