Search in sources :

Example 36 with LocalizedMessage

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

the class ChoiceValidator method isChoiceValid.

/**
     * Method isChoiceValid
     *
     *
     * @param choice
     * @param props
     * @param IStateAccess
     *
     * @return ValidationResult
     *
     */
public ValidationResult isChoiceValid(String choice, Map props, IStateAccess state) {
    ValidationResultStatus validRes = ValidationResultStatus.STATUS_FAILED;
    LocalizedMessage returnMessage = null;
    boolean ignoreCase = getIgnoreCaseStat(props);
    if ((choice != null) && (choice.length() > 0)) {
        Iterator iter = props.entrySet().iterator();
        while (iter.hasNext()) {
            Map.Entry me = (Map.Entry) iter.next();
            String key = (String) me.getKey();
            // We are only interested with keys starting with "value"
            if (key.startsWith(STR_VAL_MATCH_PATTERN)) {
                String val = (String) me.getValue();
                if (val != null) {
                    if (ignoreCase) {
                        if (choice.equalsIgnoreCase(val)) {
                            validRes = ValidationResultStatus.STATUS_SUCCESS;
                            Debug.log("ChoiceValidator:isChoiceValid(..) " + " comparing value = " + val + ", with choice " + "=" + choice + ", ignore case = " + ignoreCase + ", comparison result = " + true);
                            break;
                        }
                    } else {
                        if (choice.equals(val)) {
                            validRes = ValidationResultStatus.STATUS_SUCCESS;
                            Debug.log("ChoiceValidator:isChoiceValid(..) " + " comparing value = " + val + ", with choice " + "=" + choice + ", ignore case = " + ignoreCase + ", comparison result = " + true);
                            break;
                        }
                    }
                }
            }
        }
    }
    if (validRes.getIntValue() == ValidationResultStatus.INT_STATUS_FAILED) {
        returnMessage = LocalizedMessage.get(LOC_VA_WRN_IN_VAL_CHOICE, new Object[] { choice });
    } else {
        returnMessage = LocalizedMessage.get(LOC_VA_MSG_VAL_CHOICE, new Object[] { choice });
    }
    Debug.log("ChoiceValidator:isChoiceValid(..) Is choice valid ? " + validRes.isSuccessful());
    return new ValidationResult(validRes, null, returnMessage);
}
Also used : Iterator(java.util.Iterator) Map(java.util.Map) HashMap(java.util.HashMap) LocalizedMessage(com.sun.identity.install.tools.util.LocalizedMessage)

Example 37 with LocalizedMessage

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

the class CustomInstallDriver 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 38 with LocalizedMessage

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

the class Driver method printConsoleMessage.

/*
     *  Used to print the welcome and exit message for console mode
     */
public void printConsoleMessage(I18NInfo messageInfo) {
    //Only in console mode
    if (!isSilentMode()) {
        LocalizedMessage message = LocalizedMessage.get(messageInfo.getKey(), messageInfo.getGroup());
        Console.println();
        Console.println(message);
        Console.println();
    }
}
Also used : LocalizedMessage(com.sun.identity.install.tools.util.LocalizedMessage)

Example 39 with LocalizedMessage

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

the class Driver method getLogFilePathMessage.

public LocalizedMessage getLogFilePathMessage(InstallLogger installLog, String installLogLocKey) {
    Audit installAuditLog = installLog.getLogger();
    Object[] args = { installAuditLog.getAuditLogFileName() };
    LocalizedMessage message = LocalizedMessage.get(installLogLocKey, args);
    return message;
}
Also used : Audit(com.sun.identity.install.tools.util.Audit) LocalizedMessage(com.sun.identity.install.tools.util.LocalizedMessage)

Example 40 with LocalizedMessage

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

the class CreateLayoutTask method createDir.

private void createDir(String dirName) throws InstallException {
    Debug.log("LayoutHandlerTask.createDir() - Creating Dir for: " + dirName);
    File dir = new File(dirName);
    if (!dir.mkdir()) {
        Debug.log("LayoutHandlerTask.createDir() - Error Unable to " + "create Dir for: " + dirName);
        // If the creation is not successful throw an Exception
        LocalizedMessage lMessage = LocalizedMessage.get(LOC_DR_ERR_DIR_CREATE, new Object[] { dirName });
        throw new InstallException(lMessage);
    }
}
Also used : File(java.io.File) 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