com.dell.cpsd.hal.data.provider.client.log.HDPCMessageCode Maven / Gradle / Ivy
/**
* Copyright © 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
* Dell EMC Confidential/Proprietary Information
*/
package com.dell.cpsd.hal.data.provider.client.log;
import com.dell.cpsd.hal.data.provider.client.i18n.HDPCMessageBundle;
import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
* This is the message code enum for the service client.
*
*
* Copyright © 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
* Dell EMC Confidential/Proprietary Information
*
*
* @since 1.0
*/
public enum HDPCMessageCode
{
RABBIT_AMQP_LISTENER_E(2001, "HDPC2001E"),
RABBIT_AMQP_RECOVERY_E(2002, "HDPC2002E"),
PRODUCER_ROUTING_I(2003, "HDPC2003I"),
SERVICE_RESPONSE_QUEUE_I(2004, "HDPC2004I"),
SERVICE_RESPONSE_BINDING_I(2005, "HDPC2005I"),
PRODUCER_PUBLISH_E(2006, "HDPC2006E"),
MESSAGE_NULL_W(2007, "HDPC2007W"),
SERVICE_ERROR_NULL_W(2008, "HDPC2008W"),
SERVICE_HANDLER_NULL_W(2009, "HDPC2009W"),
MESSAGE_TIMEOUT_E(2010, "HDPC2010E"),
PUBLISH_MESSAGE_FAIL_E(2011, "HDPC2011E"),
ERROR_CALLBACK_FAIL_E(2012, "HDPC2012E"),
NO_EXCHANGE_NAME_E(2013, "HDPC2013E"),
REUSE_2014_E(2014, "HDPC2014E"),
REUSE_2015_E(2015, "HDPC2015E"),
MANAGER_SHUTDOWN_E(2016, "HDPC2016E"),
REUSE_2017_E(2017, "HDPC2017E"),
EXECUTOR_SHUTDOWN_I(2018, "HDPC2018I"),
WAIT_ON_REQUESTS_I(2019, "HDPC2019I"),
REUSE_2020_I(2020, "HDPC2020I"),
TIMEOUT_TASK_CHECK_E(2021, "HDPC2021E");
/*
* The path to the resource bundle
*/
private static ResourceBundle BUNDLE = ResourceBundle.getBundle(HDPCMessageBundle.class.getName());
/*
* The error code.
*/
private final int errorCode;
/*
* The message code.
*/
private final String messageCode;
/**
* HDPCMessageCode constructor
*
* @param errorCode
* The error code.
* @param messageCode
* The message code.
*
* @since 1.0
*/
private HDPCMessageCode(int errorCode, String messageCode)
{
this.errorCode = errorCode;
this.messageCode = messageCode;
}
/**
* This returns the message code.
*
* @return The message code.
*
* @since 1.0
*/
public String getMessageCode()
{
return this.messageCode;
}
/**
* This returns the error code.
*
* @return The error code.
*
* @since 1.0
*/
public int getErrorCode()
{
return this.errorCode;
}
/**
* This returns the error text.
*
* @return The error text.
*
* @since 1.0
*/
public String getErrorText()
{
try
{
return BUNDLE.getString(this.messageCode);
}
catch (MissingResourceException exception)
{
return this.messageCode;
}
}
/**
* This formats the message using the array of parameters.
*
* @param params
* The message parameters.
*
* @return The localized message populated with the parameters.
*
* @since 1.0
*/
public String getMessageText(Object[] params)
{
String message = null;
try
{
message = BUNDLE.getString(this.messageCode);
}
catch (MissingResourceException exception)
{
return this.messageCode;
}
if ((params == null) || (params.length == 0))
{
return message;
}
return MessageFormat.format(message, params);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy