static public boolean writeStringToDiskPathAtomically(String string, String path, boolean flag) { _NSStringUtilities.writeToFile(new File(path), string); return true; }
private String _objcNameForJavaName(String name) { if (name == null) return null; if (name.equals(CN_JavaString)) return CN_NSString; if (name.equals(CN_JavaNumber)) return CN_NSNumber; if (name.equals(CN_JavaBigDecimal)) return CN_NSDecimalNumber; if (name.equals(CN_JavaNSTimestamp)) return CN_NSCalendarDate; if (name.equals(CN_JavaNSData)) return CN_NSData; if (name.equals("")) return null; return _NSStringUtilities.lastComponentInString(name, '.'); }
private String _removeNewStyleCommentsAndQuotedStringsFromString(String declarationsStr) { String escapedQuoteStr = _NSStringUtilities.replaceAllInstancesOfString(declarationsStr, "\\\"", WOHelperFunctionDeclarationParser.ESCAPED_QUOTE_STRING); StringBuilder declarationWithoutCommentsBuffer = new StringBuilder(100); StringTokenizer tokenizer = new StringTokenizer(escapedQuoteStr, "/\"", true); token = tokenizer.nextToken("\n"); if (token.startsWith("/")) { token = _NSStringUtilities.replaceAllInstancesOfString(token, WOHelperFunctionDeclarationParser.ESCAPED_QUOTE_STRING, "\\\""); declarationWithoutCommentsBuffer.append('\n'); tokenizer.nextToken(); NSLog.debug.appendln("Found a quoted string: " + quotedStringKey + "='" + token + "';"); token = _NSStringUtilities.replaceAllInstancesOfString(token, WOHelperFunctionDeclarationParser.ESCAPED_QUOTE_STRING, "\""); _quotedStrings.setObjectForKey(token, quotedStringKey); declarationWithoutCommentsBuffer.append(quotedStringKey);
private void didParseText() { if (_contentText != null) { if (log.isDebugEnabled()) { log.debug("Parsed Text (" + _contentText.length() + ") : " + _contentText); } if (_contentText.length() > 0) { _parserDelegate.didParseText(_NSStringUtilities.stringFromBuffer(_contentText), this); _contentText.setLength(0); } } }
String result = _NSStringUtilities.stringForBytes(bytes, 0, length, CharEncoding.UTF_8); if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelInformational, NSLog.DebugGroupDatabaseAccess)) if (NSLog.debugLoggingAllowedForLevel(NSLog.DebugLevelDetailed)) value = _NSStringUtilities.stringForBytes(bytes, 0, length, CharEncoding.UTF_8); if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelInformational, NSLog.DebugGroupDatabaseAccess)) if (NSLog.debugLoggingAllowedForLevel(NSLog.DebugLevelDetailed))
public String columnTypeStringForAttribute(EOAttribute attribute) { if (attribute.precision() != 0) { String precision = String.valueOf(attribute.precision()); String scale = String.valueOf(attribute.scale()); return _NSStringUtilities.concat(attribute.externalType(), "(", precision, ",", scale, ")"); } if (attribute.width() != 0) { String width = String.valueOf(attribute.width()); return _NSStringUtilities.concat(attribute.externalType(), "(", width, ")"); } return attribute.externalType(); }
else if (_NSStringUtilities.isNumber(associationValue)) { Number number = null; if (associationValue != null && associationValue.contains(".")) {
if (string != null) setReadFormat(string); int num = _NSStringUtilities.integerFromPlist(plist, "maximumLength", -1); if (num == -1) num = _NSStringUtilities.integerFromPlist(plist, "width", -1); if (num != -1) setWidth(num); if ((string = (String) plist.objectForKey("valueFactoryMethodName")) != null) setValueFactoryMethodName(string); num = _NSStringUtilities.integerFromPlist(plist, "precision", -1); if (num != -1) setPrecision(num); num = _NSStringUtilities.integerFromPlist(plist, "scale", -1); if (num != -1) setScale(num); setServerTimeZone(tz); num = _NSStringUtilities.integerFromPlist(plist, "parameterDirection", -1); if (num != -1) setParameterDirection(num);
value = _valueFactoryMethod.invoke(valueFactoryClass()==null?_valueClass:valueFactoryClass(), _NSStringUtilities.bytesForString(str, CharEncoding.UTF_8)); if (!NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelInformational, NSLog.DebugGroupDatabaseAccess)) break;
private void didParseComment() { if (_contentText != null) { if (log.isDebugEnabled()) { log.debug("Parsed Comment (" + _contentText.length() + ") : " + _contentText); } if (_contentText.length() > 0) { _parserDelegate.didParseComment(_NSStringUtilities.stringFromBuffer(_contentText), this); _contentText.setLength(0); } } } }
value = _valueFactoryMethod.invoke(valueFactoryClass()==null?_valueClass:valueFactoryClass(), _NSStringUtilities.stringForBytes(bytes, CharEncoding.UTF_8)); if (!NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelInformational, NSLog.DebugGroupDatabaseAccess)) break;
public void saveSiteConfig(File sc, String value, boolean compress) { try { if ( sc.exists() && !sc.canWrite() ) { log.error("Don't have permission to write to file {} as this user, please change the permissions.", sc.getAbsolutePath()); String pre = WOApplication.application().name() + " - " + localHostName; globalErrorDictionary.takeValueForKey(pre + " Don't have permission to write to file " + sc.getAbsolutePath() + " as this user, please change the permissions.", "archiveSiteConfig"); return; } if(compress) { sc = new File(sc.getParentFile(), sc.getName() + ".gz"); ERXFileUtilities.stringToGZippedFile(value, sc); } else { _NSStringUtilities.writeToFile(sc, value); } globalErrorDictionary.takeValueForKey(null, "archiveSiteConfig"); } catch (IOException e) { String message = "Cannot write to file " + sc.getAbsolutePath() + ". IOException: " + e.getLocalizedMessage(); log.error(message); String pre = WOApplication.application().name() + " - " + localHostName; globalErrorDictionary.takeValueForKey(pre + message, "archiveSiteConfig"); } catch (NSForwardException ne) { log.error("Cannot write to file {}. Possible Permissions Problem.", sc.getAbsolutePath()); String pre = WOApplication.application().name() + " - " + localHostName; globalErrorDictionary.takeValueForKey(pre + " Cannot write to file " + sc.getAbsolutePath() + ". Possible Permissions Problem.", "archiveSiteConfig"); } }
private void didParseOpeningWebObjectTag() throws WOHelperFunctionHTMLFormatException { if (_contentText != null) { if (log.isDebugEnabled()) { log.debug("Parsed Opening WebObject (" + _contentText.length() + ") : " + _contentText); } if (_contentText.length() > 0) { _parserDelegate.didParseOpeningWebObjectTag(_NSStringUtilities.stringFromBuffer(_contentText), this); _contentText.setLength(0); } } }
public void archiveAdaptorConfig() { try { File ac = fileForAdaptorConfig(); if ( ac.exists() && !ac.canWrite() ) { log.error("Don't have permission to write to file {} as this user, please change the permissions.", fileForAdaptorConfig()); String pre = WOApplication.application().name() + " - " + localHostName; globalErrorDictionary.takeValueForKey(pre + " Don't have permission to write to file " + fileForAdaptorConfig() + "as this user, please change the permissions.", "archiveSiteConfig"); return; } _NSStringUtilities.writeToFile(fileForAdaptorConfig(), generateAdaptorConfigXML(false, false)); globalErrorDictionary.takeValueForKey(null, "archiveAdaptorConfig"); } catch (NSForwardException ne) { log.error("Cannot write to file {}. Possible Permissions Problem.", pathForAdaptorConfig()); String pre = WOApplication.application().name() + " - " + localHostName; globalErrorDictionary.takeValueForKey(pre + " Cannot write to file " + pathForAdaptorConfig() + ". Possible Permissions Problem.", "archiveAdaptorConfig"); } } /**********/
private void didParseClosingWebObjectTag() throws WOHelperFunctionDeclarationFormatException, WOHelperFunctionHTMLFormatException, ClassNotFoundException, ClassNotFoundException { if (_contentText != null) { if (log.isDebugEnabled()) { log.debug("Parsed Closing WebObject (" + _contentText.length() + ") : " + _contentText); } if (_contentText.length() > 0) { _parserDelegate.didParseClosingWebObjectTag(_NSStringUtilities.stringFromBuffer(_contentText), this); _contentText.setLength(0); } } }
_NSStringUtilities.writeToFile( fileForSiteConfig(), (new _JavaMonitorCoder()).encodeRootObjectForKey(NSDictionary.EmptyDictionary, "SiteConfig"));