flex.messaging.log.Logger.warn()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(13.5k)|赞(0)|评价(0)|浏览(225)

本文整理了Java中flex.messaging.log.Logger.warn()方法的一些代码示例,展示了Logger.warn()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.warn()方法的具体详情如下:
包路径:flex.messaging.log.Logger
类名称:Logger
方法名:warn

Logger.warn介绍

[英]Logs out a warn message.
[中]注销警告消息。

代码示例

代码示例来源:origin: apache/flex-blazeds

/**
 * 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);
}

代码示例来源:origin: apache/flex-blazeds

/**
 * 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();
  }
}

代码示例来源:origin: org.apache.flex.blazeds/flex-messaging-core

/**
 * 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();
  }
}

代码示例来源:origin: com.adobe.flex/com.springsource.flex.messaging

/**
 * 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);
}

代码示例来源:origin: org.apache.flex.blazeds/flex-messaging-core

/**
 * 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);
}

代码示例来源:origin: apache/flex-blazeds

/**
 * 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);
}

代码示例来源:origin: org.apache.flex.blazeds/flex-messaging-core

/**
 * 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;
}

代码示例来源:origin: com.adobe.flex/com.springsource.flex.messaging.services.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);
  }
}

代码示例来源:origin: apache/flex-blazeds

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);
  }
}

代码示例来源:origin: com.adobe.flex/com.springsource.flex.messaging

/**
 * 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;
}

代码示例来源:origin: apache/flex-blazeds

/**
 * 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;
}

代码示例来源:origin: org.apache.flex.blazeds/flex-messaging-core

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;
  }
}

代码示例来源:origin: apache/flex-blazeds

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;
  }
}

代码示例来源:origin: com.adobe.flex/com.springsource.flex.messaging

/**
 * 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();
}

代码示例来源:origin: apache/flex-blazeds

/**
 * 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();
}

代码示例来源:origin: org.apache.flex.blazeds/flex-messaging-core

/**
 * 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;
}

代码示例来源:origin: apache/flex-blazeds

/**
 * 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;
}

代码示例来源:origin: com.adobe.flex/com.springsource.flex.messaging

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;
}

代码示例来源:origin: com.adobe.flex/com.springsource.flex.messaging

/**
 * 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();
}

代码示例来源:origin: apache/flex-blazeds

/**
 * 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();
}

相关文章