/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.AsyncAdminMethods$JobId
 *  com.l7tech.gateway.common.siteminder.SiteMinderAdmin
 *  com.l7tech.gateway.common.siteminder.SiteMinderConfiguration
 *  com.l7tech.gateway.common.siteminder.SiteMinderHost
 *  com.l7tech.objectmodel.DeleteException
 *  com.l7tech.objectmodel.FindException
 *  com.l7tech.objectmodel.Goid
 *  com.l7tech.objectmodel.SaveException
 *  com.l7tech.objectmodel.UpdateException
 *  com.l7tech.util.Either
 *  com.l7tech.util.Eithers
 *  com.l7tech.util.Option
 */
package com.l7tech.server.siteminder;

import com.l7tech.gateway.common.AsyncAdminMethods;
import com.l7tech.gateway.common.siteminder.SiteMinderAdmin;
import com.l7tech.gateway.common.siteminder.SiteMinderConfiguration;
import com.l7tech.gateway.common.siteminder.SiteMinderHost;
import com.l7tech.objectmodel.DeleteException;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.Goid;
import com.l7tech.objectmodel.SaveException;
import com.l7tech.objectmodel.UpdateException;
import com.l7tech.server.admin.AsyncAdminMethodsImpl;
import com.l7tech.server.admin.ExtensionInterfaceManager;
import com.l7tech.util.Either;
import com.l7tech.util.Eithers;
import com.l7tech.util.Option;
import java.util.List;

