/** * Adds the channel id to the list of default channel ids. * * @param id The id of the channel to add to the list of default channel ids. */ public void addDefaultChannel(String id) { if (defaultChannels == null) defaultChannels = new ArrayList<String>(); else if (defaultChannels.contains(id)) return; List<String> channelIds = getChannelIds(); if (channelIds == null || !channelIds.contains(id)) { // No channel with id ''{0}'' is known by the MessageBroker. if (Log.isWarn()) { Log.getLogger(LOG_CATEGORY).warn("No channel with id '{0}' is known by the MessageBroker." + " Not adding the channel.", new Object[]{id}); } return; } defaultChannels.add(id); }
/** * Start all of the broker's shared servers. */ private void startServers() { for (Server server : servers.values()) { // Validate that the server is actually referenced by an endpoint; if not, warn. boolean serverIsReferenced = false; for (Endpoint endpoint : endpoints.values()) { if (endpoint instanceof Endpoint2 && server.equals(((Endpoint2)endpoint).getServer())) { serverIsReferenced = true; break; } } if (!serverIsReferenced && Log.isWarn()) Log.getLogger(LogCategories.CONFIGURATION).warn("Server '" + server.getId() + "' is not referenced by any endpoints."); server.start(); } }
/** * Start all of the broker's shared servers. */ private void startServers() { for (Server server : servers.values()) { // Validate that the server is actually referenced by an endpoint; if not, warn. boolean serverIsReferenced = false; for (Endpoint endpoint : endpoints.values()) { if (endpoint instanceof Endpoint2 && server.equals(((Endpoint2)endpoint).getServer())) { serverIsReferenced = true; break; } } if (!serverIsReferenced && Log.isWarn()) Log.getLogger(LogCategories.CONFIGURATION).warn("Server '" + server.getId() + "' is not referenced by any endpoints."); server.start(); } }
/** * Returns true if the passed in principal belongs to at least one of the * roles in the passed in list of roles. * * @param principal Principal to check against roles * @param roles list of roles * @return true if principal belongs to at least one of the roles in the list */ public boolean checkRoles(Principal principal, List roles) { if (loginCommand == null) // This should not happen but just in case. { if (Log.isWarn()) Log.getLogger(LOG_CATEGORY).warn ("Login command is null. Please ensure that the login-command" + " tag has the correct server attribute value" + ", or use 'all' to use the login command regardless of the server."); return false; } return loginCommand.doAuthorization(principal, roles); }
/** * Returns true if the passed in principal belongs to at least one of the * roles in the passed in list of roles. * * @param principal Principal to check against roles * @param roles list of roles * @return true if principal belongs to at least one of the roles in the list */ public boolean checkRoles(Principal principal, List roles) { if (loginCommand == null) // This should not happen but just in case. { if (Log.isWarn()) Log.getLogger(LOG_CATEGORY).warn ("Login command is null. Please ensure that the login-command" + " tag has the correct server attribute value" + ", or use 'all' to use the login command regardless of the server."); return false; } return loginCommand.doAuthorization(principal, roles); }
/** * Returns true if the passed in principal belongs to at least one of the * roles in the passed in list of roles. * * @param principal Principal to check against roles * @param roles list of roles * @return true if principal belongs to at least one of the roles in the list */ public boolean checkRoles(Principal principal, List roles) { if (loginCommand == null) // This should not happen but just in case. { if (Log.isWarn()) Log.getLogger(LOG_CATEGORY).warn ("Login command is null. Please ensure that the login-command" + " tag has the correct server attribute value" + ", or use 'all' to use the login command regardless of the server."); return false; } return loginCommand.doAuthorization(principal, roles); }
/** * Sets the source of the <code>FactoryDestination</code> that is used * in <code>FactoryInstance</code> creation. Source cannot be changed once * <code>FactoryInstance</code> is initialized and the scope is application. * * @param source the source string */ public void setSource(String source) { if (factoryInstance != null) { if (FlexFactory.SCOPE_APPLICATION.equals(scope)) { if (Log.isWarn()) Log.getLogger(getLogCategory()).warn( "Source of the destination cannot be changed once " + "factory instance is already initialized and it has " + FlexFactory.SCOPE_APPLICATION +" scope"); return; } factoryInstance.setSource(source); } this.source = source; }
private void checkURL(ProxyContext context) { Target target = context.getTarget(); // We only allow http type urls if (!context.getTarget().getUrl().getProtocol().equalsIgnoreCase("http") && !target.isHTTPS()) { Log.getLogger(HTTPProxyService.LOG_CATEGORY).warn(ProxyConstants.PROXY_SECURITY + ProxyConstants.ONLY_HTTP_HTTPS); throw new ProxyException(ONLY_HTTP_HTTPS); } if (target.isHTTPS() && !context.isClientHttps()) { // Respond with error Log.getLogger(HTTPProxyService.LOG_CATEGORY).warn(ProxyConstants.PROXY_SECURITY + ProxyConstants.NO_HTTPS_VIA_HTTP); throw new ProxyException(NO_HTTPS_VIA_HTTP); } }
private void checkURL(ProxyContext context) { Target target = context.getTarget(); // We only allow http type urls if (!context.getTarget().getUrl().getProtocol().equalsIgnoreCase("http") && !target.isHTTPS()) { Log.getLogger(HTTPProxyService.LOG_CATEGORY).warn(ProxyConstants.PROXY_SECURITY + ProxyConstants.ONLY_HTTP_HTTPS); throw new ProxyException(ONLY_HTTP_HTTPS); } if (target.isHTTPS() && !context.isClientHttps()) { // Respond with error Log.getLogger(HTTPProxyService.LOG_CATEGORY).warn(ProxyConstants.PROXY_SECURITY + ProxyConstants.NO_HTTPS_VIA_HTTP); throw new ProxyException(NO_HTTPS_VIA_HTTP); } }
/** * Sets the source of the <code>FactoryDestination</code> that is used * in <code>FactoryInstance</code> creation. Source cannot be changed once * <code>FactoryInstance</code> is initialized and the scope is application. * * @param source */ public void setSource(String source) { if (factoryInstance != null) { if (FlexFactory.SCOPE_APPLICATION.equals(scope)) { if (Log.isWarn()) Log.getLogger(getLogCategory()).warn( "Source of the destination cannot be changed once " + "factory instance is already initialized and it has " + FlexFactory.SCOPE_APPLICATION +" scope"); return; } factoryInstance.setSource(source); } this.source = source; }
/** * Sets the source of the <code>FactoryDestination</code> that is used * in <code>FactoryInstance</code> creation. Source cannot be changed once * <code>FactoryInstance</code> is initialized and the scope is application. * * @param source the source string */ public void setSource(String source) { if (factoryInstance != null) { if (FlexFactory.SCOPE_APPLICATION.equals(scope)) { if (Log.isWarn()) Log.getLogger(getLogCategory()).warn( "Source of the destination cannot be changed once " + "factory instance is already initialized and it has " + FlexFactory.SCOPE_APPLICATION +" scope"); return; } factoryInstance.setSource(source); } this.source = source; }
protected Object readXml() throws IOException { String xml = readLongUTF(); if (isDebug) { trace.write(xml); } // Only deserialize xml if this is enabled. if (context.allowXml) { return stringToDocument(xml); } else { Log.getLogger(LogCategories.CONFIGURATION).warn( "Xml deserialization is disabled, please enable by setting allowXml to 'true'"); return null; } }
protected Object readXml() throws IOException { String xml = readLongUTF(); if (isDebug) { trace.write(xml); } // Only deserialize xml if this is enabled. if (context.allowXml) { return stringToDocument(xml); } else { Log.getLogger(LogCategories.CONFIGURATION).warn( "Xml deserialization is disabled, please enable by setting allowXml to 'true'"); return null; } }
/** * Stops the <code>JMSProducer</code> by closing its underlying * <code>MessageProducer</code>. It then calls <code>JMSProxy.close</code> * for session and connection closure. */ public void stop() { if (Log.isInfo()) Log.getLogger(JMSAdapter.LOG_CATEGORY).info("JMS producer for JMS destination '" + destinationJndiName + "' is stopping."); try { if (producer != null) producer.close(); } catch (JMSException e) { if (Log.isWarn()) Log.getLogger(JMSAdapter.LOG_CATEGORY).warn("JMS producer for JMS destination '" + destinationJndiName + "' received an error while closing" + " its underlying MessageProducer: " + e.getMessage()); } super.stop(); }
/** * Stops the <code>JMSProducer</code> by closing its underlying * <code>MessageProducer</code>. It then calls <code>JMSProxy.close</code> * for session and connection closure. */ public void stop() { if (Log.isInfo()) Log.getLogger(JMSAdapter.LOG_CATEGORY).info("JMS producer for JMS destination '" + destinationJndiName + "' is stopping."); try { if (producer != null) producer.close(); } catch (JMSException e) { if (Log.isWarn()) Log.getLogger(JMSAdapter.LOG_CATEGORY).warn("JMS producer for JMS destination '" + destinationJndiName + "' received an error while closing" + " its underlying MessageProducer: " + e.getMessage()); } super.stop(); }
/** * Enables or disables management for the component. Management cannot be * changed once the component is started and management cannot be * <code>true</code> if the parent of the component is not managed. * * @param enableManagement <code>true</code> to enable management, <code>false</code> to disable management. */ public void setManaged(boolean enableManagement) { if (isStarted() && control != null) { blockAssignmentWhileStarted("managed"); } if (enableManagement && parent != null && !parent.isManaged()) { if (Log.isWarn()) { Log.getLogger(getLogCategory()).warn("Component: '" + id + "' cannot be managed" + " since its parent is unmanaged."); } return; } managed = enableManagement; }
/** * Enables or disables management for the component. Management cannot be * changed once the component is started and management cannot be * <code>true</code> if the parent of the component is not managed. * * @param enableManagement <code>true</code> to enable management, <code>false</code> to disable management. */ public void setManaged(boolean enableManagement) { if (isStarted() && control != null) { blockAssignmentWhileStarted("managed"); } if (enableManagement && parent != null && !parent.isManaged()) { if (Log.isWarn()) { Log.getLogger(getLogCategory()).warn("Component: '" + id + "' cannot be managed" + " since its parent is unmanaged."); } return; } managed = enableManagement; }
private int getPolicyFromThrottleSettings(ConfigMap settings) { String policyString = settings.getPropertyAsString(ThrottleSettings.ELEMENT_POLICY, null); int policy = ThrottleSettings.POLICY_NONE; if (policyString == null) return policy; try { policy = ThrottleSettings.parsePolicy(policyString); if (policy == ThrottleSettings.POLICY_REPLACE) { if (Log.isWarn()) { Log.getLogger(getLogCategory()).warn("Throttle outbound policy '{0}' found on message destination '{1}'." + " The '{0}' throttle outbound policy has been deprecated. Please remove it from your configuration file.", new Object[]{"REPLACE", id}); } } } catch (ConfigurationException exception) { ConfigurationException ce = new ConfigurationException(); ce.setMessage(UNSUPPORTED_POLICY, new Object[] {getId(), policyString}); throw ce; } return policy; }
/** * Stops the <code>JMSConsumer</code> by stopping its associated receiver * adapter and closing the underlying <code>MessageConsumer</code>. It then * calls <code>JMSProxy.close</code> for session and connection closure. */ public void stop() { if (Log.isInfo()) Log.getLogger(JMSAdapter.LOG_CATEGORY).info("JMS consumer for JMS destination '" + destinationJndiName + "' is stopping."); stopMessageReceiver(); try { if (consumer != null) consumer.close(); } catch (JMSException e) { if (Log.isWarn()) Log.getLogger(JMSAdapter.LOG_CATEGORY).warn("JMS consumer for JMS destination '" + destinationJndiName + "' received an error while closing its underlying MessageConsumer: " + e.getMessage()); } super.stop(); }
/** * Stops the <code>JMSConsumer</code> by stopping its associated receiver * adapter and closing the underlying <code>MessageConsumer</code>. It then * calls <code>JMSProxy.close</code> for session and connection closure. */ public void stop() { if (Log.isInfo()) Log.getLogger(JMSAdapter.LOG_CATEGORY).info("JMS consumer for JMS destination '" + destinationJndiName + "' is stopping."); stopMessageReceiver(); try { if (consumer != null) consumer.close(); } catch (JMSException e) { if (Log.isWarn()) Log.getLogger(JMSAdapter.LOG_CATEGORY).warn("JMS consumer for JMS destination '" + destinationJndiName + "' received an error while closing its underlying MessageConsumer: " + e.getMessage()); } super.stop(); }