Search in sources :

Example 1 with SystemValue

use of com.ibm.as400.access.SystemValue in project IBMiProgTool by vzupka.

the class MainWindow method connectReconnect.

/**
 */
protected boolean connectReconnect() {
    // Set wait-cursor (rotating wheel?)
    // setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    // Keeps the scroll pane at the LAST MESSAGE.
    scrollMessagePane.getVerticalScrollBar().addAdjustmentListener(messageScrollPaneAdjustmentListenerMax);
    // *****
    // ========
    // ======================================== Connetion to the server
    // 
    // Get connection to the IBM i SERVER.
    // The third parameter (password) should NOT be specified. The user must sign on.
    remoteServer = new AS400(hostTextField.getText(), userNameTextField.getText());
    // Connect FILE service of the IBM i server.
    try {
        // Introductory message - waiting for the server.
        row = "Wait: Connecting to server  " + properties.getProperty("HOST") + " . . .";
        msgVector.add(row);
        // Reload LEFT side. Do not use Right side! It would enter a loop.
        showMessages(noNodes);
        remoteServer.connectService(AS400.FILE);
        SystemValue sysVal = new SystemValue(remoteServer, "QCCSID");
        row = "Info: System value QCCSID is " + sysVal.getValue() + ".";
        msgVector.add(row);
        // Reload LEFT side. Do not use Right side! It would enter a loop.
        showMessages(noNodes);
        try {
            infile = Files.newBufferedReader(parPath, Charset.forName(encoding));
            properties.load(infile);
            infile.close();
            properties.setProperty("LIBRARY_PATTERN", libraryPatternTextField.getText());
            properties.setProperty("FILE_PATTERN", filePatternTextField.getText());
            properties.setProperty("MEMBER_PATTERN", memberPatternTextField.getText());
            outfile = Files.newBufferedWriter(parPath, Charset.forName(encoding));
            properties.store(outfile, PROP_COMMENT);
            outfile.close();
        } catch (Exception exc) {
            exc.printStackTrace();
        }
    } catch (Exception exc) {
        exc.printStackTrace();
        row = "Error: Connection to server  " + properties.getProperty("HOST") + "  failed.  -  " + exc.toString();
        msgVector.add(row);
        showMessages(noNodes);
        // Change cursor to default
        setCursor(Cursor.getDefaultCursor());
        // Remove setting last element of messages
        scrollMessagePane.getVerticalScrollBar().removeAdjustmentListener(messageScrollPaneAdjustmentListenerMax);
        return false;
    }
    // 
    // ================================= End of connection to the server
    // =======
    // *****
    // Show completion message when connection to IBM i server connected.
    row = "Comp: Server IBM i  " + properties.getProperty("HOST") + "  has been connected to user  " + remoteServer.getUserId() + " and is retrieving the Integrated File System.";
    msgVector.add(row);
    showMessages(noNodes);
    // Change cursor to default
    setCursor(Cursor.getDefaultCursor());
    // Remove setting last element of messages
    scrollMessagePane.getVerticalScrollBar().removeAdjustmentListener(messageScrollPaneAdjustmentListenerMax);
    // Check connection and keep connection alive in background.
    chkConn = new CheckConnection(remoteServer);
    chkConn.execute();
    return true;
}
Also used : SystemValue(com.ibm.as400.access.SystemValue) AS400(com.ibm.as400.access.AS400) UnsupportedCharsetException(java.nio.charset.UnsupportedCharsetException) IllegalCharsetNameException(java.nio.charset.IllegalCharsetNameException) IOException(java.io.IOException)

Example 2 with SystemValue

use of com.ibm.as400.access.SystemValue in project openicf by Evolveum.

the class OS400Connector method fetchPasswordLevel.

protected void fetchPasswordLevel() throws ConnectorException {
    try {
        SystemValue systemValue = new SystemValue(as400, "QPWDLVL");
        Object qpwdlvl = systemValue.getValue();
        if (qpwdlvl instanceof Integer) {
            this.passwordLevel = ((Integer) qpwdlvl).intValue();
        }
    } catch (RequestNotSupportedException e) {
        this.passwordLevel = QPWDLVL_UNSET;
        LOG.error("QPWDLVL System Value not supported on this resource");
    } catch (Exception e) {
        throw new ConnectorException(e);
    }
}
Also used : SystemValue(com.ibm.as400.access.SystemValue) RequestNotSupportedException(com.ibm.as400.access.RequestNotSupportedException) ConnectorException(org.identityconnectors.framework.common.exceptions.ConnectorException) ConnectorSecurityException(org.identityconnectors.framework.common.exceptions.ConnectorSecurityException) IntrospectionException(java.beans.IntrospectionException) ConnectorIOException(org.identityconnectors.framework.common.exceptions.ConnectorIOException) ConnectorException(org.identityconnectors.framework.common.exceptions.ConnectorException) RequestNotSupportedException(com.ibm.as400.access.RequestNotSupportedException) IOException(java.io.IOException) AS400SecurityException(com.ibm.as400.access.AS400SecurityException)

Aggregations

SystemValue (com.ibm.as400.access.SystemValue)2 IOException (java.io.IOException)2 AS400 (com.ibm.as400.access.AS400)1 AS400SecurityException (com.ibm.as400.access.AS400SecurityException)1 RequestNotSupportedException (com.ibm.as400.access.RequestNotSupportedException)1 IntrospectionException (java.beans.IntrospectionException)1 IllegalCharsetNameException (java.nio.charset.IllegalCharsetNameException)1 UnsupportedCharsetException (java.nio.charset.UnsupportedCharsetException)1 ConnectorException (org.identityconnectors.framework.common.exceptions.ConnectorException)1 ConnectorIOException (org.identityconnectors.framework.common.exceptions.ConnectorIOException)1 ConnectorSecurityException (org.identityconnectors.framework.common.exceptions.ConnectorSecurityException)1