/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.service.PublishedService
 *  com.l7tech.gateway.common.service.ServiceDocument
 *  com.l7tech.gateway.common.service.ServiceDocumentWsdlStrategy
 *  com.l7tech.objectmodel.FindException
 *  javax.wsdl.WSDLException
 */
package com.l7tech.server.service;

import com.l7tech.gateway.common.service.PublishedService;
import com.l7tech.gateway.common.service.ServiceDocument;
import com.l7tech.gateway.common.service.ServiceDocumentWsdlStrategy;
import com.l7tech.objectmodel.FindException;
import com.l7tech.server.service.ServiceDocumentManager;
import java.util.Collection;
import java.util.concurrent.atomic.AtomicReference;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.wsdl.WSDLException;

public class PersistentServiceDocumentWsdlStrategy
extends ServiceDocumentWsdlStrategy {
    private static final Logger a;
    private static final AtomicReference<ServiceDocumentManager> b;
    private static final String[] d;

    public PersistentServiceDocumentWsdlStrategy() {
        super(null);
    }

    public static void setServiceDocumentManager(ServiceDocumentManager serviceDocumentManager) {
        b.compareAndSet(null, serviceDocumentManager);
    }

    protected Collection<ServiceDocument> loadServiceDocuments(PublishedService publishedService) throws WSDLException {
        Collection<ServiceDocument> collection;
        block8: {
            ServiceDocumentManager serviceDocumentManager = b.get();
            try {
                if (serviceDocumentManager == null) {
                    throw new WSDLException(d[6], d[5]);
                }
            }
            catch (FindException findException) {
                throw PersistentServiceDocumentWsdlStrategy.a(findException);
            }
            try {
                String[] stringArray;
                block7: {
                    stringArray = d;
                    collection = serviceDocumentManager.findByServiceIdAndType(publishedService.getGoid(), stringArray[3]);
                    try {
                        if (collection.isEmpty()) break block7;
                        a.log(Level.FINE, stringArray[0], new Object[]{publishedService.getGoid(), collection.size()});
                        break block8;
                    }
                    catch (FindException findException) {
                        throw PersistentServiceDocumentWsdlStrategy.a(findException);
                    }
                }
                stringArray = d;
                a.log(Level.FINE, stringArray[1], publishedService.getGoid());
            }
            catch (FindException findException) {
                String[] stringArray = d;
                throw new WSDLException(stringArray[2], stringArray[7] + String.valueOf(publishedService.getGoid()) + stringArray[4], (Throwable)findException);
            }
        }
        return collection;
    }

    protected Logger getLogger() {
        return a;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[8];
                var3_1 = 0;
                var2_2 = "W&DC\u007fy|$d\u0011N&6wq.TPd6)yd\u0011\u00196rxwc\u0011\u0012m+d#d\u0016\\{jvv7E\u001b3W&DC\u007fy|$d\u0011N&6wq.TPd6)yd\u0011\u00196rxwcXZ6{oe*ZTtv|$*[Eyhmwm\u000bK\u0017~pDE\\V\u0011yg\u000bS\u0010ry;STT\fda\u0002#m W&DC\u007fy|$'YVcw|j7E\u0015xum$\"@T\u007fvxf/S\u001b";
                var4_3 = "W&DC\u007fy|$d\u0011N&6wq.TPd6)yd\u0011\u00196rxwc\u0011\u0012m+d#d\u0016\\{jvv7E\u001b3W&DC\u007fy|$d\u0011N&6wq.TPd6)yd\u0011\u00196rxwcXZ6{oe*ZTtv|$*[Eyhmwm\u000bK\u0017~pDE\\V\u0011yg\u000bS\u0010ry;STT\fda\u0002#m W&DC\u007fy|$'YVcw|j7E\u0015xum$\"@T\u007fvxf/S\u001b".length();
                var1_4 = 46;
                var0_5 = -1;
lbl7:
                // 2 sources

                while (true) {
                    v0 = 89;
                    v1 = ++var0_5;
                    v2 = var2_2.substring(v1, v1 + var1_4);
                    v3 = -1;
                    break block9;
                    break;
                }
lbl13:
                // 1 sources

                while (true) {
                    var5[var3_1++] = PersistentServiceDocumentWsdlStrategy.b(v0, PersistentServiceDocumentWsdlStrategy.b(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "`+_Txzkq%E[~saf6C]c0v\npp]X\u001eW\u000b1sR^[P\u00171v^^KN\u0001\u007ffB\u001dXL\u00161aTOHJ\u0007t2FTJKDxv\u0011\u001a";
                    var4_3 = "`+_Txzkq%E[~saf6C]c0v\npp]X\u001eW\u000b1sR^[P\u00171v^^KN\u0001\u007ffB\u001dXL\u00161aTOHJ\u0007t2FTJKDxv\u0011\u001a".length();
                    var1_4 = 19;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 126;
                        v4 = ++var0_5;
                        v2 = var2_2.substring(v4, v4 + var1_4);
                        v3 = 0;
                        break block9;
                        break;
                    }
                    break;
                }
lbl28:
                // 1 sources

                while (true) {
                    var5[var3_1++] = PersistentServiceDocumentWsdlStrategy.b(v0, PersistentServiceDocumentWsdlStrategy.b(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    break block10;
                    break;
                }
            }
            switch (v3) {
                default: {
                    ** continue;
                }
                ** case 0:
lbl39:
                // 1 sources

                ** continue;
            }
        }
        PersistentServiceDocumentWsdlStrategy.d = var5;
        PersistentServiceDocumentWsdlStrategy.a = Logger.getLogger(PersistentServiceDocumentWsdlStrategy.class.getName());
        PersistentServiceDocumentWsdlStrategy.b = new AtomicReference<V>();
    }

    private static FindException a(FindException findException) {
        return findException;
    }

    private static char[] b(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x40);
        }
        return cArray;
    }

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String b(int n2, char[] cArray) {
        char[] cArray2;
        block11: {
            int n3;
            int n4;
            int n5;
            block10: {
                n5 = n2;
                cArray2 = cArray;
                n4 = cArray.length;
                n3 = 0;
                if (!true) break block10;
                n4 = n4;
                if (n4 <= n3) break block11;
            }
            do {
                n5 = n5;
                cArray2 = cArray2;
                int n6 = n3;
                cArray2[n6] = (char)(cArray2[n6] ^ (n5 ^ (switch (n3 % 7) {
                    case 0 -> 93;
                    case 1 -> 26;
                    case 2 -> 111;
                    case 3 -> 108;
                    case 4 -> 79;
                    case 5 -> 67;
                    default -> 64;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

