Charset charset = Charset.forName(context.getProperty(CHARSET).evaluateAttributeExpressions(flowFile).getValue()); if (StringUtil.isBlank(logPrefix)) { dashedLine = StringUtils.repeat('-', 50); } else {
if (StringUtil.isBlank(logPrefix)) { messageToWrite = logMessage; } else {
if (StringUtil.isBlank(methodName))
/** * Check if the filename is a session filename. * * @param filename the filename to check * @return true if the filename has the correct filename format */ protected boolean isSessionFilename (String filename) { if (StringUtil.isBlank(filename)) return false; String[] parts = filename.split("_"); //Need at least 4 parts for a valid filename if (parts.length < 4) return false; return true; }
static boolean isValidOrNull(String value) { return isBlank(value) || ALL_DIGITS.matcher(value).matches(); }
protected String getContextFromFilename (String filename) { if (StringUtil.isBlank(filename)) return null; int start = filename.indexOf('_'); int end = filename.lastIndexOf('_'); return filename.substring(start+1, end); }
/** * Extract the session id and context from the filename * @param filename the name of the file to use * @return the session id plus context */ protected String getIdWithContextFromFilename (String filename) { if (StringUtil.isBlank(filename) || filename.indexOf('_') < 0) return null; return filename.substring(filename.indexOf('_')+1); }
private Optional<ZonedDateTime> parseDate(String date) { if (!isBlank(date)) { return Optional.of(ZonedDateTime.parse(date)); } return Optional.empty(); } }
/** * Concatenate an element on to fully qualified classname. * * @param path the path under construction * @param element the element of the name to add */ protected void appendPath (StringBuffer path, String element) { if (StringUtil.isBlank(element)) return; if (path.length() > 0) path.append("."); path.append(element); }
protected long getExpiryFromFilename (String filename) { if (StringUtil.isBlank(filename) || filename.indexOf("_") < 0) throw new IllegalStateException ("Invalid or missing filename"); String s = filename.substring(0, filename.indexOf('_')); return (s==null?0:Long.parseLong(s)); }
private static boolean validateState(Account account, String state) { return isBlank(state) || (isDirectDebitAccount(account) ? VALID_DIRECT_DEBIT_STATES.contains(state) : VALID_CARD_PAYMENT_STATES.contains(state)); }
public static boolean validate(String value) { return isBlank(value) || DateTimeUtils.toUTCZonedDateTime(value).isPresent(); } }
/** * @param w the source WebAppContext * @param extraXML any extra xml snippet to append * @param originAttribute param value to use for the context param origin attribute * @param generateOrigin <code>true</code> to generate the origin attribute */ public QuickStartDescriptorGenerator (WebAppContext w, String extraXML, String originAttribute, boolean generateOrigin) { _webApp = w; _extraXML = extraXML; _originAttribute = (StringUtil.isBlank(originAttribute)?DEFAULT_ORIGIN_ATTRIBUTE_NAME:originAttribute); _generateOrigin = generateOrigin || LOG.isDebugEnabled(); _count = 0; }
/** * @see org.eclipse.jetty.annotations.AnnotationConfiguration#parseWebInfClasses(org.eclipse.jetty.webapp.WebAppContext, org.eclipse.jetty.annotations.AnnotationParser) */ @Override public void parseWebInfClasses(WebAppContext context, org.eclipse.jetty.annotations.AnnotationParser parser) throws Exception { Bundle webbundle = (Bundle) context.getAttribute(OSGiWebappConstants.JETTY_OSGI_BUNDLE); String bundleClasspath = (String)webbundle.getHeaders().get(Constants.BUNDLE_CLASSPATH); //only scan WEB-INF/classes if we didn't already scan it with parseWebBundle if (StringUtil.isBlank(bundleClasspath) || !bundleClasspath.contains("WEB-INF/classes")) super.parseWebInfClasses(context, parser); }
public PreparedStatement getDeleteStatement (Connection connection, String id, SessionContext contextId) throws Exception { if (_dbAdaptor == null) throw new IllegalStateException("No DB adaptor"); String cp = contextId.getCanonicalContextPath(); if (_dbAdaptor.isEmptyStringNull() && StringUtil.isBlank(cp)) cp = NULL_CONTEXT_PATH; PreparedStatement statement = connection.prepareStatement("delete from "+getSchemaTableName()+ " where "+getIdColumn()+" = ? and "+getContextPathColumn()+ " = ? and "+getVirtualHostColumn()+" = ?"); statement.setString(1, id); statement.setString(2, cp); statement.setString(3, contextId.getVhost()); return statement; }
public PreparedStatement getLoadStatement (Connection connection, String id, SessionContext contextId) throws SQLException { if (_dbAdaptor == null) throw new IllegalStateException("No DB adaptor"); String cp = contextId.getCanonicalContextPath(); if (_dbAdaptor.isEmptyStringNull()&& StringUtil.isBlank(cp)) cp = NULL_CONTEXT_PATH; PreparedStatement statement = connection.prepareStatement("select * from "+getSchemaTableName()+ " where "+getIdColumn()+" = ? and "+getContextPathColumn()+ " = ? and "+getVirtualHostColumn()+" = ?"); statement.setString(1, id); statement.setString(2, cp); statement.setString(3, contextId.getVhost()); return statement; }
public PreparedStatement getExpiredSessionsStatement (Connection connection, String canonicalContextPath, String vhost, long expiry) throws SQLException { // TODO expiry should be a delay rather than an absolute time. if (_dbAdaptor == null) throw new IllegalStateException("No DB adaptor"); String cp = canonicalContextPath; if (_dbAdaptor.isEmptyStringNull() && StringUtil.isBlank(cp)) cp = NULL_CONTEXT_PATH; PreparedStatement statement = connection.prepareStatement("select "+getIdColumn()+", "+getExpiryTimeColumn()+ " from "+getSchemaTableName()+" where "+getContextPathColumn()+" = ? and "+ getVirtualHostColumn()+" = ? and "+ getExpiryTimeColumn()+" >0 and "+getExpiryTimeColumn()+" <= ?"); statement.setString(1, cp); statement.setString(2, vhost); statement.setLong(3, expiry); return statement; }
/** * @param jsp the jsp-file from web.xml * @return the fully qualified classname */ public String getClassNameForJsp (String jsp) { if (jsp == null) return null; String name = getNameOfJspClass(jsp); if (StringUtil.isBlank(name)) return null; StringBuffer fullName = new StringBuffer(); appendPath(fullName, getJspPackagePrefix()); appendPath(fullName, getPackageOfJspClass(jsp)); appendPath(fullName, name); return fullName.toString(); }
public PreparedStatement getCheckSessionExistsStatement (Connection connection, SessionContext context) throws SQLException { if (_dbAdaptor == null) throw new IllegalStateException("No DB adaptor"); String cp = context.getCanonicalContextPath(); if (_dbAdaptor.isEmptyStringNull() && StringUtil.isBlank(cp)) cp = NULL_CONTEXT_PATH; PreparedStatement statement = connection.prepareStatement("select "+getIdColumn()+", "+getExpiryTimeColumn()+ " from "+getSchemaTableName()+ " where "+getIdColumn()+" = ? and "+ getContextPathColumn()+" = ? and "+ getVirtualHostColumn()+" = ?"); statement.setString(2, cp); statement.setString(3, context.getVhost()); return statement; }
public PreparedStatement getUpdateSessionStatement(Connection connection, String id, SessionContext context) throws SQLException { String s = "update "+getSchemaTableName()+ " set "+getLastNodeColumn()+" = ?, "+getAccessTimeColumn()+" = ?, "+ getLastAccessTimeColumn()+" = ?, "+getLastSavedTimeColumn()+" = ?, "+getExpiryTimeColumn()+" = ?, "+ getMaxIntervalColumn()+" = ?, "+getMapColumn()+" = ? where "+getIdColumn()+" = ? and "+getContextPathColumn()+ " = ? and "+getVirtualHostColumn()+" = ?"; String cp = context.getCanonicalContextPath(); if (_dbAdaptor.isEmptyStringNull() && StringUtil.isBlank(cp)) cp = NULL_CONTEXT_PATH; PreparedStatement statement = connection.prepareStatement(s); statement.setString(8, id); statement.setString(9, cp); statement.setString(10, context.getVhost()); return statement; }