/** * Returns true if key resolves to a *non-null value* (considering * a possible default), false otherwise. */ public boolean has(T key) { return get(key) != null; }
private void configure(Options<CreateOption> options) { autoStart = options.getBoolean(CreateOption.AUTO_START); Undertow.Builder builder = (Undertow.Builder) options.get(CreateOption.CONFIGURATION); if (builder != null) { undertow = builder .setHandler(Handlers.header(pathology.handler(), Headers.SERVER_STRING, "undertow")) .build(); } else { int port = options.getInt(CreateOption.PORT); String host = options.getString(CreateOption.HOST); undertow = Undertow.builder() .addHttpListener(port, host) .setHandler(Handlers.header(pathology.handler(), Headers.SERVER_STRING, "undertow")) .build(); } }
public List getList(T key) { Object v = get(key); if (v instanceof List || v == null) { return (List) v; } return Arrays.asList(v); }
public Double getDouble(T key, Double defaultValue) { Object value = get(key); if (value == null) { value = defaultValue; } else if (!(value instanceof Double)) { value = Double.parseDouble(value.toString()); } return (Double)value; }
public Integer getInt(T key, Integer defaultValue) { Object value = get(key); if (value == null) { value = defaultValue; } else if (!(value instanceof Integer)) { value = Integer.parseInt(value.toString()); } return (Integer)value; }
public Boolean getBoolean(T key, Boolean defaultValue) { Object value = get(key); if (value == null) { value = defaultValue; } else if (!(value instanceof Boolean)) { value = Boolean.parseBoolean(value.toString()); } return (Boolean)value; }
public Long getLong(T key, Long defaultValue) { Object value = get(key); if (value == null) { value = defaultValue; } else if (!(value instanceof Long)) { value = Long.parseLong(value.toString()); } return (Long)value; }
void read() { Configuration c = (Configuration) options.get(Caching.CreateOption.CONFIGURATION); if (c != null) { builder.read(c); } } void mode() {
protected Options<MessageOpOption> replyOptions(Map<Destination.MessageOpOption, Object> options) throws Exception { Options<MessageOpOption> opts = new Options<>(options); Map<String, Object> properties = (Map<String, Object>)opts.get(Destination.PublishOption.PROPERTIES); Map<String, Object> newProperties = new HashMap<>(); if (properties != null) { newProperties.putAll(properties); } newProperties.put(SYNC_RESPONSE_PROPERTY, true); newProperties.put(REQUEST_ID_PROPERTY, requestID()); newProperties.put(REQUEST_NODE_ID_PROPERTY, requestNodeID()); opts.put(Destination.PublishOption.PROPERTIES, newProperties); return opts; }
private TransactionManager getWildFlyTransactionManager() { ServiceRegistry serviceRegistry = (ServiceRegistry) WunderBoss.options().get("service-registry"); return (TransactionManager) serviceRegistry.getRequiredService(TRANSACTION_MANAGER).getValue(); } }
private EmbeddedCacheManager getWebCacheManager() { ServiceRegistry serviceRegistry = (ServiceRegistry) WunderBoss.options().get("service-registry"); return (EmbeddedCacheManager) serviceRegistry.getRequiredService(WEB_CACHE_MANAGER).getValue(); }
public static Configuration uration(Options<Caching.CreateOption> options) { Configuration c = (Configuration) options.get(Caching.CreateOption.CONFIGURATION); return (c != null && options.size() == 1) ? c : builder(options).build(); }
void persist() { Object v = options.get(Caching.CreateOption.PERSIST); if (v instanceof Boolean && (boolean) v) { builder.loaders().addFileCacheStore(); } if (v instanceof String) { builder.loaders().addFileCacheStore().location(v.toString()); } }
void persist() { Object v = options.get(Caching.CreateOption.PERSIST); if (v instanceof Boolean && (boolean) v) { builder.persistence().addSingleFileStore(); } if (v instanceof String) { builder.persistence().addSingleFileStore().location(v.toString()); } }
@Override public void unsubscribe(String id, Map<UnsubscribeOption, Object> options) throws Exception { final Options<UnsubscribeOption> opts = new Options<>(options); try (JMSSpecificContext context = (JMSSpecificContext)context(id, opts.get(UnsubscribeOption.CONTEXT))) { context.jmsSession().unsubscribe(id); } }
@Override public Messaging create(String name, Options options) { final WunderBossService service = (WunderBossService)WunderBoss.options().get(WunderBossService.KEY); ASDestinationManager destManager; if (ASUtils.containerIsEAP6()) { destManager = new EAPDestinationManager(service.serviceTarget(), ASUtils.messagingServiceName(), service.namingContext()); } else { destManager = new WildFlyDestinationManager(service.serviceTarget(), ASUtils.messagingServiceName()); } return new ASMessaging(name, service, destManager, options); } }