/** * Used by the parser to report the replaced tokens once logging is setup. */ public void reportTokens() { if (Log.isWarn()) { for (Iterator iter = replacedTokens.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry)iter.next(); String tokenWithParanthesis = (String)entry.getKey(); String propertyValue = (String)entry.getValue(); // Issue a special warning for context.root replacements, if (ConfigurationConstants.CONTEXT_PATH_TOKEN.equals(tokenWithParanthesis) || ConfigurationConstants.CONTEXT_PATH_ALT_TOKEN.equals(tokenWithParanthesis)) { if (Log.isWarn()) Log.getLogger(LogCategories.CONFIGURATION).warn("Token '{0}' was replaced with '{1}'. Note that this will apply to all applications on the JVM", new Object[]{tokenWithParanthesis, propertyValue}); } else if (Log.isDebug()) { Log.getLogger(LogCategories.CONFIGURATION).debug("Token '{0}' was replaced with '{1}'", new Object[]{tokenWithParanthesis, propertyValue}); } } } } }
/** * Sets the default channel ids of the MessageBroker. * * @param ids Default channel ids of the MessageBroker. */ public void setDefaultChannels(List<String> ids) { if (ids != null) { List<String> channelIds = getChannelIds(); for (Iterator<String> iter = ids.iterator(); iter.hasNext();) { String id = iter.next(); if (channelIds == null || !channelIds.contains(id)) { iter.remove(); 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}); } } } } defaultChannels = ids; }
/** * Sets the default channel ids of the MessageBroker. * * @param ids Default channel ids of the MessageBroker. */ public void setDefaultChannels(List<String> ids) { if (ids != null) { List<String> channelIds = getChannelIds(); for (Iterator<String> iter = ids.iterator(); iter.hasNext();) { String id = iter.next(); if (channelIds == null || !channelIds.contains(id)) { iter.remove(); 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}); } } } } defaultChannels = ids; }
/** * 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; }
/** * 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; }
/** * 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(); }
/** * 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(); }