/** * Initializes Log with id and properties. * * @param id Id for the Log which is ignored, though is used by the ManageableComponent superclass * @param properties ConfigMap of properties for the Log. */ public static synchronized void initialize(String id, ConfigMap properties) { String value = properties.getPropertyAsString("pretty-printer", null); if (value != null) { prettyPrinterClass = value; } // Create a HashSet with the properties that we want to exclude from the // list of properties given by 'getPropertiesAsList' ConfigMap excludeMap = properties.getPropertyAsMap("exclude-properties", null); if (excludeMap != null) { if (excludeMap.getPropertyAsList("property", null) != null) excludedProperties.addAll(excludeMap.getPropertyAsList("property", null)); } }
/** * Initializes the target with id and properties. Subclasses can overwrite. * * @param id id for the target which is ignored. * @param properties ConfigMap of properties for the target. */ public void initialize(String id, ConfigMap properties) { super.initialize(id, properties); includeTime = properties.getPropertyAsBoolean("includeTime", false); includeDate = properties.getPropertyAsBoolean("includeDate", false); includeCategory = properties.getPropertyAsBoolean("includeCategory", false); includeLevel = properties.getPropertyAsBoolean("includeLevel", false); prefix = properties.getPropertyAsString("prefix", null); }
public final int getPropertyAsInt(String name, int defaultValue) { return properties.getPropertyAsInt(name, defaultValue); }
private boolean isPollingEnabled(Endpoint endpoint) { ConfigMap endpointConfig = endpoint.describeEndpoint().getPropertyAsMap("properties", null); if (endpointConfig != null && endpointConfig.getPropertyAsMap("polling-enabled", null) != null) { return endpointConfig.getPropertyAsMap("polling-enabled", null).getPropertyAsBoolean("", false); } return false; }
public void setSubscribeSecurityConstraint(String constraint) { ConfigMap constraintMap = new ConfigMap(); constraintMap.addProperty("ref", constraint); getServerMap().addProperty("subscribe-security-constraint", constraintMap); }
/** * Initializes the <code>Destination</code> with the properties. * If subclasses override, they must call <code>super.initialize()</code>. * * @param id The id of the destination. * @param properties Properties for the destination. */ public void initialize(String id, ConfigMap properties) { super.initialize(id, properties); if (properties == null || properties.size() == 0) return; ConfigMap network = properties.getPropertyAsMap(NetworkSettings.NETWORK_ELEMENT, null); if (network != null) { ConfigMap clusterInfo = network.getPropertyAsMap(ClusterSettings.CLUSTER_ELEMENT, null); if (clusterInfo != null) { // Mark these as used so we do not get warnings about them. network.allowProperty(ClusterSettings.CLUSTER_ELEMENT); clusterInfo.allowProperty(ClusterSettings.REF_ATTR); clusterInfo.allowProperty(ClusterSettings.SHARED_BACKEND_ATTR); String clusterId = clusterInfo.getPropertyAsString(ClusterSettings.REF_ATTR, null); String coordinatorPolicy = clusterInfo.getPropertyAsString(ClusterSettings.SHARED_BACKEND_ATTR, null); if (coordinatorPolicy != null) networkSettings.setSharedBackend(Boolean.valueOf(coordinatorPolicy).booleanValue()); networkSettings.setClusterId(clusterId); } } }
ConfigMap jms = properties.getPropertyAsMap(JMS, null); if (jms != null) String destType = jms.getPropertyAsString(DESTINATION_TYPE, defaultDestinationType); settings.setDestinationType(destType); String msgType = jms.getPropertyAsString(MESSAGE_TYPE, null); settings.setMessageType(msgType); String factory = jms.getPropertyAsString(CONNECTION_FACTORY, null); settings.setConnectionFactory(factory); ConfigMap connectionCredentials = jms.getPropertyAsMap(CONNECTION_CREDENTIALS, null); if (connectionCredentials != null) String username = connectionCredentials.getPropertyAsString(USERNAME, null); settings.setConnectionUsername(username); String password = connectionCredentials.getPropertyAsString(PASSWORD, null); settings.setConnectionPassword(password); ConfigMap deliverySettings = jms.getPropertyAsMap(DELIVERY_SETTINGS, null); if (deliverySettings != null) String mode = deliverySettings.getPropertyAsString(MODE, JMSConfigConstants.defaultMode); ds.setMode(mode); long receiveIntervalMillis = deliverySettings.getPropertyAsLong(SYNC_RECEIVE_INTERVAL_MILLIS, defaultSyncReceiveIntervalMillis); ds.setSyncReceiveIntervalMillis(receiveIntervalMillis);
if (properties == null || properties.size() == 0) return; ConfigMap conn = properties.getPropertyAsMap(HTTPConnectionManagerSettings.CONNECTION_MANAGER, null); if (conn != null) if (conn.getProperty(HTTPConnectionManagerSettings.MAX_TOTAL_CONNECTIONS) != null) int maxTotal = conn.getPropertyAsInt(HTTPConnectionManagerSettings.MAX_TOTAL_CONNECTIONS, MultiThreadedHttpConnectionManager.DEFAULT_MAX_TOTAL_CONNECTIONS); connectionManagerSettings.setMaxTotalConnections(maxTotal); if (conn.getProperty(HTTPConnectionManagerSettings.DEFAULT_MAX_CONNECTIONS_PER_HOST) != null) defaultMaxConnsPerHost = conn.getPropertyAsInt(HTTPConnectionManagerSettings.DEFAULT_MAX_CONNECTIONS_PER_HOST, MultiThreadedHttpConnectionManager.DEFAULT_MAX_HOST_CONNECTIONS); connectionManagerSettings.setDefaultMaxConnectionsPerHost(defaultMaxConnsPerHost); if (conn.getProperty(HTTPConnectionManagerSettings.CONNECTION_TIMEOUT) != null) int timeout = conn.getPropertyAsInt(HTTPConnectionManagerSettings.CONNECTION_TIMEOUT, 0); if (timeout >= 0) connectionManagerSettings.setConnectionTimeout(timeout); if (conn.getProperty(HTTPConnectionManagerSettings.SOCKET_TIMEOUT) != null) int timeout = conn.getPropertyAsInt(HTTPConnectionManagerSettings.SOCKET_TIMEOUT, 0); if (timeout >= 0) connectionManagerSettings.setSocketTimeout(timeout);
if (properties == null || properties.size() == 0) return; connectTimeoutSeconds = properties.getPropertyAsInt(CONNECT_TIMEOUT_SECONDS_ELEMENT, 0); requestTimeoutSeconds = properties.getPropertyAsInt(REQUEST_TIMEOUT_SECONDS_ELEMENT, 0); ConfigMap outboundQueueConfig = properties.getPropertyAsMap(FLEX_CLIENT_OUTBOUND_QUEUE_PROCESSOR, null); if (outboundQueueConfig != null) flexClientOutboundQueueProcessorConfig = outboundQueueConfig.getPropertyAsMap(PROPERTIES_ELEMENT, null); String pClassName = outboundQueueConfig.getPropertyAsString(CLASS_ATTR, null); if (pClassName != null) ConfigMap serialization = properties.getPropertyAsMap(SERIALIZATION, null); if (serialization != null) List<?> deserializers = serialization.getPropertyAsList(CUSTOM_DESERIALIZER, null); if (deserializers != null && Log.isWarn()) log.warn("Endpoint <custom-deserializer> functionality is no longer available. Please remove this entry from your configuration."); List<?> serializers = serialization.getPropertyAsList(CUSTOM_SERIALIZER, null); if (serializers != null && Log.isWarn()) log.warn("Endpoint <custom-serializer> functionality is no longer available. Please remove this entry from your configuration."); String typeMarshallerClassName = serialization.getPropertyAsString(TYPE_MARSHALLER, null); if (typeMarshallerClassName != null && typeMarshallerClassName.length() > 0)
protected void server(ConfigMap properties) { ConfigMap server = properties.getPropertyAsMap(DestinationSettings.SERVER_ELEMENT, null); if (server != null) { int max = server.getPropertyAsInt(MessagingConstants.MAX_CACHE_SIZE_ELEMENT, MessagingConstants.DEFAULT_MAX_CACHE_SIZE); serverSettings.setMaxCacheSize(max); long ttl = server.getPropertyAsLong(MessagingConstants.TIME_TO_LIVE_ELEMENT, -1); serverSettings.setMessageTTL(ttl); boolean durable = server.getPropertyAsBoolean(MessagingConstants.IS_DURABLE_ELEMENT, false); serverSettings.setDurable(durable); boolean allowSubtopics = server.getPropertyAsBoolean(MessagingConstants.ALLOW_SUBTOPICS_ELEMENT, false); serverSettings.setAllowSubtopics(allowSubtopics); String subtopicSeparator = server.getPropertyAsString(MessagingConstants.SUBTOPIC_SEPARATOR_ELEMENT, MessagingConstants.DEFAULT_SUBTOPIC_SEPARATOR); serverSettings.setSubtopicSeparator(subtopicSeparator); String routingMode = server.getPropertyAsString(MessagingConstants.CLUSTER_MESSAGE_ROUTING, "server-to-server"); serverSettings.setBroadcastRoutingMode(routingMode); } }
if (properties == null || properties.size() == 0) return; pollingEnabled = properties.getPropertyAsBoolean(POLLING_ENABLED, false); pollingIntervalMillis = properties.getPropertyAsLong(POLLING_INTERVAL_MILLIS, -1); long pollingIntervalSeconds = properties.getPropertyAsLong(POLLING_INTERVAL_SECONDS, -1); // Deprecated if (pollingIntervalSeconds > -1) pollingIntervalMillis = pollingIntervalSeconds * 1000; piggybackingEnabled = properties.getPropertyAsBoolean(ConfigurationConstants.PIGGYBACKING_ENABLED_ELEMENT, false); maxWaitingPollRequests = properties.getPropertyAsInt(MAX_WAITING_POLL_REQUESTS, 0); waitInterval = properties.getPropertyAsLong(WAIT_INTERVAL_MILLIS, 0); clientWaitInterval = properties.getPropertyAsInt(CLIENT_WAIT_INTERVAL_MILLIS, 0);
ConfigMap serialization = map.getPropertyAsMap(SERIALIZATION_ELEMENT, null); if (serialization != null) String enableSmallMessages = serialization.getProperty(ENABLE_SMALL_MESSAGES_ELEMENT); if (enableSmallMessages != null) ConfigMap clientMap = new ConfigMap(); clientMap.addProperty(ENABLE_SMALL_MESSAGES_ELEMENT, enableSmallMessages); channelSettings.addProperty(SERIALIZATION_ELEMENT, clientMap);
private ConfigMap getNetworkMap() { ConfigMap network = getProperties().getPropertyAsMap("network", null); if (network == null) { network = new ConfigMap(); getProperties().addProperty("network", network); } return network; }
/** * {@inheritDoc} */ public void initialize(String id, ConfigMap properties) { if (properties == null || properties.size() == 0) { return; } // Process allow-classes. ConfigMap allowedClassesMap = properties.getPropertyAsMap(PROPERTY_ALLOW_CLASSES, null); if (allowedClassesMap != null && !allowedClassesMap.isEmpty()) { List<?> names = allowedClassesMap.getPropertyAsList(PROPERTY_CLASS_ATTR, null); if (names != null && !names.isEmpty()) { for (Object element : names) { String name = ((ConfigMap) element).getProperty(PROPERTY_NAME_ATTR); addAllowClassPattern(name); } } } // Process disallow-classes. ConfigMap disallowedClassesMap = properties.getPropertyAsMap(PROPERTY_DISALLOW_CLASSES, null); if (disallowedClassesMap != null && !disallowedClassesMap.isEmpty()) { List<?> names = disallowedClassesMap.getPropertyAsList(PROPERTY_CLASS_ATTR, null); if (names != null && !names.isEmpty()) { for (Object element : names) { String name = ((ConfigMap) element).getProperty(PROPERTY_NAME_ATTR); addDisallowClassPattern(name); } } } }
/** * Initializes the <code>Endpoint</code> with the properties. * If subclasses override, they must call <code>super.initialize()</code>. * * @param id Id of the <code>Endpoint</code>. * @param properties Properties for the <code>Endpoint</code>. */ public void initialize(String id, ConfigMap properties) { super.initialize(id, properties); if (properties == null || properties.size() == 0) return; // General HTTP props. addNoCacheHeaders = properties.getPropertyAsBoolean(ADD_NO_CACHE_HEADERS, true); redirectURL = properties.getPropertyAsString(REDIRECT_URL, null); invalidateSessionOnDisconnect = properties.getPropertyAsBoolean(INVALIDATE_SESSION_ON_DISCONNECT, false); loginAfterDisconnect = properties.getPropertyAsBoolean(ConfigurationConstants.LOGIN_AFTER_DISCONNECT_ELEMENT, false); validateEndpointProtocol(); }
manager.putUserAgentSettings(UserAgentSettings.getAgent(UserAgentSettings.GENERIC_FIREFOX_USER_AGENT)); ConfigMap userAgents = properties.getPropertyAsMap(USER_AGENT_SETTINGS, null); if (userAgents != null) List userAgent = userAgents.getPropertyAsList(USER_AGENT, null); if (userAgent != null) String matchOn = agent.getPropertyAsString(MATCH_ON, null); int kickstartBytes = agent.getPropertyAsInt(KICKSTART_BYTES, 0); int connectionsPerSession = agent.getPropertyAsInt(MAX_STREAMING_CONNECTIONS_PER_SESSION, UserAgentSettings.DEFAULT_MAX_STREAMING_CONNECTIONS_PER_SESSION); if (matchOn != null)
/** * Gets the property with the specified name as a string if possible. * * @param name The property name. * @return The property name. */ public String getProperty(String name) { return getPropertyAsString(name, null); }
protected void throttle(ThrottleSettings ts, ConfigMap network) { ConfigMap inbound = network.getPropertyAsMap(ThrottleSettings.ELEMENT_INBOUND, null); if (inbound != null) { int policy = getPolicyFromThrottleSettings(inbound); ts.setInboundPolicy(policy); int destFreq = inbound.getPropertyAsInt(ThrottleSettings.ELEMENT_DEST_FREQ, 0); ts.setIncomingDestinationFrequency(destFreq); int clientFreq = inbound.getPropertyAsInt(ThrottleSettings.ELEMENT_CLIENT_FREQ, 0); ts.setIncomingClientFrequency(clientFreq); } ConfigMap outbound = network.getPropertyAsMap(ThrottleSettings.ELEMENT_OUTBOUND, null); if (outbound != null) { int policy = getPolicyFromThrottleSettings(outbound); ts.setOutboundPolicy(policy); int destFreq = outbound.getPropertyAsInt(ThrottleSettings.ELEMENT_DEST_FREQ, 0); ts.setOutgoingDestinationFrequency(destFreq); int clientFreq = outbound.getPropertyAsInt(ThrottleSettings.ELEMENT_CLIENT_FREQ, 0); ts.setOutgoingClientFrequency(clientFreq); } }
protected void initializeHttpResponseHeaders(ConfigMap properties) { if (!properties.containsKey(HTTP_RESPONSE_HEADERS)) return; ConfigMap httpResponseHeaders = properties.getPropertyAsMap(HTTP_RESPONSE_HEADERS, null); if (httpResponseHeaders == null) return; @SuppressWarnings("unchecked") List<String> headers = httpResponseHeaders.getPropertyAsList(HEADER_ATTR, null); if (headers == null || headers.isEmpty()) return; if (this.httpResponseHeaders == null) this.httpResponseHeaders = new ArrayList<HttpHeader>(); for (String header : headers) { int colonIndex = header.indexOf(":"); String name = header.substring(0, colonIndex).trim(); String value = header.substring(colonIndex + 1).trim(); this.httpResponseHeaders.add(new HttpHeader(name, value)); } }
/** * Called by the <code>MessageBroker</code> after all of the server * components are created but right before they are started. This is * usually the place to create dynamic components. * * @param id Id of the <code>AbstractBootstrapService</code>. * @param properties Properties for the <code>AbstractBootstrapService</code>. */ public void initialize(String id, ConfigMap properties) { serviceId = properties.getPropertyAsString("service-id", "remoting-service"); destFactory = properties.getPropertyAsString("dest-factory", "spring"); destAdapter = properties.getProperty("dest-adapter"); destScope = properties.getProperty("dest-scope"); destSecurityConstraint = properties.getProperty("dest-security-constraint"); destChannel = properties.getPropertyAsString("dest-channel","my-amf"); includeEndsWithBeans = properties.getPropertyAsString("includeEndsWithBeans",DEFAULT_INCLUDE_END_WITH_BEANS); Service remotingService = broker.getService(serviceId); if(remotingService == null) { throw createServiceException("not found Service with serviceId:"+serviceId); } createSpringDestinations(remotingService); }