public class SiteMinderAdminImpl
extends AsyncAdminMethodsImpl
implements SiteMinderAdmin {
    private final ExtensionInterfaceManager e;
    private static final String f;
    private static final String g;
    private static final String[] h;

    public SiteMinderAdminImpl(ExtensionInterfaceManager extensionInterfaceManager) {
        this.e = extensionInterfaceManager;
    }

    public SiteMinderConfiguration getSiteMinderConfiguration(String string) throws FindException {
        try {
            String[] stringArray = h;
            Either<Throwable, Option<Object>> either = this.e.invokeExtensionMethod(stringArray[15], g, stringArray[13], new Class[]{String.class}, new Object[]{string});
            return (SiteMinderConfiguration)((Option)Eithers.extract(either)).toNull();
        }
        catch (ClassNotFoundException | NoSuchMethodException reflectiveOperationException) {
            String[] stringArray = h;
            throw new FindException(stringArray[18] + reflectiveOperationException.getMessage(), (Throwable)reflectiveOperationException);
        }
        catch (FindException findException) {
            throw findException;
        }
        catch (Throwable throwable) {
            throw new FindException(h[9] + throwable.getMessage(), throwable);
        }
    }

    public SiteMinderConfiguration getSiteMinderConfiguration(Goid goid) throws FindException {
        try {
            String[] stringArray = h;
            Either<Throwable, Option<Object>> either = this.e.invokeExtensionMethod(stringArray[15], g, stringArray[6], new Class[]{Goid.class}, new Object[]{goid});
            return (SiteMinderConfiguration)((Option)Eithers.extract(either)).toNull();
        }
        catch (ClassNotFoundException | NoSuchMethodException reflectiveOperationException) {
            String[] stringArray = h;
            throw new FindException(stringArray[20] + reflectiveOperationException.getMessage(), (Throwable)reflectiveOperationException);
        }
        catch (FindException findException) {
            throw findException;
        }
        catch (Throwable throwable) {
            throw new FindException(h[21] + throwable.getMessage(), throwable);
        }
    }

    public List<SiteMinderConfiguration> getAllSiteMinderConfigurations() throws FindException {
        try {
            String[] stringArray = h;
            Either<Throwable, Option<Object>> either = this.e.invokeExtensionMethod(stringArray[15], g, stringArray[17], new Class[0], new Object[0]);
            return (List)((Option)Eithers.extract(either)).toNull();
        }
        catch (ClassNotFoundException | NoSuchMethodException reflectiveOperationException) {
            String[] stringArray = h;
            throw new FindException(stringArray[16] + reflectiveOperationException.getMessage(), (Throwable)reflectiveOperationException);
        }
        catch (FindException findException) {
            throw findException;
        }
        catch (Throwable throwable) {
            throw new FindException(h[12] + throwable.getMessage(), throwable);
        }
    }

    public Goid saveSiteMinderConfiguration(SiteMinderConfiguration siteMinderConfiguration) throws UpdateException, SaveException {
        try {
            String[] stringArray = h;
            Either<Throwable, Option<Object>> either = this.e.invokeExtensionMethod(stringArray[15], g, stringArray[4], new Class[]{SiteMinderConfiguration.class}, new Object[]{siteMinderConfiguration});
            return (Goid)((Option)Eithers.extract(either)).toNull();
        }
        catch (ClassNotFoundException | NoSuchMethodException reflectiveOperationException) {
            String[] stringArray = h;
            throw new UpdateException(stringArray[8] + reflectiveOperationException.getMessage(), (Throwable)reflectiveOperationException);
        }
        catch (SaveException | UpdateException throwable) {
            throw throwable;
        }
        catch (Throwable throwable) {
            throw new UpdateException(h[5] + throwable.getMessage(), throwable);
        }
    }

    public void deleteSiteMinderConfiguration(SiteMinderConfiguration siteMinderConfiguration) throws DeleteException {
        try {
            String[] stringArray = h;
            Either<Throwable, Option<Object>> either = this.e.invokeExtensionMethod(stringArray[3], g, stringArray[10], new Class[]{SiteMinderConfiguration.class}, new Object[]{siteMinderConfiguration});
            ((Option)Eithers.extract(either)).toNull();
        }
        catch (ClassNotFoundException | NoSuchMethodException reflectiveOperationException) {
            String[] stringArray = h;
            throw new DeleteException(stringArray[14] + reflectiveOperationException.getMessage(), (Throwable)reflectiveOperationException);
        }
        catch (DeleteException deleteException) {
            throw deleteException;
        }
        catch (Throwable throwable) {
            throw new DeleteException(h[11] + throwable.getMessage(), throwable);
        }
    }

    public AsyncAdminMethods.JobId<SiteMinderHost> registerSiteMinderConfiguration(SiteMinderConfiguration siteMinderConfiguration) {
        try {
            String[] stringArray = h;
            Either<Throwable, Option<Object>> either = this.e.invokeExtensionMethod(stringArray[15], g, stringArray[22], new Class[]{SiteMinderConfiguration.class}, new Object[]{siteMinderConfiguration});
            return (AsyncAdminMethods.JobId)((Option)Eithers.extract(either)).toNull();
        }
        catch (ClassNotFoundException | NoSuchMethodException reflectiveOperationException) {
            String[] stringArray = h;
            throw new RuntimeException(stringArray[19] + reflectiveOperationException.getMessage(), reflectiveOperationException);
        }
        catch (RuntimeException runtimeException) {
            throw runtimeException;
        }
        catch (Throwable throwable) {
            throw new RuntimeException(h[1] + throwable.getMessage(), throwable);
        }
    }

    public AsyncAdminMethods.JobId<String> testSiteMinderConfiguration(SiteMinderConfiguration siteMinderConfiguration) {
        try {
            String[] stringArray = h;
            Either<Throwable, Option<Object>> either = this.e.invokeExtensionMethod(stringArray[15], g, stringArray[2], new Class[]{SiteMinderConfiguration.class}, new Object[]{siteMinderConfiguration});
            return (AsyncAdminMethods.JobId)((Option)Eithers.extract(either)).toNull();
        }
        catch (ClassNotFoundException | NoSuchMethodException reflectiveOperationException) {
            String[] stringArray = h;
            throw new RuntimeException(stringArray[0] + reflectiveOperationException.getMessage(), reflectiveOperationException);
        }
        catch (RuntimeException runtimeException) {
            throw runtimeException;
        }
        catch (Throwable throwable) {
            throw new RuntimeException(h[7] + throwable.getMessage(), throwable);
        }
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[23];
                var3_1 = 0;
                var2_2 = "\u000f\u0002 \u0001\u0012pm=\fi\u0004\u0019b\"\"\u0006i\u0019\u0012g9\u001a\n=\b:}#-\u0006;.\u0018z+ \u0004<\u001f\u0016`$&\rsM;\u001c\r,\u0015\u0007q.=\u0006-M\u0012f?&\u0011i\u0004\u0019b\"\"\n'\nWf(.\n:\u0019\u0012f\u001e \u0017, \u001ez),\u0011\n\u0002\u0019r$.\u0016;\f\u0003}\"'Yi\u001b=\u0006:\u0019$}9,. \u0003\u0013q?\n\f'\u000b\u001es8;\u0002=\u0004\u0018z4*\f$C\u001b#9,\u0000!C\u0010u9,\u0014(\u0014Yw\"$\u000e&\u0003Yg$=\u0006$\u0004\u0019p(;M\u001a\u0004\u0003q\u0000 \r-\b\u0005U)$\n'\u001b:\u0002?\b$}9,. \u0003\u0013q?\n\f'\u000b\u001es8;\u0002=\u0004\u0018z7\u001c\r,\u0015\u0007q.=\u0006-M\u0012f?&\u0011i\u0004\u0019b\"\"\n'\nWg,?\u0006\u001a\u0004\u0003q\u0000 \r-\b\u0005W\"'\u0005 \n\u0002f,=\n&\u0003M4\u001a.\u0006=>\u001e`(\u0004\n'\t\u0012f\u000e&\r/\u0004\u0010a?(\u0017 \u0002\u00197\u001c\r,\u0015\u0007q.=\u0006-M\u0012f?&\u0011i\u0004\u0019b\"\"\n'\nW`(:\u0017\u001a\u0004\u0003q\u0000 \r-\b\u0005W\"'\u0005 \n\u0002f,=\n&\u0003M4.\u000f\u0002 \u0001\u0012pm=\fi\u0004\u0019b\"\"\u0006i\u001e\u0016b(\u001a\n=\b:}#-\u0006;.\u0018z+ \u0004<\u001f\u0016`$&\rsM6\u001c\r,\u0015\u0007q.=\u0006-M\u0012f?&\u0011i\u0004\u0019b\"\"\n'\nWs(=0 \u0019\u0012Y$'\u0007,\u001f4{#/\n.\u0018\u0005u9 \f'WW\u001d-\u0006%\b\u0003q\u001e \u0017, \u001ez),\u0011\n\u0002\u0019r$.\u0016;\f\u0003}\"'9\u001c\r,\u0015\u0007q.=\u0006-M\u0012f?&\u0011i\u0004\u0019b\"\"\n'\nWp(%\u0006=\b$}9,. \u0003\u0013q?\n\f'\u000b\u001es8;\u0002=\u0004\u0018zwi:\u001c\r,\u0015\u0007q.=\u0006-M\u0012f?&\u0011i\u0004\u0019b\"\"\n'\nWs(=\"%\u0001$}9,. \u0003\u0013q?\n\f'\u000b\u001es8;\u0002=\u0004\u0018z>sC\u001a.\u0006=>\u001e`(\u0004\n'\t\u0012f\u000e&\r/\u0004\u0010a?(\u0017 \u0002\u00190\u000f\u0002 \u0001\u0012pm=\fi\u0004\u0019b\"\"\u0006i\t\u0012x(=\u0006\u001a\u0004\u0003q\u0000 \r-\b\u0005W\"'\u0005 \n\u0002f,=\n&\u0003M44*\f$C\u001b#9,\u0000!C\u0010u9,\u0014(\u0014Yw\"$\u000e&\u0003Yg$=\u0006$\u0004\u0019p(;M\u001a\u0004\u0003q\u0000 \r-\b\u0005U)$\n'1\u000f\u0002 \u0001\u0012pm=\fi\u0004\u0019b\"\"\u0006i\n\u0012`\f%\u000f\u001a\u0004\u0003q\u0000 \r-\b\u0005W\"'\u0005 \n\u0002f,=\n&\u0003\u0004.m\u001e.\u0006=,\u001bx\u001e \u0017, \u001ez),\u0011\n\u0002\u0019r$.\u0016;\f\u0003}\"'\u0010-\u000f\u0002 \u0001\u0012pm=\fi\u0004\u0019b\"\"\u0006i\n\u0012`\u001e \u0017, \u001ez),\u0011\n\u0002\u0019r$.\u0016;\f\u0003}\"'Yi2\u000f\u0002 \u0001\u0012pm=\fi\u0004\u0019b\"\"\u0006i\u001f\u0012s$:\u0017,\u001f$}9,. \u0003\u0013q?\n\f'\u000b\u001es8;\u0002=\u0004\u0018zwi-\u000f\u0002 \u0001\u0012pm=\fi\u0004\u0019b\"\"\u0006i\n\u0012`\u001e \u0017, \u001ez),\u0011\n\u0002\u0019r$.\u0016;\f\u0003}\"'Yi";
                var4_3 = "\u000f\u0002 \u0001\u0012pm=\fi\u0004\u0019b\"\"\u0006i\u0019\u0012g9\u001a\n=\b:}#-\u0006;.\u0018z+ \u0004<\u001f\u0016`$&\rsM;\u001c\r,\u0015\u0007q.=\u0006-M\u0012f?&\u0011i\u0004\u0019b\"\"\n'\nWf(.\n:\u0019\u0012f\u001e \u0017, \u001ez),\u0011\n\u0002\u0019r$.\u0016;\f\u0003}\"'Yi\u001b=\u0006:\u0019$}9,. \u0003\u0013q?\n\f'\u000b\u001es8;\u0002=\u0004\u0018z4*\f$C\u001b#9,\u0000!C\u0010u9,\u0014(\u0014Yw\"$\u000e&\u0003Yg$=\u0006$\u0004\u0019p(;M\u001a\u0004\u0003q\u0000 \r-\b\u0005U)$\n'\u001b:\u0002?\b$}9,. \u0003\u0013q?\n\f'\u000b\u001es8;\u0002=\u0004\u0018z7\u001c\r,\u0015\u0007q.=\u0006-M\u0012f?&\u0011i\u0004\u0019b\"\"\n'\nWg,?\u0006\u001a\u0004\u0003q\u0000 \r-\b\u0005W\"'\u0005 \n\u0002f,=\n&\u0003M4\u001a.\u0006=>\u001e`(\u0004\n'\t\u0012f\u000e&\r/\u0004\u0010a?(\u0017 \u0002\u00197\u001c\r,\u0015\u0007q.=\u0006-M\u0012f?&\u0011i\u0004\u0019b\"\"\n'\nW`(:\u0017\u001a\u0004\u0003q\u0000 \r-\b\u0005W\"'\u0005 \n\u0002f,=\n&\u0003M4.\u000f\u0002 \u0001\u0012pm=\fi\u0004\u0019b\"\"\u0006i\u001e\u0016b(\u001a\n=\b:}#-\u0006;.\u0018z+ \u0004<\u001f\u0016`$&\rsM6\u001c\r,\u0015\u0007q.=\u0006-M\u0012f?&\u0011i\u0004\u0019b\"\"\n'\nWs(=0 \u0019\u0012Y$'\u0007,\u001f4{#/\n.\u0018\u0005u9 \f'WW\u001d-\u0006%\b\u0003q\u001e \u0017, \u001ez),\u0011\n\u0002\u0019r$.\u0016;\f\u0003}\"'9\u001c\r,\u0015\u0007q.=\u0006-M\u0012f?&\u0011i\u0004\u0019b\"\"\n'\nWp(%\u0006=\b$}9,. \u0003\u0013q?\n\f'\u000b\u001es8;\u0002=\u0004\u0018zwi:\u001c\r,\u0015\u0007q.=\u0006-M\u0012f?&\u0011i\u0004\u0019b\"\"\n'\nWs(=\"%\u0001$}9,. \u0003\u0013q?\n\f'\u000b\u001es8;\u0002=\u0004\u0018z>sC\u001a.\u0006=>\u001e`(\u0004\n'\t\u0012f\u000e&\r/\u0004\u0010a?(\u0017 \u0002\u00190\u000f\u0002 \u0001\u0012pm=\fi\u0004\u0019b\"\"\u0006i\t\u0012x(=\u0006\u001a\u0004\u0003q\u0000 \r-\b\u0005W\"'\u0005 \n\u0002f,=\n&\u0003M44*\f$C\u001b#9,\u0000!C\u0010u9,\u0014(\u0014Yw\"$\u000e&\u0003Yg$=\u0006$\u0004\u0019p(;M\u001a\u0004\u0003q\u0000 \r-\b\u0005U)$\n'1\u000f\u0002 \u0001\u0012pm=\fi\u0004\u0019b\"\"\u0006i\n\u0012`\f%\u000f\u001a\u0004\u0003q\u0000 \r-\b\u0005W\"'\u0005 \n\u0002f,=\n&\u0003\u0004.m\u001e.\u0006=,\u001bx\u001e \u0017, \u001ez),\u0011\n\u0002\u0019r$.\u0016;\f\u0003}\"'\u0010-\u000f\u0002 \u0001\u0012pm=\fi\u0004\u0019b\"\"\u0006i\n\u0012`\u001e \u0017, \u001ez),\u0011\n\u0002\u0019r$.\u0016;\f\u0003}\"'Yi2\u000f\u0002 \u0001\u0012pm=\fi\u0004\u0019b\"\"\u0006i\u001f\u0012s$:\u0017,\u001f$}9,. \u0003\u0013q?\n\f'\u000b\u001es8;\u0002=\u0004\u0018zwi-\u000f\u0002 \u0001\u0012pm=\fi\u0004\u0019b\"\"\u0006i\n\u0012`\u001e \u0017, \u001ez),\u0011\n\u0002\u0019r$.\u0016;\f\u0003}\"'Yi".length();
                var1_4 = 46;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = SiteMinderAdminImpl.b(v0, SiteMinderAdminImpl.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "\u0001\u00101\b\u001al3 \u001b0P\u000f{\";\ft\u0019\u0004\u007f??\u0017:\u0017Jn5 -=\u0004\u000fD9:\u001a1\u0002)f>2\u00173\u0005\u0018h$=\u0011:JJ\u001f&\u001b3\u0019\u0019}5&-=\u0004\u000fD9:\u001a1\u0002)f>2\u00173\u0005\u0018h$=\u0011:";
                    var4_3 = "\u0001\u00101\b\u001al3 \u001b0P\u000f{\";\ft\u0019\u0004\u007f??\u0017:\u0017Jn5 -=\u0004\u000fD9:\u001a1\u0002)f>2\u00173\u0005\u0018h$=\u0011:JJ\u001f&\u001b3\u0019\u0019}5&-=\u0004\u000fD9:\u001a1\u0002)f>2\u00173\u0005\u0018h$=\u0011:".length();
                    var1_4 = 54;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 52;
                        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++] = SiteMinderAdminImpl.b(v0, SiteMinderAdminImpl.a(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;
            }
        }
        SiteMinderAdminImpl.h = var5;
        SiteMinderAdminImpl.f = SiteMinderAdminImpl.h[15];
        SiteMinderAdminImpl.g = null;
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x64);
        }
        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 -> 96;
                    case 1 -> 74;
                    case 2 -> 96;
                    case 3 -> 68;
                    case 4 -> 94;
                    case 5 -> 61;
                    default -> 100;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

