Search in sources :

Example 11 with LocalizedMessage

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

the class NetworkValidator method isPortValid.

/*
     * Checks if port is valid
     * 
     * @param port @param props @param state
     * 
     * @return ValidationResult
     */
public ValidationResult isPortValid(String port, Map props, IStateAccess state) {
    int portno = -1;
    ValidationResultStatus validRes = ValidationResultStatus.STATUS_FAILED;
    LocalizedMessage returnMessage = null;
    if ((port != null) && (port.length() > 0) && (port.length() <= 5)) {
        try {
            portno = Integer.parseInt(port);
            if ((portno > 0) && (portno < 65535)) {
                returnMessage = LocalizedMessage.get(LOC_VA_MSG_VAL_PORT, new Object[] { port });
                validRes = ValidationResultStatus.STATUS_SUCCESS;
            }
        } catch (NumberFormatException nfe) {
            Debug.log("NetworkValidator.isPortValid threw exception :", nfe);
        }
    }
    if (validRes.getIntValue() == ValidationResultStatus.INT_STATUS_FAILED) {
        returnMessage = LocalizedMessage.get(LOC_VA_WRN_IN_VAL_PORT, new Object[] { port });
    }
    Debug.log("NetworkValidator : Is port : " + port + " valid ? " + validRes.isSuccessful());
    return new ValidationResult(validRes, null, returnMessage);
}
Also used : LocalizedMessage(com.sun.identity.install.tools.util.LocalizedMessage)

Example 12 with LocalizedMessage

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

the class NetworkValidator method isValidURI.

/**
     * Method validateURI
     * 
     * 
     * @param uri
     * @param props
     * @param state
     * 
     * @return ValidationResult
     * 
     */
public ValidationResult isValidURI(String uri, Map props, IStateAccess state) {
    ValidationResultStatus validRes = ValidationResultStatus.STATUS_FAILED;
    LocalizedMessage returnMessage = null;
    if ((uri != null) && (uri.trim().length() >= 0)) {
        if (uri.startsWith(STR_VA_DEF_URI_PATH)) {
            returnMessage = LocalizedMessage.get(LOC_VA_MSG_VALID_URI, new Object[] { uri });
            validRes = ValidationResultStatus.STATUS_SUCCESS;
        }
    }
    if (validRes.getIntValue() == ValidationResultStatus.INT_STATUS_FAILED) {
        returnMessage = LocalizedMessage.get(LOC_VA_WRN_IN_VALID_URI, new Object[] { uri });
    }
    Debug.log("NetworkValidator : Is URI : " + uri + " valid ? " + validRes.isSuccessful());
    return new ValidationResult(validRes, null, returnMessage);
}
Also used : LocalizedMessage(com.sun.identity.install.tools.util.LocalizedMessage)

Example 13 with LocalizedMessage

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

the class InstallDriver method getProductAuditLogsPathMessage.

public LocalizedMessage getProductAuditLogsPathMessage() {
    String productAuditDirectory = (String) getInstallState().getStateAccess().get(STR_AUDIT_DIR_PREFIX_TAG);
    Object[] args = { productAuditDirectory };
    LocalizedMessage message = LocalizedMessage.get(LOC_DR_MSG_PRODUCT_AUDIT_DIR, args);
    return message;
}
Also used : LocalizedMessage(com.sun.identity.install.tools.util.LocalizedMessage)

Example 14 with LocalizedMessage

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

the class InstallRunInfo method toString.

