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;
}
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);
}
}
Aggregations