List of usage examples for javax.naming OperationNotSupportedException getMessage
public String getMessage()
From source file:com.bigtobster.pgnextractalt.commands.EvaluateCommands.java
/** * Handle the interface for evaluating the machine correlation of a game and inserting the evaluated correlation value into the tag for the * evaluated person for that game/*from ww w . j ava 2 s.co m*/ * * @param depth The minimum depth that the engine must search to before returning a best move * @param wait The period that PGN-Extract-Alt will sleep for in ms before polling the UCI engine * @param force Whether to overwrite existing machine correlation scores * @return Success message * @throws java.io.IOException Thrown on unknown engine failure */ @SuppressWarnings({ "ProhibitedExceptionDeclared", "FeatureEnvy", "BooleanParameter" }) @CliCommand(value = EvaluateCommands.EVALUATE_MACHINE_CORRELATION_COMMAND, help = EvaluateCommands.EVALUATE_MACHINE_CORRELATION_COMMAND_HELP) public String evaluateMachineCorrelation(@CliOption(key = { EvaluateCommands.DEPTH_OPTION }, help = "The minimum depth the engine will search for the best move (default of 10)", mandatory = false, unspecifiedDefaultValue = "13") final int depth, @CliOption(key = { EvaluateCommands.WAIT_OPTION }, help = "The time period in ms the engine will wait before checking if best move found." + " Increase value for slower hardware to improve performance.", mandatory = false, unspecifiedDefaultValue = "20") final int wait, @SuppressWarnings("DuplicateStringLiteralInspection") @CliOption(key = { EvaluateCommands.FORCE_OPTION }, help = "Overwrite existing MachineCorrelation scores (default of false)", mandatory = false, unspecifiedDefaultValue = "false") final boolean force) throws Exception { int tagsInsertedNo = 0; String failureDetails = null; if (wait <= 0) { failureDetails = EvaluateCommands.WAIT_OPTION + EvaluateCommands.SPACE + EvaluateCommands.PARAMETER_MUST_BE_GREATER_THAN_0; } if (depth <= 0) { failureDetails = EvaluateCommands.DEPTH_OPTION + EvaluateCommands.SPACE + EvaluateCommands.PARAMETER_MUST_BE_GREATER_THAN_0; } if (failureDetails == null) { try { tagsInsertedNo = ChessEvaluator.evaluateMachineCorrelation( this.commandContext.getChessIO().getGames(), depth, wait, force); } catch (final IOException ioe) { failureDetails = CommandContext.UNKNOWN_IMPORT_ERROR + OsUtils.LINE_SEPARATOR + CommandContext.NOTIFY_DEV; CommandContext.handleAndThrowSevereError(ioe, failureDetails); } catch (@SuppressWarnings("LocalVariableNamingConvention") final OperationNotSupportedException operationNotSupportedException) { failureDetails = operationNotSupportedException.getMessage(); } catch (final URISyntaxException use) { failureDetails = CommandContext.UNKNOWN_IMPORT_ERROR + OsUtils.LINE_SEPARATOR + CommandContext.NOTIFY_DEV; CommandContext.handleAndThrowSevereError(use, failureDetails); } } if (failureDetails == null) { return CommandContext.SUCCESSFULLY_INSERTED_TAGS + EvaluateCommands.SPACE + tagsInsertedNo + EvaluateCommands.SPACE + CommandContext.TAGS_INSERTED; } return EvaluateCommands.FAILED_EVALUATION + EvaluateCommands.SPACE + failureDetails; }
From source file:org.kalypso.ui.wizard.wfs.ImportWfsSourceWizard.java
@Override public boolean performFinish() { final IKalypsoLayerModell mapModell = getMapModel(); if (mapModell == null) return true; try {// www . ja v a 2 s .com final WFSFeatureType[] layers = m_importWFSPage.getChoosenFeatureLayer(); for (final WFSFeatureType featureType : layers) { final Filter complexFilter = m_importWFSPage.getFilter(featureType); final Filter simpleFilter = m_filterWFSPage.getFilter(); final Filter mergedFilter = FilterUtilites.mergeFilters(complexFilter, simpleFilter); final String xml = buildXml(featureType, mergedFilter); // TODO here the featurePath is set to featureMember because this is // the top feature of the GMLWorkspace // it must be implemented to only set the name of the feature // (relative path of feature) final StringBuffer source = new StringBuffer(); final QualifiedName qNameFT = featureType.getName(); source.append("#").append(WfsLoader.KEY_URL).append("=").append(m_importWFSPage.getUri()); //$NON-NLS-1$ //$NON-NLS-2$ source.append("#").append(WfsLoader.KEY_FEATURETYPE).append("=").append(qNameFT.getLocalName()); //$NON-NLS-1$ //$NON-NLS-2$ final String namespaceURI = qNameFT.getNamespace().toString(); if (namespaceURI != null && namespaceURI.length() > 0) source.append("#").append(WfsLoader.KEY_FEATURETYPENAMESPACE).append("=").append(namespaceURI); //$NON-NLS-1$ //$NON-NLS-2$ if (xml != null) source.append("#").append(WfsLoader.KEY_FILTER).append("=").append(xml); //$NON-NLS-1$ //$NON-NLS-2$ if (m_filterWFSPage.doFilterMaxFeatures()) { final int maxfeatures = m_filterWFSPage.getMaxFeatures(); source.append("#").append(WfsLoader.KEY_MAXFEATURE).append("=") //$NON-NLS-1$//$NON-NLS-2$ .append(Integer.toString(maxfeatures)); } final String featurePath = "featureMember[" + qNameFT.getLocalName() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ String title = featureType.getTitle(); if (title == null || title.isEmpty()) title = qNameFT.getLocalName(); final AddThemeCommand command = new AddThemeCommand(mapModell, title, "wfs", featurePath, //$NON-NLS-1$ source.toString()); postCommand(command, null); } } catch (final OperationNotSupportedException e) { e.printStackTrace(); m_filterWFSPage.setErrorMessage(e.getMessage()); return false; } return true; }