Example usage for java.util Arrays binarySearch

List of usage examples for java.util Arrays binarySearch

Introduction

In this page you can find the example usage for java.util Arrays binarySearch.

Prototype

public static int binarySearch(Object[] a, Object key) 

Source Link

Document

Searches the specified array for the specified object using the binary search algorithm.

Usage

From source file:com.twinsoft.convertigo.eclipse.editors.connector.HtmlConnectorDesignComposite.java

public void createStatementFromGenerator(Document dom) {
    // Retrieve selected statement generator xpath
    String statementGeneratorXpath = xpathEvaluator.getSelectionXpath();

    // retrieve element on which generate a statement 
    // every test has been done before activating the button, no need to do them again
    Element element = (Element) (dom.getDocumentElement().getChildNodes().item(0));
    boolean clickable = false, valuable = false, checkable = false, selectable = false, radioable = false,
            formable = false;/*  ww w.j  a v a 2 s .  com*/

    if (element.getTagName().equalsIgnoreCase("A")) {
        clickable = true;
    } else if (element.getTagName().equalsIgnoreCase("INPUT")) {
        String type = element.getAttribute("type");
        clickable = Arrays.binarySearch(new String[] { "button", "checkbox", "radio", "submit" }, type) > -1; //warning, must be sort
        valuable = Arrays.binarySearch(new String[] { "", "password", "text" }, type) > -1; //warning, must be sort
        checkable = Arrays.binarySearch(new String[] { "checkbox", "radio" }, type) > -1; //warning, must be sort
        radioable = type.equals("radio");
    } else if (element.getTagName().equalsIgnoreCase("TEXTAREA")) {
        valuable = true;
    } else if (element.getTagName().equalsIgnoreCase("SELECT")) {
        selectable = true;
    } else if (element.getTagName().equalsIgnoreCase("FORM")) {
        formable = true;
    }

    // Retrieve parent Statement
    StatementWithExpressions parentObject = getParentStatement();

    // launch wizard
    StatementGeneratorWizard statementGeneratorWizard = new StatementGeneratorWizard(parentObject,
            statementGeneratorXpath,
            new boolean[] { clickable, valuable, checkable, selectable, radioable, formable });

    WizardDialog wzdlg = new WizardDialog(Display.getCurrent().getActiveShell(), statementGeneratorWizard);
    wzdlg.open();
    if (wzdlg.getReturnCode() != Window.CANCEL) {
        // TODO
    }
}

From source file:org.eclipse.swt.examples.fileviewer.FileViewer.java

/**
 * Updates the table's contents//from   w  w w  .  j a  v  a2  s .  c o  m
 */
private void workerExecute() {
    File[] dirList;

    dirList = getDirectoryList(workerStateDir);
    display.syncExec(new Runnable() {
        @Override
        public void run() {
            mCurTableFiles = getTableData(table.getItems());
        }
    });

    // Only update the table when the current directory files have changed.
    if (isSameFiles(dirList, mCurTableFiles)) {
        // Log.i("same file, cancel update");
        return;
    }

    // Save the current selection and restore that after refresh.
    display.syncExec(new Runnable() {
        @Override
        public void run() {
            mSelectedFiles = getTableSelectFiles();
            mCurTableTopIndex = table.getTopIndex();
        }
    });

    // Clear existing information
    display.syncExec(new Runnable() {
        public void run() {
            tableContentsOfLabel.setText(FileViewer.getResourceString("details.ContentsOf.text",
                    new Object[] { workerStateDir.getPath() }));
            table.removeAll();
            table.setData(TABLEDATA_DIR, workerStateDir);
        }
    });

    for (int i = 0; (!workerCancelled) && (i < dirList.length); i++) {
        workerAddFileDetails(dirList[i]);
    }
    display.syncExec(new Runnable() {
        @Override
        public void run() {
            File[] files = getTableData(table.getItems());
            for (File file : mSelectedFiles) {
                table.select(Arrays.binarySearch(files, file));
            }
            table.setTopIndex(mCurTableTopIndex);
        }
    });
}

From source file:it.infn.ct.nuclemd.Nuclemd.java

