All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.unidal.dal.jdbc.mapping.RawTableProvider Maven / Gradle / Ivy

The newest version!
package org.unidal.dal.jdbc.mapping;

import java.util.Map;

import org.unidal.lookup.annotation.Named;

@Named(type = TableProvider.class, value = "raw")
public class RawTableProvider implements TableProvider {
   private static ThreadLocal s_threadLocalData = new ThreadLocal() {
      @Override
      protected String initialValue() {
         throw new UnsupportedOperationException("Please call RawTableProvider.setDataSourceName(...) first!");
      }
   };

   public static void reset() {
      s_threadLocalData.remove();
   }

   public static void setDataSourceName(String dataSourceName) {
      s_threadLocalData.set(dataSourceName);
   }

   @Override
   public String getDataSourceName(Map hints, String logicalTableName) {
      return s_threadLocalData.get();
   }

   @Override
   public String getPhysicalTableName(Map hints, String logicalTableName) {
      throw new UnsupportedOperationException("This table provider is only used by RawDao!");
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy