@Override
 public String getUsageTips() {
   return resourceBundle.getString(WebsocketLocalEventAdapterConstants.ADAPTOR_USAGE_TIPS_PREFIX)
       + httpPort
       + resourceBundle.getString(WebsocketLocalEventAdapterConstants.ADAPTER_USAGE_TIPS_MID)
       + httpsPort
       + resourceBundle.getString(WebsocketLocalEventAdapterConstants.ADAPTER_USAGE_TIPS_POSTFIX);
 }
/** The websocket-local event adapter factory class to create a websocket-local output adapter */
public class WebsocketLocalEventAdapterFactory extends OutputEventAdapterFactory {
  private ResourceBundle resourceBundle =
      ResourceBundle.getBundle(
          "org.wso2.carbon.event.output.adapter.websocket.local.i18n.Resources",
          Locale.getDefault());
  private int httpPort;
  private int httpsPort;
  private int portOffset;

  public WebsocketLocalEventAdapterFactory() {
    portOffset = getPortOffset();
    httpPort = WebsocketLocalEventAdapterConstants.DEFAULT_HTTP_PORT + portOffset;
    httpsPort = WebsocketLocalEventAdapterConstants.DEFAULT_HTTPS_PORT + portOffset;
  }

  @Override
  public String getType() {
    return WebsocketLocalEventAdapterConstants.ADAPTER_TYPE_WEBSOCKET_LOCAL;
  }

  @Override
  public List<String> getSupportedMessageFormats() {
    List<String> supportedMessageFormats = new ArrayList<String>();
    supportedMessageFormats.add(MessageType.TEXT);
    supportedMessageFormats.add(MessageType.XML);
    supportedMessageFormats.add(MessageType.JSON);
    return supportedMessageFormats;
  }

  @Override
  public List<Property> getStaticPropertyList() {
    return null;
  }

  @Override
  public List<Property> getDynamicPropertyList() {
    return null;
  }

  @Override
  public String getUsageTips() {
    return resourceBundle.getString(WebsocketLocalEventAdapterConstants.ADAPTOR_USAGE_TIPS_PREFIX)
        + httpPort
        + resourceBundle.getString(WebsocketLocalEventAdapterConstants.ADAPTER_USAGE_TIPS_MID)
        + httpsPort
        + resourceBundle.getString(WebsocketLocalEventAdapterConstants.ADAPTER_USAGE_TIPS_POSTFIX);
  }

  @Override
  public OutputEventAdapter createEventAdapter(
      OutputEventAdapterConfiguration eventAdapterConfiguration,
      Map<String, String> globalProperties) {
    return new WebsocketLocalEventAdapter(eventAdapterConfiguration, globalProperties);
  }

  private int getPortOffset() {
    return CarbonUtils.getPortFromServerConfig(
            WebsocketLocalEventAdapterConstants.CARBON_CONFIG_PORT_OFFSET_NODE)
        + 1;
  }
}