public class WebsocketEventAdapterFactory extends InputEventAdapterFactory {
  private ResourceBundle resourceBundle =
      ResourceBundle.getBundle(
          "org.wso2.carbon.event.input.adapter.websocket.i18n.Resources", Locale.getDefault());

  @Override
  public String getType() {
    return WebsocketEventAdapterConstants.ADAPTER_TYPE_WEBSOCKET;
  }

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

  @Override
  public List<Property> getPropertyList() {
    List<Property> propertyList = new ArrayList<Property>();
    Property urlProperty = new Property(WebsocketEventAdapterConstants.ADAPTER_SERVER_URL);
    urlProperty.setDisplayName(
        resourceBundle.getString(WebsocketEventAdapterConstants.ADAPTER_SERVER_URL));
    urlProperty.setHint(
        resourceBundle.getString(WebsocketEventAdapterConstants.ADAPTER_SERVER_URL_HINT));
    urlProperty.setRequired(true);
    propertyList.add(urlProperty);
    return propertyList;
  }

  @Override
  public InputEventAdapter createEventAdapter(
      InputEventAdapterConfiguration eventAdapterConfiguration,
      Map<String, String> globalProperties) {
    return new WebsocketEventAdapter(eventAdapterConfiguration, globalProperties);
  }
}
public class MQTTEventAdapterFactory extends InputEventAdapterFactory {

  private ResourceBundle resourceBundle =
      ResourceBundle.getBundle(
          "org.wso2.carbon.event.input.adapter.mqtt.i18n.Resources", Locale.getDefault());

  @Override
  public String getType() {
    return MQTTEventAdapterConstants.ADAPTER_TYPE_MQTT;
  }

  @Override
  public List<String> getSupportedMessageFormats() {
    List<String> supportInputMessageTypes = new ArrayList<String>();

    supportInputMessageTypes.add(MessageType.TEXT);
    supportInputMessageTypes.add(MessageType.JSON);
    supportInputMessageTypes.add(MessageType.XML);

    return supportInputMessageTypes;
  }

  @Override
  public List<Property> getPropertyList() {
    List<Property> propertyList = new ArrayList<Property>();

    // set topic
    Property topicProperty = new Property(MQTTEventAdapterConstants.ADAPTER_MESSAGE_TOPIC);
    topicProperty.setDisplayName(
        resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_MESSAGE_TOPIC));
    topicProperty.setRequired(true);
    topicProperty.setHint(
        resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_MESSAGE_TOPIC_HINT));
    propertyList.add(topicProperty);

    // Broker Url
    Property brokerUrl = new Property(MQTTEventAdapterConstants.ADAPTER_CONF_URL);
    brokerUrl.setDisplayName(resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_URL));
    brokerUrl.setRequired(true);
    brokerUrl.setHint(resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_URL_HINT));
    propertyList.add(brokerUrl);

    // Broker Username
    Property userName = new Property(MQTTEventAdapterConstants.ADAPTER_CONF_USERNAME);
    userName.setDisplayName(
        resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_USERNAME));
    userName.setRequired(false);
    userName.setHint(
        resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_USERNAME_HINT));
    propertyList.add(userName);

    // Broker Password
    Property password = new Property(MQTTEventAdapterConstants.ADAPTER_CONF_PASSWORD);
    password.setDisplayName(
        resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_PASSWORD));
    password.setRequired(false);
    password.setHint(
        resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_PASSWORD_HINT));
    propertyList.add(password);

    // Broker clear session
    Property clearSession = new Property(MQTTEventAdapterConstants.ADAPTER_CONF_CLEAN_SESSION);
    clearSession.setDisplayName(
        resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_CLEAN_SESSION));
    clearSession.setRequired(false);
    clearSession.setOptions(new String[] {"true", "false"});
    clearSession.setDefaultValue("true");
    clearSession.setHint(
        resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_CLEAN_SESSION_HINT));
    propertyList.add(clearSession);

    // set clientId
    Property clientId = new Property(MQTTEventAdapterConstants.ADAPTER_CONF_CLIENTID);
    clientId.setDisplayName(
        resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_CLIENTID));
    clientId.setRequired(false);
    clientId.setHint(
        resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_CLIENTID_HINT));
    propertyList.add(clientId);

    return propertyList;
  }

  @Override
  public String getUsageTips() {
    return null;
  }

  @Override
  public InputEventAdapter createEventAdapter(
      InputEventAdapterConfiguration eventAdapterConfiguration,
      Map<String, String> globalProperties) {
    return new MQTTEventAdapter(eventAdapterConfiguration, globalProperties);
  }
}