/** * Sets the publisher ID used for identifying the publisher in a * {@link WanReplicationConfig}. * If there is no publisher ID defined (it is empty), the group name will * be used as a publisher ID. * * @param publisherId the WAN publisher ID * @return this config * @see #getGroupName() */ public WanPublisherConfig setPublisherId(String publisherId) { this.publisherId = !isNullOrEmptyAfterTrim(publisherId) ? publisherId : null; return this; }
/** * Sets the publisher ID used for identifying the publisher in a * {@link WanReplicationConfig}. * If there is no publisher ID defined (it is empty), the group name will * be used as a publisher ID. * * @param publisherId the WAN publisher ID * @return this config * @see #getGroupName() */ public WanPublisherConfig setPublisherId(String publisherId) { this.publisherId = !isNullOrEmptyAfterTrim(publisherId) ? publisherId : null; return this; }
public static String createLoggerName( String processorClassName, String jobName, String vertexName, int processorIndex ) { if (StringUtil.isNullOrEmptyAfterTrim(jobName)) { return processorClassName + '.' + vertexName + '#' + processorIndex; } else { return processorClassName + '.' + jobName.trim() + "/" + vertexName + '#' + processorIndex; } }
private static boolean getBoolean(FilterConfig filterConfig, Properties properties, String paramName, boolean defaultValue) { String value = getValue(filterConfig, properties, paramName); if (StringUtil.isNullOrEmptyAfterTrim(value)) { return defaultValue; } else { return Boolean.valueOf(value); } }
private static boolean getBoolean(FilterConfig filterConfig, Properties properties, String paramName, boolean defaultValue) { String value = getValue(filterConfig, properties, paramName); if (StringUtil.isNullOrEmptyAfterTrim(value)) { return defaultValue; } else { return Boolean.valueOf(value); } }
private static String getString(FilterConfig filterConfig, Properties properties, String paramName, String defaultValue) { String value = getValue(filterConfig, properties, paramName); if (StringUtil.isNullOrEmptyAfterTrim(value)) { return defaultValue; } else { return value; } }
private static String getString(FilterConfig filterConfig, Properties properties, String paramName, String defaultValue) { String value = getValue(filterConfig, properties, paramName); if (StringUtil.isNullOrEmptyAfterTrim(value)) { return defaultValue; } else { return value; } }
private static Set<String> getStringSet(FilterConfig filterConfig, Properties properties, String paramName) { String value = getValue(filterConfig, properties, paramName); if (StringUtil.isNullOrEmptyAfterTrim(value)) { return Collections.emptySet(); } else { HashSet<String> transientAttributes = new HashSet<String>(); StringTokenizer st = new StringTokenizer(value, ","); while (st.hasMoreTokens()) { String token = st.nextToken(); transientAttributes.add(token.trim()); } return transientAttributes; } }
private static Set<String> getStringSet(FilterConfig filterConfig, Properties properties, String paramName) { String value = getValue(filterConfig, properties, paramName); if (StringUtil.isNullOrEmptyAfterTrim(value)) { return Collections.emptySet(); } else { HashSet<String> transientAttributes = new HashSet<String>(); StringTokenizer st = new StringTokenizer(value, ","); while (st.hasMoreTokens()) { String token = st.nextToken(); transientAttributes.add(token.trim()); } return transientAttributes; } }
private static int getInt(FilterConfig filterConfig, Properties properties, String paramName, int defaultValue) { String value = getValue(filterConfig, properties, paramName); if (StringUtil.isNullOrEmptyAfterTrim(value)) { return defaultValue; } else { try { return Integer.parseInt(value); } catch (NumberFormatException e) { throw new InvalidConfigurationException(paramName + " needs to be an integer: (" + value + ")"); } } }
private static int getInt(FilterConfig filterConfig, Properties properties, String paramName, int defaultValue) { String value = getValue(filterConfig, properties, paramName); if (StringUtil.isNullOrEmptyAfterTrim(value)) { return defaultValue; } else { try { return Integer.parseInt(value); } catch (NumberFormatException e) { throw new InvalidConfigurationException(paramName + " needs to be an integer: (" + value + ")"); } } }
private HazelcastInstance getDefaultInstance() { if (hazelcastInstance == null) { // if there is no default instance in use (not created yet and not specified): // 1. locate default ClientConfig: if it specifies an instance name, get-or-create an instance by that name // 2. otherwise start a new Hazelcast member Config config = getDefaultConfig(); if (isNullOrEmptyAfterTrim(config.getInstanceName())) { hazelcastInstance = Hazelcast.newHazelcastInstance(); } else { hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance(config); } } return hazelcastInstance; }
private HazelcastInstance getDefaultInstance() { if (hazelcastInstance == null) { // if there is no default instance in use (not created yet and not specified): // 1. locate default ClientConfig: if it specifies an instance name, get-or-create an instance by that name // 2. otherwise start a new Hazelcast member Config config = getDefaultConfig(); if (isNullOrEmptyAfterTrim(config.getInstanceName())) { hazelcastInstance = Hazelcast.newHazelcastInstance(); } else { hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance(config); } } return hazelcastInstance; }
private void reviewConfiguration(AwsConfig config) { if (StringUtil.isNullOrEmptyAfterTrim(config.getSecretKey()) || StringUtil .isNullOrEmptyAfterTrim(config.getAccessKey())) { if (!StringUtil.isNullOrEmptyAfterTrim(config.getIamRole())) { getLogger().info("Describe instances will be queried with iam-role, " + "please make sure given iam-role have ec2:DescribeInstances policy attached."); } else { getLogger().warning("Describe instances will be queried with iam-role assigned to EC2 instance, " + "please make sure given iam-role have ec2:DescribeInstances policy attached."); } } else { if (!StringUtil.isNullOrEmptyAfterTrim(config.getIamRole())) { getLogger().info("No need to define iam-role, when access and secret keys are configured!"); } } }
private void reviewConfiguration(AwsConfig config) { if (StringUtil.isNullOrEmptyAfterTrim(config.getSecretKey()) || StringUtil .isNullOrEmptyAfterTrim(config.getAccessKey())) { if (!StringUtil.isNullOrEmptyAfterTrim(config.getIamRole())) { getLogger().info("Describe instances will be queried with iam-role, " + "please make sure given iam-role have ec2:DescribeInstances policy attached."); } else { getLogger().warning("Describe instances will be queried with iam-role assigned to EC2 instance, " + "please make sure given iam-role have ec2:DescribeInstances policy attached."); } } else { if (!StringUtil.isNullOrEmptyAfterTrim(config.getIamRole())) { getLogger().info("No need to define iam-role, when access and secret keys are configured!"); } } }
private HazelcastInstance getDefaultInstance() { if (hazelcastInstance == null) { // if there is no default instance in use (not created yet and not specified): // 1. locate default ClientConfig: if it specifies an instance name, get-or-create an instance by that name // 2. otherwise start a new Hazelcast client ClientConfig clientConfig = getDefaultClientConfig(); if (isNullOrEmptyAfterTrim(clientConfig.getInstanceName())) { hazelcastInstance = HazelcastClient.newHazelcastClient(); } else { hazelcastInstance = getOrCreateInstanceByConfig(clientConfig); } } return hazelcastInstance; }
private HazelcastInstance getDefaultInstance() { if (hazelcastInstance == null) { // if there is no default instance in use (not created yet and not specified): // 1. locate default ClientConfig: if it specifies an instance name, get-or-create an instance by that name // 2. otherwise start a new Hazelcast client ClientConfig clientConfig = getDefaultClientConfig(); if (isNullOrEmptyAfterTrim(clientConfig.getInstanceName())) { hazelcastInstance = HazelcastClient.newHazelcastClient(); } else { hazelcastInstance = getOrCreateInstanceByConfig(clientConfig); } } return hazelcastInstance; }
@Override public void writeData(ObjectDataOutput out) throws IOException { out.writeUTF(permissionConfig.getType().getNodeName()); out.writeUTF(permissionConfig.getName()); if (StringUtil.isNullOrEmptyAfterTrim(permissionConfig.getPrincipal())) { out.writeUTF("*"); } else { out.writeUTF(permissionConfig.getPrincipal()); } Set<String> endpoints = permissionConfig.getEndpoints(); out.writeInt(endpoints.size()); for (String endpoint : endpoints) { out.writeUTF(endpoint); } Set<String> actions = permissionConfig.getActions(); out.writeInt(actions.size()); for (String action : actions) { out.writeUTF(action); } }
private static void wanReplicationPublisherXmlGenerator(XmlGenerator gen, WanPublisherConfig p) { String publisherId = !isNullOrEmptyAfterTrim(p.getPublisherId()) ? p.getPublisherId() : ""; gen.open("wan-publisher", "group-name", p.getGroupName(), "publisher-id", publisherId) .node("class-name", p.getClassName()) .node("queue-full-behavior", p.getQueueFullBehavior()) .node("initial-publisher-state", p.getInitialPublisherState()) .node("queue-capacity", p.getQueueCapacity()) .appendProperties(p.getProperties()); wanReplicationSyncGenerator(gen, p.getWanSyncConfig()); aliasedDiscoveryConfigsGenerator(gen, aliasedDiscoveryConfigsFrom(p)); discoveryStrategyConfigXmlGenerator(gen, p.getDiscoveryConfig()); gen.close(); }
private static void wanReplicationPublisherXmlGenerator(XmlGenerator gen, WanPublisherConfig p) { String publisherId = !isNullOrEmptyAfterTrim(p.getPublisherId()) ? p.getPublisherId() : ""; gen.open("wan-publisher", "group-name", p.getGroupName(), "publisher-id", publisherId) .node("class-name", p.getClassName()) .node("queue-full-behavior", p.getQueueFullBehavior()) .node("initial-publisher-state", p.getInitialPublisherState()) .node("queue-capacity", p.getQueueCapacity()) .appendProperties(p.getProperties()); wanReplicationSyncGenerator(gen, p.getWanSyncConfig()); aliasedDiscoveryConfigsGenerator(gen, aliasedDiscoveryConfigsFrom(p)); discoveryStrategyConfigXmlGenerator(gen, p.getDiscoveryConfig()); gen.close(); }