/** * React to a change in an attribute. * * @param attribute The changed parameter. * @exception IllegalActionException If the parameter set is not valid. */ public void attributeChanged(Attribute attribute) throws IllegalActionException { String tmp = null; if (attribute == serverName) { // -------------- the user has changed serverName ----------- String strServerName = serverName.getExpression(); if (_serverNameString == null) { // the value is loaded from the moml file // don't cal the _createSubmission _serverNameString = strServerName; log.info("_serverNameString is set according to original value of moml file."); if (!strServerName.equals("")) { _appMetadata = AppMetadataParser.parseAppMetadata(strServerName); if (_appMetadata == null) { // something bad happen while getting the appMetadata log.error("Failed to parse metadata at " + strServerName); throw new IllegalActionException( this, "The selected URL does not point to a valid Opal service"); } } } else if (!strServerName.equals(_serverNameString)) { // the user changed the value, we have to update the actor log.info("Got a new server name: " + strServerName); _appMetadata = AppMetadataParser.parseAppMetadata(strServerName); if (_appMetadata != null) { if (_appMetadata.isArgMetadataEnable()) // complex submission form _createSubmission(_appMetadata); else // simple submission form _createSimpleSubmission(_appMetadata); _addDocumentation(_appMetadata); } else { // something bad happen while getting the appMetadata log.error("Failed to parse metadata at " + strServerName); throw new IllegalActionException( this, "The selected URL does not point to a valid Opal service"); } _serverNameString = strServerName; this.propagateValues(); } } else if (attribute == numberFiles) { // -------------- the user has changed the number of files ----------- int numFiles = 1; try { numFiles = Integer.parseInt(numberFiles.stringValue()); } catch (NumberFormatException e) { throw new IllegalActionException( this, "The numberFiles parameter is not a valid integer, please correct the value"); } if (numFiles != _numberFiles) { _updateUploadFileNumber(numFiles); _numberFiles = numFiles; } } else { log.debug("the user has changed: " + attribute.toString()); } super.attributeChanged(attribute); } // attributeChanged