package com.l7tech.external.assertions.gatewaymanagement.server;

import com.l7tech.util.ExceptionUtils;
import com.sun.ws.management.InternalErrorFault;
import com.sun.ws.management.framework.transfer.TransferSupport;
import com.sun.ws.management.server.EnumerationItem;
import com.sun.ws.management.server.EnumerationIterator;
import com.sun.ws.management.soap.SOAP;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import org.xmlsoap.schemas.ws._2004._08.addressing.EndpointReferenceType;

final class ci implements EnumerationIterator {
   private final String a;
   private final ResourceFactory<?, ?> b;
   private final Collection<Map<String, String>> c;
   private final Iterator<Map<String, String>> d;
   private final String e;
   private final boolean f;
   private final boolean g;

   ci(String var1, ResourceFactory<?, ?> var2, String var3, boolean var4, boolean var5) {
      this.a = var1;
      this.b = var2;
      this.e = var3;
      this.f = var4;
      this.g = var5;

      try {
         this.c = var2.getResources();
         this.d = this.c.iterator();
      } catch (Exception var7) {
         throw (InternalErrorFault)new InternalErrorFault(
               SOAP.createFaultDetail(ExceptionUtils.getMessage(var7), null, ExceptionUtils.getDebugException(var7), null, new Object[0])
            )
            .initCause(var7);
      }
   }

   public int estimateTotalItems() {
      return this.c.size();
   }

   public boolean isFiltered() {
      return false;
   }

   public boolean hasNext() {
      return this.d.hasNext();
   }

   public EnumerationItem next() {
      Map var1 = this.d.next();
      Object var2;
      if (this.f) {
         try {
            var2 = this.b.getResource(var1);
         } catch (ResourceFactory.ResourceNotFoundException var6) {
            throw (InternalErrorFault)new InternalErrorFault(
                  SOAP.createFaultDetail(ExceptionUtils.getMessage(var6), null, ExceptionUtils.getDebugException(var6), null, new Object[0])
               )
               .initCause(var6);
         }
      } else {
         var2 = null;
      }

      EndpointReferenceType var3;
      if (this.g) {
         try {
            var3 = TransferSupport.createEpr(this.e, this.a, var1);
         } catch (Exception var5) {
            throw (InternalErrorFault)new InternalErrorFault(
                  SOAP.createFaultDetail(ExceptionUtils.getMessage(var5), null, ExceptionUtils.getDebugException(var5), null, new Object[0])
               )
               .initCause(var5);
         }
      } else {
         var3 = null;
      }

      return new EnumerationItem(var2, var3);
   }

   public void release() {
   }
}
