List of usage examples for java.util Properties containsKey
@Override public boolean containsKey(Object key)
From source file:net.pandoragames.far.ui.FARConfig.java
/** * Loads the base and the backupd directory from a Properties object. * The property names are defined as constants of this class. * The property values are supposed to be valid pathes, but both * directories are controlled for existance. Inheriting classes may overwrite * this method to load additional properties. * @param properties holding properties for base and backup directory. *//* w ww . j a v a2 s .co m*/ protected void loadFromProperties(Properties properties) { // base directory File baseDir = getValidDirectory(properties.getProperty(PPT_BASEDIR)); if (baseDir != null) { setBaseDirectory(baseDir); } else { logger.info("Base directory " + properties.getProperty(PPT_BASEDIR) + " could not be restored. Using fall back: " + lastBaseDir.getPath()); } // backup directory File bckpDir = getValidDirectory(properties.getProperty(PPT_BCKPDIR)); if (bckpDir != null) { if (bckpDir.canWrite()) { if (bckpDir.equals(new File(System.getProperty("java.io.tmpdir")))) { bckpDir = makeDefaultBackupDir(); } setBackupDirectory(bckpDir); } else { defaultBackupDirectory = makeDefaultBackupDir(); logger.info("Backup directory " + properties.getProperty(PPT_BCKPDIR) + " is not writable. Using fall back: " + defaultBackupDirectory.getPath()); } } else { defaultBackupDirectory = makeDefaultBackupDir(); if (!defaultBackupDirectory.getPath().equals(properties.getProperty(PPT_BCKPDIR))) { logger.info("Backup directory " + properties.getProperty(PPT_BCKPDIR) + " could not be restored. Using fall back: " + defaultBackupDirectory.getPath()); } } // list impex directory setFileListExportDirectory(getValidDirectory(properties.getProperty(PPT_LISTEXDIR))); // group reference indicator String grefind = properties.getProperty(PPT_GROUPREF); if (grefind == null || !(grefind.equals(GROUPREFINDICATORLIST[0]) || grefind.equals(GROUPREFINDICATORLIST[1]) || grefind.equals(GROUPREFINDICATORLIST[2]))) { grefind = GROUPREFINDICATORLIST[0]; } groupReferenceIndicator = grefind.charAt(0); // application version String versionNumber = properties.getProperty(PPT_VERSION); String currentVersion = getCurrentApplicationVersion(); if (currentVersion != null && !currentVersion.equals(versionNumber)) { versionHasChanged = true; } processBinary = Boolean.parseBoolean(properties.getProperty(PPT_BINARY)); if (properties.containsKey(PPT_UNKNOWN_AS_BINARY)) { FileType.TREAT_UNKNOWN_AS_BINARY = Boolean.parseBoolean(properties.getProperty(PPT_UNKNOWN_AS_BINARY)); } }
From source file:com.meltmedia.cadmium.servlets.guice.CadmiumListener.java
@Override public void contextInitialized(ServletContextEvent servletContextEvent) { //Force the use of slf4j logger in all JBoss log uses in this wars context!!! jboss = ContainerUtils.isJBoss();// w w w . j a v a 2 s .c o m if (jboss) { oldJBoss = ContainerUtils.isOldJBoss(); } if (oldJBoss) { System.setProperty("org.jboss.logging.provider", "slf4j"); } failOver = servletContextEvent.getServletContext().getRealPath("/"); MaintenanceFilter.siteDown.start(); context = servletContextEvent.getServletContext(); configManager = new ConfigManager(context); Properties cadmiumProperties = configManager.getPropertiesByContext(context, "/WEB-INF/cadmium.properties"); Properties configProperties = new Properties(); configProperties = configManager.getSystemProperties(); configProperties.putAll(cadmiumProperties); sharedContentRoot = sharedContextRoot(configProperties, context, log); // compute the directory for this application, based on the war name. warName = WarUtils.getWarName(context); vHostName = getVHostName(context); applicationContentRoot = applicationContentRoot(sharedContentRoot, warName, log); executor = new ScheduledThreadPoolExecutor(1); executor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); executor.setKeepAliveTime(5, TimeUnit.MINUTES); executor.setMaximumPoolSize(Math.min(Runtime.getRuntime().availableProcessors(), 4)); configProperties = configManager.appendProperties(configProperties, new File(applicationContentRoot, CONFIG_PROPERTIES_FILE)); configManager.setDefaultProperties(configProperties); configManager.setDefaultPropertiesFile(new File(applicationContentRoot, CONFIG_PROPERTIES_FILE)); try { LogUtils.configureLogback(servletContextEvent.getServletContext(), applicationContentRoot, getVHostName(servletContextEvent.getServletContext()), log); } catch (IOException e) { log.error("Failed to reconfigure logging", e); } if ((sshDir = getSshDir(configProperties, sharedContentRoot, log)) != null) { GitService.setupSsh(sshDir.getAbsolutePath()); } String repoDir = servletContextEvent.getServletContext().getInitParameter("repoDir"); if (repoDir != null && repoDir.trim().length() > 0) { this.repoDir = repoDir; } String contentDir = servletContextEvent.getServletContext().getInitParameter("contentDir"); if (contentDir != null && contentDir.trim().length() > 0) { this.contentDir = contentDir; } if (configProperties.containsKey(LAST_UPDATED_DIR)) { File cntDir = new File(configProperties.getProperty(LAST_UPDATED_DIR)); if (cntDir.exists() && cntDir.canRead()) { this.contentDir = cntDir.getName(); } } File repoFile = new File(this.applicationContentRoot, this.repoDir); if (repoFile.isDirectory() && repoFile.canWrite()) { this.repoDir = repoFile.getAbsoluteFile().getAbsolutePath(); } else { log.warn("The repo directory may not have been initialized yet."); this.repoDir = repoFile.getAbsoluteFile().getAbsolutePath(); } File contentFile = new File(this.applicationContentRoot, this.contentDir); if (contentFile.exists() && contentFile.isDirectory() && contentFile.canWrite()) { this.contentDir = contentFile.getAbsoluteFile().getAbsolutePath(); } else { log.warn("The content directory may not have been initialized yet."); this.contentDir = contentFile.getAbsoluteFile().getAbsolutePath(); } String channelCfgUrl = configProperties.getProperty(JGROUPS_CHANNEL_CONFIG_URL); //String channelCfgUrl = System.getProperty(JGROUPS_CHANNEL_CONFIG_URL); if (channelCfgUrl != null) { File channelCfgFile = null; URL fileUrl = null; try { fileUrl = new URL(channelCfgUrl); } catch (Exception e) { channelCfgFile = new File(channelCfgUrl); } if (fileUrl == null && channelCfgFile != null) { if (!channelCfgFile.isAbsolute() && !channelCfgFile.exists()) { channelCfgFile = new File(this.sharedContentRoot, channelCfgUrl); if (channelCfgFile.exists()) { this.channelConfigUrl = "file://" + channelCfgFile.getAbsoluteFile().getAbsolutePath(); } } else { this.channelConfigUrl = "file://" + channelCfgFile.getAbsoluteFile().getAbsolutePath(); } } else if (fileUrl != null) { this.channelConfigUrl = fileUrl.toString(); } } Vfs.addDefaultURLTypes(new JBossVfsUrlType()); reflections = Reflections.collect(); Module modules[] = new Module[] { createServletModule(), createModule() }; InternalInjectorCreator guiceCreator = new InternalInjectorCreator().stage(Stage.DEVELOPMENT) .addModules(Arrays.asList(modules)); try { injector = guiceCreator.build(); //injector = Guice.createInjector(createServletModule(), createModule()); // run the postConstruct methods. jsr250Executor = Jsr250Utils.createJsr250Executor(injector, log, Scopes.SINGLETON); jsr250Executor.postConstruct(); super.contextInitialized(servletContextEvent); File graphFile = new File(applicationContentRoot, "injector.dot"); graphGood(graphFile, injector); } catch (Throwable t) { try { log.error("Failed to initialize...", t); Method primaryInjector = InternalInjectorCreator.class.getDeclaredMethod("primaryInjector"); primaryInjector.setAccessible(true); injector = (Injector) primaryInjector.invoke(guiceCreator); if (injector == null) { log.error("Injector must not have been created."); } else { log.error("Found injector {}", injector); } } catch (Throwable e) { log.error("Failed to retrieve injector that failed to initialize.", e); } throw new RuntimeException("Failed to Initialize", t); } }
From source file:org.alfresco.reporting.script.AlfrescoReporting.java
/** * // www . j a v a 2 s . c om * @param definition * @param nodeRef Current nodeRef to put all related and relevant property * values into the reporting database * @param defBacklist the Blacklist String * @return */ private Properties processPropertyDefinitions(Properties definition, NodeRef nodeRef, String defBacklist) { try { Map<QName, Serializable> map = serviceRegistry.getNodeService().getProperties(nodeRef); Iterator<QName> keys = map.keySet().iterator(); while (keys.hasNext()) { String key = ""; String type = ""; try { QName qname = keys.next(); //Serializable s = map.get(qname); if (qname != null) { key = qname.toString(); key = replaceNameSpaces(key); //logger.debug("processPropertyDefinitions: Processing key " + key); if (!key.startsWith("{urn:schemas_microsoft_com:}") && !definition.containsKey(key)) { type = ""; if (getReplacementDataType().containsKey(key)) { type = getReplacementDataType().getProperty(key, "-").trim(); } else { type = "-"; try { type = serviceRegistry.getDictionaryService().getProperty(qname).getDataType() .toString().trim(); type = type.substring(type.indexOf("}") + 1, type.length()); type = getClassToColumnType().getProperty(type, "-"); } catch (NullPointerException npe) { // ignore. cm_source and a few others have issues in their datatype?? //logger.fatal("Silent drop of NullPointerException against " + key); } // if the key is not in the BlackList, add it to the prop object that // will update the table definition } if ((type != null) && !type.equals("-") && !type.equals("") && (key != null) && (!key.equals("")) && (!defBacklist.contains("," + key + ","))) { definition.setProperty(key, type); //if (logger.isDebugEnabled()) // logger.debug("processPropertyDefinitions: Adding column "+ key + "=" + type); } else { //if (logger.isDebugEnabled()) // logger.debug("Ignoring column "+ key + "=" + type); } } // end if containsKey } //end if key!=null } catch (Exception e) { logger.info("processPropertyDefinitions: Property not found! Property below..."); logger.info("processPropertyDefinitions: type=" + type + ", key=" + key); e.printStackTrace(); } } // end while } catch (Exception e) { e.printStackTrace(); } //logger.debug("Exit processPropertyDefinitions"); return definition; }
From source file:com.udps.hive.jdbc.HiveConnection.java
public HiveConnection(String uri, Properties info) throws SQLException { setupLoginTimeout();/*from w w w.j a v a 2 s .co m*/ jdbcURI = uri; // parse the connection uri Utils.JdbcConnectionParams connParams; try { connParams = Utils.parseURL(uri); } catch (IllegalArgumentException e) { throw new SQLException(e); } // extract parsed connection parameters: // JDBC URL: // jdbc:hive2://<host>:<port>/dbName;sess_var_list?hive_conf_list#hive_var_list // each list: <key1>=<val1>;<key2>=<val2> and so on // sess_var_list -> sessConfMap // hive_conf_list -> hiveConfMap // hive_var_list -> hiveVarMap host = connParams.getHost(); port = connParams.getPort(); sessConfMap = connParams.getSessionVars(); hiveConfMap = connParams.getHiveConfs(); hiveVarMap = connParams.getHiveVars(); for (Map.Entry<Object, Object> kv : info.entrySet()) { if ((kv.getKey() instanceof String)) { String key = (String) kv.getKey(); if (key.startsWith(HIVE_VAR_PREFIX)) { hiveVarMap.put(key.substring(HIVE_VAR_PREFIX.length()), info.getProperty(key)); } else if (key.startsWith(HIVE_CONF_PREFIX)) { hiveConfMap.put(key.substring(HIVE_CONF_PREFIX.length()), info.getProperty(key)); } } } isEmbeddedMode = connParams.isEmbeddedMode(); if (isEmbeddedMode) { client = new EmbeddedThriftBinaryCLIService(); } else { // extract user/password from JDBC connection properties if its not // supplied in the // connection URL if (info.containsKey(HIVE_AUTH_USER)) { sessConfMap.put(HIVE_AUTH_USER, info.getProperty(HIVE_AUTH_USER)); if (info.containsKey(HIVE_AUTH_PASSWD)) { sessConfMap.put(HIVE_AUTH_PASSWD, info.getProperty(HIVE_AUTH_PASSWD)); } } if (info.containsKey(HIVE_AUTH_TYPE)) { sessConfMap.put(HIVE_AUTH_TYPE, info.getProperty(HIVE_AUTH_TYPE)); } // open the client transport openTransport(); // set up the client client = new TCLIService.Client(new TBinaryProtocol(transport)); } // add supported protocols supportedProtocols.add(TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V1); supportedProtocols.add(TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V2); supportedProtocols.add(TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V3); supportedProtocols.add(TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V4); supportedProtocols.add(TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V5); supportedProtocols.add(TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V6); supportedProtocols.add(TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V7); // open client session openSession(connParams); }
From source file:biz.wolschon.finance.jgnucash.panels.TaxReportPanel.java
/** * @param books the accounts and transactions we work with. *//*from ww w . j a v a2s.c o m*/ private void initializeUI(final GnucashFile books) { this.setLayout(new BorderLayout()); Properties props = new Properties(); File configFile = new File(new File(System.getProperty("user.home"), ".jgnucash"), "TaxReportPanel.xml"); if (configFile.exists()) { try { props.loadFromXML(new FileInputStream(configFile)); } catch (Exception e) { LOGGER.error("Problem loading " + configFile.getAbsolutePath(), e); JLabel errorLabel = new JLabel(e.getMessage()); this.add(errorLabel, BorderLayout.CENTER); return; } } else { throw new IllegalStateException( "To use the OPTIONAL tax-report panel, please create a file " + configFile.getAbsolutePath()); /*try { props.loadFromXML(getClass().getResourceAsStream( "TaxReportPanel.xml")); props.storeToXML(new FileOutputStream(configFile), "UTF-8\n" + "sum.([0-9]*).name - name of the entry\n" + "sum.([0-9]*).target.([0-9]*) - (may be ommited) " + "Look at all transactions containing these accounts You can specify qualified names, unqualified names or ids\n" + "sum.([0-9]*).source.([0-9]*) - of these accounts add all splits that refer to these accounts\n" + "sum.([0-9]*).type = ONLYTO - sum only the ones that increase the balance of the account (other values: ONLYFROM, ALL)\n" + "sum.([0-9]*).type = ONLYFROM - sum only the ones that decrease the balance of the account (other values: ONLYFROM, ALL)\n" + "sum.([0-9]*).type = ALL - sum all the ones that increase or decreas the balance of the account (other values: ONLYFROM, ALL)\n" + "sum.([0-9]*).type = ALLRECURSIVE - ignore targets and build the recursive balance\n"); LOGGER.info("demo-config-file for TaxReportPanel has been stored in " + configFile.getAbsolutePath()); } catch (Exception e) { LOGGER.error("Problem loading or storing default-TaxReportPanel.xml", e); JLabel errorLabel = new JLabel(e.getMessage()); this.add(errorLabel, BorderLayout.CENTER); return; }*/ } LOGGER.info("calculating tax-panel..."); for (int i = 0; props.containsKey("sum." + i + ".name"); i++) { try { createSum(books, props, i); } catch (Exception e) { LOGGER.error("[Exception] Problem in " + getClass().getName(), e); } } mySumsPanel.setLayout(new GridLayout(mySums.size(), 1)); for (TransactionSum sum : mySums) { mySumsPanel.add(sum); } this.add(mySumsPanel, BorderLayout.CENTER); myExportButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent aE) { showExportCSVDialog(); } }); myExportPanel.add(myExportButton); myExportGranularityCombobox.setSelectedItem(ExportGranularities.Month); myExportGranularityCombobox.setEditable(false); myExportPanel.add(myExportGranularityCombobox); this.add(myExportPanel, BorderLayout.SOUTH); LOGGER.info("calculating tax-panel...DONE"); }
From source file:org.alfresco.solr.SolrInformationServer.java
private void initSkippingDescendantDocs(Properties p, Set<QName> dataForSkippingDescendantDocs, String propPrefixParent, String skipByField, DefinitionExistChecker dec) { int i = 0;/* w w w .j av a 2s .c o m*/ for (String key = new StringBuilder(propPrefixParent).append(i).toString(); p .containsKey(key); key = new StringBuilder(propPrefixParent).append(++i).toString()) { String qNameInString = p.getProperty(key); if ((null != qNameInString) && !qNameInString.isEmpty()) { QName qName = QName.resolveToQName(dataModel.getNamespaceDAO(), qNameInString); if (qName == null && log.isWarnEnabled()) { log.warn("QName was not found for " + qNameInString); } if (dec.isDefinitionExists(qName)) { dataForSkippingDescendantDocs.add(qName); } } } if (null == skippingDocsQueryString) { skippingDocsQueryString = this.cloud.getQuery(skipByField, OR, dataForSkippingDescendantDocs); } else { skippingDocsQueryString += OR + this.cloud.getQuery(skipByField, OR, dataForSkippingDescendantDocs); } }
From source file:edu.kit.dama.mdm.content.mets.MetsMetadataExtractor.java
@Override public final void validateProperties(Properties pProperties) throws PropertyValidationException { LOGGER.debug("Validating mets metadata extractor named {}", getName()); if (pProperties.getProperty(COMMUNITY_DMD_SECTION_ID) == null) { // LOGGER.warn("No {} property defined for mets extractor named {}. No community metadata will be added to mets documents created by this extractor.", COMMUNITY_DMD_SECTION_ID, getName()); throw new PropertyValidationException( "Mandatory property '" + COMMUNITY_DMD_SECTION_ID + "' is missing."); }//from ww w . j a va2 s .c o m //Does this check make any sense? /* if (pProperties.getProperty(COMMUNITY_METADATA_SCHEMA_ID) != null && pProperties.getProperty(COMMUNITY_MD_TYPE_ID) != null) { LOGGER.warn("Both, property {} and property {}, are defined for mets extractor named {}. The value of property {} will be ignored.", COMMUNITY_METADATA_SCHEMA_ID, COMMUNITY_MD_TYPE_ID, getName(), COMMUNITY_METADATA_SCHEMA_ID); }*/ if (pProperties.getProperty(COMMUNITY_METADATA_SCHEMA_ID) == null) { throw new PropertyValidationException( "Mandatory property '" + COMMUNITY_METADATA_SCHEMA_ID + "' is missing."); } else { if (getLinkedSchema(pProperties.getProperty(COMMUNITY_METADATA_SCHEMA_ID)) == null) { throw new PropertyValidationException("The value of '" + COMMUNITY_METADATA_SCHEMA_ID + "' does not refer to a valid schema identifier."); } } if (pProperties.getProperty(COMMUNITY_MD_TYPE_ID) == null) { throw new PropertyValidationException("Mandatory property '" + COMMUNITY_MD_TYPE_ID + "' is missing."); } String mdType = pProperties.getProperty(COMMUNITY_MD_TYPE_ID); if (mdType != null) { try { LOGGER.debug("Successfully checked value {} of property {}", MDTYPE.valueOf(mdType), COMMUNITY_MD_TYPE_ID); } catch (IllegalArgumentException ex) { throw new PropertyValidationException("Property " + COMMUNITY_MD_TYPE_ID + " has an invalid value.", ex); } } for (String plugins : extractorMap.keySet()) { IMetsTypeExtractor plugin = extractorMap.get(plugins); if (pProperties.containsKey(plugins)) { validatePluginString(plugins, pProperties.getProperty(plugins)); } else { LOGGER.warn( "New plugin '{}' available! As it is not configured yet it will be ignored. Please " + "reconfigure extractor '{}' if you want to support this plugin!", plugin.getName(), getClass().toString()); } } LOGGER.debug("Performing validation of extractor-specific properties."); validateExtractorProperties(pProperties); }
From source file:com.twinsoft.convertigo.eclipse.ConvertigoPlugin.java
static public Properties decodePsc(String psc) throws PscException { if (psc.length() == 0) { throw new PscException("Invalid PSC (empty)!"); } else {/*from w w w . jav a 2 s. c o m*/ Properties properties = new Properties(); try { String decipheredPSC = Crypto2.decodeFromHexString("registration", psc); if (decipheredPSC == null) { throw new PscException("Invalid PSC (unable to decipher)!"); } else if (!decipheredPSC.startsWith("# PSC file")) { throw new PscException("Invalid PSC (wrong format)!"); } else { try { properties.load(IOUtils.toInputStream(decipheredPSC, "utf8")); } catch (IOException e) { throw new PscException("Invalid PSC (cannot load properties)!"); } } } catch (PscException e) { try { String decipheredPSC = SimpleCipher.decode(psc); properties.load(IOUtils.toInputStream(decipheredPSC, "utf8")); String server = properties.getProperty("server"); String user = properties.getProperty("admin.user"); String password = properties.getProperty("admin.password"); if (server == null && user == null && password == null) { throw e; } if (server == null || user == null || password == null) { throw new PscException("Invalid PSC (incomplet data)!"); } if (!user.equals(SimpleCipher.decode(password))) { throw new PscException("Invalid PSC (altered data)"); } boolean bHttps = Boolean.parseBoolean(properties.getProperty("https")); properties.clear(); DeploymentKey.adminUser.setValue(properties, 1, user); DeploymentKey.adminPassword.setValue(properties, 1, password); DeploymentKey.server.setValue(properties, 1, server); DeploymentKey.sslHttps.setValue(properties, 1, Boolean.toString(bHttps)); } catch (PscException ex) { throw ex; } catch (Exception ex) { throw e; } } int i = 0; while (++i > 0) { if (i > 1 && !properties.containsKey(DeploymentKey.adminUser.key(i))) { i = -1; } else { for (DeploymentKey key : DeploymentKey.values()) { if (!properties.containsKey(key.key(i))) { if (!key.hasDefault()) { throw new PscException("Invalid PSC (altered data)"); } key.setValue(properties, i); } } } } return properties; } }
From source file:org.apache.geode.management.internal.cli.commands.ConnectCommand.java
Result jmxConnect(Properties gfProperties, boolean useSsl, ConnectionEndpoint memberRmiHostPort, ConnectionEndpoint locatorTcpHostPort, boolean retry) { ConnectionEndpoint jmxHostPortToConnect = null; Gfsh gfsh = getGfsh();//from w ww . ja va 2 s. c om try { // trying to find the rmi host and port, if rmi host port exists, use that, otherwise, use // locator to find the rmi host port if (memberRmiHostPort != null) { jmxHostPortToConnect = memberRmiHostPort; } else { if (useSsl) { gfsh.logToFile(CliStrings.CONNECT__USE_SSL + " is set to true. Connecting to Locator via SSL.", null); } Gfsh.println(CliStrings.format(CliStrings.CONNECT__MSG__CONNECTING_TO_LOCATOR_AT_0, new Object[] { locatorTcpHostPort.toString(false) })); ConnectToLocatorResult connectToLocatorResult = connectToLocator(locatorTcpHostPort.getHost(), locatorTcpHostPort.getPort(), CONNECT_LOCATOR_TIMEOUT_MS, gfProperties); jmxHostPortToConnect = connectToLocatorResult.getMemberEndpoint(); // when locator is configured to use SSL (ssl-enabled=true) but manager is not // (jmx-manager-ssl=false) if (useSsl && !connectToLocatorResult.isJmxManagerSslEnabled()) { gfsh.logInfo(CliStrings.CONNECT__USE_SSL + " is set to true. But JMX Manager doesn't support SSL, connecting without SSL.", null); useSsl = false; } } if (useSsl) { gfsh.logToFile("Connecting to manager via SSL.", null); } // print out the connecting endpoint if (!retry) { Gfsh.println(CliStrings.format(CliStrings.CONNECT__MSG__CONNECTING_TO_MANAGER_AT_0, new Object[] { jmxHostPortToConnect.toString(false) })); } InfoResultData infoResultData = ResultBuilder.createInfoResultData(); JmxOperationInvoker operationInvoker = new JmxOperationInvoker(jmxHostPortToConnect.getHost(), jmxHostPortToConnect.getPort(), gfProperties); gfsh.setOperationInvoker(operationInvoker); infoResultData.addLine( CliStrings.format(CliStrings.CONNECT__MSG__SUCCESS, jmxHostPortToConnect.toString(false))); LogWrapper.getInstance().info( CliStrings.format(CliStrings.CONNECT__MSG__SUCCESS, jmxHostPortToConnect.toString(false))); return ResultBuilder.buildResult(infoResultData); } catch (SecurityException | AuthenticationFailedException e) { // if it's security exception, and we already sent in username and password, still returns the // connection error if (gfProperties.containsKey(ResourceConstants.USER_NAME)) { return handleException(e, jmxHostPortToConnect); } // otherwise, prompt for username and password and retry the connection gfProperties.setProperty(UserInputProperty.USERNAME.getKey(), UserInputProperty.USERNAME.promptForAcceptableValue(gfsh)); gfProperties.setProperty(UserInputProperty.PASSWORD.getKey(), UserInputProperty.PASSWORD.promptForAcceptableValue(gfsh)); return jmxConnect(gfProperties, useSsl, jmxHostPortToConnect, null, true); } catch (Exception e) { // all other exceptions, just logs it and returns a connection error return handleException(e, jmxHostPortToConnect); } finally { Gfsh.redirectInternalJavaLoggers(); } }