Class PulsarConnectorUtils


  • public class PulsarConnectorUtils
    extends java.lang.Object
    A helper class containing repeatable logic used in the other classes.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T createInstance​(java.lang.String userClassName, java.lang.Class<T> xface, java.lang.ClassLoader classLoader)
      Create an instance of userClassName using provided classLoader.
      static java.util.Properties getProperties​(java.util.Map<java.lang.String,​java.lang.String> configMap)  
      static boolean isPartitionedTopic​(org.apache.pulsar.common.naming.TopicName topicName, org.apache.pulsar.client.admin.PulsarAdmin pulsarAdmin)  
      static org.apache.avro.Schema parseSchema​(java.lang.String schemaJson)  
      static java.lang.String restoreNamespaceDelimiterIfNeeded​(java.lang.String namespace, PulsarConnectorConfig config)  
      static java.lang.String rewriteNamespaceDelimiterIfNeeded​(java.lang.String namespace, PulsarConnectorConfig config)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PulsarConnectorUtils

        public PulsarConnectorUtils()
    • Method Detail

      • parseSchema

        public static org.apache.avro.Schema parseSchema​(java.lang.String schemaJson)
      • isPartitionedTopic

        public static boolean isPartitionedTopic​(org.apache.pulsar.common.naming.TopicName topicName,
                                                 org.apache.pulsar.client.admin.PulsarAdmin pulsarAdmin)
                                          throws org.apache.pulsar.client.admin.PulsarAdminException
        Throws:
        org.apache.pulsar.client.admin.PulsarAdminException
      • createInstance

        public static <T> T createInstance​(java.lang.String userClassName,
                                           java.lang.Class<T> xface,
                                           java.lang.ClassLoader classLoader)
        Create an instance of userClassName using provided classLoader. This instance should implement the provided interface xface.
        Parameters:
        userClassName - user class name
        xface - the interface that the reflected instance should implement
        classLoader - class loader to load the class.
        Returns:
        the instance
      • getProperties

        public static java.util.Properties getProperties​(java.util.Map<java.lang.String,​java.lang.String> configMap)
      • rewriteNamespaceDelimiterIfNeeded

        public static java.lang.String rewriteNamespaceDelimiterIfNeeded​(java.lang.String namespace,
                                                                         PulsarConnectorConfig config)
      • restoreNamespaceDelimiterIfNeeded

        public static java.lang.String restoreNamespaceDelimiterIfNeeded​(java.lang.String namespace,
                                                                         PulsarConnectorConfig config)