package com.l7tech.server.migration;

import com.l7tech.objectmodel.migration.PropertyResolver;
import com.l7tech.objectmodel.migration.PropertyResolver.Type;
import com.l7tech.server.EntityFinder;
import com.l7tech.server.ServerConfig;
import com.l7tech.server.cassandra.CassandraConnectionEntityManager;
import com.l7tech.server.cluster.ClusterPropertyManager;
import com.l7tech.server.globalresources.ResourceEntryManager;
import com.l7tech.server.jdbc.JdbcConnectionManager;
import com.l7tech.server.security.keystore.SsgKeyStoreManager;
import com.l7tech.server.service.ServiceDocumentManager;
import java.util.HashMap;
import java.util.Map;

public class PropertyResolverFactory {
   private EntityFinder a;
   private SsgKeyStoreManager b;
   private ServiceDocumentManager c;
   private ClusterPropertyManager d;
   private ResourceEntryManager e;
   private ServerConfig f;
   private JdbcConnectionManager g;
   private CassandraConnectionEntityManager h;
   private Map<Type, PropertyResolver> i = new HashMap<>();

   public PropertyResolverFactory(
      EntityFinder var1,
      ServiceDocumentManager var2,
      SsgKeyStoreManager var3,
      ClusterPropertyManager var4,
      ResourceEntryManager var5,
      ServerConfig var6,
      JdbcConnectionManager var7,
      CassandraConnectionEntityManager var8
   ) {
      this.a = var1;
      this.b = var3;
      this.c = var2;
      this.d = var4;
      this.e = var5;
      this.f = var6;
      this.g = var7;
      this.h = var8;
      this.a();
   }

   private void a() {
      this.a(new DefaultEntityPropertyResolver(this, Type.DEFAULT));
      this.a(new ServiceDocumentResolver(this, Type.SERVICE_DOCUMENT, this.c));
      this.a(new a(this, this, Type.SERVICE, this.a));
      this.a(new b(this, this, Type.SERVICE_ALIAS, this.a));
      this.a(new PolicyPropertyResolver(this, Type.POLICY));
      this.a(new c(this, this, Type.POLICY_ALIAS, this.a));
      this.a(new AssertionPropertyResolver(this, Type.ASSERTION));
      this.a(new d(this, this, Type.ID_PROVIDER_CONFIG, this.a));
      this.a(new UserGroupResolver(this, Type.USERGROUP));
      this.a(new ValueReferencePropertyResolver(this, Type.VALUE_REFERENCE));
      this.a(new SsgKeyResolver(this, Type.SSGKEY, this.b));
      this.a(new ServerVariablePropertyResolver(this, Type.SERVER_VARIABLE, this.d, this.f));
      this.a(new ResourceEntryPropertyResolver(this, Type.RESOURCE_ENTRY, this.e));
      this.a(new JdbcConnectionPropertyResolver(this, Type.JDBC_CONNECTION, this.g));
      this.a(new CassandraConnectionPropertyResolver(this, Type.CASSANDRA_CONNECTION, this.h));
   }

   private void a(PropertyResolver var1) {
      this.i.put(var1.getType(), var1);
   }

   public PropertyResolver getPropertyResolver(Type var1) {
      return this.i.get(var1);
   }
}
