/** * @param input * the input. * @return new list, never null. */ public static List<String> fromString( final String input ) { final List<String> result = new ArrayList<String>(); if ( StringUtils.isBlank( input ) ) { return result; } for ( String value : StringUtils.split( input, SEPARATOR_CHAR ) ) { result.add( value ); } return result; }
protected void addInjectionProperty( Injection metaInj, BeanLevelInfo leaf ) { if ( StringUtils.isBlank( metaInj.name() ) ) { throw new RuntimeException( "Property name shouldn't be blank in the " + clazz ); } String propertyName = calcPropertyName( metaInj, leaf ); if ( properties.containsKey( propertyName ) ) { throw new RuntimeException( "Property '" + propertyName + "' already defined for " + clazz ); } // probably hided if ( hideProperties.contains( propertyName ) ) { return; } Property prop = new Property( propertyName, metaInj.group(), leaf.createCallStack() ); properties.put( prop.name, prop ); Group gr = groupsMap.get( metaInj.group() ); if ( gr == null ) { throw new RuntimeException( "Group '" + metaInj.group() + "' for property '" + metaInj.name() + "' is not defined " + clazz ); } gr.groupProperties.add( prop ); }
String tenantTmp = StringUtils.isBlank(tenant) ? StringUtils.EMPTY : tenant; final String appName = configAdvanceInfo == null ? null : (String)configAdvanceInfo.get("appName"); final String configTags = configAdvanceInfo == null ? null : (String)configAdvanceInfo.get("config_tags"); List<String> paramList = new ArrayList<String>(); paramList.add(dataId); paramList.add(group); paramList.add(tenantTmp); if (StringUtils.isNotBlank(configTags)) { sql = new StringBuilder( "select a.ID,a.data_id,a.group_id,a.tenant_id,a.app_name,a.content from config_info a left join " if (StringUtils.isNotBlank(appName)) { sql.append(" and a.app_name=? "); paramList.add(appName); if (StringUtils.isNotBlank(appName)) { sql.append(" and app_name=? "); paramList.add(appName);
if (StringUtils.isBlank(stormHome)) { stormHome = "./"; environment.put("REDIRECT", "true"); } else { environment.put("REDIRECT", "false"); environment.put("LD_LIBRARY_PATH", (String) totalConf.get(Config.JAVA_LIBRARY_PATH)); environment.put("jstorm.home", stormHome); environment.put("jstorm.workerId", workerId);
private void buildOutputLocations() { String xlearningOutputs = envs.get(XLearningConstants.Environment.XLEARNING_OUTPUTS.toString()); if (StringUtils.isBlank(xlearningOutputs)) { return; } String[] outputs = StringUtils.split(xlearningOutputs, "|"); if (outputs != null && outputs.length > 0) { for (String output : outputs) { String outputPathTuple[] = StringUtils.split(output, "#"); if (outputPathTuple.length < 2) { throw new RuntimeException("Error input path format " + xlearningOutputs); } String pathRemote = outputPathTuple[0]; OutputInfo outputInfo = new OutputInfo(); outputInfo.setDfsLocation(pathRemote); String pathLocal = outputPathTuple[1]; outputInfo.setLocalLocation(pathLocal); outputInfos.add(outputInfo); LOG.info("Application output " + pathRemote + "#" + pathLocal); } } else { throw new RuntimeException("Error input path format " + xlearningOutputs); } }
private void addTempResources(Configuration conf, List<LocalResource> tmpResources, String hdfsDirPathStr, LocalResourceType type, String[] files, String[] skipFiles) throws IOException { HashSet<Path> skipFileSet = null; if (skipFiles != null) { skipFileSet = new HashSet<>(); for (String skipFile : skipFiles) { if (StringUtils.isBlank(skipFile)) { continue; } skipFileSet.add(new Path(skipFile)); } } for (String file : files) { if (!StringUtils.isNotBlank(file)) { continue; } if (skipFileSet != null && skipFileSet.contains(new Path(file))) { LOG.info("Skipping vertex resource " + file + " that already exists in the session"); continue; } Path hdfsFilePath = new Path(hdfsDirPathStr, getResourceBaseName(new Path(file))); LocalResource localResource = localizeResource(new Path(file), hdfsFilePath, type, conf); tmpResources.add(localResource); } }
public static void replaceLocalDir(Map<Object, Object> conf) { String stormHome = System.getProperty("jstorm.home"); boolean isEmpty = StringUtils.isBlank(stormHome); Map<Object, Object> replaceMap = new HashMap<>(); for (Entry entry : conf.entrySet()) { Object key = entry.getKey(); Object value = entry.getValue(); if (value instanceof String) { if (StringUtils.isBlank((String) value)) { continue; } String str = (String) value; if (isEmpty) { // replace %JSTORM_HOME% as current directory str = str.replace("%JSTORM_HOME%", "."); } else { str = str.replace("%JSTORM_HOME%", stormHome); } replaceMap.put(key, str); } } conf.putAll(replaceMap); }
final String principal = StringUtils.isBlank(asUser) ? getPrincipal(subject) : asUser; String serviceName = AuthUtils.get(login_conf, AuthUtils.LOGIN_CONTEXT_CLIENT, "serviceName"); if (serviceName == null) { props.put(Sasl.QOP, "auth"); props.put(Sasl.SERVER_AUTH, "false"); LOG.debug("SASL GSSAPI client transport is being established"); final TTransport sasalTransport = new TSaslClientTransport(KERBEROS, principal, serviceName, serverHost, props, null, transport);
if ((null != alterDbDesc.getReplicationSpec()) && !alterDbDesc.getReplicationSpec().allowEventReplacementInto(params)) { LOG.debug("DDLTask: Alter Database {} is skipped as database is newer than update", dbName); return 0; // no replacement, the existing database state is newer than our update. URI locationURI = new URI(newLocation); if ( !locationURI.isAbsolute() || StringUtils.isBlank(locationURI.getScheme())) { throw new HiveException(ErrorMsg.BAD_LOCATION_VALUE, newLocation);
/** * Retrieve host & port from environment */ private static void retrieveFromEnv() { // retrieve host & port from environment DOCKER_HOST = System.getenv(ENV_KEY_HOST); DOCKER_PORT = System.getenv(ENV_KEY_PORT); // not found from 'JPAAS_HTTP_PORT', then try to find from 'JPAAS_HOST_PORT_8080' if (StringUtils.isBlank(DOCKER_PORT)) { DOCKER_PORT = System.getenv(ENV_KEY_PORT_ORIGINAL); } boolean hasEnvHost = StringUtils.isNotBlank(DOCKER_HOST); boolean hasEnvPort = StringUtils.isNotBlank(DOCKER_PORT); // docker can find both host & port from environment if (hasEnvHost && hasEnvPort) { IS_DOCKER = true; // found nothing means not a docker, maybe an actual machine } else if (!hasEnvHost && !hasEnvPort) { IS_DOCKER = false; } else { LOGGER.error("Missing host or port from env for Docker. host:{}, port:{}", DOCKER_HOST, DOCKER_PORT); throw new RuntimeException( "Missing host or port from env for Docker. host:" + DOCKER_HOST + ", port:" + DOCKER_PORT); } }
ResultSet columnMeta = null; List<TableMeta> tableMetas = null; if (StringUtils.isBlank(project)) { return Collections.emptyList(); tableMetas.add(tblMeta); tableMap.put(tblMeta.getTABLE_SCHEM() + "#" + tblMeta.getTABLE_NAME(), tblMeta); tableMap.get(colmnMeta.getTABLE_SCHEM() + "#" + colmnMeta.getTABLE_NAME()).addColumn(colmnMeta);
private String getGenericCredentialsNotFoundMsg(String credentialHelperName) { if (!CREDENTIALS_HELPERS_NOT_FOUND_MESSAGE_CACHE.containsKey(credentialHelperName)) { String credentialsNotFoundMsg = discoverCredentialsHelperNotFoundMessage(credentialHelperName); if (!isBlank(credentialsNotFoundMsg)) { CREDENTIALS_HELPERS_NOT_FOUND_MESSAGE_CACHE.put(credentialHelperName, credentialsNotFoundMsg); } } return CREDENTIALS_HELPERS_NOT_FOUND_MESSAGE_CACHE.get(credentialHelperName); }