public String toString() {
    StringBuffer buff = new StringBuffer("InstallRunInfo For: ");
    buff.append(getType()).append(LINE_SEP);
    buff.append("Welcome message: ").append(LINE_SEP);
    LocalizedMessage welcomeMesssage = LocalizedMessage.get(getWelcomeMessageInfo().getKey(), getWelcomeMessageInfo().getGroup());
    buff.append(welcomeMesssage.toString()).append(LINE_SEP);
    buff.append("Exit message: ").append(LINE_SEP);
    LocalizedMessage exitMesssage = LocalizedMessage.get(getExitMessageInfo().getKey(), getExitMessageInfo().getGroup());
    buff.append(exitMesssage.toString()).append(LINE_SEP);
    buff.append("HomeDirLocator: ");
    buff.append(getHomeDirLocator()).append(LINE_SEP);
    buff.append("Instance Finder Interactions: ").append(LINE_SEP);
    ArrayList iiInteractions = getInstanceFinderInteractions();
    for (int i = 0; i < iiInteractions.size(); i++) {
        buff.append(iiInteractions.get(i)).append(LINE_SEP);
    }
    buff.append("Common Interactions: ").append(LINE_SEP);
    ArrayList commonInteractions = this.getCommonInteractions();
    for (int i = 0; i < commonInteractions.size(); i++) {
        buff.append(commonInteractions.get(i)).append(LINE_SEP);
    }
    buff.append("Instance Interactions: ").append(LINE_SEP);
    ArrayList instanceInteractions = this.getInstanceInteractions();
    for (int i = 0; i < instanceInteractions.size(); i++) {
        buff.append(instanceInteractions.get(i)).append(LINE_SEP);
    }
    buff.append("Common Tasks: ").append(LINE_SEP);
    ArrayList commonTasks = this.getCommonTasks();
    for (int i = 0; i < commonTasks.size(); i++) {
        buff.append("  ");
        buff.append(commonTasks.get(i)).append(LINE_SEP);
    }
    buff.append("Instance Tasks: ").append(LINE_SEP);
    ArrayList instanceTasks = this.getInstanceTasks();
    for (int i = 0; i < instanceTasks.size(); i++) {
        buff.append("  ");
        buff.append(instanceTasks.get(i)).append(LINE_SEP);
    }
    buff.append("Check optional-display attribute:" + isCheckDisplay()).append(LINE_SEP);
    buff.append("--------------------------------------------------");
    buff.append(LINE_SEP);
    return buff.toString();
}
Also used : ArrayList(java.util.ArrayList) LocalizedMessage(com.sun.identity.install.tools.util.LocalizedMessage)

Example 15 with LocalizedMessage

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

the class MultipleUninstallDriver method uninstall.

public void uninstall(int operationType, InstallLogger uninstallLog, String fileName) throws InstallException {
    Debug.log("MultipleUninstallDriver: Starting Uninstall");
    // Set the install type
    setOperationType(operationType);
    // Show the welcome message
    printConsoleMessageWithMarkers(getRunInfo().getWelcomeMessageInfo());
    // Write the Version info to the log file
    writeVersionInfoToLog(uninstallLog, LOC_DR_MSG_UNINSTALL_LOG_VERSION_DESC, LOC_DR_MSG_UNINSTALL_LOG_VERSION_DESC_LINE);
    // This object has to be created before we iterate
    InstFinderInteractionsRunner iFinderRunner = new InstFinderInteractionsRunner(getRunInfo(), null, getServerLocatorHandler());
    // Retrieve the inst finder keys to get all product details
    ArrayList instFinderKeys = iFinderRunner.getAllInteractionKeys();
    InstFinderStore iFinderStore = InstFinderStore.getInstance();
    Map allProductsDetails = iFinderStore.getAllProductDetails(instFinderKeys);
    if (allProductsDetails == null || allProductsDetails.isEmpty()) {
        LocalizedMessage productsNotFoundMsg = LocalizedMessage.get(LOC_HR_MSG_UNINSTALL_ALL_NONE_FOUND);
        Console.println(productsNotFoundMsg);
        Debug.log(productsNotFoundMsg.toString());
    } else {
        // Start uninstalling products one at a time
        Iterator iter = allProductsDetails.keySet().iterator();
        while (iter.hasNext()) {
            String instanceName = (String) iter.next();
            Map productDetails = (Map) allProductsDetails.get(instanceName);
            Console.println();
            Console.println();
            LocalizedMessage productUninstallBeginMsg = LocalizedMessage.get(LOC_HR_MSG_UNINSTALL_PRODUCT_BEGIN_MSG);
            Console.println(productUninstallBeginMsg);
            Debug.log(productUninstallBeginMsg.toString());
            Console.println();
            try {
                // Now set the transient state access with product
                // details of the instance being uninstalled
                iFinderRunner.setStateAccess(new TransientStateAccess(productDetails));
                // Execute the common code
                uninstallInternal(operationType, iFinderRunner, uninstallLog);
            } catch (InstallAbortException iae) {
                Debug.log("Failed to Uninstall product instance " + instanceName + " with ex : ", iae);
                Console.print(LocalizedMessage.get(LOC_DR_MSG_USER_ABORT));
            } catch (Exception ex) {
                Debug.log("Failed to Uninstall product instance with ex : ", ex);
                Console.print(LocalizedMessage.get(LOC_HR_ERR_UNINSTALL_PRODUCT_EX_MSG), new Object[] { ex.getMessage() });
            }
        }
    }
    // Show the exit message
    printConsoleMessage(getRunInfo().getExitMessageInfo());
}
Also used : ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) Map(java.util.Map) 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