@Override
public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException {
    try {/* w w w.  ja  va 2 s  .co m*/
        String action = "";

        // Getting the action to be processed from the request
        action = request.getParameter("ActionEvent");

        // Determine the username and the email address
        ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
        User user = themeDisplay.getUser();

        String username = user.getScreenName();
        String emailAddress = user.getDisplayEmailAddress();

        Company company = PortalUtil.getCompany(request);
        String portal = company.getName();

        PortletPreferences portletPreferences = (PortletPreferences) request.getPreferences();

        if (action.equals("CONFIG_NUCLEMD_PORTLET")) {
            log.info("\nPROCESS ACTION => " + action);

            // Getting the NUCLEMD APPID from the portlet request
            String nuclemd_APPID = request.getParameter("nuclemd_APPID");
            // Getting the LOGLEVEL from the portlet request
            String nuclemd_LOGLEVEL = request.getParameter("nuclemd_LOGLEVEL");
            // Getting the NUCLEMD_METADATA_HOST from the portlet request
            String nuclemd_METADATA_HOST = request.getParameter("nuclemd_METADATA_HOST");
            // Getting the NUCLEMD OUTPUT_PATH from the portlet request
            String nuclemd_OUTPUT_PATH = request.getParameter("nuclemd_OUTPUT_PATH");
            // Getting the NUCLEMD SOFTWARE from the portlet request
            String nuclemd_SOFTWARE = request.getParameter("nuclemd_SOFTWARE");
            // Getting the TRACKING_DB_HOSTNAME from the portlet request
            String TRACKING_DB_HOSTNAME = request.getParameter("TRACKING_DB_HOSTNAME");
            // Getting the TRACKING_DB_USERNAME from the portlet request
            String TRACKING_DB_USERNAME = request.getParameter("TRACKING_DB_USERNAME");
            // Getting the TRACKING_DB_PASSWORD from the portlet request
            String TRACKING_DB_PASSWORD = request.getParameter("TRACKING_DB_PASSWORD");
            // Getting the SMTP_HOST from the portlet request
            String SMTP_HOST = request.getParameter("SMTP_HOST");
            // Getting the SENDER_MAIL from the portlet request
            String SENDER_MAIL = request.getParameter("SENDER_MAIL");
            String[] infras = new String[6];

            String lato_nuclemd_ENABLEINFRASTRUCTURE = "unchecked";
            String garuda_nuclemd_ENABLEINFRASTRUCTURE = "unchecked";
            String eumed_nuclemd_ENABLEINFRASTRUCTURE = "unchecked";
            String sagrid_nuclemd_ENABLEINFRASTRUCTURE = "unchecked";
            String see_nuclemd_ENABLEINFRASTRUCTURE = "unchecked";
            String gridit_nuclemd_ENABLEINFRASTRUCTURE = "unchecked";

            String[] nuclemd_INFRASTRUCTURES = request.getParameterValues("nuclemd_ENABLEINFRASTRUCTURES");

            if (nuclemd_INFRASTRUCTURES != null) {
                Arrays.sort(nuclemd_INFRASTRUCTURES);
                lato_nuclemd_ENABLEINFRASTRUCTURE = Arrays.binarySearch(nuclemd_INFRASTRUCTURES, "lato") >= 0
                        ? "checked"
                        : "unchecked";
                garuda_nuclemd_ENABLEINFRASTRUCTURE = Arrays.binarySearch(nuclemd_INFRASTRUCTURES,
                        "garuda") >= 0 ? "checked" : "unchecked";
                eumed_nuclemd_ENABLEINFRASTRUCTURE = Arrays.binarySearch(nuclemd_INFRASTRUCTURES, "eumed") >= 0
                        ? "checked"
                        : "unchecked";
                sagrid_nuclemd_ENABLEINFRASTRUCTURE = Arrays.binarySearch(nuclemd_INFRASTRUCTURES,
                        "sagrid") >= 0 ? "checked" : "unchecked";
                see_nuclemd_ENABLEINFRASTRUCTURE = Arrays.binarySearch(nuclemd_INFRASTRUCTURES, "see") >= 0
                        ? "checked"
                        : "unchecked";
                gridit_nuclemd_ENABLEINFRASTRUCTURE = Arrays.binarySearch(nuclemd_INFRASTRUCTURES,
                        "gridit") >= 0 ? "checked" : "unchecked";
            }

            if (lato_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")) {
                infras[0] = "lato";
                // Getting the NUCLEMD INFRASTRUCTURE from the portlet request for LATO
                String lato_nuclemd_INFRASTRUCTURE = request.getParameter("lato_nuclemd_INFRASTRUCTURE");
                // Getting the NUCLEMD VONAME from the portlet request for LATO
                String lato_nuclemd_LOGIN = request.getParameter("lato_nuclemd_LOGIN");
                // Getting the NUCLEMD TOPBDII from the portlet request for LATO
                String lato_nuclemd_PASSWD = request.getParameter("lato_nuclemd_PASSWD");
                // Getting the NUCLEMD WMS from the portlet request for LATO
                String[] lato_nuclemd_WMS = request.getParameterValues("lato_nuclemd_WMS");
                // Getting the NUCLEMD ETOKENSERVER from the portlet request for LATO
                String lato_nuclemd_ETOKENSERVER = request.getParameter("lato_nuclemd_ETOKENSERVER");
                // Getting the NUCLEMD MYPROXYSERVER from the portlet request for LATO
                String lato_nuclemd_MYPROXYSERVER = request.getParameter("lato_nuclemd_MYPROXYSERVER");
                // Getting the NUCLEMD PORT from the portlet request for LATO
                String lato_nuclemd_PORT = request.getParameter("lato_nuclemd_PORT");
                // Getting the NUCLEMD ROBOTID from the portlet request for LATO
                String lato_nuclemd_ROBOTID = request.getParameter("lato_nuclemd_ROBOTID");
                // Getting the NUCLEMD WEBDAV from the portlet request for LATO
                String lato_nuclemd_WEBDAV = request.getParameter("lato_nuclemd_WEBDAV");
                // Getting the NUCLEMD ROLE from the portlet request for LATO
                String lato_nuclemd_ROLE = request.getParameter("lato_nuclemd_ROLE");
                // Getting the NUCLEMD OPTIONS from the portlet request for LATO
                String[] lato_nuclemd_OPTIONS = request.getParameterValues("lato_nuclemd_OPTIONS");

                String lato_nuclemd_RENEWAL = "";
                String lato_nuclemd_DISABLEVOMS = "";

                if (lato_nuclemd_OPTIONS == null) {
                    lato_nuclemd_RENEWAL = "checked";
                    lato_nuclemd_DISABLEVOMS = "unchecked";
                } else {
                    Arrays.sort(lato_nuclemd_OPTIONS);
                    // Getting the NUCLEMD RENEWAL from the portlet preferences for LATO
                    lato_nuclemd_RENEWAL = Arrays.binarySearch(lato_nuclemd_OPTIONS, "enableRENEWAL") >= 0
                            ? "checked"
                            : "unchecked";
                    // Getting the NUCLEMD DISABLEVOMS from the portlet preferences for LATO
                    lato_nuclemd_DISABLEVOMS = Arrays.binarySearch(lato_nuclemd_OPTIONS, "disableVOMS") >= 0
                            ? "checked"
                            : "unchecked";
                }

                int nmax = 0;
                for (int i = 0; i < lato_nuclemd_WMS.length; i++)
                    if (lato_nuclemd_WMS[i] != null && (!lato_nuclemd_WMS[i].trim().equals("N/A")))
                        nmax++;

                log.info("\n\nLength=" + nmax);
                String[] lato_nuclemd_WMS_trimmed = new String[nmax];
                for (int i = 0; i < nmax; i++) {
                    lato_nuclemd_WMS_trimmed[i] = lato_nuclemd_WMS[i].trim();
                    log.info("\n\nLATO [" + i + "] WMS=[" + lato_nuclemd_WMS_trimmed[i] + "]");
                }

                // Set the portlet preferences
                portletPreferences.setValue("lato_nuclemd_INFRASTRUCTURE", lato_nuclemd_INFRASTRUCTURE.trim());
                portletPreferences.setValue("lato_nuclemd_LOGIN", lato_nuclemd_LOGIN.trim());
                portletPreferences.setValue("lato_nuclemd_PASSWD", lato_nuclemd_PASSWD.trim());
                portletPreferences.setValues("lato_nuclemd_WMS", lato_nuclemd_WMS_trimmed);
                portletPreferences.setValue("lato_nuclemd_ETOKENSERVER", lato_nuclemd_ETOKENSERVER.trim());
                portletPreferences.setValue("lato_nuclemd_MYPROXYSERVER", lato_nuclemd_MYPROXYSERVER.trim());
                portletPreferences.setValue("lato_nuclemd_PORT", lato_nuclemd_PORT.trim());
                portletPreferences.setValue("lato_nuclemd_ROBOTID", lato_nuclemd_ROBOTID.trim());
                portletPreferences.setValue("lato_nuclemd_WEBDAV", lato_nuclemd_WEBDAV.trim());
                portletPreferences.setValue("lato_nuclemd_ROLE", lato_nuclemd_ROLE.trim());
                portletPreferences.setValue("lato_nuclemd_RENEWAL", lato_nuclemd_RENEWAL);
                portletPreferences.setValue("lato_nuclemd_DISABLEVOMS", lato_nuclemd_DISABLEVOMS);

                portletPreferences.setValue("nuclemd_APPID", nuclemd_APPID.trim());
                portletPreferences.setValue("nuclemd_LOGLEVEL", nuclemd_LOGLEVEL.trim());
                portletPreferences.setValue("nuclemd_METADATA_HOST", nuclemd_METADATA_HOST.trim());
                portletPreferences.setValue("nuclemd_OUTPUT_PATH", nuclemd_OUTPUT_PATH.trim());
                portletPreferences.setValue("nuclemd_SOFTWARE", nuclemd_SOFTWARE.trim());
                portletPreferences.setValue("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
                portletPreferences.setValue("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
                portletPreferences.setValue("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
                portletPreferences.setValue("SMTP_HOST", SMTP_HOST.trim());
                portletPreferences.setValue("SENDER_MAIL", SENDER_MAIL.trim());

                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n\nPROCESS ACTION => " + action
                            + "\n- Storing the NUCLEMD portlet preferences ..."
                            + "\nlato_nuclemd_INFRASTRUCTURE: " + lato_nuclemd_INFRASTRUCTURE
                            + "\nlato_nuclemd_LOGIN: " + lato_nuclemd_LOGIN + "\nlato_nuclemd_PASSWD: "
                            + lato_nuclemd_PASSWD + "\nlato_nuclemd_ETOKENSERVER: " + lato_nuclemd_ETOKENSERVER
                            + "\nlato_nuclemd_MYPROXYSERVER: " + lato_nuclemd_MYPROXYSERVER
                            + "\nlato_nuclemd_PORT: " + lato_nuclemd_PORT + "\nlato_nuclemd_ROBOTID: "
                            + lato_nuclemd_ROBOTID + "\nlato_nuclemd_WEBDAV: " + lato_nuclemd_WEBDAV
                            + "\nlato_nuclemd_ROLE: " + lato_nuclemd_ROLE + "\nlato_nuclemd_RENEWAL: "
                            + lato_nuclemd_RENEWAL + "\nlato_nuclemd_DISABLEVOMS: " + lato_nuclemd_DISABLEVOMS

                            + "\n\nnuclemd_ENABLEINFRASTRUCTURE: " + "lato" + "\nnuclemd_APPID: "
                            + nuclemd_APPID + "\nnuclemd_LOGLEVEL: " + nuclemd_LOGLEVEL
                            + "\nnuclemd_METADATA_HOSTL: " + nuclemd_METADATA_HOST + "\nnuclemd_OUTPUT_PATH: "
                            + nuclemd_OUTPUT_PATH + "\nnuclemd_SOFTWARE: " + nuclemd_SOFTWARE
                            + "\nTracking_DB_Hostname: " + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: "
                            + TRACKING_DB_USERNAME + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD
                            + "\nSMTP_HOST: " + SMTP_HOST + "\nSENDER_MAIL: " + SENDER_MAIL);
                }
            }

            if (garuda_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")) {
                infras[1] = "garuda";
                // Getting the NUCLEMD INFRASTRUCTURE from the portlet request for the GARUDA VO
                String garuda_nuclemd_INFRASTRUCTURE = request.getParameter("garuda_nuclemd_INFRASTRUCTURE");
                // Getting the NUCLEMD VONAME from the portlet request for the GARUDA VO
                String garuda_nuclemd_VONAME = request.getParameter("garuda_nuclemd_VONAME");
                // Getting the NUCLEMD TOPBDII from the portlet request for the GARUDA VO
                String garuda_nuclemd_TOPBDII = request.getParameter("garuda_nuclemd_TOPBDII");
                // Getting the NUCLEMD WMS from the portlet request for the GARUDA VO
                String[] garuda_nuclemd_WMS = request.getParameterValues("garuda_nuclemd_WMS");
                // Getting the NUCLEMD ETOKENSERVER from the portlet request for the GARUDA VO
                String garuda_nuclemd_ETOKENSERVER = request.getParameter("garuda_nuclemd_ETOKENSERVER");
                // Getting the NUCLEMD MYPROXYSERVER from the portlet request for the GARUDA VO
                String garuda_nuclemd_MYPROXYSERVER = request.getParameter("garuda_nuclemd_MYPROXYSERVER");
                // Getting the NUCLEMD PORT from the portlet request for the GARUDA VO
                String garuda_nuclemd_PORT = request.getParameter("garuda_nuclemd_PORT");
                // Getting the NUCLEMD ROBOTID from the portlet request for the GARUDA VO
                String garuda_nuclemd_ROBOTID = request.getParameter("garuda_nuclemd_ROBOTID");
                // Getting the NUCLEMD WEBDAV from the portlet request for the GARUDA VO
                String garuda_nuclemd_WEBDAV = request.getParameter("garuda_nuclemd_WEBDAV");
                // Getting the NUCLEMD ROLE from the portlet request for the GARUDA VO
                String garuda_nuclemd_ROLE = request.getParameter("garuda_nuclemd_ROLE");
                // Getting the NUCLEMD OPTIONS from the portlet request for the GARUDA VO
                String[] garuda_nuclemd_OPTIONS = request.getParameterValues("garuda_nuclemd_OPTIONS");

                String garuda_nuclemd_RENEWAL = "";
                String garuda_nuclemd_DISABLEVOMS = "";

                if (garuda_nuclemd_OPTIONS == null) {
                    garuda_nuclemd_RENEWAL = "checked";
                    garuda_nuclemd_DISABLEVOMS = "unchecked";
                } else {
                    Arrays.sort(garuda_nuclemd_OPTIONS);
                    // Getting the NUCLEMD RENEWAL from the portlet preferences for the GARUDA VO
                    garuda_nuclemd_RENEWAL = Arrays.binarySearch(garuda_nuclemd_OPTIONS, "enableRENEWAL") >= 0
                            ? "checked"
                            : "unchecked";
                    // Getting the NUCLEMD DISABLEVOMS from the portlet preferences for the GARUDA VO
                    garuda_nuclemd_DISABLEVOMS = Arrays.binarySearch(garuda_nuclemd_OPTIONS, "disableVOMS") >= 0
                            ? "checked"
                            : "unchecked";
                }

                int nmax = 0;
                for (int i = 0; i < garuda_nuclemd_WMS.length; i++)
                    if (garuda_nuclemd_WMS[i] != null && (!garuda_nuclemd_WMS[i].trim().equals("N/A")))
                        nmax++;

                log.info("\n\nLength=" + nmax);
                String[] garuda_nuclemd_WMS_trimmed = new String[nmax];
                for (int i = 0; i < nmax; i++) {
                    garuda_nuclemd_WMS_trimmed[i] = garuda_nuclemd_WMS[i].trim();
                    log.info("\n\nLATO [" + i + "] WMS=[" + garuda_nuclemd_WMS_trimmed[i] + "]");
                }

                // Set the portlet preferences
                portletPreferences.setValue("garuda_nuclemd_INFRASTRUCTURE",
                        garuda_nuclemd_INFRASTRUCTURE.trim());
                portletPreferences.setValue("garuda_nuclemd_VONAME", garuda_nuclemd_VONAME.trim());
                portletPreferences.setValue("garuda_nuclemd_TOPBDII", garuda_nuclemd_TOPBDII.trim());
                portletPreferences.setValues("garuda_nuclemd_WMS", garuda_nuclemd_WMS_trimmed);
                portletPreferences.setValue("garuda_nuclemd_ETOKENSERVER", garuda_nuclemd_ETOKENSERVER.trim());
                portletPreferences.setValue("garuda_nuclemd_MYPROXYSERVER",
                        garuda_nuclemd_MYPROXYSERVER.trim());
                portletPreferences.setValue("garuda_nuclemd_PORT", garuda_nuclemd_PORT.trim());
                portletPreferences.setValue("garuda_nuclemd_ROBOTID", garuda_nuclemd_ROBOTID.trim());
                portletPreferences.setValue("garuda_nuclemd_WEBDAV", garuda_nuclemd_WEBDAV.trim());
                portletPreferences.setValue("garuda_nuclemd_ROLE", garuda_nuclemd_ROLE.trim());
                portletPreferences.setValue("garuda_nuclemd_RENEWAL", garuda_nuclemd_RENEWAL);
                portletPreferences.setValue("garuda_nuclemd_DISABLEVOMS", garuda_nuclemd_DISABLEVOMS);

                portletPreferences.setValue("nuclemd_APPID", nuclemd_APPID.trim());
                portletPreferences.setValue("nuclemd_LOGLEVEL", nuclemd_LOGLEVEL.trim());
                portletPreferences.setValue("nuclemd_METADATA_HOST", nuclemd_METADATA_HOST.trim());
                portletPreferences.setValue("nuclemd_OUTPUT_PATH", nuclemd_OUTPUT_PATH.trim());
                portletPreferences.setValue("nuclemd_SOFTWARE", nuclemd_SOFTWARE.trim());
                portletPreferences.setValue("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
                portletPreferences.setValue("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
                portletPreferences.setValue("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
                portletPreferences.setValue("SMTP_HOST", SMTP_HOST.trim());
                portletPreferences.setValue("SENDER_MAIL", SENDER_MAIL.trim());

                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n\nPROCESS ACTION => " + action
                            + "\n- Storing the NUCLEMD portlet preferences ..."
                            + "\ngaruda_nuclemd_INFRASTRUCTURE: " + garuda_nuclemd_INFRASTRUCTURE
                            + "\ngaruda_nuclemd_VONAME: " + garuda_nuclemd_VONAME + "\ngaruda_nuclemd_TOPBDII: "
                            + garuda_nuclemd_TOPBDII + "\ngaruda_nuclemd_ETOKENSERVER: "
                            + garuda_nuclemd_ETOKENSERVER + "\ngaruda_nuclemd_MYPROXYSERVER: "
                            + garuda_nuclemd_MYPROXYSERVER + "\ngaruda_nuclemd_PORT: " + garuda_nuclemd_PORT
                            + "\ngaruda_nuclemd_ROBOTID: " + garuda_nuclemd_ROBOTID
                            + "\ngaruda_nuclemd_WEBDAV: " + garuda_nuclemd_WEBDAV + "\ngaruda_nuclemd_ROLE: "
                            + garuda_nuclemd_ROLE + "\ngaruda_nuclemd_RENEWAL: " + garuda_nuclemd_RENEWAL
                            + "\ngaruda_nuclemd_DISABLEVOMS: " + garuda_nuclemd_DISABLEVOMS

                            + "\n\nnuclemd_ENABLEINFRASTRUCTURE: " + "garuda" + "\nnuclemd_APPID: "
                            + nuclemd_APPID + "\nnuclemd_LOGLEVEL: " + nuclemd_LOGLEVEL
                            + "\nnuclemd_METADATA_HOST: " + nuclemd_METADATA_HOST + "\nnuclemd_OUTPUT_PATH: "
                            + nuclemd_OUTPUT_PATH + "\nnuclemd_SOFTWARE: " + nuclemd_SOFTWARE
                            + "\nTracking_DB_Hostname: " + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: "
                            + TRACKING_DB_USERNAME + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD
                            + "\nSMTP_HOST: " + SMTP_HOST + "\nSENDER_MAIL: " + SENDER_MAIL);
                }
            }

            if (eumed_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")) {
                infras[2] = "eumed";
                // Getting the NUCLEMD INFRASTRUCTURE from the portlet request for the EUMED VO
                String eumed_nuclemd_INFRASTRUCTURE = request.getParameter("eumed_nuclemd_INFRASTRUCTURE");
                // Getting the NUCLEMD VONAME from the portlet request for the EUMED VO
                String eumed_nuclemd_VONAME = request.getParameter("eumed_nuclemd_VONAME");
                // Getting the NUCLEMD TOPBDII from the portlet request for the EUMED VO
                String eumed_nuclemd_TOPBDII = request.getParameter("eumed_nuclemd_TOPBDII");
                // Getting the NUCLEMD WMS from the portlet request for the EUMED VO
                String[] eumed_nuclemd_WMS = request.getParameterValues("eumed_nuclemd_WMS");
                // Getting the NUCLEMD ETOKENSERVER from the portlet request for the EUMED VO
                String eumed_nuclemd_ETOKENSERVER = request.getParameter("eumed_nuclemd_ETOKENSERVER");
                // Getting the NUCLEMD MYPROXYSERVER from the portlet request for the EUMED VO
                String eumed_nuclemd_MYPROXYSERVER = request.getParameter("eumed_nuclemd_MYPROXYSERVER");
                // Getting the NUCLEMD PORT from the portlet request for the EUMED VO
                String eumed_nuclemd_PORT = request.getParameter("eumed_nuclemd_PORT");
                // Getting the NUCLEMD ROBOTID from the portlet request for the EUMED VO
                String eumed_nuclemd_ROBOTID = request.getParameter("eumed_nuclemd_ROBOTID");
                // Getting the NUCLEMD WEBDAV from the portlet request for the EUMED VO
                String eumed_nuclemd_WEBDAV = request.getParameter("eumed_nuclemd_WEBDAV");
                // Getting the NUCLEMD ROLE from the portlet request for the EUMED VO
                String eumed_nuclemd_ROLE = request.getParameter("eumed_nuclemd_ROLE");
                // Getting the NUCLEMD OPTIONS from the portlet request for the EUMED VO
                String[] eumed_nuclemd_OPTIONS = request.getParameterValues("eumed_nuclemd_OPTIONS");

                String eumed_nuclemd_RENEWAL = "";
                String eumed_nuclemd_DISABLEVOMS = "";

                if (eumed_nuclemd_OPTIONS == null) {
                    eumed_nuclemd_RENEWAL = "checked";
                    eumed_nuclemd_DISABLEVOMS = "unchecked";
                } else {
                    Arrays.sort(eumed_nuclemd_OPTIONS);
                    // Getting the NUCLEMD RENEWAL from the portlet preferences for the EUMED VO
                    eumed_nuclemd_RENEWAL = Arrays.binarySearch(eumed_nuclemd_OPTIONS, "enableRENEWAL") >= 0
                            ? "checked"
                            : "unchecked";
                    // Getting the NUCLEMD DISABLEVOMS from the portlet preferences for the GARUDA VO
                    eumed_nuclemd_DISABLEVOMS = Arrays.binarySearch(eumed_nuclemd_OPTIONS, "disableVOMS") >= 0
                            ? "checked"
                            : "unchecked";
                }

                int nmax = 0;
                for (int i = 0; i < eumed_nuclemd_WMS.length; i++)
                    if (eumed_nuclemd_WMS[i] != null && (!eumed_nuclemd_WMS[i].trim().equals("N/A")))
                        nmax++;

                log.info("\n\nLength=" + nmax);
                String[] eumed_nuclemd_WMS_trimmed = new String[nmax];
                for (int i = 0; i < nmax; i++) {
                    eumed_nuclemd_WMS_trimmed[i] = eumed_nuclemd_WMS[i].trim();
                    log.info("\n\nEUMED [" + i + "] WMS=[" + eumed_nuclemd_WMS_trimmed[i] + "]");
                }

                // Set the portlet preferences
                portletPreferences.setValue("eumed_nuclemd_INFRASTRUCTURE",
                        eumed_nuclemd_INFRASTRUCTURE.trim());
                portletPreferences.setValue("eumed_nuclemd_VONAME", eumed_nuclemd_VONAME.trim());
                portletPreferences.setValue("eumed_nuclemd_TOPBDII", eumed_nuclemd_TOPBDII.trim());
                portletPreferences.setValues("eumed_nuclemd_WMS", eumed_nuclemd_WMS_trimmed);
                portletPreferences.setValue("eumed_nuclemd_ETOKENSERVER", eumed_nuclemd_ETOKENSERVER.trim());
                portletPreferences.setValue("eumed_nuclemd_MYPROXYSERVER", eumed_nuclemd_MYPROXYSERVER.trim());
                portletPreferences.setValue("eumed_nuclemd_PORT", eumed_nuclemd_PORT.trim());
                portletPreferences.setValue("eumed_nuclemd_ROBOTID", eumed_nuclemd_ROBOTID.trim());
                portletPreferences.setValue("eumed_nuclemd_WEBDAV", eumed_nuclemd_WEBDAV.trim());
                portletPreferences.setValue("eumed_nuclemd_ROLE", eumed_nuclemd_ROLE.trim());
                portletPreferences.setValue("eumed_nuclemd_RENEWAL", eumed_nuclemd_RENEWAL);
                portletPreferences.setValue("eumed_nuclemd_DISABLEVOMS", eumed_nuclemd_DISABLEVOMS);

                portletPreferences.setValue("nuclemd_APPID", nuclemd_APPID.trim());
                portletPreferences.setValue("nuclemd_LOGLEVEL", nuclemd_LOGLEVEL.trim());
                portletPreferences.setValue("nuclemd_METADATA_HOST", nuclemd_METADATA_HOST.trim());
                portletPreferences.setValue("nuclemd_OUTPATH_PATH", nuclemd_OUTPUT_PATH.trim());
                portletPreferences.setValue("nuclemd_SOFTWARE", nuclemd_SOFTWARE.trim());
                portletPreferences.setValue("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
                portletPreferences.setValue("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
                portletPreferences.setValue("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
                portletPreferences.setValue("SMTP_HOST", SMTP_HOST.trim());
                portletPreferences.setValue("SENDER_MAIL", SENDER_MAIL.trim());

                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n\nPROCESS ACTION => " + action
                            + "\n- Storing the NUCLEMD portlet preferences ..."
                            + "\n\neumed_nuclemd_INFRASTRUCTURE: " + eumed_nuclemd_INFRASTRUCTURE
                            + "\neumed_nuclemd_VONAME: " + eumed_nuclemd_VONAME + "\neumed_nuclemd_TOPBDII: "
                            + eumed_nuclemd_TOPBDII + "\neumed_nuclemd_ETOKENSERVER: "
                            + eumed_nuclemd_ETOKENSERVER + "\neumed_nuclemd_MYPROXYSERVER: "
                            + eumed_nuclemd_MYPROXYSERVER + "\neumed_nuclemd_PORT: " + eumed_nuclemd_PORT
                            + "\neumed_nuclemd_ROBOTID: " + eumed_nuclemd_ROBOTID + "\neumed_nuclemd_WEBDAV: "
                            + eumed_nuclemd_WEBDAV + "\neumed_nuclemd_ROLE: " + eumed_nuclemd_ROLE
                            + "\neumed_nuclemd_RENEWAL: " + eumed_nuclemd_RENEWAL
                            + "\neumed_nuclemd_DISABLEVOMS: " + eumed_nuclemd_DISABLEVOMS

                            + "\n\nnuclemd_ENABLEINFRASTRUCTURE: " + "eumed" + "\nnuclemd_APPID: "
                            + nuclemd_APPID + "\nnuclemd_LOGLEVEL: " + nuclemd_LOGLEVEL
                            + "\nnuclemd_METADATA_HOST: " + nuclemd_METADATA_HOST + "\nnuclemd_OUTPUT_PATH: "
                            + nuclemd_OUTPUT_PATH + "\nnuclemd_SOFTWARE: " + nuclemd_SOFTWARE
                            + "\nTracking_DB_Hostname: " + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: "
                            + TRACKING_DB_USERNAME + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD
                            + "\nSMTP_HOST: " + SMTP_HOST + "\nSENDER_MAIL: " + SENDER_MAIL);
                }
            }

            if (sagrid_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")) {
                infras[3] = "sagrid";
                // Getting the NUCLEMD INFRASTRUCTURE from the portlet request for the SAGRID VO
                String sagrid_nuclemd_INFRASTRUCTURE = request.getParameter("sagrid_nuclemd_INFRASTRUCTURE");
                // Getting the NUCLEMD VONAME from the portlet request for the SAGRID VO
                String sagrid_nuclemd_VONAME = request.getParameter("sagrid_nuclemd_VONAME");
                // Getting the NUCLEMD TOPBDII from the portlet request for the SAGRID VO
                String sagrid_nuclemd_TOPBDII = request.getParameter("sagrid_nuclemd_TOPBDII");
                // Getting the NUCLEMD WMS from the portlet request for the SAGRID VO
                String[] sagrid_nuclemd_WMS = request.getParameterValues("sagrid_nuclemd_WMS");
                // Getting the NUCLEMD ETOKENSERVER from the portlet request for the SAGRID VO
                String sagrid_nuclemd_ETOKENSERVER = request.getParameter("sagrid_nuclemd_ETOKENSERVER");
                // Getting the NUCLEMD MYPROXYSERVER from the portlet request for the SAGRID VO
                String sagrid_nuclemd_MYPROXYSERVER = request.getParameter("sagrid_nuclemd_MYPROXYSERVER");
                // Getting the NUCLEMD PORT from the portlet request for the SAGRID VO
                String sagrid_nuclemd_PORT = request.getParameter("sagrid_nuclemd_PORT");
                // Getting the NUCLEMD ROBOTID from the portlet request for the SAGRID VO
                String sagrid_nuclemd_ROBOTID = request.getParameter("sagrid_nuclemd_ROBOTID");
                // Getting the NUCLEMD WEBDAV from the portlet request for the SAGRID VO
                String sagrid_nuclemd_WEBDAV = request.getParameter("sagrid_nuclemd_WEBDAV");
                // Getting the NUCLEMD ROLE from the portlet request for the SAGRID VO
                String sagrid_nuclemd_ROLE = request.getParameter("sagrid_nuclemd_ROLE");
                // Getting the NUCLEMD OPTIONS from the portlet request for the SAGRID VO
                String[] sagrid_nuclemd_OPTIONS = request.getParameterValues("sagrid_nuclemd_OPTIONS");

                String sagrid_nuclemd_RENEWAL = "";
                String sagrid_nuclemd_DISABLEVOMS = "";

                if (sagrid_nuclemd_OPTIONS == null) {
                    sagrid_nuclemd_RENEWAL = "checked";
                    sagrid_nuclemd_DISABLEVOMS = "unchecked";
                } else {
                    Arrays.sort(sagrid_nuclemd_OPTIONS);
                    // Getting the NUCLEMD RENEWAL from the portlet preferences for the SAGRID VO
                    sagrid_nuclemd_RENEWAL = Arrays.binarySearch(sagrid_nuclemd_OPTIONS, "enableRENEWAL") >= 0
                            ? "checked"
                            : "unchecked";
                    // Getting the NUCLEMD DISABLEVOMS from the portlet preferences for the SAGRID VO
                    sagrid_nuclemd_DISABLEVOMS = Arrays.binarySearch(sagrid_nuclemd_OPTIONS, "disableVOMS") >= 0
                            ? "checked"
                            : "unchecked";
                }

                int nmax = 0;
                for (int i = 0; i < sagrid_nuclemd_WMS.length; i++)
                    if (sagrid_nuclemd_WMS[i] != null && (!sagrid_nuclemd_WMS[i].trim().equals("N/A")))
                        nmax++;

                log.info("\n\nLength=" + nmax);
                String[] sagrid_nuclemd_WMS_trimmed = new String[nmax];
                for (int i = 0; i < nmax; i++) {
                    sagrid_nuclemd_WMS_trimmed[i] = sagrid_nuclemd_WMS[i].trim();
                    log.info("\n\nSAGRID [" + i + "] WMS=[" + sagrid_nuclemd_WMS_trimmed[i] + "]");
                }

                // Set the portlet preferences
                portletPreferences.setValue("sagrid_nuclemd_INFRASTRUCTURE",
                        sagrid_nuclemd_INFRASTRUCTURE.trim());
                portletPreferences.setValue("sagrid_nuclemd_VONAME", sagrid_nuclemd_VONAME.trim());
                portletPreferences.setValue("sagrid_nuclemd_TOPBDII", sagrid_nuclemd_TOPBDII.trim());
                portletPreferences.setValues("sagrid_nuclemd_WMS", sagrid_nuclemd_WMS_trimmed);
                portletPreferences.setValue("sagrid_nuclemd_ETOKENSERVER", sagrid_nuclemd_ETOKENSERVER.trim());
                portletPreferences.setValue("sagrid_nuclemd_MYPROXYSERVER",
                        sagrid_nuclemd_MYPROXYSERVER.trim());
                portletPreferences.setValue("sagrid_nuclemd_PORT", sagrid_nuclemd_PORT.trim());
                portletPreferences.setValue("sagrid_nuclemd_ROBOTID", sagrid_nuclemd_ROBOTID.trim());
                portletPreferences.setValue("sagrid_nuclemd_WEBDAV", sagrid_nuclemd_WEBDAV.trim());
                portletPreferences.setValue("sagrid_nuclemd_ROLE", sagrid_nuclemd_ROLE.trim());
                portletPreferences.setValue("sagrid_nuclemd_RENEWAL", sagrid_nuclemd_RENEWAL);
                portletPreferences.setValue("sagrid_nuclemd_DISABLEVOMS", sagrid_nuclemd_DISABLEVOMS);

                portletPreferences.setValue("nuclemd_APPID", nuclemd_APPID.trim());
                portletPreferences.setValue("nuclemd_LOGLEVEL", nuclemd_LOGLEVEL.trim());
                portletPreferences.setValue("nuclemd_METADATA_HOST", nuclemd_METADATA_HOST.trim());
                portletPreferences.setValue("nuclemd_OUTPATH_PATH", nuclemd_OUTPUT_PATH.trim());
                portletPreferences.setValue("nuclemd_SOFTWARE", nuclemd_SOFTWARE.trim());
                portletPreferences.setValue("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
                portletPreferences.setValue("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
                portletPreferences.setValue("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
                portletPreferences.setValue("SMTP_HOST", SMTP_HOST.trim());
                portletPreferences.setValue("SENDER_MAIL", SENDER_MAIL.trim());

                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n\nPROCESS ACTION => " + action
                            + "\n- Storing the NUCLEMD portlet preferences ..."
                            + "\n\nsagrid_nuclemd_INFRASTRUCTURE: " + sagrid_nuclemd_INFRASTRUCTURE
                            + "\nsagrid_nuclemd_VONAME: " + sagrid_nuclemd_VONAME + "\nsagrid_nuclemd_TOPBDII: "
                            + sagrid_nuclemd_TOPBDII + "\nsagrid_nuclemd_ETOKENSERVER: "
                            + sagrid_nuclemd_ETOKENSERVER + "\nsagrid_nuclemd_MYPROXYSERVER: "
                            + sagrid_nuclemd_MYPROXYSERVER + "\nsagrid_nuclemd_PORT: " + sagrid_nuclemd_PORT
                            + "\nsagrid_nuclemd_ROBOTID: " + sagrid_nuclemd_ROBOTID
                            + "\nsagrid_nuclemd_WEBDAV: " + sagrid_nuclemd_WEBDAV + "\neumed_nuclemd_ROLE: "
                            + sagrid_nuclemd_ROLE + "\nsagrid_nuclemd_RENEWAL: " + sagrid_nuclemd_RENEWAL
                            + "\nsagrid_nuclemd_DISABLEVOMS: " + sagrid_nuclemd_DISABLEVOMS

                            + "\n\nnuclemd_ENABLEINFRASTRUCTURE: " + "sagrid" + "\nnuclemd_APPID: "
                            + nuclemd_APPID + "\nnuclemd_LOGLEVEL: " + nuclemd_LOGLEVEL
                            + "\nnuclemd_METADATA_HOST: " + nuclemd_METADATA_HOST + "\nnuclemd_OUTPUT_PATH: "
                            + nuclemd_OUTPUT_PATH + "\nnuclemd_SOFTWARE: " + nuclemd_SOFTWARE
                            + "\nTracking_DB_Hostname: " + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: "
                            + TRACKING_DB_USERNAME + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD
                            + "\nSMTP_HOST: " + SMTP_HOST + "\nSENDER_MAIL: " + SENDER_MAIL);
                }
            }

            if (see_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")) {
                infras[4] = "see";
                // Getting the NUCLEMD INFRASTRUCTURE from the portlet request for the SEE VO
                String see_nuclemd_INFRASTRUCTURE = request.getParameter("see_nuclemd_INFRASTRUCTURE");
                // Getting the NUCLEMD VONAME from the portlet request for the SEE VO
                String see_nuclemd_VONAME = request.getParameter("see_nuclemd_VONAME");
                // Getting the NUCLEMD TOPBDII from the portlet request for the SEE VO
                String see_nuclemd_TOPBDII = request.getParameter("see_nuclemd_TOPBDII");
                // Getting the NUCLEMD WMS from the portlet request for the SEE VO
                String[] see_nuclemd_WMS = request.getParameterValues("see_nuclemd_WMS");
                // Getting the NUCLEMD ETOKENSERVER from the portlet request for the SEE VO
                String see_nuclemd_ETOKENSERVER = request.getParameter("see_nuclemd_ETOKENSERVER");
                // Getting the NUCLEMD MYPROXYSERVER from the portlet request for the SEE VO
                String see_nuclemd_MYPROXYSERVER = request.getParameter("see_nuclemd_MYPROXYSERVER");
                // Getting the NUCLEMD PORT from the portlet request for the SEE VO
                String see_nuclemd_PORT = request.getParameter("see_nuclemd_PORT");
                // Getting the NUCLEMD ROBOTID from the portlet request for the SEE VO
                String see_nuclemd_ROBOTID = request.getParameter("see_nuclemd_ROBOTID");
                // Getting the NUCLEMD WEBDAV from the portlet request for the SEE VO
                String see_nuclemd_WEBDAV = request.getParameter("see_nuclemd_WEBDAV");
                // Getting the NUCLEMD ROLE from the portlet request for the SEE VO
                String see_nuclemd_ROLE = request.getParameter("see_nuclemd_ROLE");
                // Getting the NUCLEMD OPTIONS from the portlet request for the SEE VO
                String[] see_nuclemd_OPTIONS = request.getParameterValues("see_nuclemd_OPTIONS");

                String see_nuclemd_RENEWAL = "";
                String see_nuclemd_DISABLEVOMS = "";

                if (see_nuclemd_OPTIONS == null) {
                    see_nuclemd_RENEWAL = "checked";
                    see_nuclemd_DISABLEVOMS = "unchecked";
                } else {
                    Arrays.sort(see_nuclemd_OPTIONS);
                    // Get the NUCLEMD RENEWAL from the portlet preferences for the SEE VO
                    see_nuclemd_RENEWAL = Arrays.binarySearch(see_nuclemd_OPTIONS, "enableRENEWAL") >= 0
                            ? "checked"
                            : "unchecked";
                    // Get the NUCLEMD DISABLEVOMS from the portlet preferences for the SEE VO
                    see_nuclemd_DISABLEVOMS = Arrays.binarySearch(see_nuclemd_OPTIONS, "disableVOMS") >= 0
                            ? "checked"
                            : "unchecked";
                }

                int nmax = 0;
                for (int i = 0; i < see_nuclemd_WMS.length; i++)
                    if (see_nuclemd_WMS[i] != null && (!see_nuclemd_WMS[i].trim().equals("N/A")))
                        nmax++;

                log.info("\n\nLength=" + nmax);
                String[] see_nuclemd_WMS_trimmed = new String[nmax];
                for (int i = 0; i < nmax; i++) {
                    see_nuclemd_WMS_trimmed[i] = see_nuclemd_WMS[i].trim();
                    log.info("\n\nSEE [" + i + "] WMS=[" + see_nuclemd_WMS_trimmed[i] + "]");
                }

                // Set the portlet preferences
                portletPreferences.setValue("see_nuclemd_INFRASTRUCTURE", see_nuclemd_INFRASTRUCTURE.trim());
                portletPreferences.setValue("see_nuclemd_VONAME", see_nuclemd_VONAME.trim());
                portletPreferences.setValue("see_nuclemd_TOPBDII", see_nuclemd_TOPBDII.trim());
                portletPreferences.setValues("see_nuclemd_WMS", see_nuclemd_WMS_trimmed);
                portletPreferences.setValue("see_nuclemd_ETOKENSERVER", see_nuclemd_ETOKENSERVER.trim());
                portletPreferences.setValue("see_nuclemd_MYPROXYSERVER", see_nuclemd_MYPROXYSERVER.trim());
                portletPreferences.setValue("see_nuclemd_PORT", see_nuclemd_PORT.trim());
                portletPreferences.setValue("see_nuclemd_ROBOTID", see_nuclemd_ROBOTID.trim());
                portletPreferences.setValue("see_nuclemd_WEBDAV", see_nuclemd_WEBDAV.trim());
                portletPreferences.setValue("see_nuclemd_ROLE", see_nuclemd_ROLE.trim());
                portletPreferences.setValue("see_nuclemd_RENEWAL", see_nuclemd_RENEWAL);
                portletPreferences.setValue("see_nuclemd_DISABLEVOMS", see_nuclemd_DISABLEVOMS);

                portletPreferences.setValue("nuclemd_APPID", nuclemd_APPID.trim());
                portletPreferences.setValue("nuclemd_LOGLEVEL", nuclemd_LOGLEVEL.trim());
                portletPreferences.setValue("nuclemd_METADATA_HOST", nuclemd_METADATA_HOST.trim());
                portletPreferences.setValue("nuclemd_OUTPUT_PATH", nuclemd_OUTPUT_PATH.trim());
                portletPreferences.setValue("nuclemd_SOFTWARE", nuclemd_SOFTWARE.trim());
                portletPreferences.setValue("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
                portletPreferences.setValue("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
                portletPreferences.setValue("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
                portletPreferences.setValue("SMTP_HOST", SMTP_HOST.trim());
                portletPreferences.setValue("SENDER_MAIL", SENDER_MAIL.trim());

                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n\nPROCESS ACTION => " + action
                            + "\n- Storing the NUCLEMD portlet preferences ..."
                            + "\n\nsee_nuclemd_INFRASTRUCTURE: " + see_nuclemd_INFRASTRUCTURE
                            + "\nsee_nuclemd_VONAME: " + see_nuclemd_VONAME + "\nsee_nuclemd_TOPBDII: "
                            + see_nuclemd_TOPBDII + "\nsee_nuclemd_ETOKENSERVER: " + see_nuclemd_ETOKENSERVER
                            + "\nsee_nuclemd_MYPROXYSERVER: " + see_nuclemd_MYPROXYSERVER
                            + "\nsee_nuclemd_PORT: " + see_nuclemd_PORT + "\nsee_nuclemd_ROBOTID: "
                            + see_nuclemd_ROBOTID + "\nsee_nuclemd_WEBDAV: " + see_nuclemd_WEBDAV
                            + "\nsee_nuclemd_ROLE: " + see_nuclemd_ROLE + "\nsee_nuclemd_RENEWAL: "
                            + see_nuclemd_RENEWAL + "\nsee_nuclemd_DISABLEVOMS: " + see_nuclemd_DISABLEVOMS

                            + "\n\nnuclemd_ENABLEINFRASTRUCTURE: " + "see" + "\nnuclemd_APPID: " + nuclemd_APPID
                            + "\nnuclemd_LOGLEVEL: " + nuclemd_LOGLEVEL + "\nnuclemd_METADATA_HOST: "
                            + nuclemd_METADATA_HOST + "\nnuclemd_OUTPUT_PATH: " + nuclemd_OUTPUT_PATH
                            + "\nnuclemd_SOFTWARE: " + nuclemd_SOFTWARE + "\nTracking_DB_Hostname: "
                            + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: " + TRACKING_DB_USERNAME
                            + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD + "\nSMTP_HOST: " + SMTP_HOST
                            + "\nSENDER_MAIL: " + SENDER_MAIL);
                }
            }

            if (gridit_nuclemd_ENABLEINFRASTRUCTURE.equals("checked")) {
                infras[5] = "gridit";
                // Getting the NUCLEMD INFRASTRUCTURE from the portlet request for the GRIDIT VO
                String gridit_nuclemd_INFRASTRUCTURE = request.getParameter("gridit_nuclemd_INFRASTRUCTURE");
                // Getting the NUCLEMD VONAME from the portlet request for the GRIDIT VO
                String gridit_nuclemd_VONAME = request.getParameter("gridit_nuclemd_VONAME");
                // Getting the NUCLEMD TOPBDII from the portlet request for the GRIDIT VO
                String gridit_nuclemd_TOPBDII = request.getParameter("gridit_nuclemd_TOPBDII");
                // Getting the NUCLEMD WMS from the portlet request for the GRIDIT VO
                String[] gridit_nuclemd_WMS = request.getParameterValues("gridit_nuclemd_WMS");
                // Getting the NUCLEMD ETOKENSERVER from the portlet request for the GRIDIT VO
                String gridit_nuclemd_ETOKENSERVER = request.getParameter("gridit_nuclemd_ETOKENSERVER");
                // Getting the NUCLEMD MYPROXYSERVER from the portlet request for the GRIDIT VO
                String gridit_nuclemd_MYPROXYSERVER = request.getParameter("gridit_nuclemd_MYPROXYSERVER");
                // Getting the NUCLEMD PORT from the portlet request for the GRIDIT VO
                String gridit_nuclemd_PORT = request.getParameter("gridit_nuclemd_PORT");
                // Getting the NUCLEMD ROBOTID from the portlet request for the GRIDIT VO
                String gridit_nuclemd_ROBOTID = request.getParameter("gridit_nuclemd_ROBOTID");
                // Getting the NUCLEMD WEBDAV from the portlet request for the GRIDIT VO
                String gridit_nuclemd_WEBDAV = request.getParameter("gridit_nuclemd_WEBDAV");
                // Getting the NUCLEMD ROLE from the portlet request for the GRIDIT VO
                String gridit_nuclemd_ROLE = request.getParameter("gridit_nuclemd_ROLE");
                // Getting the NUCLEMD OPTIONS from the portlet request for the GRIDIT VO
                String[] gridit_nuclemd_OPTIONS = request.getParameterValues("gridit_nuclemd_OPTIONS");

                String gridit_nuclemd_RENEWAL = "";
                String gridit_nuclemd_DISABLEVOMS = "";

                if (gridit_nuclemd_OPTIONS == null) {
                    gridit_nuclemd_RENEWAL = "checked";
                    gridit_nuclemd_DISABLEVOMS = "unchecked";
                } else {
                    Arrays.sort(gridit_nuclemd_OPTIONS);
                    // Get the NUCLEMD RENEWAL from the portlet preferences for the GRIDIT VO
                    gridit_nuclemd_RENEWAL = Arrays.binarySearch(gridit_nuclemd_OPTIONS, "enableRENEWAL") >= 0
                            ? "checked"
                            : "unchecked";
                    // Get the NUCLEMD DISABLEVOMS from the portlet preferences for the GRIDIT VO
                    gridit_nuclemd_DISABLEVOMS = Arrays.binarySearch(gridit_nuclemd_OPTIONS, "disableVOMS") >= 0
                            ? "checked"
                            : "unchecked";
                }

                int nmax = 0;
                for (int i = 0; i < gridit_nuclemd_WMS.length; i++)
                    if (gridit_nuclemd_WMS[i] != null && (!gridit_nuclemd_WMS[i].trim().equals("N/A")))
                        nmax++;

                log.info("\n\nLength=" + nmax);
                String[] gridit_nuclemd_WMS_trimmed = new String[nmax];
                for (int i = 0; i < nmax; i++) {
                    gridit_nuclemd_WMS_trimmed[i] = gridit_nuclemd_WMS[i].trim();
                    log.info("\n\nGRIDIT [" + i + "] WMS=[" + gridit_nuclemd_WMS_trimmed[i] + "]");
                }

                // Set the portlet preferences
                portletPreferences.setValue("gridit_nuclemd_INFRASTRUCTURE",
                        gridit_nuclemd_INFRASTRUCTURE.trim());
                portletPreferences.setValue("gridit_nuclemd_VONAME", gridit_nuclemd_VONAME.trim());
                portletPreferences.setValue("gridit_nuclemd_TOPBDII", gridit_nuclemd_TOPBDII.trim());
                portletPreferences.setValues("gridit_nuclemd_WMS", gridit_nuclemd_WMS_trimmed);
                portletPreferences.setValue("gridit_nuclemd_ETOKENSERVER", gridit_nuclemd_ETOKENSERVER.trim());
                portletPreferences.setValue("gridit_nuclemd_MYPROXYSERVER",
                        gridit_nuclemd_MYPROXYSERVER.trim());
                portletPreferences.setValue("gridit_nuclemd_PORT", gridit_nuclemd_PORT.trim());
                portletPreferences.setValue("gridit_nuclemd_ROBOTID", gridit_nuclemd_ROBOTID.trim());
                portletPreferences.setValue("gridit_nuclemd_WEBDAV", gridit_nuclemd_WEBDAV.trim());
                portletPreferences.setValue("gridit_nuclemd_ROLE", gridit_nuclemd_ROLE.trim());
                portletPreferences.setValue("gridit_nuclemd_RENEWAL", gridit_nuclemd_RENEWAL);
                portletPreferences.setValue("gridit_nuclemd_DISABLEVOMS", gridit_nuclemd_DISABLEVOMS);

                portletPreferences.setValue("nuclemd_APPID", nuclemd_APPID.trim());
                portletPreferences.setValue("nuclemd_LOGLEVEL", nuclemd_LOGLEVEL.trim());
                portletPreferences.setValue("nuclemd_METADATA_HOST", nuclemd_METADATA_HOST.trim());
                portletPreferences.setValue("nuclemd_OUTPUT_PATH", nuclemd_OUTPUT_PATH.trim());
                portletPreferences.setValue("nuclemd_SOFTWARE", nuclemd_SOFTWARE.trim());
                portletPreferences.setValue("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
                portletPreferences.setValue("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
                portletPreferences.setValue("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
                portletPreferences.setValue("SMTP_HOST", SMTP_HOST.trim());
                portletPreferences.setValue("SENDER_MAIL", SENDER_MAIL.trim());

                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n\nPROCESS ACTION => " + action
                            + "\n- Storing the NUCLEMD portlet preferences ..."
                            + "\n\ngridit_nuclemd_INFRASTRUCTURE: " + gridit_nuclemd_INFRASTRUCTURE
                            + "\ngridit_nuclemd_VONAME: " + gridit_nuclemd_VONAME + "\ngridit_nuclemd_TOPBDII: "
                            + gridit_nuclemd_TOPBDII + "\ngridit_nuclemd_ETOKENSERVER: "
                            + gridit_nuclemd_ETOKENSERVER + "\ngridit_nuclemd_MYPROXYSERVER: "
                            + gridit_nuclemd_MYPROXYSERVER + "\ngridit_nuclemd_PORT: " + gridit_nuclemd_PORT
                            + "\ngridit_nuclemd_ROBOTID: " + gridit_nuclemd_ROBOTID
                            + "\ngridit_nuclemd_WEBDAV: " + gridit_nuclemd_WEBDAV + "\ngridit_nuclemd_ROLE: "
                            + gridit_nuclemd_ROLE + "\ngridit_nuclemd_RENEWAL: " + gridit_nuclemd_RENEWAL
                            + "\ngridit_nuclemd_DISABLEVOMS: " + gridit_nuclemd_DISABLEVOMS

                            + "\n\nnuclemd_ENABLEINFRASTRUCTURE: " + "gridit" + "\nnuclemd_APPID: "
                            + nuclemd_APPID + "\nnuclemd_LOGLEVEL: " + nuclemd_LOGLEVEL
                            + "\nnuclemd_METADATA_HOST: " + nuclemd_METADATA_HOST + "\nnuclemd_OUTPUT_PATH: "
                            + nuclemd_OUTPUT_PATH + "\nnuclemd_SOFTWARE: " + nuclemd_SOFTWARE
                            + "\nTracking_DB_Hostname: " + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: "
                            + TRACKING_DB_USERNAME + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD
                            + "\nSMTP_HOST: " + SMTP_HOST + "\nSENDER_MAIL: " + SENDER_MAIL);
                }
            }

            for (int i = 0; i < infras.length; i++)
                log.info("\n - Infrastructure Enabled = " + infras[i]);
            portletPreferences.setValues("nuclemd_ENABLEINFRASTRUCTURE", infras);
            portletPreferences.setValue("lato_nuclemd_ENABLEINFRASTRUCTURE", infras[0]);
            portletPreferences.setValue("garuda_nuclemd_ENABLEINFRASTRUCTURE", infras[1]);
            portletPreferences.setValue("eumed_nuclemd_ENABLEINFRASTRUCTURE", infras[2]);
            portletPreferences.setValue("sagrid_nuclemd_ENABLEINFRASTRUCTURE", infras[3]);
            portletPreferences.setValue("see_nuclemd_ENABLEINFRASTRUCTURE", infras[4]);
            portletPreferences.setValue("gridit_nuclemd_ENABLEINFRASTRUCTURE", infras[5]);

            portletPreferences.store();
            response.setPortletMode(PortletMode.VIEW);
        } // end PROCESS ACTION [ CONFIG_NUCLEMD_PORTLET ]

        if (action.equals("SUBMIT_NUCLEMD_PORTLET")) {
            log.info("\nPROCESS ACTION => " + action);
            InfrastructureInfo infrastructures[] = new InfrastructureInfo[6];
            String jdlRequirements[] = new String[2];
            String nuclemd_DEFAULT_STORAGE = "";
            int MAX = 0;

            // Getting the NUCLEMD APPID from the portlet preferences
            String nuclemd_APPID = portletPreferences.getValue("nuclemd_APPID", "N/A");
            // Getting the LOGLEVEL from the portlet preferences
            String nuclemd_LOGLEVEL = portletPreferences.getValue("nuclemd_LOGLEVEL", "INFO");
            // Getting the NUCLEMD_METADATA_HOST from the portlet preferences
            String nuclemd_METADATA_HOST = portletPreferences.getValue("nuclemd_METADATA_HOST", "INFO");
            // Getting the NUCLEMD OUTPUT_PATH from the portlet preferences
            String nuclemd_OUTPUT_PATH = portletPreferences.getValue("nuclemd_OUTPUT_PATH", "/tmp");
            // Getting the NUCLEMD SOFTWARE from the portlet preferences
            String nuclemd_SOFTWARE = portletPreferences.getValue("nuclemd_SOFTWARE", "N/A");
            // Getting the TRACKING_DB_HOSTNAME from the portlet request
            String TRACKING_DB_HOSTNAME = portletPreferences.getValue("TRACKING_DB_HOSTNAME", "N/A");
            // Getting the TRACKING_DB_USERNAME from the portlet request
            String TRACKING_DB_USERNAME = portletPreferences.getValue("TRACKING_DB_USERNAME", "N/A");
            // Getting the TRACKING_DB_PASSWORD from the portlet request
            String TRACKING_DB_PASSWORD = portletPreferences.getValue("TRACKING_DB_PASSWORD", "N/A");
            // Getting the SMTP_HOST from the portlet request
            String SMTP_HOST = portletPreferences.getValue("SMTP_HOST", "N/A");
            // Getting the SENDER_MAIL from the portlet request
            String SENDER_MAIL = portletPreferences.getValue("SENDER_MAIL", "N/A");

            String lato_nuclemd_ENABLEINFRASTRUCTURE = portletPreferences
                    .getValue("lato_nuclemd_ENABLEINFRASTRUCTURE", "null");
            String garuda_nuclemd_ENABLEINFRASTRUCTURE = portletPreferences
                    .getValue("garuda_nuclemd_ENABLEINFRASTRUCTURE", "null");
            String eumed_nuclemd_ENABLEINFRASTRUCTURE = portletPreferences
                    .getValue("eumed_nuclemd_ENABLEINFRASTRUCTURE", "null");
            String sagrid_nuclemd_ENABLEINFRASTRUCTURE = portletPreferences
                    .getValue("sagrid_nuclemd_ENABLEINFRASTRUCTURE", "null");
            String see_nuclemd_ENABLEINFRASTRUCTURE = portletPreferences
                    .getValue("see_nuclemd_ENABLEINFRASTRUCTURE", "null");
            String gridit_nuclemd_ENABLEINFRASTRUCTURE = portletPreferences
                    .getValue("gridit_nuclemd_ENABLEINFRASTRUCTURE", "null");

            if (lato_nuclemd_ENABLEINFRASTRUCTURE != null && lato_nuclemd_ENABLEINFRASTRUCTURE.equals("lato")) {
                MAX++;
                // Getting the NUCLEMD VONAME from the portlet preferences for LATO
                String lato_nuclemd_INFRASTRUCTURE = portletPreferences.getValue("lato_nuclemd_INFRASTRUCTURE",
                        "N/A");
                // Getting the NUCLEMD VONAME from the portlet preferences for LATO
                String lato_nuclemd_LOGIN = portletPreferences.getValue("lato_nuclemd_LOGIN", "N/A");
                // Getting the NUCLEMD TOPPBDII from the portlet preferences for LATO
                String lato_nuclemd_PASSWD = portletPreferences.getValue("lato_nuclemd_PASSWD", "N/A");
                // Getting the NUCLEMD WMS from the portlet preferences for LATO                
                String[] lato_nuclemd_WMS = portletPreferences.getValues("lato_nuclemd_WMS", new String[5]);
                // Getting the NUCLEMD ETOKENSERVER from the portlet preferences for LATO
                String lato_nuclemd_ETOKENSERVER = portletPreferences.getValue("lato_nuclemd_ETOKENSERVER",
                        "N/A");
                // Getting the NUCLEMD MYPROXYSERVER from the portlet preferences for LATO
                String lato_nuclemd_MYPROXYSERVER = portletPreferences.getValue("lato_nuclemd_MYPROXYSERVER",
                        "N/A");
                // Getting the NUCLEMD PORT from the portlet preferences for LATO
                String lato_nuclemd_PORT = portletPreferences.getValue("lato_nuclemd_PORT", "N/A");
                // Getting the NUCLEMD ROBOTID from the portlet preferences for LATO
                String lato_nuclemd_ROBOTID = portletPreferences.getValue("lato_nuclemd_ROBOTID", "N/A");
                // Getting the NUCLEMD WEBDAV from the portlet preferences for LATO
                String lato_nuclemd_WEBDAV = portletPreferences.getValue("lato_nuclemd_WEBDAV", "N/A");
                // Getting the NUCLEMD ROLE from the portlet preferences for LATO
                String lato_nuclemd_ROLE = portletPreferences.getValue("lato_nuclemd_ROLE", "N/A");
                // Getting the NUCLEMD RENEWAL from the portlet preferences for LATO
                String lato_nuclemd_RENEWAL = portletPreferences.getValue("lato_nuclemd_RENEWAL", "checked");
                // Getting the NUCLEMD DISABLEVOMS from the portlet preferences for LATO
                String lato_nuclemd_DISABLEVOMS = portletPreferences.getValue("lato_nuclemd_DISABLEVOMS",
                        "unchecked");

                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n- Getting the NUCLEMD portlet preferences ..."
                            + "\nlato_nuclemd_INFRASTRUCTURE: " + lato_nuclemd_INFRASTRUCTURE
                            + "\nlato_nuclemd_LOGIN: " + lato_nuclemd_LOGIN + "\nlato_nuclemd_PASSWD: "
                            + lato_nuclemd_PASSWD + "\nlato_nuclemd_ETOKENSERVER: " + lato_nuclemd_ETOKENSERVER
                            + "\nlato_nuclemd_MYPROXYSERVER: " + lato_nuclemd_MYPROXYSERVER
                            + "\nlato_nuclemd_PORT: " + lato_nuclemd_PORT + "\nlato_nuclemd_ROBOTID: "
                            + lato_nuclemd_ROBOTID + "\nlato_nuclemd_WEBDAV: " + lato_nuclemd_WEBDAV
                            + "\nlato_nuclemd_ROLE: " + lato_nuclemd_ROLE + "\nlato_nuclemd_RENEWAL: "
                            + lato_nuclemd_RENEWAL + "\nlato_nuclemd_DISABLEVOMS: " + lato_nuclemd_DISABLEVOMS

                            + "\n\nnuclemd_ENABLEINFRASTRUCTURE: " + lato_nuclemd_ENABLEINFRASTRUCTURE
                            + "\nnuclemd_APPID: " + nuclemd_APPID + "\nnuclemd_LOGLEVEL: " + nuclemd_LOGLEVEL
                            + "\nnuclemd_METADATA_HOST: " + nuclemd_METADATA_HOST + "\nnuclemd_OUTPUT_PATH: "
                            + nuclemd_OUTPUT_PATH + "\nnuclemd_SOFTWARE: " + nuclemd_SOFTWARE
                            + "\nTracking_DB_Hostname: " + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: "
                            + TRACKING_DB_USERNAME + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD
                            + "\nSMTP_HOST: " + SMTP_HOST + "\nSENDER_MAIL: " + SENDER_MAIL);
                }

                // Defining the WMS list for the "LATO" Infrastructure
                int nmax = 0;
                for (int i = 0; i < lato_nuclemd_WMS.length; i++)
                    if ((lato_nuclemd_WMS[i] != null) && (!lato_nuclemd_WMS[i].equals("N/A")))
                        nmax++;

                String lato_wmsList[] = new String[nmax];
                for (int i = 0; i < nmax; i++) {
                    if (lato_nuclemd_WMS[i] != null) {
                        lato_wmsList[i] = lato_nuclemd_WMS[i].trim();
                        log.info("\n\n[" + nmax + "] Submit to LATO [" + i + "] using WMS=[" + lato_wmsList[i]
                                + "]");
                    }
                }

                infrastructures[0] = new InfrastructureInfo("SSH", "ssh", lato_nuclemd_LOGIN,
                        lato_nuclemd_PASSWD, lato_wmsList);
            }

            if (garuda_nuclemd_ENABLEINFRASTRUCTURE != null
                    && garuda_nuclemd_ENABLEINFRASTRUCTURE.equals("garuda")) {
                MAX++;
                // Getting the NUCLEMDVONAME from the portlet preferences for the GARUDA VO
                String garuda_nuclemd_INFRASTRUCTURE = portletPreferences
                        .getValue("garuda_nuclemd_INFRASTRUCTURE", "N/A");
                // Getting the NUCLEMD VONAME from the portlet preferences for the GARUDA VO
                String garuda_nuclemd_VONAME = portletPreferences.getValue("garuda_nuclemd_VONAME", "N/A");
                // Getting the NUCLEMD TOPPBDII from the portlet preferences for the GARUDA VO
                String garuda_nuclemd_TOPBDII = portletPreferences.getValue("garuda_nuclemd_TOPBDII", "N/A");
                // Getting the NUCLEMD WMS from the portlet preferences for the GARUDA VO                
                String[] garuda_nuclemd_WMS = portletPreferences.getValues("garuda_nuclemd_WMS", new String[5]);
                // Getting the NUCLEMD ETOKENSERVER from the portlet preferences for the GARUDA VO
                String garuda_nuclemd_ETOKENSERVER = portletPreferences.getValue("garuda_nuclemd_ETOKENSERVER",
                        "N/A");
                // Getting the NUCLEMD MYPROXYSERVER from the portlet preferences for the GARUDA VO
                String garuda_nuclemd_MYPROXYSERVER = portletPreferences
                        .getValue("garuda_nuclemd_MYPROXYSERVER", "N/A");
                // Getting the NUCLEMD PORT from the portlet preferences for the GARUDA VO
                String garuda_nuclemd_PORT = portletPreferences.getValue("garuda_nuclemd_PORT", "N/A");
                // Getting the NUCLEMD ROBOTID from the portlet preferences for the GARUDA VO
                String garuda_nuclemd_ROBOTID = portletPreferences.getValue("garuda_nuclemd_ROBOTID", "N/A");
                // Getting the NUCLEMD WEBDAV from the portlet preferences for the GARUDA VO
                String garuda_nuclemd_WEBDAV = portletPreferences.getValue("garuda_nuclemd_WEBDAV", "N/A");
                // Getting the NUCLEMD ROLE from the portlet preferences for the GARUDA VO
                String garuda_nuclemd_ROLE = portletPreferences.getValue("garuda_nuclemd_ROLE", "N/A");
                // Getting the NUCLEMD RENEWAL from the portlet preferences for the GARUDA VO
                String garuda_nuclemd_RENEWAL = portletPreferences.getValue("garuda_nuclemd_RENEWAL",
                        "checked");
                // Getting the NUCLEMD DISABLEVOMS from the portlet preferences for the GARUDA VO
                String garuda_nuclemd_DISABLEVOMS = portletPreferences.getValue("garuda_nuclemd_DISABLEVOMS",
                        "unchecked");

                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n- Getting the NUCLEMD portlet preferences ..."
                            + "\ngaruda_nuclemd_INFRASTRUCTURE: " + garuda_nuclemd_INFRASTRUCTURE
                            + "\ngaruda_nuclemd_VONAME: " + garuda_nuclemd_VONAME + "\ngaruda_nuclemd_TOPBDII: "
                            + garuda_nuclemd_TOPBDII + "\ngaruda_nuclemd_ETOKENSERVER: "
                            + garuda_nuclemd_ETOKENSERVER + "\ngaruda_nuclemd_MYPROXYSERVER: "
                            + garuda_nuclemd_MYPROXYSERVER + "\ngaruda_nuclemd_PORT: " + garuda_nuclemd_PORT
                            + "\ngaruda_nuclemd_ROBOTID: " + garuda_nuclemd_ROBOTID
                            + "\ngaruda_nuclemd_WEBDAV: " + garuda_nuclemd_WEBDAV + "\ngaruda_nuclemd_ROLE: "
                            + garuda_nuclemd_ROLE + "\ngaruda_nuclemd_RENEWAL: " + garuda_nuclemd_RENEWAL
                            + "\ngaruda_nuclemd_DISABLEVOMS: " + garuda_nuclemd_DISABLEVOMS

                            + "\n\nnuclemd_ENABLEINFRASTRUCTURE: " + garuda_nuclemd_ENABLEINFRASTRUCTURE
                            + "\nnuclemd_APPID: " + nuclemd_APPID + "\nnuclemd_LOGLEVEL: " + nuclemd_LOGLEVEL
                            + "\nnuclemd_METADATA_HOST: " + nuclemd_METADATA_HOST + "\nnuclemd_OUTPUT_PATH: "
                            + nuclemd_OUTPUT_PATH + "\nnuclemd_SOFTWARE: " + nuclemd_SOFTWARE
                            + "\nTracking_DB_Hostname: " + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: "
                            + TRACKING_DB_USERNAME + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD
                            + "\nSMTP_HOST: " + SMTP_HOST + "\nSENDER_MAIL: " + SENDER_MAIL);
                }

                // Defining the WMS list for the "GARUDA" Infrastructure
                int nmax = 0;
                for (int i = 0; i < garuda_nuclemd_WMS.length; i++)
                    if ((garuda_nuclemd_WMS[i] != null) && (!garuda_nuclemd_WMS[i].equals("N/A")))
                        nmax++;

                String wmsList[] = new String[nmax];
                for (int i = 0; i < nmax; i++) {
                    if (garuda_nuclemd_WMS[i] != null) {
                        wmsList[i] = garuda_nuclemd_WMS[i].trim();
                        log.info("\n\n[" + nmax + "] Submit to GARUDA [" + i + "] using WMSGRAM=[" + wmsList[i]
                                + "]");
                    }
                }

                infrastructures[1] = new InfrastructureInfo("GARUDA", "wsgram", "", wmsList,
                        garuda_nuclemd_ETOKENSERVER, garuda_nuclemd_PORT, garuda_nuclemd_ROBOTID,
                        garuda_nuclemd_VONAME, garuda_nuclemd_ROLE);
            }

            if (eumed_nuclemd_ENABLEINFRASTRUCTURE != null
                    && eumed_nuclemd_ENABLEINFRASTRUCTURE.equals("eumed")) {
                MAX++;
                // Getting the NUCLEMD VONAME from the portlet preferences for the EUMED VO
                String eumed_nuclemd_INFRASTRUCTURE = portletPreferences
                        .getValue("eumed_nuclemd_INFRASTRUCTURE", "N/A");
                // Getting the NUCLEMD VONAME from the portlet preferences for the EUMED VO
                String eumed_nuclemd_VONAME = portletPreferences.getValue("eumed_nuclemd_VONAME", "N/A");
                // Getting the NUCLEMD TOPPBDII from the portlet preferences for the EUMED VO
                String eumed_nuclemd_TOPBDII = portletPreferences.getValue("eumed_nuclemd_TOPBDII", "N/A");
                // Getting the NUCLEMD WMS from the portlet preferences for the EUMED VO
                String[] eumed_nuclemd_WMS = portletPreferences.getValues("eumed_nuclemd_WMS", new String[5]);
                // Getting the NUCLEMD ETOKENSERVER from the portlet preferences for the EUMED VO
                String eumed_nuclemd_ETOKENSERVER = portletPreferences.getValue("eumed_nuclemd_ETOKENSERVER",
                        "N/A");
                // Getting the NUCLEMD MYPROXYSERVER from the portlet preferences for the EUMED VO
                String eumed_nuclemd_MYPROXYSERVER = portletPreferences.getValue("eumed_nuclemd_MYPROXYSERVER",
                        "N/A");
                // Getting the NUCLEMD PORT from the portlet preferences for the EUMED VO
                String eumed_nuclemd_PORT = portletPreferences.getValue("eumed_nuclemd_PORT", "N/A");
                // Getting the NUCLEMD ROBOTID from the portlet preferences for the EUMED VO
                String eumed_nuclemd_ROBOTID = portletPreferences.getValue("eumed_nuclemd_ROBOTID", "N/A");
                // Getting the NUCLEMD WEBDAV from the portlet preferences for the EUMED VO
                String eumed_nuclemd_WEBDAV = portletPreferences.getValue("eumed_nuclemd_WEBDAV", "N/A");
                // Getting the NUCLEMD ROLE from the portlet preferences for the EUMED VO
                String eumed_nuclemd_ROLE = portletPreferences.getValue("eumed_nuclemd_ROLE", "N/A");
                // Getting the NUCLEMD RENEWAL from the portlet preferences for the EUMED VO
                String eumed_nuclemd_RENEWAL = portletPreferences.getValue("eumed_nuclemd_RENEWAL", "checked");
                // Getting the NUCLEMD DISABLEVOMS from the portlet preferences for the EUMED VO
                String eumed_nuclemd_DISABLEVOMS = portletPreferences.getValue("eumed_nuclemd_DISABLEVOMS",
                        "unchecked");
                nuclemd_DEFAULT_STORAGE = eumed_nuclemd_WEBDAV;

                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n- Getting the NUCLEMD portlet preferences ..."
                            + "\n\neumed_nuclemd_INFRASTRUCTURE: " + eumed_nuclemd_INFRASTRUCTURE
                            + "\neumed_nuclemd_VONAME: " + eumed_nuclemd_VONAME + "\neumed_nuclemd_TOPBDII: "
                            + eumed_nuclemd_TOPBDII + "\neumed_nuclemd_ETOKENSERVER: "
                            + eumed_nuclemd_ETOKENSERVER + "\neumed_nuclemd_MYPROXYSERVER: "
                            + eumed_nuclemd_MYPROXYSERVER + "\neumed_nuclemd_PORT: " + eumed_nuclemd_PORT
                            + "\neumed_nuclemd_ROBOTID: " + eumed_nuclemd_ROBOTID + "\neumed_nuclemd_WEBDAV: "
                            + eumed_nuclemd_WEBDAV + "\neumed_nuclemd_ROLE: " + eumed_nuclemd_ROLE
                            + "\neumed_nuclemd_RENEWAL: " + eumed_nuclemd_RENEWAL
                            + "\neumed_nuclemd_DISABLEVOMS: " + eumed_nuclemd_DISABLEVOMS

                            + "\n\nnuclemd_ENABLEINFRASTRUCTURE: " + eumed_nuclemd_ENABLEINFRASTRUCTURE
                            + "\nnuclemd_APPID: " + nuclemd_APPID + "\nnuclemd_LOGLEVEL: " + nuclemd_LOGLEVEL
                            + "\nnuclemd_METADATA_HOST: " + nuclemd_METADATA_HOST
                            + "\nnuclemd_DEFAULT_STORAGE: " + nuclemd_DEFAULT_STORAGE
                            + "\nnuclemd_OUTPUT_PATH: " + nuclemd_OUTPUT_PATH + "\nnuclemd_SOFTWARE: "
                            + nuclemd_SOFTWARE + "\nTracking_DB_Hostname: " + TRACKING_DB_HOSTNAME
                            + "\nTracking_DB_Username: " + TRACKING_DB_USERNAME + "\nTracking_DB_Password: "
                            + TRACKING_DB_PASSWORD + "\nSMTP_HOST: " + SMTP_HOST + "\nSENDER_MAIL: "
                            + SENDER_MAIL);
                }

                // Defining the WMS list for the "EUMED" Infrastructure
                int nmax = 0;
                for (int i = 0; i < eumed_nuclemd_WMS.length; i++)
                    if ((eumed_nuclemd_WMS[i] != null) && (!eumed_nuclemd_WMS[i].equals("N/A")))
                        nmax++;

                String wmsList[] = new String[nmax];
                for (int i = 0; i < nmax; i++) {
                    if (eumed_nuclemd_WMS[i] != null) {
                        wmsList[i] = eumed_nuclemd_WMS[i].trim();
                        log.info("\n\n[" + nmax + "] Submit to EUMED [" + i + "] using WMS=[" + wmsList[i]
                                + "]");
                    }
                }

                // Setting the JDL Requirements
                String[] SOFTWARE_LIST = nuclemd_SOFTWARE.split(",");
                int index = 0;

                for (String SOFTWARE : SOFTWARE_LIST) {
                    jdlRequirements[index++] = "VO-" + eumed_nuclemd_VONAME + "-" + SOFTWARE;
                }

                infrastructures[2] = new InfrastructureInfo(eumed_nuclemd_VONAME, eumed_nuclemd_TOPBDII,
                        wmsList, eumed_nuclemd_ETOKENSERVER, eumed_nuclemd_PORT, eumed_nuclemd_ROBOTID,
                        eumed_nuclemd_VONAME, eumed_nuclemd_ROLE, true, // set the RFC proxy for the infrastructure                            
                        jdlRequirements[0] + "," + jdlRequirements[1]);
                //"VO-" + eumed_nuclemd_VONAME + "-" + nuclemd_SOFTWARE);
            }

            if (sagrid_nuclemd_ENABLEINFRASTRUCTURE != null
                    && sagrid_nuclemd_ENABLEINFRASTRUCTURE.equals("sagrid")) {
                MAX++;
                // Getting the NUCLEMD VONAME from the portlet preferences for the SAGRID VO
                String sagrid_nuclemd_INFRASTRUCTURE = portletPreferences
                        .getValue("sagrid_nuclemd_INFRASTRUCTURE", "N/A");
                // Getting the NUCLEMD VONAME from the portlet preferences for the SAGRID VO
                String sagrid_nuclemd_VONAME = portletPreferences.getValue("sagrid_nuclemd_VONAME", "N/A");
                // Getting the NUCLEMD TOPPBDII from the portlet preferences for the SAGRID VO
                String sagrid_nuclemd_TOPBDII = portletPreferences.getValue("sagrid_nuclemd_TOPBDII", "N/A");
                // Getting the NUCLEMD WMS from the portlet preferences for the SAGRID VO
                String[] sagrid_nuclemd_WMS = portletPreferences.getValues("sagrid_nuclemd_WMS", new String[5]);
                // Getting the NUCLEMD ETOKENSERVER from the portlet preferences for the SAGRID VO
                String sagrid_nuclemd_ETOKENSERVER = portletPreferences.getValue("sagrid_nuclemd_ETOKENSERVER",
                        "N/A");
                // Getting the NUCLEMD MYPROXYSERVER from the portlet preferences for the SAGRID VO
                String sagrid_nuclemd_MYPROXYSERVER = portletPreferences
                        .getValue("sagrid_nuclemd_MYPROXYSERVER", "N/A");
                // Getting the NUCLEMD PORT from the portlet preferences for the SAGRID VO
                String sagrid_nuclemd_PORT = portletPreferences.getValue("sagrid_nuclemd_PORT", "N/A");
                // Getting the NUCLEMD ROBOTID from the portlet preferences for the SAGRID VO
                String sagrid_nuclemd_ROBOTID = portletPreferences.getValue("sagrid_nuclemd_ROBOTID", "N/A");
                // Getting the NUCLEMD WEBDAV from the portlet preferences for the SAGRID VO
                String sagrid_nuclemd_WEBDAV = portletPreferences.getValue("sagrid_nuclemd_WEBDAV", "N/A");
                // Getting the NUCLEMD ROLE from the portlet preferences for the SAGRID VO
                String sagrid_nuclemd_ROLE = portletPreferences.getValue("sagrid_nuclemd_ROLE", "N/A");
                // Getting the NUCLEMD RENEWAL from the portlet preferences for the SAGRID VO
                String sagrid_nuclemd_RENEWAL = portletPreferences.getValue("sagrid_nuclemd_RENEWAL",
                        "checked");
                // Getting the NUCLEMD DISABLEVOMS from the portlet preferences for the SAGRID VO
                String sagrid_nuclemd_DISABLEVOMS = portletPreferences.getValue("sagrid_nuclemd_DISABLEVOMS",
                        "unchecked");
                nuclemd_DEFAULT_STORAGE = sagrid_nuclemd_WEBDAV;

                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n- Getting the NUCLEMD portlet preferences ..."
                            + "\n\nsagrid_nuclemd_INFRASTRUCTURE: " + sagrid_nuclemd_INFRASTRUCTURE
                            + "\nsagrid_nuclemd_VONAME: " + sagrid_nuclemd_VONAME + "\nsagrid_nuclemd_TOPBDII: "
                            + sagrid_nuclemd_TOPBDII + "\nsagrid_nuclemd_ETOKENSERVER: "
                            + sagrid_nuclemd_ETOKENSERVER + "\nsagrid_nuclemd_MYPROXYSERVER: "
                            + sagrid_nuclemd_MYPROXYSERVER + "\nsagrid_nuclemd_PORT: " + sagrid_nuclemd_PORT
                            + "\nsagrid_nuclemd_ROBOTID: " + sagrid_nuclemd_ROBOTID
                            + "\nsagrid_nuclemd_WEBDAV: " + sagrid_nuclemd_WEBDAV + "\nsagrid_nuclemd_ROLE: "
                            + sagrid_nuclemd_ROLE + "\nsagrid_nuclemd_RENEWAL: " + sagrid_nuclemd_RENEWAL
                            + "\nsagrid_nuclemd_DISABLEVOMS: " + sagrid_nuclemd_DISABLEVOMS

                            + "\n\nnuclemd_ENABLEINFRASTRUCTURE: " + eumed_nuclemd_ENABLEINFRASTRUCTURE
                            + "\nnuclemd_APPID: " + nuclemd_APPID + "\nnuclemd_LOGLEVEL: " + nuclemd_LOGLEVEL
                            + "\nnuclemd_METADATA_HOST: " + nuclemd_METADATA_HOST
                            + "\nnuclemd_DEFAULT_STORAGE: " + nuclemd_DEFAULT_STORAGE
                            + "\nnuclemd_OUTPUT_PATH: " + nuclemd_OUTPUT_PATH + "\nnuclemd_SOFTWARE: "
                            + nuclemd_SOFTWARE + "\nTracking_DB_Hostname: " + TRACKING_DB_HOSTNAME
                            + "\nTracking_DB_Username: " + TRACKING_DB_USERNAME + "\nTracking_DB_Password: "
                            + TRACKING_DB_PASSWORD + "\nSMTP_HOST: " + SMTP_HOST + "\nSENDER_MAIL: "
                            + SENDER_MAIL);
                }

                // Defining the WMS list for the "SAGRID" Infrastructure
                int nmax = 0;
                for (int i = 0; i < sagrid_nuclemd_WMS.length; i++)
                    if ((sagrid_nuclemd_WMS[i] != null) && (!sagrid_nuclemd_WMS[i].equals("N/A")))
                        nmax++;

                String wmsList[] = new String[nmax];
                for (int i = 0; i < nmax; i++) {
                    if (sagrid_nuclemd_WMS[i] != null) {
                        wmsList[i] = sagrid_nuclemd_WMS[i].trim();
                        log.info("\n\n[" + nmax + "] Submit to SAGRID [" + i + "] using WMS=[" + wmsList[i]
                                + "]");
                    }
                }

                // Setting the JDL Requirements
                String[] SOFTWARE_LIST = nuclemd_SOFTWARE.split(",");
                int index = 0;

                for (String SOFTWARE : SOFTWARE_LIST) {
                    jdlRequirements[index++] = "VO-" + sagrid_nuclemd_VONAME + "-" + SOFTWARE;
                }

                infrastructures[3] = new InfrastructureInfo(sagrid_nuclemd_VONAME, sagrid_nuclemd_TOPBDII,
                        wmsList, sagrid_nuclemd_ETOKENSERVER, sagrid_nuclemd_PORT, sagrid_nuclemd_ROBOTID,
                        sagrid_nuclemd_VONAME, sagrid_nuclemd_ROLE, true, // set the RFC proxy for the infrastructure                            
                        jdlRequirements[0] + "," + jdlRequirements[1]);
                //"VO-" + sagrid_nuclemd_VONAME + "-" + nuclemd_SOFTWARE);
            }

            if (see_nuclemd_ENABLEINFRASTRUCTURE != null && see_nuclemd_ENABLEINFRASTRUCTURE.equals("see")) {
                MAX++;
                // Getting the NUCLEMD VONAME from the portlet preferences for the SEE VO
                String see_nuclemd_INFRASTRUCTURE = portletPreferences.getValue("see_nuclemd_INFRASTRUCTURE",
                        "N/A");
                // Getting the NUCLEMD VONAME from the portlet preferences for the SEE VO
                String see_nuclemd_VONAME = portletPreferences.getValue("see_nuclemd_VONAME", "N/A");
                // Getting the NUCLEMD TOPPBDII from the portlet preferences for the SEE VO
                String see_nuclemd_TOPBDII = portletPreferences.getValue("see_nuclemd_TOPBDII", "N/A");
                // Getting the NUCLEMD WMS from the portlet preferences for the SEE VO
                String[] see_nuclemd_WMS = portletPreferences.getValues("see_nuclemd_WMS", new String[5]);
                // Getting the NUCLEMD ETOKENSERVER from the portlet preferences for the SEE VO
                String see_nuclemd_ETOKENSERVER = portletPreferences.getValue("see_nuclemd_ETOKENSERVER",
                        "N/A");
                // Getting the NUCLEMD MYPROXYSERVER from the portlet preferences for the SEE VO
                String see_nuclemd_MYPROXYSERVER = portletPreferences.getValue("see_nuclemd_MYPROXYSERVER",
                        "N/A");
                // Getting the NUCLEMD PORT from the portlet preferences for the SEE VO
                String see_nuclemd_PORT = portletPreferences.getValue("see_nuclemd_PORT", "N/A");
                // Getting the NUCLEMD ROBOTID from the portlet preferences for the SEE VO
                String see_nuclemd_ROBOTID = portletPreferences.getValue("see_nuclemd_ROBOTID", "N/A");
                // Getting the NUCLEMD WEBDAV from the portlet preferences for the SEE VO
                String see_nuclemd_WEBDAV = portletPreferences.getValue("see_nuclemd_WEBDAV", "N/A");
                // Getting the NUCLEMD ROLE from the portlet preferences for the SEE VO
                String see_nuclemd_ROLE = portletPreferences.getValue("see_nuclemd_ROLE", "N/A");
                // Getting the NUCLEMD RENEWAL from the portlet preferences for the SEE VO
                String see_nuclemd_RENEWAL = portletPreferences.getValue("see_nuclemd_RENEWAL", "checked");
                // Getting the NUCLEMD DISABLEVOMS from the portlet preferences for the SEE VO
                String see_nuclemd_DISABLEVOMS = portletPreferences.getValue("see_nuclemd_DISABLEVOMS",
                        "unchecked");
                nuclemd_DEFAULT_STORAGE = see_nuclemd_WEBDAV;

                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n- Getting the NUCLEMD portlet preferences ..."
                            + "\n\nsee_nuclemd_INFRASTRUCTURE: " + see_nuclemd_INFRASTRUCTURE
                            + "\nsee_nuclemd_VONAME: " + see_nuclemd_VONAME + "\nsee_nuclemd_TOPBDII: "
                            + see_nuclemd_TOPBDII + "\nsee_nuclemd_ETOKENSERVER: " + see_nuclemd_ETOKENSERVER
                            + "\nsee_nuclemd_MYPROXYSERVER: " + see_nuclemd_MYPROXYSERVER
                            + "\nsee_nuclemd_PORT: " + see_nuclemd_PORT + "\nsee_nuclemd_ROBOTID: "
                            + see_nuclemd_ROBOTID + "\nsee_nuclemd_WEBDAV: " + see_nuclemd_WEBDAV
                            + "\nsee_nuclemd_ROLE: " + see_nuclemd_ROLE + "\nsee_nuclemd_RENEWAL: "
                            + see_nuclemd_RENEWAL + "\nsee_nuclemd_DISABLEVOMS: " + see_nuclemd_DISABLEVOMS

                            + "\n\nnuclemd_ENABLEINFRASTRUCTURE: " + see_nuclemd_ENABLEINFRASTRUCTURE
                            + "\nnuclemd_APPID: " + nuclemd_APPID + "\nnuclemd_LOGLEVEL: " + nuclemd_LOGLEVEL
                            + "\nnuclemd_METADATA_HOST: " + nuclemd_METADATA_HOST
                            + "\nnuclemd_DEFAULT_STORAGE: " + nuclemd_DEFAULT_STORAGE
                            + "\nnuclemd_OUTPUT_PATH: " + nuclemd_OUTPUT_PATH + "\nnuclemd_SOFTWARE: "
                            + nuclemd_SOFTWARE + "\nTracking_DB_Hostname: " + TRACKING_DB_HOSTNAME
                            + "\nTracking_DB_Username: " + TRACKING_DB_USERNAME + "\nTracking_DB_Password: "
                            + TRACKING_DB_PASSWORD + "\nSMTP_HOST: " + SMTP_HOST + "\nSENDER_MAIL: "
                            + SENDER_MAIL);
                }

                // Defining the WMS list for the "SEE" Infrastructure
                int nmax = 0;
                for (int i = 0; i < see_nuclemd_WMS.length; i++)
                    if ((see_nuclemd_WMS[i] != null) && (!see_nuclemd_WMS[i].equals("N/A")))
                        nmax++;

                String wmsList[] = new String[see_nuclemd_WMS.length];
                for (int i = 0; i < see_nuclemd_WMS.length; i++) {
                    if (see_nuclemd_WMS[i] != null) {
                        wmsList[i] = see_nuclemd_WMS[i].trim();
                        log.info("\n\nSubmit for SEE [" + i + "] using WMS=[" + wmsList[i] + "]");
                    }
                }

                // Setting the JDL Requirements
                String[] SOFTWARE_LIST = nuclemd_SOFTWARE.split(",");
                int index = 0;

                for (String SOFTWARE : SOFTWARE_LIST) {
                    jdlRequirements[index++] = "VO-" + see_nuclemd_VONAME + "-" + SOFTWARE;
                }

                infrastructures[4] = new InfrastructureInfo(see_nuclemd_VONAME, see_nuclemd_TOPBDII, wmsList,
                        see_nuclemd_ETOKENSERVER, see_nuclemd_PORT, see_nuclemd_ROBOTID, see_nuclemd_VONAME,
                        see_nuclemd_ROLE, true, // set the RFC proxy for the infrastructure
                        jdlRequirements[0] + "," + jdlRequirements[1]);
                //"VO-" + see_nuclemd_VONAME + "-" + nuclemd_SOFTWARE);                                                            
            }

            if (gridit_nuclemd_ENABLEINFRASTRUCTURE != null
                    && gridit_nuclemd_ENABLEINFRASTRUCTURE.equals("gridit")) {
                MAX++;
                // Getting the NUCLEMD VONAME from the portlet preferences for the GRIDIT VO
                String gridit_nuclemd_INFRASTRUCTURE = portletPreferences
                        .getValue("gridit_nuclemd_INFRASTRUCTURE", "N/A");
                // Getting the NUCLEMD VONAME from the portlet preferences for the GRIDIT VO
                String gridit_nuclemd_VONAME = portletPreferences.getValue("gridit_nuclemd_VONAME", "N/A");
                // Getting the NUCLEMD TOPPBDII from the portlet preferences for the GRIDIT VO
                String gridit_nuclemd_TOPBDII = portletPreferences.getValue("gridit_nuclemd_TOPBDII", "N/A");
                // Getting the NUCLEMD WMS from the portlet preferences for the GRIDIT VO
                String[] gridit_nuclemd_WMS = portletPreferences.getValues("gridit_nuclemd_WMS", new String[5]);
                // Getting the NUCLEMD ETOKENSERVER from the portlet preferences for the GRIDIT VO
                String gridit_nuclemd_ETOKENSERVER = portletPreferences.getValue("gridit_nuclemd_ETOKENSERVER",
                        "N/A");
                // Getting the NUCLEMD MYPROXYSERVER from the portlet preferences for the GRIDIT VO
                String gridit_nuclemd_MYPROXYSERVER = portletPreferences
                        .getValue("gridit_nuclemd_MYPROXYSERVER", "N/A");
                // Getting the NUCLEMD PORT from the portlet preferences for the GRIDIT VO
                String gridit_nuclemd_PORT = portletPreferences.getValue("gridit_nuclemd_PORT", "N/A");
                // Getting the NUCLEMD ROBOTID from the portlet preferences for the GRIDIT VO
                String gridit_nuclemd_ROBOTID = portletPreferences.getValue("gridit_nuclemd_ROBOTID", "N/A");
                // Getting the NUCLEMD WEBDAV from the portlet preferences for the GRIDIT VO
                String gridit_nuclemd_WEBDAV = portletPreferences.getValue("gridit_nuclemd_WEBDAV", "N/A");
                // Getting the NUCLEMD ROLE from the portlet preferences for the GRIDIT VO
                String gridit_nuclemd_ROLE = portletPreferences.getValue("gridit_nuclemd_ROLE", "N/A");
                // Getting the NUCLEMD RENEWAL from the portlet preferences for the GRIDIT VO
                String gridit_nuclemd_RENEWAL = portletPreferences.getValue("gridit_nuclemd_RENEWAL",
                        "checked");
                // Getting the NUCLEMD DISABLEVOMS from the portlet preferences for the GRIDIT VO
                String gridit_nuclemd_DISABLEVOMS = portletPreferences.getValue("gridit_nuclemd_DISABLEVOMS",
                        "unchecked");
                nuclemd_DEFAULT_STORAGE = gridit_nuclemd_WEBDAV;

                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n- Getting the NUCLEMD portlet preferences ..."
                            + "\n\ngridit_nuclemd_INFRASTRUCTURE: " + gridit_nuclemd_INFRASTRUCTURE
                            + "\ngridit_nuclemd_VONAME: " + gridit_nuclemd_VONAME + "\ngridit_nuclemd_TOPBDII: "
                            + gridit_nuclemd_TOPBDII + "\ngridit_nuclemd_ETOKENSERVER: "
                            + gridit_nuclemd_ETOKENSERVER + "\ngridit_nuclemd_MYPROXYSERVER: "
                            + gridit_nuclemd_MYPROXYSERVER + "\ngridit_nuclemd_PORT: " + gridit_nuclemd_PORT
                            + "\ngridit_nuclemd_ROBOTID: " + gridit_nuclemd_ROBOTID
                            + "\ngridit_nuclemd_WEBDAV: " + gridit_nuclemd_WEBDAV + "\ngridit_nuclemd_ROLE: "
                            + gridit_nuclemd_ROLE + "\ngridit_nuclemd_RENEWAL: " + gridit_nuclemd_RENEWAL
                            + "\ngridit_nuclemd_DISABLEVOMS: " + gridit_nuclemd_DISABLEVOMS

                            + "\n\nnuclemd_ENABLEINFRASTRUCTURE: " + see_nuclemd_ENABLEINFRASTRUCTURE
                            + "\nnuclemd_APPID: " + nuclemd_APPID + "\nnuclemd_LOGLEVEL: " + nuclemd_LOGLEVEL
                            + "\nnuclemd_METADATA_HOST: " + nuclemd_METADATA_HOST
                            + "\nnuclemd_DEFAULT_STORAGE: " + nuclemd_DEFAULT_STORAGE
                            + "\nnuclemd_OUTPUT_PATH: " + nuclemd_OUTPUT_PATH + "\nnuclemd_SOFTWARE: "
                            + nuclemd_SOFTWARE + "\nTracking_DB_Hostname: " + TRACKING_DB_HOSTNAME
                            + "\nTracking_DB_Username: " + TRACKING_DB_USERNAME + "\nTracking_DB_Password: "
                            + TRACKING_DB_PASSWORD + "\nSMTP_HOST: " + SMTP_HOST + "\nSENDER_MAIL: "
                            + SENDER_MAIL);
                }

                // Defining the WMS list for the "GRIDIT" Infrastructure
                int nmax = 0;
                for (int i = 0; i < gridit_nuclemd_WMS.length; i++)
                    if ((gridit_nuclemd_WMS[i] != null) && (!gridit_nuclemd_WMS[i].equals("N/A")))
                        nmax++;

                String wmsList[] = new String[gridit_nuclemd_WMS.length];
                for (int i = 0; i < gridit_nuclemd_WMS.length; i++) {
                    if (gridit_nuclemd_WMS[i] != null) {
                        wmsList[i] = gridit_nuclemd_WMS[i].trim();
                        log.info("\n\nSubmit to GRIDIT [" + i + "] using WMS=[" + wmsList[i] + "]");
                    }
                }

                // Setting the JDL Requirements
                String[] SOFTWARE_LIST = nuclemd_SOFTWARE.split(",");
                int index = 0;

                for (String SOFTWARE : SOFTWARE_LIST) {
                    jdlRequirements[index++] = "VO-" + gridit_nuclemd_VONAME + "-" + SOFTWARE;
                }

                infrastructures[5] = new InfrastructureInfo(gridit_nuclemd_VONAME, gridit_nuclemd_TOPBDII,
                        wmsList, gridit_nuclemd_ETOKENSERVER, gridit_nuclemd_PORT, gridit_nuclemd_ROBOTID,
                        gridit_nuclemd_VONAME, gridit_nuclemd_ROLE, true); // set the RFC proxy for the infrastructure
                //jdlRequirements[0] + "," + jdlRequirements[1]);                       
            }

            String[] NUCLEMD_Parameters = new String[9];

            // Upload the input settings for the application
            NUCLEMD_Parameters = uploadNuclemdSettings(request, response, username);
            //String trimmed = NUCLEMD_Parameters[1].replaceAll("\\s", "_");

            log.info("\n\n [ NUCLEMD simulation settings ]");
            log.info("\n- Input Parameters: ");
            log.info("\n- Release = " + NUCLEMD_Parameters[8]);
            log.info("\n- Description = " + NUCLEMD_Parameters[0]);
            log.info("\n- Computing Resource = " + NUCLEMD_Parameters[1]);
            log.info("\n- Enable Notification = " + NUCLEMD_Parameters[5]);
            log.info("\n- WallClock Time = " + NUCLEMD_Parameters[6]);
            ;
            log.info("\n- Enable Demo = " + NUCLEMD_Parameters[7]);

            log.info("\n\n [ Additional settings (for the eTokenSever) ]");
            log.info("\n- Username = " + username);
            log.info("\n- Portal = " + portal);

            if (NUCLEMD_Parameters[7] == null) {
                log.info("\n- INP File = " + NUCLEMD_Parameters[2]);
                log.info("\n- CONF(1) File = " + NUCLEMD_Parameters[3]);
                log.info("\n- CONF(2) File = " + NUCLEMD_Parameters[4]);
            } else
                log.info("\n- Demo input files selected ");

            // Preparing to submit jobs in different grid infrastructure..
            //=============================================================
            // IMPORTANT: INSTANCIATE THE MultiInfrastructureJobSubmission
            //            CLASS USING THE EMPTY CONSTRUCTOR WHEN
            //            WHEN THE PORTLET IS DEPLOYED IN PRODUCTION!!!
            //=============================================================
            /*MultiInfrastructureJobSubmission NuclemdMultiJobSubmission =
            new MultiInfrastructureJobSubmission(TRACKING_DB_HOSTNAME,
                                             TRACKING_DB_USERNAME,
                                             TRACKING_DB_PASSWORD);*/

            MultiInfrastructureJobSubmission NuclemdMultiJobSubmission = new MultiInfrastructureJobSubmission();

            // Set the list of infrastructure(s) activated for the portlet           
            if (infrastructures[0] != null) {
                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE"))
                    log.info("\n- Adding the LATO Infrastructure.");
                NuclemdMultiJobSubmission.addInfrastructure(infrastructures[0]);
            }
            if (infrastructures[1] != null) {
                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE"))
                    log.info("\n- Adding the GARUDA Infrastructure.");
                NuclemdMultiJobSubmission.addInfrastructure(infrastructures[1]);
            }
            if (infrastructures[2] != null) {
                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE"))
                    log.info("\n- Adding the EUMED Infrastructure.");
                NuclemdMultiJobSubmission.addInfrastructure(infrastructures[2]);
            }
            if (infrastructures[3] != null) {
                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE"))
                    log.info("\n- Adding the SAGRID Infrastructure.");
                NuclemdMultiJobSubmission.addInfrastructure(infrastructures[3]);
            }
            if (infrastructures[4] != null) {
                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE"))
                    log.info("\n- Adding the SEE Infrastructure.");
                NuclemdMultiJobSubmission.addInfrastructure(infrastructures[4]);
            }
            if (infrastructures[5] != null) {
                if (nuclemd_LOGLEVEL.trim().equals("VERBOSE"))
                    log.info("\n- Adding the GRIDIT Infrastructure.");
                NuclemdMultiJobSubmission.addInfrastructure(infrastructures[5]);
            }

            String NuclemdFilesPath = getPortletContext().getRealPath("/") + "WEB-INF/config";

            // Set the Output path forresults
            //NuclemdMultiJobSubmission.setOutputPath("/tmp");
            NuclemdMultiJobSubmission.setOutputPath(nuclemd_OUTPUT_PATH);

            // Set the StandardOutput for NUCLEMD
            NuclemdMultiJobSubmission.setJobOutput(".std.txt");

            // Set the StandardError for NUCLEMD
            NuclemdMultiJobSubmission.setJobError(".std.err");

            // Set the Executable for NUCLEMD
            NuclemdMultiJobSubmission.setExecutable("start_nuclemd.sh");

            String InputSandbox = "";
            String Arguments = "";

            InfrastructureInfo infrastructure = NuclemdMultiJobSubmission.getInfrastructure();

            String Middleware = null;
            if (infrastructure.getMiddleware().equals("glite"))
                Middleware = "gLite";

            if (infrastructure.getMiddleware().equals("wsgram"))
                Middleware = "wsgram";

            if (infrastructure.getMiddleware().equals("ssh"))
                Middleware = "ssh";

            log.info("\n- Selected Infrastructure = " + infrastructure.getName());
            log.info("\n- Enabled Middleware = " + Middleware);

            if (NUCLEMD_Parameters[7] != null) {
                // Demo ?                    
                if (NUCLEMD_Parameters[8].equals("nuclemd_ver1")) {
                    // Release v0.1
                    InputSandbox = NuclemdFilesPath + "/start_nuclemd.sh" + "," + NuclemdFilesPath
                            + "/nuclemd_v1" + "," + NuclemdFilesPath + "/v0.1/comd_coll1.inp" + ","
                            + NuclemdFilesPath + "/v0.1/conf_18O_new_1.dat" + "," + NuclemdFilesPath
                            + "/v0.1/conf_ca40_tr0165.dat";

                    Arguments = username + "," + NuclemdFilesPath + "/comd_coll1.inp" + "," + NuclemdFilesPath
                            + "/conf_18O_new_1.dat" + "," + NuclemdFilesPath + "/conf_ca40_tr0165.dat" + ","
                            + NUCLEMD_Parameters[7] + "," + NUCLEMD_Parameters[8];
                } else {
                    // Release v0.2
                    InputSandbox = NuclemdFilesPath + "/start_nuclemd.sh" + "," + NuclemdFilesPath
                            + "/nuclemd_v2" + "," + NuclemdFilesPath + "/v0.2/comd_c1c2.inp" + ","
                            + NuclemdFilesPath + "/v0.2/conf_124Sn_c1c2_L72K250_1.dat" + "," + NuclemdFilesPath
                            + "/v0.2/fake.dat";

                    Arguments = username + "," + NuclemdFilesPath + "/comd_c1c2.inp" + "," + NuclemdFilesPath
                            + "/conf_124Sn_c1c2_L72K250_1.dat" + "," + NuclemdFilesPath + "/fake.dat" + ","
                            + NUCLEMD_Parameters[7] + "," + NUCLEMD_Parameters[8];
                }
            } else {
                if (NUCLEMD_Parameters[8].equals("nuclemd_ver1")) {
                    // Release v0.1
                    InputSandbox = NuclemdFilesPath + "/start_nuclemd.sh" + "," + NuclemdFilesPath
                            + "/nuclemd_v1" + "," + NUCLEMD_Parameters[2] + "," + NUCLEMD_Parameters[3] + ","
                            + NUCLEMD_Parameters[4];

                    Arguments = username + "," + NUCLEMD_Parameters[2] + "," + NUCLEMD_Parameters[3] + ","
                            + NUCLEMD_Parameters[4] + "," + NUCLEMD_Parameters[7] + "," + NUCLEMD_Parameters[8];
                } else {
                    // Release v0.2
                    InputSandbox = NuclemdFilesPath + "/start_nuclemd.sh" + "," + NuclemdFilesPath
                            + "/nuclemd_v2" + "," + NUCLEMD_Parameters[2] + "," + NUCLEMD_Parameters[3] + ","
                            + NuclemdFilesPath + "/v0.2/fake.dat";

                    Arguments = username + "," + NUCLEMD_Parameters[2] + "," + NUCLEMD_Parameters[3] + ","
                            + NuclemdFilesPath + "/v0.2/fake.dat" + "," + NUCLEMD_Parameters[7] + ","
                            + NUCLEMD_Parameters[8];
                }
            }

            // Set the list of Arguments for NUCLEMD
            NuclemdMultiJobSubmission.setArguments(Arguments);

            // Set InputSandbox files (string with comma separated list of file names)
            NuclemdMultiJobSubmission.setInputFiles(InputSandbox);

            // OutputSandbox (string with comma separated list of file names)
            String README = "output.README";
            String NUCLEMD_LOG = "nuclemd.log";
            String NuclemdFiles = "results.tar.gz";

            // Set the OutputSandbox files (string with comma separated list of file names)
            NuclemdMultiJobSubmission.setOutputFiles(NuclemdFiles + "," + NUCLEMD_LOG + "," + README);

            // Set the MaxWallClockTime Requirements
            String MaxWallClockTimeRequirements[] = new String[1];
            MaxWallClockTimeRequirements[0] = "JDLRequirements=(other.GlueCEPolicyMaxWallClockTime>"
                    + NUCLEMD_Parameters[6] + ")";

            NuclemdMultiJobSubmission.setJDLRequirements(MaxWallClockTimeRequirements);

            /*String jdlRequirements[] = new String[1];
            jdlRequirements[0] = "JDLRequirements=(other.GlueCEPolicyMaxCPUTime>1440)";
            NuclemdMultiJobSubmission.setJDLRequirements(jdlRequirements);*/

            // Check if more than one infrastructure have been enabled                
            if (MAX == 1)
                if (!NUCLEMD_Parameters[1].isEmpty())
                    log.info("\nSetting the CE = " + NUCLEMD_Parameters[1]);
            NuclemdMultiJobSubmission.setJobQueue(NUCLEMD_Parameters[1]);

            InetAddress addr = InetAddress.getLocalHost();
            //Company company;

            try {
                company = PortalUtil.getCompany(request);
                String gateway = company.getName();

                // Send a notification email to the user if enabled.
                if (NUCLEMD_Parameters[5] != null)
                    if ((SMTP_HOST == null) || (SMTP_HOST.trim().equals("")) || (SMTP_HOST.trim().equals("N/A"))
                            || (SENDER_MAIL == null) || (SENDER_MAIL.trim().equals(""))
                            || (SENDER_MAIL.trim().equals("N/A")))
                        log.info("\nThe Notification Service is not properly configured!");
                    else {
                        // Setting the user's email for notifications
                        NuclemdMultiJobSubmission.setUserEmail(emailAddress);

                        // Setting the Sender
                        if (!SENDER_MAIL.isEmpty())
                            NuclemdMultiJobSubmission.setSenderEmail(SENDER_MAIL);

                        sendHTMLEmail(username, emailAddress, SENDER_MAIL, SMTP_HOST, "NUCLEMD", gateway);
                    }

                log.info("\n- Submission in progress ...");
                NuclemdMultiJobSubmission.submitJobAsync(infrastructure, username,
                        addr.getHostAddress() + ":8162", Integer.valueOf(nuclemd_APPID), NUCLEMD_Parameters[0]);

            } catch (PortalException ex) {
                Logger.getLogger(Nuclemd.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SystemException ex) {
                Logger.getLogger(Nuclemd.class.getName()).log(Level.SEVERE, null, ex);
            }
        } // end PROCESS ACTION [ SUBMIT_NUCLEMD_PORTLET ]
    } catch (PortalException ex) {
        Logger.getLogger(Nuclemd.class.getName()).log(Level.SEVERE, null, ex);
    } catch (SystemException ex) {
        Logger.getLogger(Nuclemd.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:it.infn.ct.wrf.Wrf.java

@Override
public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException {
    try {//w ww  .j  a v a  2s  .  c om
        String action = "";

        // Get the action to be processed from the request
        action = request.getParameter("ActionEvent");

        // Determine the username and the email address
        ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
        User user = themeDisplay.getUser();

        String username = user.getScreenName();
        String emailAddress = user.getDisplayEmailAddress();

        Company company = PortalUtil.getCompany(request);
        String portal = company.getName();
        //String portalURL = themeDisplay.getPortalURL();

        PortletPreferences portletPreferences = (PortletPreferences) request.getPreferences();

        if (action.equals("CONFIG_WRF_PORTLET")) {
            log.info("\nPROCESS ACTION => " + action);

            // Get the APPID from the portlet request
            String wrf_APPID = request.getParameter("wrf_APPID");
            // Get the LOGLEVEL from the portlet request
            String wrf_LOGLEVEL = request.getParameter("wrf_LOGLEVEL");
            // Get the OUTPUT from the portlet request
            String wrf_OUTPUT_PATH = request.getParameter("wrf_OUTPUT_PATH");
            // Get the SOFTWARE from the portlet request
            String wrf_SOFTWARE = request.getParameter("wrf_SOFTWARE");
            // Get the TRACKING_DB_HOSTNAME from the portlet request
            String TRACKING_DB_HOSTNAME = request.getParameter("TRACKING_DB_HOSTNAME");
            // Get the TRACKING_DB_USERNAME from the portlet request
            String TRACKING_DB_USERNAME = request.getParameter("TRACKING_DB_USERNAME");
            // Get the TRACKING_DB_PASSWORD from the portlet request
            String TRACKING_DB_PASSWORD = request.getParameter("TRACKING_DB_PASSWORD");
            // Get the SMTP_HOST from the portlet request
            String SMTP_HOST = request.getParameter("SMTP_HOST");
            // Get the SENDER_MAIL from the portlet request
            String SENDER_MAIL = request.getParameter("SENDER_MAIL");
            String[] infras = new String[7];

            String dit_wrf_ENABLEINFRASTRUCTURE = "unchecked";
            String garuda_wrf_ENABLEINFRASTRUCTURE = "unchecked";
            String chain_wrf_ENABLEINFRASTRUCTURE = "unchecked";
            String fedcloud_wrf_ENABLEINFRASTRUCTURE = "unchecked";
            String eumed_wrf_ENABLEINFRASTRUCTURE = "unchecked";
            String gisela_wrf_ENABLEINFRASTRUCTURE = "unchecked";
            String sagrid_wrf_ENABLEINFRASTRUCTURE = "unchecked";

            String[] wrf_INFRASTRUCTURES = request.getParameterValues("wrf_ENABLEINFRASTRUCTURES");

            if (wrf_INFRASTRUCTURES != null) {
                Arrays.sort(wrf_INFRASTRUCTURES);
                dit_wrf_ENABLEINFRASTRUCTURE = Arrays.binarySearch(wrf_INFRASTRUCTURES, "dit") >= 0 ? "checked"
                        : "unchecked";
                garuda_wrf_ENABLEINFRASTRUCTURE = Arrays.binarySearch(wrf_INFRASTRUCTURES, "garuda") >= 0
                        ? "checked"
                        : "unchecked";
                chain_wrf_ENABLEINFRASTRUCTURE = Arrays.binarySearch(wrf_INFRASTRUCTURES, "chain") >= 0
                        ? "checked"
                        : "unchecked";
                fedcloud_wrf_ENABLEINFRASTRUCTURE = Arrays.binarySearch(wrf_INFRASTRUCTURES, "fedcloud") >= 0
                        ? "checked"
                        : "unchecked";
                eumed_wrf_ENABLEINFRASTRUCTURE = Arrays.binarySearch(wrf_INFRASTRUCTURES, "eumed") >= 0
                        ? "checked"
                        : "unchecked";
                gisela_wrf_ENABLEINFRASTRUCTURE = Arrays.binarySearch(wrf_INFRASTRUCTURES, "gisela") >= 0
                        ? "checked"
                        : "unchecked";
                sagrid_wrf_ENABLEINFRASTRUCTURE = Arrays.binarySearch(wrf_INFRASTRUCTURES, "sagrid") >= 0
                        ? "checked"
                        : "unchecked";
            }

            if (dit_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
                infras[0] = "dit";
                // Get the  INFRASTRUCTURE from the portlet request for the DIT VO
                String dit_wrf_INFRASTRUCTURE = request.getParameter("dit_wrf_INFRASTRUCTURE");
                // Get the  VONAME from the portlet request for the DIT VO
                String dit_wrf_LOGIN = request.getParameter("dit_wrf_LOGIN");
                // Get the  TOPBDII from the portlet request for the DIT VO
                String dit_wrf_PASSWD = request.getParameter("dit_wrf_PASSWD");
                // Get the  WMS from the portlet request for the DIT VO
                String[] dit_wrf_WMS = request.getParameterValues("dit_wrf_WMS");
                // Get the  ETOKENSERVER from the portlet request for the DIT VO
                String dit_wrf_ETOKENSERVER = request.getParameter("dit_wrf_ETOKENSERVER");
                // Get the  MYPROXYSERVER from the portlet request for the DIT VO
                String dit_wrf_MYPROXYSERVER = request.getParameter("dit_wrf_MYPROXYSERVER");
                // Get the  PORT from the portlet request for the DIT VO
                String dit_wrf_PORT = request.getParameter("dit_wrf_PORT");
                // Get the  ROBOTID from the portlet request for the DIT VO
                String dit_wrf_ROBOTID = request.getParameter("dit_wrf_ROBOTID");
                // Get the  ROLE from the portlet request for the DIT VO
                String dit_wrf_ROLE = request.getParameter("dit_wrf_ROLE");
                // Get the  OPTIONS from the portlet request for the DIT VO
                String[] dit_wrf_OPTIONS = request.getParameterValues("dit_wrf_OPTIONS");

                String dit_wrf_RENEWAL = "";
                String dit_wrf_DISABLEVOMS = "";

                if (dit_wrf_OPTIONS == null) {
                    dit_wrf_RENEWAL = "checked";
                    dit_wrf_DISABLEVOMS = "unchecked";
                } else {
                    Arrays.sort(dit_wrf_OPTIONS);
                    // Get the  RENEWAL from the portlet preferences for the DIT VO
                    dit_wrf_RENEWAL = Arrays.binarySearch(dit_wrf_OPTIONS, "enableRENEWAL") >= 0 ? "checked"
                            : "unchecked";
                    // Get the  DISABLEVOMS from the portlet preferences for the DIT VO
                    dit_wrf_DISABLEVOMS = Arrays.binarySearch(dit_wrf_OPTIONS, "disableVOMS") >= 0 ? "checked"
                            : "unchecked";
                }

                int nmax = 0;
                for (int i = 0; i < dit_wrf_WMS.length; i++)
                    if (dit_wrf_WMS[i] != null && (!dit_wrf_WMS[i].trim().equals("N/A")))
                        nmax++;

                log.info("\n\nLength=" + nmax);
                String[] dit_wrf_WMS_trimmed = new String[nmax];
                for (int i = 0; i < nmax; i++) {
                    dit_wrf_WMS_trimmed[i] = dit_wrf_WMS[i].trim();
                    log.info("\n\nDIT [" + i + "] WMS=[" + dit_wrf_WMS_trimmed[i] + "]");
                }

                // Set the portlet preferences
                portletPreferences.setValue("dit_wrf_INFRASTRUCTURE", dit_wrf_INFRASTRUCTURE.trim());
                portletPreferences.setValue("dit_wrf_LOGIN", dit_wrf_LOGIN.trim());
                portletPreferences.setValue("dit_wrf_PASSWD", dit_wrf_PASSWD.trim());
                portletPreferences.setValues("dit_wrf_WMS", dit_wrf_WMS_trimmed);
                portletPreferences.setValue("dit_wrf_ETOKENSERVER", dit_wrf_ETOKENSERVER.trim());
                portletPreferences.setValue("dit_wrf_MYPROXYSERVER", dit_wrf_MYPROXYSERVER.trim());
                portletPreferences.setValue("dit_wrf_PORT", dit_wrf_PORT.trim());
                portletPreferences.setValue("dit_wrf_ROBOTID", dit_wrf_ROBOTID.trim());
                portletPreferences.setValue("dit_wrf_ROLE", dit_wrf_ROLE.trim());
                portletPreferences.setValue("dit_wrf_RENEWAL", dit_wrf_RENEWAL);
                portletPreferences.setValue("dit_wrf_DISABLEVOMS", dit_wrf_DISABLEVOMS);

                portletPreferences.setValue("wrf_APPID", wrf_APPID.trim());
                portletPreferences.setValue("wrf_LOGLEVEL", wrf_LOGLEVEL.trim());
                portletPreferences.setValue("wrf_OUTPUT_PATH", wrf_OUTPUT_PATH.trim());
                portletPreferences.setValue("wrf_SOFTWARE", wrf_SOFTWARE.trim());
                portletPreferences.setValue("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
                portletPreferences.setValue("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
                portletPreferences.setValue("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
                portletPreferences.setValue("SMTP_HOST", SMTP_HOST.trim());
                portletPreferences.setValue("SENDER_MAIL", SENDER_MAIL.trim());

                if (wrf_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n\nPROCESS ACTION => " + action + "\n- Storing the  portlet preferences ..."
                            + "\ndit_wrf_INFRASTRUCTURE: " + dit_wrf_INFRASTRUCTURE + "\ndit_wrf_LOGIN: "
                            + dit_wrf_LOGIN + "\ndit_wrf_PASSWD: " + dit_wrf_PASSWD + "\ndit_wrf_ETOKENSERVER: "
                            + dit_wrf_ETOKENSERVER + "\ndit_wrf_MYPROXYSERVER: " + dit_wrf_MYPROXYSERVER
                            + "\ndit_wrf_PORT: " + dit_wrf_PORT + "\ndit_wrf_ROBOTID: " + dit_wrf_ROBOTID
                            + "\ndit_wrf_ROLE: " + dit_wrf_ROLE + "\ndit_wrf_RENEWAL: " + dit_wrf_RENEWAL
                            + "\ndit_wrf_DISABLEVOMS: " + dit_wrf_DISABLEVOMS

                            + "\n\nwrf_ENABLEINFRASTRUCTURE: " + "dit" + "\nwrf_APPID: " + wrf_APPID
                            + "\nwrf_LOGLEVEL: " + wrf_LOGLEVEL + "\nwrf_OUTPUT_PATH: " + wrf_OUTPUT_PATH
                            + "\nwrf_SOFTWARE: " + wrf_SOFTWARE + "\nTracking_DB_Hostname: "
                            + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: " + TRACKING_DB_USERNAME
                            + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD + "\nSMTP_HOST: " + SMTP_HOST
                            + "\nSENDER_MAIL: " + SENDER_MAIL);
                }
            }

            if (garuda_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
                infras[1] = "garuda";
                // Get the  INFRASTRUCTURE from the portlet request for the GARUDA VO
                String garuda_wrf_INFRASTRUCTURE = request.getParameter("garuda_wrf_INFRASTRUCTURE");
                // Get the  VONAME from the portlet request for the GARUDA VO
                String garuda_wrf_VONAME = request.getParameter("garuda_wrf_VONAME");
                // Get the  TOPBDII from the portlet request for the GARUDA VO
                String garuda_wrf_TOPBDII = request.getParameter("garuda_wrf_TOPBDII");
                // Get the  WMS from the portlet request for the GARUDA VO
                String[] garuda_wrf_WMS = request.getParameterValues("garuda_wrf_WMS");
                // Get the  ETOKENSERVER from the portlet request for the GARUDA VO
                String garuda_wrf_ETOKENSERVER = request.getParameter("garuda_wrf_ETOKENSERVER");
                // Get the  MYPROXYSERVER from the portlet request for the GARUDA VO
                String garuda_wrf_MYPROXYSERVER = request.getParameter("garuda_wrf_MYPROXYSERVER");
                // Get the  PORT from the portlet request for the GARUDA VO
                String garuda_wrf_PORT = request.getParameter("garuda_wrf_PORT");
                // Get the  ROBOTID from the portlet request for the GARUDA VO
                String garuda_wrf_ROBOTID = request.getParameter("garuda_wrf_ROBOTID");
                // Get the  ROLE from the portlet request for the GARUDA VO
                String garuda_wrf_ROLE = request.getParameter("garuda_wrf_ROLE");
                // Get the  OPTIONS from the portlet request for the GARUDA VO
                String[] garuda_wrf_OPTIONS = request.getParameterValues("garuda_wrf_OPTIONS");

                String garuda_wrf_RENEWAL = "";
                String garuda_wrf_DISABLEVOMS = "";

                if (garuda_wrf_OPTIONS == null) {
                    garuda_wrf_RENEWAL = "checked";
                    garuda_wrf_DISABLEVOMS = "unchecked";
                } else {
                    Arrays.sort(garuda_wrf_OPTIONS);
                    // Get the  RENEWAL from the portlet preferences for the GARUDA VO
                    garuda_wrf_RENEWAL = Arrays.binarySearch(garuda_wrf_OPTIONS, "enableRENEWAL") >= 0
                            ? "checked"
                            : "unchecked";
                    // Get the  DISABLEVOMS from the portlet preferences for the GARUDA VO
                    garuda_wrf_DISABLEVOMS = Arrays.binarySearch(garuda_wrf_OPTIONS, "disableVOMS") >= 0
                            ? "checked"
                            : "unchecked";
                }

                int nmax = 0;
                for (int i = 0; i < garuda_wrf_WMS.length; i++)
                    if (garuda_wrf_WMS[i] != null && (!garuda_wrf_WMS[i].trim().equals("N/A")))
                        nmax++;

                log.info("\n\nLength=" + nmax);
                String[] garuda_wrf_WMS_trimmed = new String[nmax];
                for (int i = 0; i < nmax; i++) {
                    garuda_wrf_WMS_trimmed[i] = garuda_wrf_WMS[i].trim();
                    log.info("\n\nGARUDA [" + i + "] WSGRAM=[" + garuda_wrf_WMS_trimmed[i] + "]");
                }

                // Set the portlet preferences
                portletPreferences.setValue("garuda_wrf_INFRASTRUCTURE", garuda_wrf_INFRASTRUCTURE.trim());
                portletPreferences.setValue("garuda_wrf_VONAME", garuda_wrf_VONAME.trim());
                portletPreferences.setValue("garuda_wrf_TOPBDII", garuda_wrf_TOPBDII.trim());
                portletPreferences.setValues("garuda_wrf_WMS", garuda_wrf_WMS_trimmed);
                portletPreferences.setValue("garuda_wrf_ETOKENSERVER", garuda_wrf_ETOKENSERVER.trim());
                portletPreferences.setValue("garuda_wrf_MYPROXYSERVER", garuda_wrf_MYPROXYSERVER.trim());
                portletPreferences.setValue("garuda_wrf_PORT", garuda_wrf_PORT.trim());
                portletPreferences.setValue("garuda_wrf_ROBOTID", garuda_wrf_ROBOTID.trim());
                portletPreferences.setValue("garuda_wrf_ROLE", garuda_wrf_ROLE.trim());
                portletPreferences.setValue("garuda_wrf_RENEWAL", garuda_wrf_RENEWAL);
                portletPreferences.setValue("garuda_wrf_DISABLEVOMS", garuda_wrf_DISABLEVOMS);

                portletPreferences.setValue("wrf_APPID", wrf_APPID.trim());
                portletPreferences.setValue("wrf_LOGLEVEL", wrf_LOGLEVEL.trim());
                portletPreferences.setValue("wrf_OUTPUT_PATH", wrf_OUTPUT_PATH.trim());
                portletPreferences.setValue("wrf_SOFTWARE", wrf_SOFTWARE.trim());
                portletPreferences.setValue("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
                portletPreferences.setValue("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
                portletPreferences.setValue("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
                portletPreferences.setValue("SMTP_HOST", SMTP_HOST.trim());
                portletPreferences.setValue("SENDER_MAIL", SENDER_MAIL.trim());

                if (wrf_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n\nPROCESS ACTION => " + action + "\n- Storing the  portlet preferences ..."
                            + "\ngaruda_wrf_INFRASTRUCTURE: " + garuda_wrf_INFRASTRUCTURE
                            + "\ngaruda_wrf_VONAME: " + garuda_wrf_VONAME + "\ngaruda_wrf_TOPBDII: "
                            + garuda_wrf_TOPBDII + "\ngaruda_wrf_ETOKENSERVER: " + garuda_wrf_ETOKENSERVER
                            + "\ngaruda_wrf_MYPROXYSERVER: " + garuda_wrf_MYPROXYSERVER + "\ngaruda_wrf_PORT: "
                            + garuda_wrf_PORT + "\ngaruda_wrf_ROBOTID: " + garuda_wrf_ROBOTID
                            + "\ngaruda_wrf_ROLE: " + garuda_wrf_ROLE + "\ngaruda_wrf_RENEWAL: "
                            + garuda_wrf_RENEWAL + "\ngaruda_wrf_DISABLEVOMS: " + garuda_wrf_DISABLEVOMS

                            + "\n\nwrf_ENABLEINFRASTRUCTURE: " + "garuda" + "\nwrf_APPID: " + wrf_APPID
                            + "\nwrf_LOGLEVEL: " + wrf_LOGLEVEL + "\nwrf_OUTPUT_PATH: " + wrf_OUTPUT_PATH
                            + "\nwrf_SOFTWARE: " + wrf_SOFTWARE + "\nTracking_DB_Hostname: "
                            + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: " + TRACKING_DB_USERNAME
                            + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD + "\nSMTP_HOST: " + SMTP_HOST
                            + "\nSENDER_MAIL: " + SENDER_MAIL);
                }
            }

            if (chain_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
                infras[2] = "chain";
                // Get the  INFRASTRUCTURE from the portlet request for the CHAIN VO
                String chain_wrf_INFRASTRUCTURE = request.getParameter("chain_wrf_INFRASTRUCTURE");
                // Get the  VONAME from the portlet request for the CHAIN VO
                String chain_wrf_VONAME = request.getParameter("chain_wrf_VONAME");
                // Get the  TOPBDII from the portlet request for the CHAIN VO
                String chain_wrf_TOPBDII = request.getParameter("chain_wrf_TOPBDII");
                // Get the  WMS from the portlet request for the CHAIN VO
                String[] chain_wrf_WMS = request.getParameterValues("chain_wrf_WMS");
                // Get the  ETOKENSERVER from the portlet request for the CHAIN VO
                String chain_wrf_ETOKENSERVER = request.getParameter("chain_wrf_ETOKENSERVER");
                // Get the  MYPROXYSERVER from the portlet request for the CHAIN VO
                String chain_wrf_MYPROXYSERVER = request.getParameter("chain_wrf_MYPROXYSERVER");
                // Get the  PORT from the portlet request for the CHAIN VO
                String chain_wrf_PORT = request.getParameter("chain_wrf_PORT");
                // Get the  ROBOTID from the portlet request for the CHAIN VO
                String chain_wrf_ROBOTID = request.getParameter("chain_wrf_ROBOTID");
                // Get the  ROLE from the portlet request for the CHAIN VO
                String chain_wrf_ROLE = request.getParameter("chain_wrf_ROLE");
                // Get the  OPTIONS from the portlet request for the CHAIN VO
                String[] chain_wrf_OPTIONS = request.getParameterValues("chain_wrf_OPTIONS");

                String chain_wrf_RENEWAL = "";
                String chain_wrf_DISABLEVOMS = "";

                if (chain_wrf_OPTIONS == null) {
                    chain_wrf_RENEWAL = "checked";
                    chain_wrf_DISABLEVOMS = "unchecked";
                } else {
                    Arrays.sort(chain_wrf_OPTIONS);
                    // Get the  RENEWAL from the portlet preferences for the CHAIN VO
                    chain_wrf_RENEWAL = Arrays.binarySearch(chain_wrf_OPTIONS, "enableRENEWAL") >= 0 ? "checked"
                            : "unchecked";
                    // Get the  DISABLEVOMS from the portlet preferences for the CHAIN VO
                    chain_wrf_DISABLEVOMS = Arrays.binarySearch(chain_wrf_OPTIONS, "disableVOMS") >= 0
                            ? "checked"
                            : "unchecked";
                }

                int nmax = 0;
                for (int i = 0; i < chain_wrf_WMS.length; i++)
                    if (chain_wrf_WMS[i] != null && (!chain_wrf_WMS[i].trim().equals("N/A")))
                        nmax++;

                log.info("\n\nLength=" + nmax);
                String[] chain_wrf_WMS_trimmed = new String[nmax];
                for (int i = 0; i < nmax; i++) {
                    chain_wrf_WMS_trimmed[i] = chain_wrf_WMS[i].trim();
                    log.info("\n\nCHAIN [" + i + "] WMS=[" + chain_wrf_WMS_trimmed[i] + "]");
                }

                // Set the portlet preferences
                portletPreferences.setValue("chain_wrf_INFRASTRUCTURE", chain_wrf_INFRASTRUCTURE.trim());
                portletPreferences.setValue("chain_wrf_VONAME", chain_wrf_VONAME.trim());
                portletPreferences.setValue("chain_wrf_TOPBDII", chain_wrf_TOPBDII.trim());
                portletPreferences.setValues("chain_wrf_WMS", chain_wrf_WMS_trimmed);
                portletPreferences.setValue("chain_wrf_ETOKENSERVER", chain_wrf_ETOKENSERVER.trim());
                portletPreferences.setValue("chain_wrf_MYPROXYSERVER", chain_wrf_MYPROXYSERVER.trim());
                portletPreferences.setValue("chain_wrf_PORT", chain_wrf_PORT.trim());
                portletPreferences.setValue("chain_wrf_ROBOTID", chain_wrf_ROBOTID.trim());
                portletPreferences.setValue("chain_wrf_ROLE", chain_wrf_ROLE.trim());
                portletPreferences.setValue("chain_wrf_RENEWAL", chain_wrf_RENEWAL);
                portletPreferences.setValue("chain_wrf_DISABLEVOMS", chain_wrf_DISABLEVOMS);

                portletPreferences.setValue("wrf_APPID", wrf_APPID.trim());
                portletPreferences.setValue("wrf_LOGLEVEL", wrf_LOGLEVEL.trim());
                portletPreferences.setValue("wrf_OUTPUT_PATH", wrf_OUTPUT_PATH.trim());
                portletPreferences.setValue("wrf_SOFTWARE", wrf_SOFTWARE.trim());
                portletPreferences.setValue("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
                portletPreferences.setValue("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
                portletPreferences.setValue("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
                portletPreferences.setValue("SMTP_HOST", SMTP_HOST.trim());
                portletPreferences.setValue("SENDER_MAIL", SENDER_MAIL.trim());

                if (wrf_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n\nPROCESS ACTION => " + action + "\n- Storing the  portlet preferences ..."
                            + "\nchain_wrf_INFRASTRUCTURE: " + chain_wrf_INFRASTRUCTURE + "\nchain_wrf_VONAME: "
                            + chain_wrf_VONAME + "\nchain_wrf_TOPBDII: " + chain_wrf_TOPBDII
                            + "\nchain_wrf_ETOKENSERVER: " + chain_wrf_ETOKENSERVER
                            + "\nchain_wrf_MYPROXYSERVER: " + chain_wrf_MYPROXYSERVER + "\nchain_wrf_PORT: "
                            + chain_wrf_PORT + "\nchain_wrf_ROBOTID: " + chain_wrf_ROBOTID
                            + "\nchain_wrf_ROLE: " + chain_wrf_ROLE + "\nchain_wrf_RENEWAL: "
                            + chain_wrf_RENEWAL + "\nchain_wrf_DISABLEVOMS: " + chain_wrf_DISABLEVOMS

                            + "\n\nwrf_ENABLEINFRASTRUCTURE: " + "chain" + "\nwrf_APPID: " + wrf_APPID
                            + "\nwrf_LOGLEVEL: " + wrf_LOGLEVEL + "\nwrf_OUTPUT_PATH: " + wrf_OUTPUT_PATH
                            + "\nwrf_SOFTWARE: " + wrf_SOFTWARE + "\nTracking_DB_Hostname: "
                            + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: " + TRACKING_DB_USERNAME
                            + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD + "\nSMTP_HOST: " + SMTP_HOST
                            + "\nSENDER_MAIL: " + SENDER_MAIL);
                }
            }

            if (fedcloud_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
                infras[3] = "fedcloud";
                // Get the  INFRASTRUCTURE from the portlet request for the FEDCLOUD VO
                String fedcloud_wrf_INFRASTRUCTURE = request.getParameter("fedcloud_wrf_INFRASTRUCTURE");
                // Get the  VONAME from the portlet request for the FEDCLOUD VO
                String fedcloud_wrf_VONAME = request.getParameter("fedcloud_wrf_VONAME");
                // Get the  TOPBDII from the portlet request for the FEDCLOUD VO
                String fedcloud_wrf_TOPBDII = request.getParameter("fedcloud_wrf_TOPBDII");
                // Get the  WMS from the portlet request for the FEDCLOUD VO
                String[] fedcloud_wrf_WMS = request.getParameterValues("fedcloud_wrf_WMS");
                // Get the  ETOKENSERVER from the portlet request for the FEDCLOUD VO
                String fedcloud_wrf_ETOKENSERVER = request.getParameter("fedcloud_wrf_ETOKENSERVER");
                // Get the  MYPROXYSERVER from the portlet request for the FEDCLOUD VO
                String fedcloud_wrf_MYPROXYSERVER = request.getParameter("fedcloud_wrf_MYPROXYSERVER");
                // Get the  PORT from the portlet request for the FEDCLOUD VO
                String fedcloud_wrf_PORT = request.getParameter("fedcloud_wrf_PORT");
                // Get the  ROBOTID from the portlet request for the FEDCLOUD VO
                String fedcloud_wrf_ROBOTID = request.getParameter("fedcloud_wrf_ROBOTID");
                // Get the  ROLE from the portlet request for the FEDCLOUD VO
                String fedcloud_wrf_ROLE = request.getParameter("fedcloud_wrf_ROLE");
                // Get the  OPTIONS from the portlet request for the FEDCLOUD VO
                String[] fedcloud_wrf_OPTIONS = request.getParameterValues("fedcloud_wrf_OPTIONS");

                String fedcloud_wrf_RENEWAL = "";
                String fedcloud_wrf_DISABLEVOMS = "";

                if (fedcloud_wrf_OPTIONS == null) {
                    fedcloud_wrf_RENEWAL = "checked";
                    fedcloud_wrf_DISABLEVOMS = "unchecked";
                } else {
                    Arrays.sort(fedcloud_wrf_OPTIONS);
                    // Get the  RENEWAL from the portlet preferences for the FEDCLOUD VO
                    fedcloud_wrf_RENEWAL = Arrays.binarySearch(fedcloud_wrf_OPTIONS, "enableRENEWAL") >= 0
                            ? "checked"
                            : "unchecked";
                    // Get the  DISABLEVOMS from the portlet preferences for the FEDCLOUD VO
                    fedcloud_wrf_DISABLEVOMS = Arrays.binarySearch(fedcloud_wrf_OPTIONS, "disableVOMS") >= 0
                            ? "checked"
                            : "unchecked";
                }

                int nmax = 0;
                for (int i = 0; i < fedcloud_wrf_WMS.length; i++)
                    if (fedcloud_wrf_WMS[i] != null && (!fedcloud_wrf_WMS[i].trim().equals("N/A")))
                        nmax++;

                log.info("\n\nLength=" + nmax);
                String[] fedcloud_wrf_WMS_trimmed = new String[nmax];
                for (int i = 0; i < nmax; i++) {
                    fedcloud_wrf_WMS_trimmed[i] = fedcloud_wrf_WMS[i].trim();
                    log.info("\n\nFEDCLOUD [" + i + "] Cloud Resource=[" + fedcloud_wrf_WMS_trimmed[i] + "]");
                }

                // Set the portlet preferences
                portletPreferences.setValue("fedcloud_wrf_INFRASTRUCTURE", fedcloud_wrf_INFRASTRUCTURE.trim());
                portletPreferences.setValue("fedcloud_wrf_VONAME", fedcloud_wrf_VONAME.trim());
                portletPreferences.setValue("fedcloud_wrf_TOPBDII", fedcloud_wrf_TOPBDII.trim());
                portletPreferences.setValues("fedcloud_wrf_WMS", fedcloud_wrf_WMS_trimmed);
                portletPreferences.setValue("fedcloud_wrf_ETOKENSERVER", fedcloud_wrf_ETOKENSERVER.trim());
                portletPreferences.setValue("fedcloud_wrf_MYPROXYSERVER", fedcloud_wrf_MYPROXYSERVER.trim());
                portletPreferences.setValue("fedcloud_wrf_PORT", fedcloud_wrf_PORT.trim());
                portletPreferences.setValue("fedcloud_wrf_ROBOTID", fedcloud_wrf_ROBOTID.trim());
                portletPreferences.setValue("fedcloud_wrf_ROLE", fedcloud_wrf_ROLE.trim());
                portletPreferences.setValue("fedcloud_wrf_RENEWAL", fedcloud_wrf_RENEWAL);
                portletPreferences.setValue("fedcloud_wrf_DISABLEVOMS", fedcloud_wrf_DISABLEVOMS);

                portletPreferences.setValue("wrf_APPID", wrf_APPID.trim());
                portletPreferences.setValue("wrf_LOGLEVEL", wrf_LOGLEVEL.trim());
                portletPreferences.setValue("wrf_OUTPUT_PATH", wrf_OUTPUT_PATH.trim());
                portletPreferences.setValue("wrf_SOFTWARE", wrf_SOFTWARE.trim());
                portletPreferences.setValue("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
                portletPreferences.setValue("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
                portletPreferences.setValue("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
                portletPreferences.setValue("SMTP_HOST", SMTP_HOST.trim());
                portletPreferences.setValue("SENDER_MAIL", SENDER_MAIL.trim());

                if (wrf_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n\nPROCESS ACTION => " + action + "\n- Storing the  portlet preferences ..."
                            + "\n\nfedcloud_wrf_INFRASTRUCTURE: " + fedcloud_wrf_INFRASTRUCTURE
                            + "\nfedcloud_wrf_VONAME: " + fedcloud_wrf_VONAME + "\nfedcloud_wrf_TOPBDII: "
                            + fedcloud_wrf_TOPBDII + "\nfedcloud_wrf_ETOKENSERVER: " + fedcloud_wrf_ETOKENSERVER
                            + "\nfedcloud_wrf_MYPROXYSERVER: " + fedcloud_wrf_MYPROXYSERVER
                            + "\nfedcloud_wrf_PORT: " + fedcloud_wrf_PORT + "\nfedcloud_wrf_ROBOTID: "
                            + fedcloud_wrf_ROBOTID + "\nfedcloud_wrf_ROLE: " + fedcloud_wrf_ROLE
                            + "\nfedcloud_wrf_RENEWAL: " + fedcloud_wrf_RENEWAL + "\nfedcloud_wrf_DISABLEVOMS: "
                            + fedcloud_wrf_DISABLEVOMS

                            + "\n\nwrf_ENABLEINFRASTRUCTURE: " + "fedcloud" + "\nwrf_APPID: " + wrf_APPID
                            + "\nwrf_LOGLEVEL: " + wrf_LOGLEVEL + "\nwrf_OUTPUT_PATH: " + wrf_OUTPUT_PATH
                            + "\nwrf_SOFTWARE: " + wrf_SOFTWARE + "\nTracking_DB_Hostname: "
                            + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: " + TRACKING_DB_USERNAME
                            + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD + "\nSMTP_HOST: " + SMTP_HOST
                            + "\nSENDER_MAIL: " + SENDER_MAIL);
                }
            }

            if (eumed_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
                infras[4] = "eumed";
                // Get the  INFRASTRUCTURE from the portlet request for the EUMED VO
                String eumed_wrf_INFRASTRUCTURE = request.getParameter("eumed_wrf_INFRASTRUCTURE");
                // Get the  VONAME from the portlet request for the EUMED VO
                String eumed_wrf_VONAME = request.getParameter("eumed_wrf_VONAME");
                // Get the  TOPBDII from the portlet request for the EUMED VO
                String eumed_wrf_TOPBDII = request.getParameter("eumed_wrf_TOPBDII");
                // Get the  WMS from the portlet request for the EUMED VO
                String[] eumed_wrf_WMS = request.getParameterValues("eumed_wrf_WMS");
                // Get the  ETOKENSERVER from the portlet request for the EUMED VO
                String eumed_wrf_ETOKENSERVER = request.getParameter("eumed_wrf_ETOKENSERVER");
                // Get the  MYPROXYSERVER from the portlet request for the EUMED VO
                String eumed_wrf_MYPROXYSERVER = request.getParameter("eumed_wrf_MYPROXYSERVER");
                // Get the  PORT from the portlet request for the EUMED VO
                String eumed_wrf_PORT = request.getParameter("eumed_wrf_PORT");
                // Get the  ROBOTID from the portlet request for the EUMED VO
                String eumed_wrf_ROBOTID = request.getParameter("eumed_wrf_ROBOTID");
                // Get the  ROLE from the portlet request for the EUMED VO
                String eumed_wrf_ROLE = request.getParameter("eumed_wrf_ROLE");
                // Get the  OPTIONS from the portlet request for the EUMED VO
                String[] eumed_wrf_OPTIONS = request.getParameterValues("eumed_wrf_OPTIONS");

                String eumed_wrf_RENEWAL = "";
                String eumed_wrf_DISABLEVOMS = "";

                if (eumed_wrf_OPTIONS == null) {
                    eumed_wrf_RENEWAL = "checked";
                    eumed_wrf_DISABLEVOMS = "unchecked";
                } else {
                    Arrays.sort(eumed_wrf_OPTIONS);
                    // Get the  RENEWAL from the portlet preferences for the EUMED VO
                    eumed_wrf_RENEWAL = Arrays.binarySearch(eumed_wrf_OPTIONS, "enableRENEWAL") >= 0 ? "checked"
                            : "unchecked";
                    // Get the  DISABLEVOMS from the portlet preferences for the CHAIN VO
                    eumed_wrf_DISABLEVOMS = Arrays.binarySearch(eumed_wrf_OPTIONS, "disableVOMS") >= 0
                            ? "checked"
                            : "unchecked";
                }

                int nmax = 0;
                for (int i = 0; i < eumed_wrf_WMS.length; i++)
                    if (eumed_wrf_WMS[i] != null && (!eumed_wrf_WMS[i].trim().equals("N/A")))
                        nmax++;

                log.info("\n\nLength=" + nmax);
                String[] eumed_wrf_WMS_trimmed = new String[nmax];
                for (int i = 0; i < nmax; i++) {
                    eumed_wrf_WMS_trimmed[i] = eumed_wrf_WMS[i].trim();
                    log.info("\n\nEUMED [" + i + "] WMS=[" + eumed_wrf_WMS_trimmed[i] + "]");
                }

                // Set the portlet preferences
                portletPreferences.setValue("eumed_wrf_INFRASTRUCTURE", eumed_wrf_INFRASTRUCTURE.trim());
                portletPreferences.setValue("eumed_wrf_VONAME", eumed_wrf_VONAME.trim());
                portletPreferences.setValue("eumed_wrf_TOPBDII", eumed_wrf_TOPBDII.trim());
                portletPreferences.setValues("eumed_wrf_WMS", eumed_wrf_WMS_trimmed);
                portletPreferences.setValue("eumed_wrf_ETOKENSERVER", eumed_wrf_ETOKENSERVER.trim());
                portletPreferences.setValue("eumed_wrf_MYPROXYSERVER", eumed_wrf_MYPROXYSERVER.trim());
                portletPreferences.setValue("eumed_wrf_PORT", eumed_wrf_PORT.trim());
                portletPreferences.setValue("eumed_wrf_ROBOTID", eumed_wrf_ROBOTID.trim());
                portletPreferences.setValue("eumed_wrf_ROLE", eumed_wrf_ROLE.trim());
                portletPreferences.setValue("eumed_wrf_RENEWAL", eumed_wrf_RENEWAL);
                portletPreferences.setValue("eumed_wrf_DISABLEVOMS", eumed_wrf_DISABLEVOMS);

                portletPreferences.setValue("wrf_APPID", wrf_APPID.trim());
                portletPreferences.setValue("wrf_LOGLEVEL", wrf_LOGLEVEL.trim());
                portletPreferences.setValue("wrf_OUTPUT_PATH", wrf_OUTPUT_PATH.trim());
                portletPreferences.setValue("wrf_SOFTWARE", wrf_SOFTWARE.trim());
                portletPreferences.setValue("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
                portletPreferences.setValue("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
                portletPreferences.setValue("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
                portletPreferences.setValue("SMTP_HOST", SMTP_HOST.trim());
                portletPreferences.setValue("SENDER_MAIL", SENDER_MAIL.trim());

                if (wrf_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n\nPROCESS ACTION => " + action + "\n- Storing the  portlet preferences ..."
                            + "\n\neumed_wrf_INFRASTRUCTURE: " + eumed_wrf_INFRASTRUCTURE
                            + "\neumed_wrf_VONAME: " + eumed_wrf_VONAME + "\neumed_wrf_TOPBDII: "
                            + eumed_wrf_TOPBDII + "\neumed_wrf_ETOKENSERVER: " + eumed_wrf_ETOKENSERVER
                            + "\neumed_wrf_MYPROXYSERVER: " + eumed_wrf_MYPROXYSERVER + "\neumed_wrf_PORT: "
                            + eumed_wrf_PORT + "\neumed_wrf_ROBOTID: " + eumed_wrf_ROBOTID
                            + "\neumed_wrf_ROLE: " + eumed_wrf_ROLE + "\neumed_wrf_RENEWAL: "
                            + eumed_wrf_RENEWAL + "\neumed_wrf_DISABLEVOMS: " + eumed_wrf_DISABLEVOMS

                            + "\n\nwrf_ENABLEINFRASTRUCTURE: " + "eumed" + "\nwrf_APPID: " + wrf_APPID
                            + "\nwrf_LOGLEVEL: " + wrf_LOGLEVEL + "\nwrf_OUTPUT_PATH: " + wrf_OUTPUT_PATH
                            + "\nwrf_SOFTWARE: " + wrf_SOFTWARE + "\nTracking_DB_Hostname: "
                            + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: " + TRACKING_DB_USERNAME
                            + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD + "\nSMTP_HOST: " + SMTP_HOST
                            + "\nSENDER_MAIL: " + SENDER_MAIL);
                }
            }

            if (gisela_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
                infras[5] = "gisela";
                // Get the  INFRASTRUCTURE from the portlet request for the GISELA VO
                String gisela_wrf_INFRASTRUCTURE = request.getParameter("gisela_wrf_INFRASTRUCTURE");
                // Get the  VONAME from the portlet request for the GISELA VO
                String gisela_wrf_VONAME = request.getParameter("gisela_wrf_VONAME");
                // Get the  TOPBDII from the portlet request for the GISELA VO
                String gisela_wrf_TOPBDII = request.getParameter("gisela_wrf_TOPBDII");
                // Get the  WMS from the portlet request for the GISELA VO
                String[] gisela_wrf_WMS = request.getParameterValues("gisela_wrf_WMS");
                // Get the  ETOKENSERVER from the portlet request for the GISELA VO
                String gisela_wrf_ETOKENSERVER = request.getParameter("gisela_wrf_ETOKENSERVER");
                // Get the  MYPROXYSERVER from the portlet request for the GISELA VO
                String gisela_wrf_MYPROXYSERVER = request.getParameter("gisela_wrf_MYPROXYSERVER");
                // Get the  PORT from the portlet request for the GISELA VO
                String gisela_wrf_PORT = request.getParameter("gisela_wrf_PORT");
                // Get the  ROBOTID from the portlet request for the GISELA VO
                String gisela_wrf_ROBOTID = request.getParameter("gisela_wrf_ROBOTID");
                // Get the  ROLE from the portlet request for the GISELA VO
                String gisela_wrf_ROLE = request.getParameter("gisela_wrf_ROLE");
                // Get the  OPTIONS from the portlet request for the GISELA VO
                String[] gisela_wrf_OPTIONS = request.getParameterValues("gisela_wrf_OPTIONS");

                String gisela_wrf_RENEWAL = "";
                String gisela_wrf_DISABLEVOMS = "";

                if (gisela_wrf_OPTIONS == null) {
                    gisela_wrf_RENEWAL = "checked";
                    gisela_wrf_DISABLEVOMS = "unchecked";
                } else {
                    Arrays.sort(gisela_wrf_OPTIONS);
                    // Get the  RENEWAL from the portlet preferences for the GISELA VO
                    gisela_wrf_RENEWAL = Arrays.binarySearch(gisela_wrf_OPTIONS, "enableRENEWAL") >= 0
                            ? "checked"
                            : "unchecked";
                    // Get the  DISABLEVOMS from the portlet preferences for the GISELA VO
                    gisela_wrf_DISABLEVOMS = Arrays.binarySearch(gisela_wrf_OPTIONS, "disableVOMS") >= 0
                            ? "checked"
                            : "unchecked";
                }

                int nmax = 0;
                for (int i = 0; i < gisela_wrf_WMS.length; i++)
                    if (gisela_wrf_WMS[i] != null && (!gisela_wrf_WMS[i].trim().equals("N/A")))
                        nmax++;

                log.info("\n\nLength=" + nmax);
                String[] gisela_wrf_WMS_trimmed = new String[nmax];
                for (int i = 0; i < nmax; i++) {
                    gisela_wrf_WMS_trimmed[i] = gisela_wrf_WMS[i].trim();
                    log.info("\n\nGISELA [" + i + "] WMS=[" + gisela_wrf_WMS_trimmed[i] + "]");
                }

                // Set the portlet preferences
                portletPreferences.setValue("gisela_wrf_INFRASTRUCTURE", gisela_wrf_INFRASTRUCTURE.trim());
                portletPreferences.setValue("gisela_wrf_VONAME", gisela_wrf_VONAME.trim());
                portletPreferences.setValue("gisela_wrf_TOPBDII", gisela_wrf_TOPBDII.trim());
                portletPreferences.setValues("gisela_wrf_WMS", gisela_wrf_WMS_trimmed);
                portletPreferences.setValue("gisela_wrf_ETOKENSERVER", gisela_wrf_ETOKENSERVER.trim());
                portletPreferences.setValue("gisela_wrf_MYPROXYSERVER", gisela_wrf_MYPROXYSERVER.trim());
                portletPreferences.setValue("gisela_wrf_PORT", gisela_wrf_PORT.trim());
                portletPreferences.setValue("gisela_wrf_ROBOTID", gisela_wrf_ROBOTID.trim());
                portletPreferences.setValue("gisela_wrf_ROLE", gisela_wrf_ROLE.trim());
                portletPreferences.setValue("gisela_wrf_RENEWAL", gisela_wrf_RENEWAL);
                portletPreferences.setValue("gisela_wrf_DISABLEVOMS", gisela_wrf_DISABLEVOMS);

                portletPreferences.setValue("wrf_APPID", wrf_APPID.trim());
                portletPreferences.setValue("wrf_LOGLEVEL", wrf_LOGLEVEL.trim());
                portletPreferences.setValue("wrf_OUTPUT_PATH", wrf_OUTPUT_PATH.trim());
                portletPreferences.setValue("wrf_SOFTWARE", wrf_SOFTWARE.trim());
                portletPreferences.setValue("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
                portletPreferences.setValue("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
                portletPreferences.setValue("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
                portletPreferences.setValue("SMTP_HOST", SMTP_HOST.trim());
                portletPreferences.setValue("SENDER_MAIL", SENDER_MAIL.trim());

                if (wrf_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n\nPROCESS ACTION => " + action + "\n- Storing the  portlet preferences ..."
                            + "\n\ngisela_wrf_INFRASTRUCTURE: " + gisela_wrf_INFRASTRUCTURE
                            + "\ngisela_wrf_VONAME: " + gisela_wrf_VONAME + "\ngisela_wrf_TOPBDII: "
                            + gisela_wrf_TOPBDII + "\ngisela_wrf_ETOKENSERVER: " + gisela_wrf_ETOKENSERVER
                            + "\ngisela_wrf_MYPROXYSERVER: " + gisela_wrf_MYPROXYSERVER + "\ngisela_wrf_PORT: "
                            + gisela_wrf_PORT + "\ngisela_wrf_ROBOTID: " + gisela_wrf_ROBOTID
                            + "\ngisela_wrf_ROLE: " + gisela_wrf_ROLE + "\ngisela_wrf_RENEWAL: "
                            + gisela_wrf_RENEWAL + "\ngisela_wrf_DISABLEVOMS: " + gisela_wrf_DISABLEVOMS

                            + "\n\nwrf_ENABLEINFRASTRUCTURE: " + "gisela" + "\nwrf_APPID: " + wrf_APPID
                            + "\nwrf_LOGLEVEL: " + wrf_LOGLEVEL + "\nwrf_OUTPUT_PATH: " + wrf_OUTPUT_PATH
                            + "\nwrf_SOFTWARE: " + wrf_SOFTWARE + "\nTracking_DB_Hostname: "
                            + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: " + TRACKING_DB_USERNAME
                            + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD + "\nSMTP_HOST: " + SMTP_HOST
                            + "\nSENDER_MAIL: " + SENDER_MAIL);
                }
            }

            if (sagrid_wrf_ENABLEINFRASTRUCTURE.equals("checked")) {
                infras[6] = "sagrid";
                // Get the  INFRASTRUCTURE from the portlet request for the SAGRID VO
                String sagrid_wrf_INFRASTRUCTURE = request.getParameter("sagrid_wrf_INFRASTRUCTURE");
                // Get the  VONAME from the portlet request for the SAGRID VO
                String sagrid_wrf_VONAME = request.getParameter("sagrid_wrf_VONAME");
                // Get the  TOPBDII from the portlet request for the SAGRID VO
                String sagrid_wrf_TOPBDII = request.getParameter("sagrid_wrf_TOPBDII");
                // Get the  WMS from the portlet request for the SAGRID VO
                String[] sagrid_wrf_WMS = request.getParameterValues("sagrid_wrf_WMS");
                // Get the  ETOKENSERVER from the portlet request for the SAGRID VO
                String sagrid_wrf_ETOKENSERVER = request.getParameter("sagrid_wrf_ETOKENSERVER");
                // Get the  MYPROXYSERVER from the portlet request for the SAGRID VO
                String sagrid_wrf_MYPROXYSERVER = request.getParameter("sagrid_wrf_MYPROXYSERVER");
                // Get the  PORT from the portlet request for the SAGRID VO
                String sagrid_wrf_PORT = request.getParameter("sagrid_wrf_PORT");
                // Get the  ROBOTID from the portlet request for the SAGRID VO
                String sagrid_wrf_ROBOTID = request.getParameter("sagrid_wrf_ROBOTID");
                // Get the  ROLE from the portlet request for the SAGRID VO
                String sagrid_wrf_ROLE = request.getParameter("sagrid_wrf_ROLE");
                // Get the  OPTIONS from the portlet request for the SAGRID VO
                String[] sagrid_wrf_OPTIONS = request.getParameterValues("sagrid_wrf_OPTIONS");

                String sagrid_wrf_RENEWAL = "";
                String sagrid_wrf_DISABLEVOMS = "";

                if (sagrid_wrf_OPTIONS == null) {
                    sagrid_wrf_RENEWAL = "checked";
                    sagrid_wrf_DISABLEVOMS = "unchecked";
                } else {
                    Arrays.sort(sagrid_wrf_OPTIONS);
                    // Get the  RENEWAL from the portlet preferences for the SAGRID VO
                    sagrid_wrf_RENEWAL = Arrays.binarySearch(sagrid_wrf_OPTIONS, "enableRENEWAL") >= 0
                            ? "checked"
                            : "unchecked";
                    // Get the  DISABLEVOMS from the portlet preferences for the SAGRID VO
                    sagrid_wrf_DISABLEVOMS = Arrays.binarySearch(sagrid_wrf_OPTIONS, "disableVOMS") >= 0
                            ? "checked"
                            : "unchecked";
                }

                int nmax = 0;
                for (int i = 0; i < sagrid_wrf_WMS.length; i++)
                    if (sagrid_wrf_WMS[i] != null && (!sagrid_wrf_WMS[i].trim().equals("N/A")))
                        nmax++;

                log.info("\n\nLength=" + nmax);
                String[] sagrid_wrf_WMS_trimmed = new String[nmax];
                for (int i = 0; i < nmax; i++) {
                    sagrid_wrf_WMS_trimmed[i] = sagrid_wrf_WMS[i].trim();
                    log.info("\n\nSAGRID [" + i + "] WMS=[" + sagrid_wrf_WMS_trimmed[i] + "]");
                }

                // Set the portlet preferences
                portletPreferences.setValue("sagrid_wrf_INFRASTRUCTURE", sagrid_wrf_INFRASTRUCTURE.trim());
                portletPreferences.setValue("sagrid_wrf_VONAME", sagrid_wrf_VONAME.trim());
                portletPreferences.setValue("sagrid_wrf_TOPBDII", sagrid_wrf_TOPBDII.trim());
                portletPreferences.setValues("sagrid_wrf_WMS", sagrid_wrf_WMS_trimmed);
                portletPreferences.setValue("sagrid_wrf_ETOKENSERVER", sagrid_wrf_ETOKENSERVER.trim());
                portletPreferences.setValue("sagrid_wrf_MYPROXYSERVER", sagrid_wrf_MYPROXYSERVER.trim());
                portletPreferences.setValue("sagrid_wrf_PORT", sagrid_wrf_PORT.trim());
                portletPreferences.setValue("sagrid_wrf_ROBOTID", sagrid_wrf_ROBOTID.trim());
                portletPreferences.setValue("sagrid_wrf_ROLE", sagrid_wrf_ROLE.trim());
                portletPreferences.setValue("sagrid_wrf_RENEWAL", sagrid_wrf_RENEWAL);
                portletPreferences.setValue("sagrid_wrf_DISABLEVOMS", sagrid_wrf_DISABLEVOMS);

                portletPreferences.setValue("wrf_APPID", wrf_APPID.trim());
                portletPreferences.setValue("wrf_LOGLEVEL", wrf_LOGLEVEL.trim());
                portletPreferences.setValue("wrf_OUTPUT_PATH", wrf_OUTPUT_PATH.trim());
                portletPreferences.setValue("wrf_SOFTWARE", wrf_SOFTWARE.trim());
                portletPreferences.setValue("TRACKING_DB_HOSTNAME", TRACKING_DB_HOSTNAME.trim());
                portletPreferences.setValue("TRACKING_DB_USERNAME", TRACKING_DB_USERNAME.trim());
                portletPreferences.setValue("TRACKING_DB_PASSWORD", TRACKING_DB_PASSWORD.trim());
                portletPreferences.setValue("SMTP_HOST", SMTP_HOST.trim());
                portletPreferences.setValue("SENDER_MAIL", SENDER_MAIL.trim());

                if (wrf_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n\nPROCESS ACTION => " + action + "\n- Storing the  portlet preferences ..."
                            + "\n\nsagrid_wrf_INFRASTRUCTURE: " + sagrid_wrf_INFRASTRUCTURE
                            + "\nsagrid_wrf_VONAME: " + sagrid_wrf_VONAME + "\nsagrid_wrf_TOPBDII: "
                            + sagrid_wrf_TOPBDII + "\nsagrid_wrf_ETOKENSERVER: " + sagrid_wrf_ETOKENSERVER
                            + "\nsagrid_wrf_MYPROXYSERVER: " + sagrid_wrf_MYPROXYSERVER + "\nsagrid_wrf_PORT: "
                            + sagrid_wrf_PORT + "\nsagrid_wrf_ROBOTID: " + sagrid_wrf_ROBOTID
                            + "\nsagrid_wrf_ROLE: " + sagrid_wrf_ROLE + "\nsagrid_wrf_RENEWAL: "
                            + sagrid_wrf_RENEWAL + "\nsagrid_wrf_DISABLEVOMS: " + sagrid_wrf_DISABLEVOMS

                            + "\n\nwrf_ENABLEINFRASTRUCTURE: " + "sagrid" + "\nwrf_APPID: " + wrf_APPID
                            + "\nwrf_LEVEL: " + wrf_LOGLEVEL + "\nwrf_OUTPUT_PATH: " + wrf_OUTPUT_PATH
                            + "\nwrf_SOFTWARE: " + wrf_SOFTWARE + "\nTracking_DB_Hostname: "
                            + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: " + TRACKING_DB_USERNAME
                            + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD + "\nSMTP_HOST: " + SMTP_HOST
                            + "\nSENDER_MAIL: " + SENDER_MAIL);
                }
            }

            for (int i = 0; i < infras.length; i++)
                if (infras[i] != null)
                    log.info("\n - Infrastructure Enabled = " + infras[i]);

            portletPreferences.setValues("wrf_ENABLEINFRASTRUCTURE", infras);
            portletPreferences.setValue("dit_wrf_ENABLEINFRASTRUCTURE", infras[0]);
            portletPreferences.setValue("garuda_wrf_ENABLEINFRASTRUCTURE", infras[1]);
            portletPreferences.setValue("chain_wrf_ENABLEINFRASTRUCTURE", infras[2]);
            portletPreferences.setValue("fedcloud_wrf_ENABLEINFRASTRUCTURE", infras[3]);
            portletPreferences.setValue("eumed_wrf_ENABLEINFRASTRUCTURE", infras[4]);
            portletPreferences.setValue("gisela_wrf_ENABLEINFRASTRUCTURE", infras[5]);
            portletPreferences.setValue("sagrid_wrf_ENABLEINFRASTRUCTURE", infras[6]);

            portletPreferences.store();
            response.setPortletMode(PortletMode.VIEW);
        } // end PROCESS ACTION [ CONFIG_WRF_PORTLET ]

        if (action.equals("SUBMIT_WRF_PORTLET")) {
            log.info("\nPROCESS ACTION => " + action);

            InfrastructureInfo infrastructures[] = new InfrastructureInfo[7];
            int NMAX = 0;
            String wmsList[] = new String[10];
            String _wmsListFedCloud[] = new String[10];
            String fedcloud_wrf_ETOKENSERVER = "";
            String fedcloud_wrf_PORT = "";
            String fedcloud_wrf_ROBOTID = "";
            String fedcloud_wrf_VONAME = "";
            String fedcloud_wrf_ROLE = "";

            String _wmsListChainCloud[] = new String[10];
            String chain_wrf_ETOKENSERVER = "";
            String chain_wrf_PORT = "";
            String chain_wrf_ROBOTID = "";
            String chain_wrf_VONAME = "";
            String chain_wrf_ROLE = "";

            // Get the APPID from the portlet preferences
            String wrf_APPID = portletPreferences.getValue("wrf_APPID", "N/A");
            // Get the LOGLEVEL from the portlet preferences
            String wrf_LOGLEVEL = portletPreferences.getValue("wrf_LOGLEVEL", "INFO");
            // Get the APPID from the portlet preferences
            String wrf_OUTPUT_PATH = portletPreferences.getValue("wrf_OUTPUT_PATH", "/tmp");
            // Get the SOFTWARE from the portlet preferences
            String wrf_SOFTWARE = portletPreferences.getValue("wrf_SOFTWARE", "N/A");
            // Get the TRACKING_DB_HOSTNAME from the portlet request
            String TRACKING_DB_HOSTNAME = portletPreferences.getValue("TRACKING_DB_HOSTNAME", "N/A");
            // Get the TRACKING_DB_USERNAME from the portlet request
            String TRACKING_DB_USERNAME = portletPreferences.getValue("TRACKING_DB_USERNAME", "N/A");
            // Get the TRACKING_DB_PASSWORD from the portlet request
            String TRACKING_DB_PASSWORD = portletPreferences.getValue("TRACKING_DB_PASSWORD", "N/A");
            // Get the SMTP_HOST from the portlet request
            String SMTP_HOST = portletPreferences.getValue("SMTP_HOST", "N/A");
            // Get the SENDER_MAIL from the portlet request
            String SENDER_MAIL = portletPreferences.getValue("SENDER_MAIL", "N/A");

            String dit_wrf_ENABLEINFRASTRUCTURE = portletPreferences.getValue("dit_wrf_ENABLEINFRASTRUCTURE",
                    "null");
            String garuda_wrf_ENABLEINFRASTRUCTURE = portletPreferences
                    .getValue("garuda_wrf_ENABLEINFRASTRUCTURE", "null");
            String chain_wrf_ENABLEINFRASTRUCTURE = portletPreferences
                    .getValue("chain_wrf_ENABLEINFRASTRUCTURE", "null");
            String fedcloud_wrf_ENABLEINFRASTRUCTURE = portletPreferences
                    .getValue("fedcloud_wrf_ENABLEINFRASTRUCTURE", "null");
            String eumed_wrf_ENABLEINFRASTRUCTURE = portletPreferences
                    .getValue("eumed_wrf_ENABLEINFRASTRUCTURE", "null");
            String gisela_wrf_ENABLEINFRASTRUCTURE = portletPreferences
                    .getValue("gisela_wrf_ENABLEINFRASTRUCTURE", "null");
            String sagrid_wrf_ENABLEINFRASTRUCTURE = portletPreferences
                    .getValue("sagrid_wrf_ENABLEINFRASTRUCTURE", "null");

            if (dit_wrf_ENABLEINFRASTRUCTURE != null && dit_wrf_ENABLEINFRASTRUCTURE.equals("dit")) {
                NMAX++;
                // Get the  VONAME from the portlet preferences for the DIT VO
                String dit_wrf_INFRASTRUCTURE = portletPreferences.getValue("dit_wrf_INFRASTRUCTURE", "N/A");
                // Get the  VONAME from the portlet preferences for the DIT VO
                String dit_wrf_LOGIN = portletPreferences.getValue("dit_wrf_LOGIN", "N/A");
                // Get the  TOPPBDII from the portlet preferences for the DIT VO
                String dit_wrf_PASSWD = portletPreferences.getValue("dit_wrf_PASSWD", "N/A");
                // Get the  WMS from the portlet preferences for the DIT VO                
                String[] dit_wrf_WMS = portletPreferences.getValues("dit_wrf_WMS", new String[5]);
                // Get the  ETOKENSERVER from the portlet preferences for the DIT VO
                String dit_wrf_ETOKENSERVER = portletPreferences.getValue("dit_wrf_ETOKENSERVER", "N/A");
                // Get the  MYPROXYSERVER from the portlet preferences for the DIT VO
                String dit_wrf_MYPROXYSERVER = portletPreferences.getValue("dit_wrf_MYPROXYSERVER", "N/A");
                // Get the  PORT from the portlet preferences for the DIT VO
                String dit_wrf_PORT = portletPreferences.getValue("dit_wrf_PORT", "N/A");
                // Get the  ROBOTID from the portlet preferences for the DIT VO
                String dit_wrf_ROBOTID = portletPreferences.getValue("dit_wrf_ROBOTID", "N/A");
                // Get the  ROLE from the portlet preferences for the DIT VO
                String dit_wrf_ROLE = portletPreferences.getValue("dit_wrf_ROLE", "N/A");
                // Get the  RENEWAL from the portlet preferences for the DIT VO
                String dit_wrf_RENEWAL = portletPreferences.getValue("dit_wrf_RENEWAL", "checked");
                // Get the  DISABLEVOMS from the portlet preferences for the DIT VO
                String dit_wrf_DISABLEVOMS = portletPreferences.getValue("dit_wrf_DISABLEVOMS", "unchecked");
                // Get the random CE for the Sonification portlet               
                //RANDOM_CE = getRandomCE(dit_wrf_LOGIN, dit_wrf_PASSWD, wrf_SOFTWARE);

                if (wrf_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n- Getting the  portlet preferences ..." + "\ndit_wrf_INFRASTRUCTURE: "
                            + dit_wrf_INFRASTRUCTURE + "\ndit_wrf_LOGIN: " + dit_wrf_LOGIN
                            + "\ndit_wrf_PASSWD: " + dit_wrf_PASSWD + "\ndit_wrf_ETOKENSERVER: "
                            + dit_wrf_ETOKENSERVER + "\ndit_wrf_MYPROXYSERVER: " + dit_wrf_MYPROXYSERVER
                            + "\ndit_wrf_PORT: " + dit_wrf_PORT + "\ndit_wrf_ROBOTID: " + dit_wrf_ROBOTID
                            + "\ndit_wrf_ROLE: " + dit_wrf_ROLE + "\ndit_wrf_RENEWAL: " + dit_wrf_RENEWAL
                            + "\ndit_wrf_DISABLEVOMS: " + dit_wrf_DISABLEVOMS

                            + "\n\nwrf_ENABLEINFRASTRUCTURE: " + dit_wrf_ENABLEINFRASTRUCTURE + "\nwrf_APPID: "
                            + wrf_APPID + "\nwrf_LOGLEVEL: " + wrf_LOGLEVEL + "\nwrf_OUTPUT_PATH: "
                            + wrf_OUTPUT_PATH + "\nwrf_SOFTWARE: " + wrf_SOFTWARE + "\nTracking_DB_Hostname: "
                            + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: " + TRACKING_DB_USERNAME
                            + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD + "\nSMTP_HOST: " + SMTP_HOST
                            + "\nSENDER_MAIL: " + SENDER_MAIL);
                }

                // Defining the WMS list for the "DIT" Infrastructure
                int nmax = 0;
                for (int i = 0; i < dit_wrf_WMS.length; i++)
                    if ((dit_wrf_WMS[i] != null) && (!dit_wrf_WMS[i].equals("N/A")))
                        nmax++;

                String dit_wmsList[] = new String[nmax];
                for (int i = 0; i < nmax; i++) {
                    if (dit_wrf_WMS[i] != null) {
                        dit_wmsList[i] = dit_wrf_WMS[i].trim();
                        log.info("\n\n[" + nmax + "] Submitting to DIT [" + i + "] using WMS=[" + dit_wmsList[i]
                                + "]");
                    }
                }

                infrastructures[0] = new InfrastructureInfo("SSH", "ssh", dit_wrf_LOGIN, dit_wrf_PASSWD,
                        dit_wmsList);
            }

            if (garuda_wrf_ENABLEINFRASTRUCTURE != null && garuda_wrf_ENABLEINFRASTRUCTURE.equals("garuda")) {
                NMAX++;
                // Get the  VONAME from the portlet preferences for the GARUDA VO
                String garuda_wrf_INFRASTRUCTURE = portletPreferences.getValue("garuda_wrf_INFRASTRUCTURE",
                        "N/A");
                // Get the  VONAME from the portlet preferences for the GARUDA VO
                String garuda_wrf_VONAME = portletPreferences.getValue("garuda_wrf_VONAME", "N/A");
                // Get the  TOPPBDII from the portlet preferences for the GARUDA VO
                String garuda_wrf_TOPBDII = portletPreferences.getValue("garuda_wrf_TOPBDII", "N/A");
                // Get the  WMS from the portlet preferences for the GARUDA VO                
                String[] garuda_wrf_WMS = portletPreferences.getValues("garuda_wrf_WMS", new String[5]);
                // Get the  ETOKENSERVER from the portlet preferences for the GARUDA VO
                String garuda_wrf_ETOKENSERVER = portletPreferences.getValue("garuda_wrf_ETOKENSERVER", "N/A");
                // Get the  MYPROXYSERVER from the portlet preferences for the GARUDA VO
                String garuda_wrf_MYPROXYSERVER = portletPreferences.getValue("garuda_wrf_MYPROXYSERVER",
                        "N/A");
                // Get the  PORT from the portlet preferences for the GARUDA VO
                String garuda_wrf_PORT = portletPreferences.getValue("garuda_wrf_PORT", "N/A");
                // Get the  ROBOTID from the portlet preferences for the GARUDA VO
                String garuda_wrf_ROBOTID = portletPreferences.getValue("garuda_wrf_ROBOTID", "N/A");
                // Get the  ROLE from the portlet preferences for the GARUDA VO
                String garuda_wrf_ROLE = portletPreferences.getValue("garuda_wrf_ROLE", "N/A");
                // Get the  RENEWAL from the portlet preferences for the GARUDA VO
                String garuda_wrf_RENEWAL = portletPreferences.getValue("garuda_wrf_RENEWAL", "checked");
                // Get the  DISABLEVOMS from the portlet preferences for the GARUDA VO
                String garuda_wrf_DISABLEVOMS = portletPreferences.getValue("garuda_wrf_DISABLEVOMS",
                        "unchecked");

                if (wrf_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n- Getting the  portlet preferences ..." + "\ngaruda_wrf_INFRASTRUCTURE: "
                            + garuda_wrf_INFRASTRUCTURE + "\ngaruda_wrf_VONAME: " + garuda_wrf_VONAME
                            + "\ngaruda_wrf_TOPBDII: " + garuda_wrf_TOPBDII + "\ngaruda_wrf_ETOKENSERVER: "
                            + garuda_wrf_ETOKENSERVER + "\ngaruda_wrf_MYPROXYSERVER: "
                            + garuda_wrf_MYPROXYSERVER + "\ngaruda_wrf_PORT: " + garuda_wrf_PORT
                            + "\ngaruda_wrf_ROBOTID: " + garuda_wrf_ROBOTID + "\ngaruda_wrf_ROLE: "
                            + garuda_wrf_ROLE + "\ngaruda_wrf_RENEWAL: " + garuda_wrf_RENEWAL
                            + "\ngaruda_wrf_DISABLEVOMS: " + garuda_wrf_DISABLEVOMS

                            + "\n\nwrf_ENABLEINFRASTRUCTURE: " + garuda_wrf_ENABLEINFRASTRUCTURE
                            + "\nwrf_APPID: " + wrf_APPID + "\nwrf_LOGLEVEL: " + wrf_LOGLEVEL
                            + "\nwrf_OUTPUT_PATH: " + wrf_OUTPUT_PATH + "\nwrf_SOFTWARE: " + wrf_SOFTWARE
                            + "\nTracking_DB_Hostname: " + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: "
                            + TRACKING_DB_USERNAME + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD
                            + "\nSMTP_HOST: " + SMTP_HOST + "\nSENDER_MAIL: " + SENDER_MAIL);
                }

                // Defining the WMS list for the "GARUDA" Infrastructure
                int nmax = 0;
                for (int i = 0; i < garuda_wrf_WMS.length; i++)
                    if ((garuda_wrf_WMS[i] != null) && (!garuda_wrf_WMS[i].equals("N/A")))
                        nmax++;

                //String wmsList[] = new String [nmax];
                for (int i = 0; i < nmax; i++) {
                    if (garuda_wrf_WMS[i] != null) {
                        wmsList[i] = garuda_wrf_WMS[i].trim();
                        log.info("\n\n[" + nmax + "] Submitting to GARUDA [" + i + "] using WSGRAM=["
                                + wmsList[i] + "]");
                    }
                }

                infrastructures[1] = new InfrastructureInfo("GARUDA", "wsgram", "", wmsList,
                        garuda_wrf_ETOKENSERVER, garuda_wrf_PORT, garuda_wrf_ROBOTID, garuda_wrf_VONAME,
                        garuda_wrf_ROLE);
            }

            if (chain_wrf_ENABLEINFRASTRUCTURE != null && chain_wrf_ENABLEINFRASTRUCTURE.equals("chain")) {
                String OCCI_AUTH = "x509";

                // Possible RESOURCE values: 'os_tpl', 'resource_tpl', 'compute'
                String OCCI_RESOURCE = "compute";

                // Possible ACTION values: 'list', 'describe', 'create' and 'delete'
                String OCCI_ACTION = "create";

                NMAX++;
                // Get the  VONAME from the portlet preferences for the CHAIN VO
                String chain_wrf_INFRASTRUCTURE = portletPreferences.getValue("chain_wrf_INFRASTRUCTURE",
                        "N/A");
                // Get the  VONAME from the portlet preferences for the CHAIN VO
                chain_wrf_VONAME = portletPreferences.getValue("chain_wrf_VONAME", "N/A");
                // Get the  TOPPBDII from the portlet preferences for the CHAIN VO
                String chain_wrf_TOPBDII = portletPreferences.getValue("chain_wrf_TOPBDII", "N/A");
                // Get the  WMS from the portlet preferences for the CHAIN VO                
                String[] chain_wrf_WMS = portletPreferences.getValues("chain_wrf_WMS", new String[10]);
                // Get the  ETOKENSERVER from the portlet preferences for the CHAIN VO
                chain_wrf_ETOKENSERVER = portletPreferences.getValue("chain_wrf_ETOKENSERVER", "N/A");
                // Get the  MYPROXYSERVER from the portlet preferences for the CHAIN VO
                String chain_wrf_MYPROXYSERVER = portletPreferences.getValue("chain_wrf_MYPROXYSERVER", "N/A");
                // Get the  PORT from the portlet preferences for the CHAIN VO
                chain_wrf_PORT = portletPreferences.getValue("chain_wrf_PORT", "N/A");
                // Get the  ROBOTID from the portlet preferences for the CHAIN VO
                chain_wrf_ROBOTID = portletPreferences.getValue("chain_wrf_ROBOTID", "N/A");
                // Get the  ROLE from the portlet preferences for the CHAIN VO
                chain_wrf_ROLE = portletPreferences.getValue("chain_wrf_ROLE", "N/A");
                // Get the  RENEWAL from the portlet preferences for the CHAIN VO
                String chain_wrf_RENEWAL = portletPreferences.getValue("chain_wrf_RENEWAL", "checked");
                // Get the  DISABLEVOMS from the portlet preferences for the CHAIN VO
                String chain_wrf_DISABLEVOMS = portletPreferences.getValue("chain_wrf_DISABLEVOMS",
                        "unchecked");
                // Get the random CE for the Sonification portlet               
                //RANDOM_CE = getRandomCE(chain_wrf_VONAME, chain_wrf_TOPBDII, wrf_SOFTWARE);

                if (wrf_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n- Getting the  portlet preferences ..." + "\nchain_wrf_INFRASTRUCTURE: "
                            + chain_wrf_INFRASTRUCTURE + "\nchain_wrf_VONAME: " + chain_wrf_VONAME
                            + "\nchain_wrf_TOPBDII: " + chain_wrf_TOPBDII + "\nchain_wrf_ETOKENSERVER: "
                            + chain_wrf_ETOKENSERVER + "\nchain_wrf_MYPROXYSERVER: " + chain_wrf_MYPROXYSERVER
                            + "\nchain_wrf_PORT: " + chain_wrf_PORT + "\nchain_wrf_ROBOTID: "
                            + chain_wrf_ROBOTID + "\nchain_wrf_ROLE: " + chain_wrf_ROLE
                            + "\nchain_wrf_RENEWAL: " + chain_wrf_RENEWAL + "\nchain_wrf_DISABLEVOMS: "
                            + chain_wrf_DISABLEVOMS

                            + "\n\nwrf_ENABLEINFRASTRUCTURE: " + chain_wrf_ENABLEINFRASTRUCTURE
                            + "\nwrf_APPID: " + wrf_APPID + "\nwrf_LOGLEVEL: " + wrf_LOGLEVEL
                            + "\nwrf_OUTPUT_PATH: " + wrf_OUTPUT_PATH + "\nwrf_SOFTWARE: " + wrf_SOFTWARE
                            + "\nTracking_DB_Hostname: " + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: "
                            + TRACKING_DB_USERNAME + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD
                            + "\nSMTP_HOST: " + SMTP_HOST + "\nSENDER_MAIL: " + SENDER_MAIL);

                    log.info("\n- Creating a proxy ...");
                    getRobotProxy(chain_wrf_ETOKENSERVER, chain_wrf_PORT, chain_wrf_ROBOTID, chain_wrf_VONAME,
                            chain_wrf_ROLE, chain_wrf_RENEWAL);
                }

                // Defining the rOCCIResource list for the "CHAIN-REDS" Infrastructure                
                int nmax = 0;
                for (int i = 0; i < chain_wrf_WMS.length; i++)
                    if ((chain_wrf_WMS[i] != null) && (!chain_wrf_WMS[i].equals("N/A")))
                        nmax++;

                //String wmsList[] = new String [nmax];
                for (int i = 0; i < nmax; i++) {
                    if (chain_wrf_WMS[i] != null) {
                        _wmsListChainCloud[i] = chain_wrf_WMS[i].trim() + "?" + "action=" + OCCI_ACTION
                                + "&resource=" + OCCI_RESOURCE + "&attributes_title=OCCI_VM_TITLE"
                                + "&mixin_os_tpl=OCCI_OS" + "&mixin_resource_tpl=OCCI_FLAVOUR" + "&auth="
                                + OCCI_AUTH;

                        log.info("\n\n[" + nmax + "] CHAIN-REDS [" + i + "] rOCCIResourceID=["
                                + _wmsListChainCloud[i] + "]");
                    }
                }

                infrastructures[2] = new InfrastructureInfo("CHAIN-REDS", "rocci", "", _wmsListChainCloud,
                        chain_wrf_ETOKENSERVER, chain_wrf_PORT, chain_wrf_ROBOTID, chain_wrf_VONAME,
                        chain_wrf_ROLE, true);
            }

            if (fedcloud_wrf_ENABLEINFRASTRUCTURE != null
                    && fedcloud_wrf_ENABLEINFRASTRUCTURE.equals("fedcloud")) {
                String OCCI_AUTH = "x509";

                // Possible RESOURCE values: 'os_tpl', 'resource_tpl', 'compute'
                String OCCI_RESOURCE = "compute";

                //String OCCI_VM_TITLE = "MyROCCITest";
                //String OCCI_FLAVOUR = "small";                

                // Possible ACTION values: 'list', 'describe', 'create' and 'delete'
                String OCCI_ACTION = "create";

                NMAX++;
                // Get the  VONAME from the portlet preferences for the FEDCLOUD VO
                String fedcloud_wrf_INFRASTRUCTURE = portletPreferences.getValue("fedcloud_wrf_INFRASTRUCTURE",
                        "N/A");
                // Get the  VONAME from the portlet preferences for the FEDCLOUD VO
                fedcloud_wrf_VONAME = portletPreferences.getValue("fedcloud_wrf_VONAME", "N/A");
                // Get the  TOPPBDII from the portlet preferences for the FEDCLOUD VO
                String fedcloud_wrf_TOPBDII = portletPreferences.getValue("fedcloud_wrf_TOPBDII", "N/A");
                // Get the  WMS from the portlet preferences for the FEDCLOUD VO
                String[] fedcloud_wrf_WMS = portletPreferences.getValues("fedcloud_wrf_WMS", new String[10]);
                // Get the  ETOKENSERVER from the portlet preferences for the FEDCLOUD VO
                fedcloud_wrf_ETOKENSERVER = portletPreferences.getValue("fedcloud_wrf_ETOKENSERVER", "N/A");
                // Get the  MYPROXYSERVER from the portlet preferences for the FEDCLOUD VO
                String fedcloud_wrf_MYPROXYSERVER = portletPreferences.getValue("fedcloud_wrf_MYPROXYSERVER",
                        "N/A");
                // Get the  PORT from the portlet preferences for the FEDCLOUD VO
                fedcloud_wrf_PORT = portletPreferences.getValue("fedcloud_wrf_PORT", "N/A");
                // Get the  ROBOTID from the portlet preferences for the FEDCLOUD VO
                fedcloud_wrf_ROBOTID = portletPreferences.getValue("fedcloud_wrf_ROBOTID", "N/A");
                // Get the  ROLE from the portlet preferences for the FEDCLOUD VO
                fedcloud_wrf_ROLE = portletPreferences.getValue("fedcloud_wrf_ROLE", "N/A");
                // Get the  RENEWAL from the portlet preferences for the FEDCLOUD VO
                String fedcloud_wrf_RENEWAL = portletPreferences.getValue("fedcloud_wrf_RENEWAL", "checked");
                // Get the  DISABLEVOMS from the portlet preferences for the FEDCLOUD VO
                String fedcloud_wrf_DISABLEVOMS = portletPreferences.getValue("fedcloud_wrf_DISABLEVOMS",
                        "unchecked");
                // Get the random CE for the Sonification portlet               
                //RANDOM_CE = getRandomCE(fedcloud_wrf_VONAME, fedcloud_wrf_TOPBDII, wrf_SOFTWARE);

                if (wrf_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n- Getting the  portlet preferences ..." + "\n\nfedcloud_wrf_INFRASTRUCTURE: "
                            + fedcloud_wrf_INFRASTRUCTURE + "\nfedcloud_wrf_VONAME: " + fedcloud_wrf_VONAME
                            + "\nfedcloud_wrf_TOPBDII: " + fedcloud_wrf_TOPBDII
                            + "\nfedcloud_wrf_ETOKENSERVER: " + fedcloud_wrf_ETOKENSERVER
                            + "\nfedcloud_wrf_MYPROXYSERVER: " + fedcloud_wrf_MYPROXYSERVER
                            + "\nfedcloud_wrf_PORT: " + fedcloud_wrf_PORT + "\nfedcloud_wrf_ROBOTID: "
                            + fedcloud_wrf_ROBOTID + "\nfedcloud_wrf_ROLE: " + fedcloud_wrf_ROLE
                            + "\nfedcloud_wrf_RENEWAL: " + fedcloud_wrf_RENEWAL + "\nfedcloud_wrf_DISABLEVOMS: "
                            + fedcloud_wrf_DISABLEVOMS

                            + "\n\nwrf_ENABLEINFRASTRUCTURE: " + fedcloud_wrf_ENABLEINFRASTRUCTURE
                            + "\nwrf_APPID: " + wrf_APPID + "\nwrf_LOGLEVEL: " + wrf_LOGLEVEL
                            + "\nwrf_OUTPUT_PATH: " + wrf_OUTPUT_PATH + "\nwrf_SOFTWARE: " + wrf_SOFTWARE
                            + "\nTracking_DB_Hostname: " + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: "
                            + TRACKING_DB_USERNAME + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD
                            + "\nSMTP_HOST: " + SMTP_HOST + "\nSENDER_MAIL: " + SENDER_MAIL);

                    //log.info("\n- Creating a proxy ...");
                    getRobotProxy(fedcloud_wrf_ETOKENSERVER, fedcloud_wrf_PORT, fedcloud_wrf_ROBOTID,
                            fedcloud_wrf_VONAME, fedcloud_wrf_ROLE, fedcloud_wrf_RENEWAL);
                }

                // Defining the rOCCIResource list for the "FEDCLOUD" Infrastructure                
                int nmax = 0;
                for (int i = 0; i < fedcloud_wrf_WMS.length; i++)
                    if ((fedcloud_wrf_WMS[i] != null) && (!fedcloud_wrf_WMS[i].equals("N/A")))
                        nmax++;

                //String wmsList[] = new String [nmax];
                for (int i = 0; i < nmax; i++) {
                    if (fedcloud_wrf_WMS[i] != null) {
                        _wmsListFedCloud[i] = fedcloud_wrf_WMS[i].trim() + "?" + "action=" + OCCI_ACTION
                                + "&resource=" + OCCI_RESOURCE + "&attributes_title=OCCI_VM_TITLE"
                                + "&mixin_os_tpl=OCCI_OS" + "&mixin_resource_tpl=OCCI_FLAVOUR" + "&auth="
                                + OCCI_AUTH;

                        log.info("\n\n[" + nmax + "] FEDCLOUD [" + i + "] rOCCIResourceID=["
                                + _wmsListFedCloud[i] + "]");
                    }
                }

                infrastructures[3] = new InfrastructureInfo("EGI-FEDCLOUD", "rocci", "", _wmsListFedCloud,
                        fedcloud_wrf_ETOKENSERVER, fedcloud_wrf_PORT, fedcloud_wrf_ROBOTID, fedcloud_wrf_VONAME,
                        fedcloud_wrf_ROLE, true);
            }

            if (eumed_wrf_ENABLEINFRASTRUCTURE != null && eumed_wrf_ENABLEINFRASTRUCTURE.equals("eumed")) {
                NMAX++;
                // Get the  VONAME from the portlet preferences for the EUMED VO
                String eumed_wrf_INFRASTRUCTURE = portletPreferences.getValue("eumed_wrf_INFRASTRUCTURE",
                        "N/A");
                // Get the  VONAME from the portlet preferences for the EUMED VO
                String eumed_wrf_VONAME = portletPreferences.getValue("eumed_wrf_VONAME", "N/A");
                // Get the  TOPPBDII from the portlet preferences for the EUMED VO
                String eumed_wrf_TOPBDII = portletPreferences.getValue("eumed_wrf_TOPBDII", "N/A");
                // Get the  WMS from the portlet preferences for the EUMED VO
                String[] eumed_wrf_WMS = portletPreferences.getValues("eumed_wrf_WMS", new String[5]);
                // Get the  ETOKENSERVER from the portlet preferences for the EUMED VO
                String eumed_wrf_ETOKENSERVER = portletPreferences.getValue("eumed_wrf_ETOKENSERVER", "N/A");
                // Get the  MYPROXYSERVER from the portlet preferences for the EUMED VO
                String eumed_wrf_MYPROXYSERVER = portletPreferences.getValue("eumed_wrf_MYPROXYSERVER", "N/A");
                // Get the  PORT from the portlet preferences for the EUMED VO
                String eumed_wrf_PORT = portletPreferences.getValue("eumed_wrf_PORT", "N/A");
                // Get the  ROBOTID from the portlet preferences for the EUMED VO
                String eumed_wrf_ROBOTID = portletPreferences.getValue("eumed_wrf_ROBOTID", "N/A");
                // Get the  ROLE from the portlet preferences for the EUMED VO
                String eumed_wrf_ROLE = portletPreferences.getValue("eumed_wrf_ROLE", "N/A");
                // Get the  RENEWAL from the portlet preferences for the EUMED VO
                String eumed_wrf_RENEWAL = portletPreferences.getValue("eumed_wrf_RENEWAL", "checked");
                // Get the  DISABLEVOMS from the portlet preferences for the EUMED VO
                String eumed_wrf_DISABLEVOMS = portletPreferences.getValue("eumed_wrf_DISABLEVOMS",
                        "unchecked");
                // Get the random CE for the Sonification portlet               
                //RANDOM_CE = getRandomCE(eumed_wrf_VONAME, eumed_wrf_TOPBDII, wrf_SOFTWARE);

                if (wrf_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n- Getting the  portlet preferences ..." + "\n\neumed_wrf_INFRASTRUCTURE: "
                            + eumed_wrf_INFRASTRUCTURE + "\neumed_wrf_VONAME: " + eumed_wrf_VONAME
                            + "\neumed_wrf_TOPBDII: " + eumed_wrf_TOPBDII + "\neumed_wrf_ETOKENSERVER: "
                            + eumed_wrf_ETOKENSERVER + "\neumed_wrf_MYPROXYSERVER: " + eumed_wrf_MYPROXYSERVER
                            + "\neumed_wrf_PORT: " + eumed_wrf_PORT + "\neumed_wrf_ROBOTID: "
                            + eumed_wrf_ROBOTID + "\neumed_wrf_ROLE: " + eumed_wrf_ROLE
                            + "\neumed_wrf_RENEWAL: " + eumed_wrf_RENEWAL + "\neumed_wrf_DISABLEVOMS: "
                            + eumed_wrf_DISABLEVOMS

                            + "\n\nwrf_ENABLEINFRASTRUCTURE: " + eumed_wrf_ENABLEINFRASTRUCTURE
                            + "\nwrf_APPID: " + wrf_APPID + "\nwrf_LOGLEVEL: " + wrf_LOGLEVEL
                            + "\nwrf_OUTPUT_PATH: " + wrf_OUTPUT_PATH + "\nwrf_SOFTWARE: " + wrf_SOFTWARE
                            + "\nTracking_DB_Hostname: " + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: "
                            + TRACKING_DB_USERNAME + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD
                            + "\nSMTP_HOST: " + SMTP_HOST + "\nSENDER_MAIL: " + SENDER_MAIL);
                }

                // Defining the WMS list for the "EUMED" Infrastructure
                int nmax = 0;
                for (int i = 0; i < eumed_wrf_WMS.length; i++)
                    if ((eumed_wrf_WMS[i] != null) && (!eumed_wrf_WMS[i].equals("N/A")))
                        nmax++;

                String eumed_wmsList[] = new String[nmax];
                for (int i = 0; i < nmax; i++) {
                    if (eumed_wrf_WMS[i] != null) {
                        eumed_wmsList[i] = eumed_wrf_WMS[i].trim();
                        log.info("\n\n[" + nmax + "] Submitting to EUMED [" + i + "] using WMS=["
                                + eumed_wmsList[i] + "]");
                    }
                }

                infrastructures[4] = new InfrastructureInfo(eumed_wrf_VONAME, eumed_wrf_TOPBDII, eumed_wmsList,
                        eumed_wrf_ETOKENSERVER, eumed_wrf_PORT, eumed_wrf_ROBOTID, eumed_wrf_VONAME,
                        eumed_wrf_ROLE, "VO-" + eumed_wrf_VONAME + "-" + wrf_SOFTWARE);
            }

            if (gisela_wrf_ENABLEINFRASTRUCTURE != null && gisela_wrf_ENABLEINFRASTRUCTURE.equals("gisela")) {
                NMAX++;
                // Get the  VONAME from the portlet preferences for the GISELA VO
                String gisela_wrf_INFRASTRUCTURE = portletPreferences.getValue("gisela_wrf_INFRASTRUCTURE",
                        "N/A");
                // Get the  VONAME from the portlet preferences for the GISELA VO
                String gisela_wrf_VONAME = portletPreferences.getValue("gisela_wrf_VONAME", "N/A");
                // Get the  TOPPBDII from the portlet preferences for the GISELA VO
                String gisela_wrf_TOPBDII = portletPreferences.getValue("gisela_wrf_TOPBDII", "N/A");
                // Get the  WMS from the portlet preferences for the GISELA VO
                String[] gisela_wrf_WMS = portletPreferences.getValues("gisela_wrf_WMS", new String[5]);
                // Get the  ETOKENSERVER from the portlet preferences for the GISELA VO
                String gisela_wrf_ETOKENSERVER = portletPreferences.getValue("gisela_wrf_ETOKENSERVER", "N/A");
                // Get the  MYPROXYSERVER from the portlet preferences for the GISELA VO
                String gisela_wrf_MYPROXYSERVER = portletPreferences.getValue("gisela_wrf_MYPROXYSERVER",
                        "N/A");
                // Get the  PORT from the portlet preferences for the GISELA VO
                String gisela_wrf_PORT = portletPreferences.getValue("gisela_wrf_PORT", "N/A");
                // Get the  ROBOTID from the portlet preferences for the GISELA VO
                String gisela_wrf_ROBOTID = portletPreferences.getValue("gisela_wrf_ROBOTID", "N/A");
                // Get the  ROLE from the portlet preferences for the GISELA VO
                String gisela_wrf_ROLE = portletPreferences.getValue("gisela_wrf_ROLE", "N/A");
                // Get the  RENEWAL from the portlet preferences for the GISELA VO
                String gisela_wrf_RENEWAL = portletPreferences.getValue("gisela_wrf_RENEWAL", "checked");
                // Get the  DISABLEVOMS from the portlet preferences for the GISELA VO
                String gisela_wrf_DISABLEVOMS = portletPreferences.getValue("gisela_wrf_DISABLEVOMS",
                        "unchecked");
                // Get the random CE for the Sonification portlet               
                //RANDOM_CE = getRandomCE(gisela_wrf_VONAME, gisela_wrf_TOPBDII, wrf_SOFTWARE);

                if (wrf_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n- Getting the  portlet preferences ..." + "\n\ngisela_wrf_INFRASTRUCTURE: "
                            + gisela_wrf_INFRASTRUCTURE + "\ngisela_wrf_VONAME: " + gisela_wrf_VONAME
                            + "\ngisela_wrf_TOPBDII: " + gisela_wrf_TOPBDII + "\ngisela_wrf_ETOKENSERVER: "
                            + gisela_wrf_ETOKENSERVER + "\ngisela_wrf_MYPROXYSERVER: "
                            + gisela_wrf_MYPROXYSERVER + "\ngisela_wrf_PORT: " + gisela_wrf_PORT
                            + "\ngisela_wrf_ROBOTID: " + gisela_wrf_ROBOTID + "\ngisela_wrf_ROLE: "
                            + gisela_wrf_ROLE + "\ngisela_wrf_RENEWAL: " + gisela_wrf_RENEWAL
                            + "\ngisela_wrf_DISABLEVOMS: " + gisela_wrf_DISABLEVOMS

                            + "\n\nwrf_ENABLEINFRASTRUCTURE: " + gisela_wrf_ENABLEINFRASTRUCTURE
                            + "\nwrf_APPID: " + wrf_APPID + "\nwrf_LOGLEVEL: " + wrf_LOGLEVEL
                            + "\nwrf_OUTPUT_PATH: " + wrf_OUTPUT_PATH + "\nwrf_SOFTWARE: " + wrf_SOFTWARE
                            + "\nTracking_DB_Hostname: " + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: "
                            + TRACKING_DB_USERNAME + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD
                            + "\nSMTP_HOST: " + SMTP_HOST + "\nSENDER_MAIL: " + SENDER_MAIL);
                }

                // Defining the WMS list for the "GISELA" Infrastructure
                int nmax = 0;
                for (int i = 0; i < gisela_wrf_WMS.length; i++)
                    if ((gisela_wrf_WMS[i] != null) && (!gisela_wrf_WMS[i].equals("N/A")))
                        nmax++;

                //String wmsList[] = new String [gisela_wrf_WMS.length];
                for (int i = 0; i < gisela_wrf_WMS.length; i++) {
                    if (gisela_wrf_WMS[i] != null) {
                        wmsList[i] = gisela_wrf_WMS[i].trim();
                        log.info("\n\nSubmitting for GISELA [" + i + "] using WMS=[" + wmsList[i] + "]");
                    }
                }

                infrastructures[5] = new InfrastructureInfo(gisela_wrf_VONAME, gisela_wrf_TOPBDII, wmsList,
                        gisela_wrf_ETOKENSERVER, gisela_wrf_PORT, gisela_wrf_ROBOTID, gisela_wrf_VONAME,
                        gisela_wrf_ROLE, "VO-" + gisela_wrf_VONAME + "-" + wrf_SOFTWARE);
            }

            if (sagrid_wrf_ENABLEINFRASTRUCTURE != null && sagrid_wrf_ENABLEINFRASTRUCTURE.equals("sagrid")) {
                NMAX++;
                // Get the  VONAME from the portlet preferences for the SAGRID VO
                String sagrid_wrf_INFRASTRUCTURE = portletPreferences.getValue("sagrid_wrf_INFRASTRUCTURE",
                        "N/A");
                // Get the  VONAME from the portlet preferences for the SAGRID VO
                String sagrid_wrf_VONAME = portletPreferences.getValue("sagrid_wrf_VONAME", "N/A");
                // Get the  TOPPBDII from the portlet preferences for the SAGRID VO
                String sagrid_wrf_TOPBDII = portletPreferences.getValue("sagrid_wrf_TOPBDII", "N/A");
                // Get the  WMS from the portlet preferences for the SAGRID VO
                String[] sagrid_wrf_WMS = portletPreferences.getValues("sagrid_wrf_WMS", new String[5]);
                // Get the  ETOKENSERVER from the portlet preferences for the SAGRID VO
                String sagrid_wrf_ETOKENSERVER = portletPreferences.getValue("sagrid_wrf_ETOKENSERVER", "N/A");
                // Get the  MYPROXYSERVER from the portlet preferences for the SAGRID VO
                String sagrid_wrf_MYPROXYSERVER = portletPreferences.getValue("sagrid_wrf_MYPROXYSERVER",
                        "N/A");
                // Get the  PORT from the portlet preferences for the SAGRID VO
                String sagrid_wrf_PORT = portletPreferences.getValue("sagrid_wrf_PORT", "N/A");
                // Get the  ROBOTID from the portlet preferences for the SAGRID VO
                String sagrid_wrf_ROBOTID = portletPreferences.getValue("sagrid_wrf_ROBOTID", "N/A");
                // Get the  ROLE from the portlet preferences for the SAGRID VO
                String sagrid_wrf_ROLE = portletPreferences.getValue("sagrid_wrf_ROLE", "N/A");
                // Get the  RENEWAL from the portlet preferences for the SAGRID VO
                String sagrid_wrf_RENEWAL = portletPreferences.getValue("sagrid_wrf_RENEWAL", "checked");
                // Get the  DISABLEVOMS from the portlet preferences for the SAGRID VO
                String sagrid_wrf_DISABLEVOMS = portletPreferences.getValue("sagrid_wrf_DISABLEVOMS",
                        "unchecked");
                // Get the random CE for the Sonification portlet               
                //RANDOM_CE = getRandomCE(sagrid_wrf_VONAME, sagrid_wrf_TOPBDII, wrf_SOFTWARE);

                if (wrf_LOGLEVEL.trim().equals("VERBOSE")) {
                    log.info("\n- Getting the  portlet preferences ..." + "\n\nsagrid_wrf_INFRASTRUCTURE: "
                            + sagrid_wrf_INFRASTRUCTURE + "\nsagrid_wrf_VONAME: " + sagrid_wrf_VONAME
                            + "\nsagrid_wrf_TOPBDII: " + sagrid_wrf_TOPBDII + "\nsagrid_wrf_ETOKENSERVER: "
                            + sagrid_wrf_ETOKENSERVER + "\nsagrid_wrf_MYPROXYSERVER: "
                            + sagrid_wrf_MYPROXYSERVER + "\nsagrid_wrf_PORT: " + sagrid_wrf_PORT
                            + "\nsagrid_wrf_ROBOTID: " + sagrid_wrf_ROBOTID + "\nsagrid_wrf_ROLE: "
                            + sagrid_wrf_ROLE + "\nsagrid_wrf_RENEWAL: " + sagrid_wrf_RENEWAL
                            + "\nsagrid_wrf_DISABLEVOMS: " + sagrid_wrf_DISABLEVOMS

                            + "\n\nwrf_ENABLEINFRASTRUCTURE: " + sagrid_wrf_ENABLEINFRASTRUCTURE
                            + "\nwrf_APPID: " + wrf_APPID + "\nwrf_LOGLEVEL: " + wrf_LOGLEVEL
                            + "\nwrf_OUTPUT_PATH: " + wrf_OUTPUT_PATH + "\nwrf_SOFTWARE: " + wrf_SOFTWARE
                            + "\nTracking_DB_Hostname: " + TRACKING_DB_HOSTNAME + "\nTracking_DB_Username: "
                            + TRACKING_DB_USERNAME + "\nTracking_DB_Password: " + TRACKING_DB_PASSWORD
                            + "\nSMTP_HOST: " + SMTP_HOST + "\nSENDER_MAIL: " + SENDER_MAIL);
                }

                // Defining the WMS list for the "SAGRID" Infrastructure
                int nmax = 0;
                for (int i = 0; i < sagrid_wrf_WMS.length; i++)
                    if ((sagrid_wrf_WMS[i] != null) && (!sagrid_wrf_WMS[i].equals("N/A")))
                        nmax++;

                for (int i = 0; i < sagrid_wrf_WMS.length; i++) {
                    if (sagrid_wrf_WMS[i] != null) {
                        wmsList[i] = sagrid_wrf_WMS[i].trim();
                        log.info("\n\nSubmitting for SAGRID [" + i + "] using WMS=[" + wmsList[i] + "]");
                    }
                }

                infrastructures[6] = new InfrastructureInfo(sagrid_wrf_VONAME, sagrid_wrf_TOPBDII, wmsList,
                        sagrid_wrf_ETOKENSERVER, sagrid_wrf_PORT, sagrid_wrf_ROBOTID, sagrid_wrf_VONAME,
                        sagrid_wrf_ROLE, "VO-" + sagrid_wrf_VONAME + "-" + wrf_SOFTWARE);
            }

            String[] _Parameters = new String[7];
            String[] _Settings = new String[4];

            // Upload the input settings for the application
            _Parameters = uploadSettings(request, response, username);
            _Settings[0] = _Parameters[6];
            _Settings[1] = username;
            _Settings[2] = portal;
            _Settings[3] = emailAddress;

            log.info("\n- Input Parameters: ");
            //log.info("\n- ASCII or Text = " + _Parameters[0]);
            log.info("\n- VM Profile Type = " + _Parameters[1]);
            log.info("\n- VM Template = " + _Parameters[5]);
            log.info("\n- VM Name = " + _Parameters[6]);
            log.info("\n- Cloud Resource = " + _Parameters[2]);
            log.info("\n- Enable Notification = " + _Parameters[3]);
            log.info("\n- Description = " + _Parameters[4]);
            log.info("\n- Username = " + _Settings[1]);
            log.info("\n- E-mail = " + _Settings[2]);
            log.info("\n- Portal = " + _Settings[3]);

            // Preparing to submit applications in different infrastructures..
            //=============================================================
            // IMPORTANT: INSTANCIATE THE MultiInfrastructureJobSubmission
            //            CLASS USING THE EMPTY CONSTRUCTOR WHEN
            //            WHEN THE PORTLET IS DEPLOYED IN PRODUCTION!!!
            //=============================================================
            /*MultiInfrastructureJobSubmission CloudMultiJobSubmission =
            new MultiInfrastructureJobSubmission(TRACKING_DB_HOSTNAME,
                                             TRACKING_DB_USERNAME,
                                             TRACKING_DB_PASSWORD);*/

            MultiInfrastructureJobSubmission CloudMultiJobSubmission = new MultiInfrastructureJobSubmission();

            if (infrastructures[0] != null) {
                if (wrf_LOGLEVEL.trim().equals("VERBOSE"))
                    log.info("\n- Adding the DIT Cluster Infrastructure.");

                CloudMultiJobSubmission.addInfrastructure(infrastructures[0]);
            }

            if (infrastructures[2] != null) {
                if (wrf_LOGLEVEL.trim().equals("VERBOSE"))
                    log.info("\n- Adding the CHAIN-REDS Cloud Testbed.");

                for (int i = 0; i < _wmsListChainCloud.length; i++) {
                    if ((_wmsListChainCloud[i] != null) && (!_wmsListChainCloud[i].equals("N/A"))) {
                        // A.) WRFTYPE = [ wrf ]
                        if (_Parameters[1].equals("appwrf")) {
                            // === SETTINGS for the INFN-STACK CLOUD RESOURCE === //
                            if ((_wmsListChainCloud[i].indexOf("stack-server-01.ct.infn.it")) != -1) {
                                log.info("\n- Adding some customizations for the INFN-STACK Cloud Provider.");
                                _wmsListChainCloud[i] = (_wmsListChainCloud[i].trim()).replace("OCCI_FLAVOUR",
                                        "m1-medium");

                                _wmsListChainCloud[i] = (_wmsListChainCloud[i].trim()).replace("OCCI_VM_TITLE",
                                        _Parameters[6]);

                                _wmsListChainCloud[i] = (_wmsListChainCloud[i].trim()).replace("OCCI_OS",
                                        "6ee0e31b-e066-4d39-86fd-059b1de8c52f");
                            }

                            // === SETTINGS for the INFN-NEBULA CLOUD RESOURCE === //
                            if ((_wmsListChainCloud[i].indexOf("nebula-server-01.ct.infn.it")) != -1) {
                                log.info("\n- Adding some customizations for the INFN-NEBULA Cloud Provider.");
                                _wmsListChainCloud[i] = (_wmsListChainCloud[i].trim()).replace("OCCI_OS",
                                        "uuid_appwrf_51");

                                _wmsListChainCloud[i] = (_wmsListChainCloud[i].trim()).replace("OCCI_FLAVOUR",
                                        _Parameters[5]);

                                _wmsListChainCloud[i] = (_wmsListChainCloud[i].trim()).replace("OCCI_VM_TITLE",
                                        _Parameters[6]);
                            }
                        }
                    }
                }

                // Defining the list of providers for the "CHAIN-REDS" Infrastructure
                int nmax = 0;
                for (int i = 0; i < _wmsListChainCloud.length; i++)
                    if ((_wmsListChainCloud[i] != null) && (!_wmsListChainCloud[i].equals("N/A")))
                        nmax++;

                String chaincloudwmsList[] = new String[nmax];
                for (int i = 0; i < _wmsListChainCloud.length; i++) {
                    if (_wmsListChainCloud[i] != null) {
                        chaincloudwmsList[i] = _wmsListChainCloud[i].trim();
                        log.info("\n\nCloud ResourceID = [" + chaincloudwmsList[i] + "]");
                    }
                }

                infrastructures[2] = new InfrastructureInfo("CHAIN-REDS", "rocci", "", chaincloudwmsList,
                        chain_wrf_ETOKENSERVER, chain_wrf_PORT, chain_wrf_ROBOTID, chain_wrf_VONAME,
                        chain_wrf_ROLE, true);

                CloudMultiJobSubmission.addInfrastructure(infrastructures[2]);
            }

            if (infrastructures[4] != null) {
                if (wrf_LOGLEVEL.trim().equals("VERBOSE"))
                    log.info("\n- Adding the EUMED Grid Infrastructure.");

                CloudMultiJobSubmission.addInfrastructure(infrastructures[4]);
            }

            // A.) WRFTYPE = [ wrf ]
            if (_Parameters[1].equals("appwrf")) {
                if (wrf_LOGLEVEL.trim().equals("VERBOSE"))
                    log.info("\n\nPreparing to launch an i686 VM with [ WRF-3.5 ]");

                String CloudFilesPath = getPortletContext().getRealPath("/") + "WEB-INF/config";

                // Set the Output path for results            
                CloudMultiJobSubmission.setOutputPath(wrf_OUTPUT_PATH);

                // Set the StandardOutput for 
                CloudMultiJobSubmission.setJobOutput("std.out");

                // Set the StandardError for 
                CloudMultiJobSubmission.setJobError("std.err");

                // OutputSandbox (string with comma separated list of file names)                    
                String CloudFiles = "wrf_output.tar.gz, README.txt";

                // Set the OutputSandbox files (string with comma separated list of file names)
                CloudMultiJobSubmission.setOutputFiles(CloudFiles);

                // Store the list of Argument(s) in a file
                File WRF_Repository = new File("/tmp");
                DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
                String timeStamp = dateFormat.format(Calendar.getInstance().getTime());

                String Arguments_File = WRF_Repository + "/" + timeStamp + "_" + username + "_patterns.txt";

                storeFile(Arguments_File, _Settings);

                // Set the Executable                    
                CloudMultiJobSubmission.setExecutable("/bin/bash");

                String Arguments = "wrf_demo_gridncloud.sh";

                // Set the list of Arguments
                CloudMultiJobSubmission.setArguments(Arguments);

                String InputSandbox = CloudFilesPath + "/wrf_demo_gridncloud.sh" + "," + CloudFilesPath
                        + "/all_wrf_inputs.tar.gz" + "," + Arguments_File;

                // Set InputSandbox files (string with comma separated list of file names)
                CloudMultiJobSubmission.setInputFiles(InputSandbox);
            }

            // Get the infra
            InfrastructureInfo infrastructure = CloudMultiJobSubmission.getInfrastructure();

            if (infrastructure.getMiddleware().equals("glite")) {
                log.info("\n- Selected Middleware = glite ");
                // Set the queue if it's defined
                // This option is not supported in multi-infrastructures mode
                if (!_Parameters[2].isEmpty())
                    CloudMultiJobSubmission.setJobQueue(_Parameters[2]);
            }

            if (infrastructure.getMiddleware().equals("occi"))
                log.info("\n- Selected Cloud Middleware = rocci ");

            if (infrastructure.getMiddleware().equals("ssh"))
                log.info("\n- Selected Infrastructure = ssh ");

            InetAddress addr = InetAddress.getLocalHost();

            try {
                company = PortalUtil.getCompany(request);
                String gateway = company.getName();

                // Send a notification email to the user if enabled.
                if (_Parameters[3] != null)
                    if ((SMTP_HOST == null) || (SMTP_HOST.trim().equals("")) || (SMTP_HOST.trim().equals("N/A"))
                            || (SENDER_MAIL == null) || (SENDER_MAIL.trim().equals(""))
                            || (SENDER_MAIL.trim().equals("N/A")))
                        log.info("\nThe Notification Service is not properly configured!!");

                    else {
                        // Enabling Job's notification via email
                        CloudMultiJobSubmission.setUserEmail(emailAddress);

                        sendHTMLEmail(username, emailAddress, SENDER_MAIL, SMTP_HOST, _Parameters[1], gateway);
                    }

                // Submitting in progress ...
                log.info("\n-  Job submittion in progress using JSAGA JobEngine");
                CloudMultiJobSubmission.submitJobAsync(infrastructure, username,
                        addr.getHostAddress() + ":8162", Integer.valueOf(wrf_APPID), _Parameters[4]);

            } catch (PortalException ex) {
                Logger.getLogger(Wrf.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SystemException ex) {
                Logger.getLogger(Wrf.class.getName()).log(Level.SEVERE, null, ex);
            }
        } // end PROCESS ACTION [ SUBMIT_WRF_PORTLET ]
    } catch (PortalException ex) {
        Logger.getLogger(Wrf.class.getName()).log(Level.SEVERE, null, ex);
    } catch (SystemException ex) {
        Logger.getLogger(Wrf.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:org.eclipse.dataset.Maths.java

/**
 * Linearly interpolate values at points in a 1D dataset corresponding to given coordinates.
 * @param x input 1-D coordinate dataset
 * @param d input 1-D dataset//from  w  ww  .j av a  2s. c om
 * @param x0 coordinate values
 * @param left value to use when x0 lies left of domain. If null, then interpolate to zero by using leftmost interval
 * @param right value to use when x0 lies right of domain. If null, then interpolate to zero by using rightmost interval
 * @return interpolated values
 */
public static Dataset interpolate(final Dataset x, final Dataset d, final IDataset x0, Number left,
        Number right) {
    assert x.getRank() == 1;
    assert d.getRank() == 1;

    DoubleDataset r = new DoubleDataset(x0.getShape());

    DoubleDataset dx = (DoubleDataset) DatasetUtils.cast(x, Dataset.FLOAT64);
    Dataset dx0 = DatasetUtils.convertToDataset(x0);
    double[] xa = dx.getData();
    int s = xa.length - 1;
    IndexIterator it = dx0.getIterator();
    int k = -1;
    while (it.hasNext()) {
        k++;
        double v = dx0.getElementDoubleAbs(it.index);
        int i = Arrays.binarySearch(xa, v);
        if (i < 0) {
            // i = -(insertion point) - 1
            if (i == -1) {
                if (left != null) {
                    r.setAbs(k, left.doubleValue());
                    continue;
                }
                final double d1 = xa[0] - xa[1];
                double t = d1 - v + xa[0];
                if (t >= 0)
                    continue; // sets to zero
                t /= d1;
                r.setAbs(k, t * d.getDouble(0));
            } else if (i == -s - 2) {
                if (right != null) {
                    r.setAbs(k, right.doubleValue());
                    continue;
                }
                final double d1 = xa[s] - xa[s - 1];
                double t = d1 - v + xa[s];
                if (t <= 0)
                    continue; // sets to zero
                t /= d1;
                r.setAbs(k, t * d.getDouble(s));
            } else {
                i = -i - 1;
                final double t = (xa[i] - v) / (xa[i] - xa[i - 1]);
                r.setAbs(k, (1 - t) * d.getDouble(i) + t * d.getDouble(i - 1));
            }
        } else {
            r.setAbs(k, d.getDouble(i));
        }
    }
    return r;
}

From source file:org.eclipse.january.dataset.Maths.java

/**
 * Linearly interpolate values at points in a 1D dataset corresponding to given coordinates.
 * @param x input 1-D coordinate dataset (must be ordered)
 * @param d input 1-D dataset/*w  w w.j a  va 2s  .c  o m*/
 * @param x0 coordinate values
 * @param left value to use when x0 lies left of domain. If null, then interpolate to zero by using leftmost interval
 * @param right value to use when x0 lies right of domain. If null, then interpolate to zero by using rightmost interval
 * @return interpolated values
 */
public static Dataset interpolate(final Dataset x, final Dataset d, final IDataset x0, Number left,
        Number right) {
    assert x.getRank() == 1;
    assert d.getRank() == 1;

    DoubleDataset r = DatasetFactory.zeros(DoubleDataset.class, x0.getShape());

    Monotonicity mono = Comparisons.findMonotonicity(x);
    if (mono == Monotonicity.NOT_ORDERED) {
        throw new IllegalArgumentException("Dataset x must be ordered");
    }
    DoubleDataset dx = (DoubleDataset) DatasetUtils.cast(x, Dataset.FLOAT64);
    Dataset dx0 = DatasetUtils.convertToDataset(x0);
    if (x == dx) {
        dx = (DoubleDataset) x.flatten();
    }
    double[] xa = dx.getData();
    int s = xa.length - 1;
    boolean isReversed = mono == Monotonicity.STRICTLY_DECREASING || mono == Monotonicity.NONINCREASING;
    if (isReversed) {
        double[] txa = xa.clone();
        for (int i = 0; i <= s; i++) { // reverse order
            txa[s - i] = xa[i];
        }
        xa = txa;
    }

    IndexIterator it = dx0.getIterator();
    int k = -1;
    while (it.hasNext()) {
        k++;
        double v = dx0.getElementDoubleAbs(it.index);
        int i = Arrays.binarySearch(xa, v);
        if (i < 0) {
            // i = -(insertion point) - 1
            if (i == -1) {
                if (left != null) {
                    r.setAbs(k, left.doubleValue());
                    continue;
                }
                final double d1 = xa[0] - xa[1];
                double t = d1 - v + xa[0];
                if (t >= 0)
                    continue; // sets to zero
                t /= d1;
                r.setAbs(k, t * d.getDouble(isReversed ? s : 0));
            } else if (i == -s - 2) {
                if (right != null) {
                    r.setAbs(k, right.doubleValue());
                    continue;
                }
                final double d1 = xa[s] - xa[s - 1];
                double t = d1 - v + xa[s];
                if (t <= 0)
                    continue; // sets to zero
                t /= d1;
                r.setAbs(k, t * d.getDouble(isReversed ? 0 : s));
            } else {
                i = -i - 1;
                double t = (xa[i] - v) / (xa[i] - xa[i - 1]);
                if (isReversed) {
                    i = s - i;
                    r.setAbs(k, t * d.getDouble(i + 1) + (1 - t) * d.getDouble(i));
                } else {
                    r.setAbs(k, (1 - t) * d.getDouble(i) + t * d.getDouble(i - 1));
                }
            }
        } else {
            r.setAbs(k, d.getDouble(isReversed ? s - i : i));
        }
    }
    return r;
}

From source file:org.alfresco.opencmis.CMISConnector.java

/**
 * Sets property values.// w  w w. j  av a2  s.  c o  m
 */
@SuppressWarnings({ "rawtypes" })
public void setProperties(NodeRef nodeRef, TypeDefinitionWrapper type, Properties properties,
        String... exclude) {
    if (properties == null) {
        return;
    }

    Map<String, PropertyData<?>> incomingPropsMap = properties.getProperties();
    if (incomingPropsMap == null) {
        return;
    }

    // extract property data into an easier to use form
    Map<String, Pair<TypeDefinitionWrapper, Serializable>> propsMap = new HashMap<String, Pair<TypeDefinitionWrapper, Serializable>>();
    for (String propertyId : incomingPropsMap.keySet()) {
        PropertyData<?> property = incomingPropsMap.get(propertyId);
        PropertyDefinitionWrapper propDef = type.getPropertyById(property.getId());
        if (propDef == null) {
            propDef = getOpenCMISDictionaryService().findProperty(propertyId);
            if (propDef == null) {
                throw new CmisInvalidArgumentException("Property " + property.getId() + " is unknown!");
            }
        }

        Updatability updatability = propDef.getPropertyDefinition().getUpdatability();
        if ((updatability == Updatability.READONLY) || (updatability == Updatability.WHENCHECKEDOUT
                && !checkOutCheckInService.isWorkingCopy(nodeRef))) {
            throw new CmisInvalidArgumentException("Property " + property.getId() + " is read-only!");
        }
        TypeDefinitionWrapper propType = propDef.getOwningType();
        Serializable value = getValue(property,
                propDef.getPropertyDefinition().getCardinality() == Cardinality.MULTI);
        Pair<TypeDefinitionWrapper, Serializable> pair = new Pair<TypeDefinitionWrapper, Serializable>(propType,
                value);
        propsMap.put(propertyId, pair);
    }

    // Need to do deal with secondary types first
    Pair<TypeDefinitionWrapper, Serializable> pair = propsMap.get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS);
    Serializable secondaryTypesProperty = (pair != null ? pair.getSecond() : null);
    if (secondaryTypesProperty != null) {
        if (!(secondaryTypesProperty instanceof List)) {
            throw new CmisInvalidArgumentException("Secondary types must be a list!");
        }
        List secondaryTypes = (List) secondaryTypesProperty;
        if (secondaryTypes != null && secondaryTypes.size() > 0) {
            // add/remove secondary types/aspects
            processSecondaryTypes(nodeRef, secondaryTypes, propsMap);
        }
    }

    for (String propertyId : propsMap.keySet()) {
        if (propertyId.equals(PropertyIds.SECONDARY_OBJECT_TYPE_IDS)) {
            // already handled above
            continue;
        }

        pair = propsMap.get(propertyId);
        TypeDefinitionWrapper propType = pair.getFirst();
        Serializable value = pair.getSecond();
        if (Arrays.binarySearch(exclude, propertyId) < 0) {
            setProperty(nodeRef, propType, propertyId, value);
        }
    }

    List<CmisExtensionElement> extensions = properties.getExtensions();
    if (extensions != null) {
        boolean isNameChanging = properties.getProperties().containsKey(PropertyIds.NAME);

        for (CmisExtensionElement extension : extensions) {
            if (ALFRESCO_EXTENSION_NAMESPACE.equals(extension.getNamespace())
                    && SET_ASPECTS.equals(extension.getName())) {
                setAspectProperties(nodeRef, isNameChanging, extension);
                break;
            }
        }
    }
}

From source file:com.enonic.vertical.engine.handlers.MenuHandler.java

private boolean showAdminMenuItemElement(Element root, boolean parentAdmin, String[] menuItemTypes,
        boolean includeReadOnlyAccessRight) {
    boolean typeFiltered;
    if (menuItemTypes != null && menuItemTypes.length > 0) {
        String type = root.getAttribute("type");
        typeFiltered = Arrays.binarySearch(menuItemTypes, type) >= 0;
    } else {//from   w  ww  .ja v a  2  s . co  m
        typeFiltered = true;
    }

    boolean addAccess = "true".equals(root.getAttribute("useradd"));
    boolean publishAccess = "true".equals(root.getAttribute("userpublish"));
    boolean createAccess = "true".equals(root.getAttribute("usercreate"));
    boolean updateAccess = "true".equals(root.getAttribute("userupdate"));
    boolean adminAccess = "true".equals(root.getAttribute("useradministrate"));

    boolean hasAnyReadAccess = "true".equals(root.getAttribute("anonread"))
            || "true".equals(root.getAttribute("userread"));
    boolean readAccess = includeReadOnlyAccessRight && hasAnyReadAccess;

    boolean hasAccess = parentAdmin || adminAccess || createAccess || updateAccess || publishAccess || addAccess
            || readAccess;

    if (hasAccess && typeFiltered) {
        return true;
    } else if (hasAccess && !typeFiltered) {
        Element[] children = XMLTool.getElements(root);
        for (Element aChildren : children) {
            if (showAdminMenuItemElement(aChildren, true, menuItemTypes, includeReadOnlyAccessRight)) {
                return true;
            }
        }
        return false;
    } else {
        // hasAccess == false
        Element[] children = XMLTool.getElements(root);
        for (Element aChildren : children) {
            if (showAdminMenuItemElement(aChildren, parentAdmin, menuItemTypes, includeReadOnlyAccessRight)) {
                return true;
            }
        }
        return false;
    }
}

From source file:com.l2jfree.gameserver.gameobjects.L2Player.java

private void onDieDropItem(L2Creature killer) {
    if (killer == null)
        return;/*from www . ja v  a  2s  . co  m*/

    L2Player pk = killer.getActingPlayer();
    if (pk != null && getKarma() <= 0 && pk.getClan() != null && getClan() != null
            && (pk.getClan().isAtWarWith(getClanId())
            //|| this.getClan().isAtWarWith(((L2Player)killer).getClanId())
            ))
        return;

    if ((!isInsideZone(L2Zone.FLAG_PVP) || pk == null) && (!isGM() || Config.KARMA_DROP_GM)) {
        boolean isKarmaDrop = false;
        boolean isKillerNpc = (killer instanceof L2Npc);
        int pkLimit = Config.KARMA_PK_LIMIT;

        int dropEquip = 0;
        int dropEquipWeapon = 0;
        int dropItem = 0;
        int dropLimit = 0;
        int dropPercent = 0;

        if (getKarma() > 0 && getPkKills() >= pkLimit) {
            isKarmaDrop = true;
            dropPercent = Config.KARMA_RATE_DROP;
            dropEquip = Config.KARMA_RATE_DROP_EQUIP;
            dropEquipWeapon = Config.KARMA_RATE_DROP_EQUIP_WEAPON;
            dropItem = Config.KARMA_RATE_DROP_ITEM;
            dropLimit = Config.KARMA_DROP_LIMIT;
        } else if (isKillerNpc && getLevel() > 4 && !isFestivalParticipant()) {
            dropPercent = Config.PLAYER_RATE_DROP;
            dropEquip = Config.PLAYER_RATE_DROP_EQUIP;
            dropEquipWeapon = Config.PLAYER_RATE_DROP_EQUIP_WEAPON;
            dropItem = Config.PLAYER_RATE_DROP_ITEM;
            dropLimit = Config.PLAYER_DROP_LIMIT;
        }

        if (dropPercent > 0 && Rnd.get(100) < dropPercent) {
            int dropCount = 0;
            int itemDropPercent = 0;
            for (L2ItemInstance itemDrop : getInventory().getItems()) {
                // Don't drop
                if (!itemDrop.isDropable() || itemDrop.getItemId() == PlayerInventory.ADENA_ID
                // Dont drop Shadow Items
                        || itemDrop.isShadowItem()
                        // Dont drop Time Limited Items
                        || itemDrop.isTimeLimitedItem()
                        // Quest Items
                        || itemDrop.getItem().getType2() == L2Item.TYPE2_QUEST
                        // Control Item of active pet
                        || getPet() != null && getPet().getControlItemId() == itemDrop.getItemId()
                        // Item listed in the non droppable item list
                        || Arrays.binarySearch(Config.KARMA_LIST_NONDROPPABLE_ITEMS, itemDrop.getItemId()) >= 0
                        // Item listed in the non droppable pet item list
                        || Arrays.binarySearch(Config.KARMA_LIST_NONDROPPABLE_PET_ITEMS,
                                itemDrop.getItemId()) >= 0)
                    continue;

                if (itemDrop.isEquipped())
                    // Set proper chance according to Item type of equipped Item
                    itemDropPercent = itemDrop.getItem().getType2() == L2Item.TYPE2_WEAPON ? dropEquipWeapon
                            : dropEquip;
                else
                    itemDropPercent = dropItem; // Item in inventory

                // NOTE: Each time an item is dropped, the chance of another item being dropped gets lesser (dropCount * 2)
                if (Rnd.get(100) < itemDropPercent) {
                    if (itemDrop.isEquipped()) {
                        getInventory().unEquipItemInSlotAndRecord(itemDrop.getLocationSlot());
                        // must be sent explicitly to avoid visible garbage
                        sendPacket(new UserInfo(this));
                    }
                    dropItem("DieDrop", itemDrop, killer, true);

                    if (isKarmaDrop)
                        _log.info(getName() + " has karma and dropped " + itemDrop);
                    else
                        _log.info(getName() + " dropped " + itemDrop);

                    if (++dropCount >= dropLimit)
                        break;
                }
            }
        }
        // Player can drop adena against other player
        if (Config.ALT_PLAYER_CAN_DROP_ADENA && !isKillerNpc && Config.PLAYER_RATE_DROP_ADENA > 0
                && 100 >= Config.PLAYER_RATE_DROP_ADENA
                && !(killer instanceof L2Player && ((L2Player) killer).isGM())) {
            L2ItemInstance itemDrop = getInventory().getAdenaInstance();
            long iCount = getInventory().getAdena();
            // Adena count depends on config
            iCount = iCount * Config.PLAYER_RATE_DROP_ADENA / 100;
            // Drop only adena this time
            if (itemDrop != null && itemDrop.getItemId() == PlayerInventory.ADENA_ID) // Adena
            {
                dropItem("DieDrop", itemDrop.getObjectId(), iCount, getPosition().getX() + Rnd.get(50) - 25,
                        getPosition().getY() + Rnd.get(50) - 25, getPosition().getZ() + 20, killer, true);
            }
        }
    }
}

From source file:com.cohort.util.String2.java

/**
 * Find the last element which is &lt;= s in an ascending sorted array.
 *
 * @param sar an ascending sorted String[] which may have duplicate values
 * @param s/*from www.  j a v a2 s  .co m*/
 * @return the index of the last element which is &lt;= s in an ascending sorted array.
 *   If s is null or s &lt; the smallest element, this returns -1  (no element is appropriate).
 *   If s &gt; the largest element, this returns sar.length-1.
 */
public static int binaryFindLastLE(String[] sar, String s) {
    if (s == null)
        return -1;
    int i = Arrays.binarySearch(sar, s);

    //an exact match; look for duplicates
    if (i >= 0) {
        while (i < sar.length - 1 && sar[i + 1].compareTo(s) <= 0)
            i++;
        return i;
    }

    int insertionPoint = -i - 1; //0.. sar.length
    return insertionPoint - 1;
}