/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.common.http.GenericHttpClient
 *  com.l7tech.common.http.GenericHttpClientFactory
 *  com.l7tech.common.http.GenericHttpHeader
 *  com.l7tech.common.http.GenericHttpRequest
 *  com.l7tech.common.http.GenericHttpRequestParams
 *  com.l7tech.common.http.GenericHttpRequestParams$HttpVersion
 *  com.l7tech.common.http.GenericHttpResponse
 *  com.l7tech.common.http.HttpConstants
 *  com.l7tech.common.http.HttpHeader
 *  com.l7tech.common.http.HttpMethod
 *  com.l7tech.common.http.RerunnableHttpRequest
 *  com.l7tech.common.http.RerunnableHttpRequest$InputStreamFactory
 *  com.l7tech.common.io.ByteLimitInputStream
 *  com.l7tech.common.io.XmlUtil
 *  com.l7tech.common.mime.ContentTypeHeader
 *  com.l7tech.gateway.common.audit.AuditDetailMessage
 *  com.l7tech.gateway.common.audit.ServiceMessages
 *  com.l7tech.gateway.common.cluster.ClusterProperty
 *  com.l7tech.gateway.common.service.MetricsSummaryBin
 *  com.l7tech.gateway.common.service.PublishedService
 *  com.l7tech.objectmodel.EntityType
 *  com.l7tech.objectmodel.FindException
 *  com.l7tech.objectmodel.Goid
 *  com.l7tech.objectmodel.ObjectModelException
 *  com.l7tech.objectmodel.PersistentEntity
 *  com.l7tech.objectmodel.UpdateException
 *  com.l7tech.policy.assertion.AssertionStatus
 *  com.l7tech.util.Background
 *  com.l7tech.util.BuildInfo
 *  com.l7tech.util.Charsets
 *  com.l7tech.util.ExceptionUtils
 *  com.l7tech.util.GoidUpgradeMapper
 *  com.l7tech.util.IOUtils
 *  com.l7tech.util.ISO8601Date
 *  com.l7tech.util.InetAddressUtil
 *  com.l7tech.util.Pair
 *  com.l7tech.util.PoolByteArrayOutputStream
 *  com.l7tech.util.ResourceUtils
 *  com.l7tech.util.SoapConstants
 *  com.l7tech.util.TimeUnit
 *  com.l7tech.xml.soap.SoapUtil
 *  jakarta.inject.Inject
 *  jakarta.inject.Named
 *  org.springframework.beans.BeansException
 *  org.springframework.context.ApplicationContext
 *  org.springframework.context.ApplicationContextAware
 *  org.springframework.context.Lifecycle
 */
package com.l7tech.server.wsdm.subscription;

import com.l7tech.common.http.GenericHttpClient;
import com.l7tech.common.http.GenericHttpClientFactory;
import com.l7tech.common.http.GenericHttpHeader;
import com.l7tech.common.http.GenericHttpRequest;
import com.l7tech.common.http.GenericHttpRequestParams;
import com.l7tech.common.http.GenericHttpResponse;
import com.l7tech.common.http.HttpConstants;
import com.l7tech.common.http.HttpHeader;
import com.l7tech.common.http.HttpMethod;
import com.l7tech.common.http.RerunnableHttpRequest;
import com.l7tech.common.io.ByteLimitInputStream;
import com.l7tech.common.io.XmlUtil;
import com.l7tech.common.mime.ContentTypeHeader;
import com.l7tech.gateway.common.audit.AuditDetailMessage;
import com.l7tech.gateway.common.audit.ServiceMessages;
import com.l7tech.gateway.common.cluster.ClusterProperty;
import com.l7tech.gateway.common.service.MetricsSummaryBin;
import com.l7tech.gateway.common.service.PublishedService;
import com.l7tech.objectmodel.EntityType;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.Goid;
import com.l7tech.objectmodel.ObjectModelException;
import com.l7tech.objectmodel.PersistentEntity;
import com.l7tech.objectmodel.UpdateException;
import com.l7tech.policy.assertion.AssertionStatus;
import com.l7tech.server.ServerConfig;
import com.l7tech.server.audit.AuditContextFactory;
import com.l7tech.server.audit.Auditor;
import com.l7tech.server.audit.MessageSummaryAuditFactory;
import com.l7tech.server.message.PolicyEnforcementContext;
import com.l7tech.server.policy.PolicyCache;
import com.l7tech.server.service.ServiceCache;
import com.l7tech.server.wsdm.Aggregator;
import com.l7tech.server.wsdm.MetricsRequestContext;
import com.l7tech.server.wsdm.QoSMetricsService;
import com.l7tech.server.wsdm.faults.FaultMappableException;
import com.l7tech.server.wsdm.faults.GenericWSRFExceptionFault;
import com.l7tech.server.wsdm.faults.ResourceUnknownFault;
import com.l7tech.server.wsdm.faults.UnacceptableTerminationTimeFault;
import com.l7tech.server.wsdm.method.Subscribe;
import com.l7tech.server.wsdm.subscription.ServiceStateMonitor;
import com.l7tech.server.wsdm.subscription.Subscription;
import com.l7tech.server.wsdm.subscription.SubscriptionKey;
import com.l7tech.server.wsdm.subscription.SubscriptionManager;
import com.l7tech.server.wsdm.subscription.h;
import com.l7tech.server.wsdm.subscription.i;
import com.l7tech.server.wsdm.subscription.j;
import com.l7tech.server.wsdm.subscription.k;
import com.l7tech.server.wsdm.subscription.l;
import com.l7tech.server.wsdm.subscription.m;
import com.l7tech.server.wsdm.subscription.n;
import com.l7tech.server.wsdm.subscription.o;
import com.l7tech.util.Background;
import com.l7tech.util.BuildInfo;
import com.l7tech.util.Charsets;
import com.l7tech.util.ExceptionUtils;
import com.l7tech.util.GoidUpgradeMapper;
import com.l7tech.util.IOUtils;
import com.l7tech.util.ISO8601Date;
import com.l7tech.util.InetAddressUtil;
import com.l7tech.util.Pair;
import com.l7tech.util.PoolByteArrayOutputStream;
import com.l7tech.util.ResourceUtils;
import com.l7tech.util.SoapConstants;
import com.l7tech.util.TimeUnit;
import com.l7tech.xml.soap.SoapUtil;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import java.io.ByteArrayInputStream;
import java.io.Closeable;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.Charset;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.EnumSet;
import java.util.Map;
import java.util.TimerTask;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.Lifecycle;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

public class SubscriptionNotifier
implements ServiceStateMonitor,
ApplicationContextAware,
Lifecycle {
    private static final Logger a;
    public static final String ESM_SUBSCRIPTION_SERVICE_NAME;
    public static final String ESM_SUBSCRIPTION_SERVICE_ROOT_WSDL;
    public static final String ESM_SUBSCRIPTION_SERVICE_URI_PREFIX;
    public static final String PRODUCT;
    public static final String DEFAULT_USER_AGENT;
    public static final String CLUSTER_PROP_NOTIFY_INTERVAL;
    public static final String CLUSTER_PROP_ESM_ENABLED;
    public static final String SERVERCONFIG_PROP_NOTIFY_INTERVAL;
    public static final String SERVERCONFIG_PROP_ESM_ENABLED;
    private static final int b = 60000;
    private static final int c = 60000;
    private static final boolean d = true;
    private static final EnumSet<NotificationType> e;
    private Auditor f;
    private URL g;
    private final AtomicLong h = new AtomicLong(0L);
    private final AtomicBoolean i = new AtomicBoolean(false);
    private volatile long j;
    @Inject
    private ServiceCache serviceCache;
    @Inject
    private SubscriptionManager subscriptionManager;
    @Inject
    private PolicyCache policyCache;
    @Inject
    private MessageSummaryAuditFactory auditFactory;
    @Inject
    private ServerConfig serverConfig;
    @Inject
    @Named(value="httpClientFactory")
    private GenericHttpClientFactory httpClientFactory;
    @Inject
    private Aggregator aggregator;
    private final String k;
    private final AtomicBoolean l = new AtomicBoolean(false);
    private TimerTask m;
    private TimerTask n;
    private TimerTask o;
    private final ExecutorService p = Executors.newSingleThreadExecutor();
    private AuditContextFactory q;
    private static final String[] r;

    public SubscriptionNotifier(String string) {
        this.k = string;
    }

    public void start() {
        long l2;
        boolean bl2;
        SubscriptionNotifier subscriptionNotifier;
        String string;
        int n2;
        String[] stringArray;
        block6: {
            this.a(true);
            String string2 = this.serverConfig.getHostname();
            stringArray = r;
            n2 = this.serverConfig.getIntProperty(stringArray[7], 8080);
            string = this.serverConfig.getProperty(stringArray[55]);
            try {
                if (string != null && string.length() != 0) break block6;
            }
            catch (MalformedURLException malformedURLException) {
                throw SubscriptionNotifier.a(malformedURLException);
            }
            string = string2;
        }
        try {
            stringArray = r;
            this.g = new URL(stringArray[16] + InetAddressUtil.getHostForUrl((String)string) + ":" + n2);
            a.log(Level.CONFIG, stringArray[42] + this.g.toString() + stringArray[10]);
        }
        catch (MalformedURLException malformedURLException) {
            throw new RuntimeException(malformedURLException);
        }
        try {
            this.subscriptionManager.setAggregator(this.aggregator);
            this.m = new m(this);
            this.n = new n(this);
            this.o = new o(this);
            subscriptionNotifier = this;
            bl2 = false;
            l2 = this.i.get() ? this.h.get() : 0L;
        }
        catch (MalformedURLException malformedURLException) {
            throw SubscriptionNotifier.a(malformedURLException);
        }
        subscriptionNotifier.a(bl2, l2);
        this.l.set(true);
    }

    public void stop() {
        this.l.set(false);
    }

    public boolean isRunning() {
        return this.l.get();
    }

    private boolean a(boolean bl2) {
        boolean bl3;
        boolean bl4;
        block18: {
            block15: {
                String string;
                String[] stringArray;
                block17: {
                    block16: {
                        long l2;
                        bl4 = false;
                        String string2 = this.serverConfig.getProperty(SERVERCONFIG_PROP_NOTIFY_INTERVAL);
                        if (string2 != null) {
                            try {
                                try {
                                    if (bl2) {
                                        a.info(r[4] + string2 + r[39]);
                                    }
                                }
                                catch (NumberFormatException numberFormatException) {
                                    throw SubscriptionNotifier.a(numberFormatException);
                                }
                                l2 = TimeUnit.parse((String)string2, (TimeUnit)TimeUnit.MILLIS);
                            }
                            catch (NumberFormatException numberFormatException) {
                                stringArray = r;
                                a.warning(stringArray[29] + string2 + stringArray[39]);
                                l2 = 60000L;
                            }
                        } else {
                            stringArray = r;
                            a.info(stringArray[3]);
                            l2 = 60000L;
                        }
                        if (this.h.get() != l2) {
                            bl4 = true;
                        }
                        this.h.set(l2);
                        string = this.serverConfig.getProperty(SERVERCONFIG_PROP_ESM_ENABLED);
                        try {
                            try {
                                if (string == null) break block15;
                                if (!bl2) break block16;
                            }
                            catch (NumberFormatException numberFormatException) {
                                throw SubscriptionNotifier.a(numberFormatException);
                            }
                            a.info(r[70] + string + r[39]);
                        }
                        catch (NumberFormatException numberFormatException) {
                            throw SubscriptionNotifier.a(numberFormatException);
                        }
                    }
                    try {
                        if (!r[21].equalsIgnoreCase(string) && !r[80].equalsIgnoreCase(string)) break block17;
                    }
                    catch (NumberFormatException numberFormatException) {
                        throw SubscriptionNotifier.a(numberFormatException);
                    }
                    bl3 = Boolean.parseBoolean(string);
                    break block18;
                }
                stringArray = r;
                a.warning(stringArray[40] + string + stringArray[39]);
                bl3 = true;
                break block18;
            }
            a.info(r[64]);
            bl3 = true;
        }
        if (this.i.get() != bl3) {
            bl4 = true;
        }
        this.i.set(bl3);
        return bl4;
    }

    private void a(boolean bl2, long l2) {
        block6: {
            block5: {
                try {
                    if (!bl2) break block5;
                    Background.cancel((TimerTask)this.n);
                    Background.cancel((TimerTask)this.o);
                    break block6;
                }
                catch (RuntimeException runtimeException) {
                    throw SubscriptionNotifier.a(runtimeException);
                }
            }
            Background.scheduleRepeated((TimerTask)this.m, (long)123077L, (long)60000L);
        }
        try {
            if (l2 > 0L) {
                a.log(Level.INFO, r[87], l2);
                Background.scheduleRepeated((TimerTask)this.n, (long)15011L, (long)l2);
                Background.scheduleRepeated((TimerTask)this.o, (long)l2, (long)((long)(2.49 * (double)l2)));
            }
        }
        catch (RuntimeException runtimeException) {
            throw SubscriptionNotifier.a(runtimeException);
        }
    }

    public void renewSubscription(String string, long l2, String string2) throws FaultMappableException {
        try {
            this.subscriptionManager.renewSubscription(string, l2, string2);
        }
        catch (FindException findException) {
            this.a(string, (Exception)((Object)findException));
        }
        catch (UpdateException updateException) {
            String[] stringArray = r;
            a.log(Level.WARNING, stringArray[47], updateException);
            throw new GenericWSRFExceptionFault(stringArray[60] + string);
        }
    }

    public void unsubscribe(String string) throws ResourceUnknownFault {
        try {
            this.subscriptionManager.deleteByUuid(string);
        }
        catch (ObjectModelException objectModelException) {
            this.a(string, (Exception)((Object)objectModelException));
        }
    }

    private void a(String string, Exception exception) throws ResourceUnknownFault {
        try {
            if (exception != null) {
                a.log(Level.WARNING, r[68] + ExceptionUtils.getMessage((Throwable)exception), exception);
            }
        }
        catch (ResourceUnknownFault resourceUnknownFault) {
            throw SubscriptionNotifier.a(resourceUnknownFault);
        }
        throw new ResourceUnknownFault(r[14] + string);
    }

    public String generateNewSubscriptionId() {
        return UUID.randomUUID().toString();
    }

    public Subscription subscribe(Subscribe subscribe, String string) throws FaultMappableException, UnacceptableTerminationTimeFault {
        long l2 = System.currentTimeMillis();
        try {
            if (subscribe.getTermination() < l2) {
                throw new UnacceptableTerminationTimeFault(r[41]);
            }
        }
        catch (ObjectModelException objectModelException) {
            throw SubscriptionNotifier.a(objectModelException);
        }
        try {
            PublishedService publishedService = this.serviceCache.getCachedService(GoidUpgradeMapper.mapId((EntityType)EntityType.SERVICE, (String)subscribe.getServiceId()));
            try {
                if (publishedService == null) {
                    throw new ResourceUnknownFault(r[13] + subscribe.getServiceId());
                }
            }
            catch (ObjectModelException objectModelException) {
                throw SubscriptionNotifier.a(objectModelException);
            }
            Subscription subscription = new Subscription(subscribe, this.generateNewSubscriptionId(), this.k);
            subscription.setNotificationPolicyGuid(string);
            SubscriptionKey subscriptionKey = new SubscriptionKey(subscription.getPublishedServiceGoid(), subscription.getTopic(), subscription.getReferenceCallback());
            Collection<Subscription> collection = this.subscriptionManager.findBySubscriptionKey(subscriptionKey);
            if (!collection.isEmpty()) {
                String string2 = collection.iterator().next().getUuid();
                String[] stringArray = r;
                a.warning(stringArray[37] + string2 + stringArray[58] + subscription.getReferenceCallback() + stringArray[39]);
                throw new GenericWSRFExceptionFault(stringArray[71]);
            }
            this.subscriptionManager.save((PersistentEntity)subscription);
            long l3 = (subscription.getTermination() - System.currentTimeMillis()) / 1000L;
            String string3 = subscription.getUuid();
            String[] stringArray = r;
            a.info(stringArray[25] + string3 + stringArray[51] + l3 + stringArray[53]);
            return subscription;
        }
        catch (ObjectModelException objectModelException) {
            throw new RuntimeException(objectModelException);
        }
    }

    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.f = new Auditor(this, applicationContext, a);
        this.q = (AuditContextFactory)applicationContext.getBean(r[77], AuditContextFactory.class);
    }

    @Override
    public void onServiceDisabled(Goid goid) {
        try {
            if (this.i.get()) {
                this.a(goid, NotificationType.DISABLED);
            }
        }
        catch (RuntimeException runtimeException) {
            throw SubscriptionNotifier.a(runtimeException);
        }
    }

    @Override
    public void onServiceEnabled(Goid goid) {
        try {
            if (this.i.get()) {
                this.a(goid, NotificationType.ENABLED);
            }
        }
        catch (RuntimeException runtimeException) {
            throw SubscriptionNotifier.a(runtimeException);
        }
    }

    private void a(Goid goid, NotificationType notificationType) {
        Collection<Subscription> collection;
        String[] stringArray = r;
        boolean bl2 = this.serverConfig.getBooleanProperty(stringArray[15], true);
        try {
            if (!bl2) {
                return;
            }
        }
        catch (FindException findException) {
            throw SubscriptionNotifier.a(findException);
        }
        try {
            collection = this.subscriptionManager.findByNodeAndServiceGoid(this.k, goid);
        }
        catch (FindException findException) {
            stringArray = r;
            a.log(Level.WARNING, stringArray[18], findException);
            return;
        }
        ArrayList<ServiceStatusNotificationContext> arrayList = new ArrayList<ServiceStatusNotificationContext>();
        long l2 = System.currentTimeMillis();
        for (Subscription subscription : collection) {
            block21: {
                try {
                    if (!Goid.equals((Goid)subscription.getPublishedServiceGoid(), (Goid)goid)) {
                        continue;
                    }
                }
                catch (FindException findException) {
                    throw SubscriptionNotifier.a(findException);
                }
                try {
                    if (subscription.getTermination() < l2) {
                        a.info(MessageFormat.format(r[5], subscription.getUuid(), (System.currentTimeMillis() - subscription.getTermination()) / 1000L));
                        continue;
                    }
                }
                catch (FindException findException) {
                    throw SubscriptionNotifier.a(findException);
                }
                try {
                    try {
                        try {
                            if (notificationType == NotificationType.METRICS && subscription.getTopic() == 1) break block21;
                        }
                        catch (FindException findException) {
                            throw SubscriptionNotifier.a(findException);
                        }
                        if (!e.contains((Object)notificationType)) continue;
                    }
                    catch (FindException findException) {
                        throw SubscriptionNotifier.a(findException);
                    }
                    if (subscription.getTopic() != 2) continue;
                }
                catch (FindException findException) {
                    throw SubscriptionNotifier.a(findException);
                }
            }
            ServiceStatusNotificationContext serviceStatusNotificationContext = new ServiceStatusNotificationContext(this);
            serviceStatusNotificationContext.subscriptionId = subscription.getUuid();
            serviceStatusNotificationContext.esmServiceGoid = subscription.getEsmServiceGoid();
            serviceStatusNotificationContext.serviceId = goid;
            serviceStatusNotificationContext.target = subscription.getReferenceCallback();
            serviceStatusNotificationContext.refParamsXml = this.a(subscription);
            serviceStatusNotificationContext.notificationPolicyGuid = subscription.getNotificationPolicyGuid();
            serviceStatusNotificationContext.ts = l2;
            arrayList.add(serviceStatusNotificationContext);
        }
        try {
            if (arrayList.size() <= 0) {
                return;
            }
        }
        catch (FindException findException) {
            throw SubscriptionNotifier.a(findException);
        }
        this.p.execute(new h(this, arrayList, notificationType));
    }

    private void a(String string, String string2, String string3) throws IOException {
        try {
            if (a.isLoggable(Level.FINEST)) {
                a.log(Level.FINEST, r[45], new String[]{string2, string});
            }
        }
        catch (Exception exception) {
            throw SubscriptionNotifier.a(exception);
        }
        Closeable[] closeableArray = new PolicyEnforcementContext[]{null};
        AssertionStatus[] assertionStatusArray = new AssertionStatus[]{AssertionStatus.SERVER_ERROR};
        try {
            this.q.doWithNewAuditContext(new i(this, string2, (PolicyEnforcementContext[])closeableArray, string, string3, assertionStatusArray), new j(this, (PolicyEnforcementContext[])closeableArray, assertionStatusArray));
        }
        catch (Exception exception) {
            throw new IOException(exception);
        }
        finally {
            ResourceUtils.closeQuietly((Closeable[])closeableArray);
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    private boolean a(PolicyEnforcementContext policyEnforcementContext, URL uRL, String string) {
        GenericHttpResponse genericHttpResponse;
        GenericHttpRequest genericHttpRequest;
        boolean bl2;
        block25: {
            bl2 = false;
            GenericHttpClient genericHttpClient = this.httpClientFactory.createHttpClient(-1, -1, this.a(), this.b(), -1, null, null);
            GenericHttpRequestParams genericHttpRequestParams = new GenericHttpRequestParams(uRL);
            try {
                genericHttpRequestParams.setFollowRedirects(false);
                genericHttpRequestParams.setContentType(ContentTypeHeader.XML_DEFAULT);
                genericHttpRequestParams.addExtraHeader((HttpHeader)new GenericHttpHeader(HttpConstants.HEADER_USER_AGENT, DEFAULT_USER_AGENT));
                genericHttpRequestParams.addExtraHeader((HttpHeader)new GenericHttpHeader(SoapUtil.SOAPACTION, ""));
                if (Boolean.valueOf(this.serverConfig.getProperty(r[11])).booleanValue()) {
                    genericHttpRequestParams.setUseExpectContinue(true);
                }
            }
            catch (Throwable throwable) {
                throw SubscriptionNotifier.a(throwable);
            }
            try {
                if (Boolean.valueOf(this.serverConfig.getProperty(r[24])).booleanValue()) {
                    genericHttpRequestParams.setUseKeepAlives(false);
                }
            }
            catch (Throwable throwable) {
                throw SubscriptionNotifier.a(throwable);
            }
            try {
                if (r[69].equals(this.serverConfig.getProperty(r[22]))) {
                    genericHttpRequestParams.setHttpVersion(GenericHttpRequestParams.HttpVersion.HTTP_VERSION_1_0);
                }
            }
            catch (Throwable throwable) {
                throw SubscriptionNotifier.a(throwable);
            }
            genericHttpRequest = null;
            genericHttpResponse = null;
            try {
                policyEnforcementContext.routingStarted();
                byte[] byArray = string.getBytes(ContentTypeHeader.XML_DEFAULT.getEncoding());
                genericHttpRequestParams.setContentLength(Long.valueOf(byArray.length));
                genericHttpRequest = genericHttpClient.createRequest(HttpMethod.POST, genericHttpRequestParams);
                if (genericHttpRequest instanceof RerunnableHttpRequest) {
                    RerunnableHttpRequest rerunnableHttpRequest = (RerunnableHttpRequest)genericHttpRequest;
                    rerunnableHttpRequest.setInputStreamFactory((RerunnableHttpRequest.InputStreamFactory)new k(this, byArray));
                } else {
                    genericHttpRequest.setInputStream((InputStream)new ByteArrayInputStream(byArray));
                }
                genericHttpResponse = genericHttpRequest.getResponse();
                int n2 = genericHttpResponse.getStatus();
                if (n2 == 200) {
                    InputStream inputStream;
                    block26: {
                        bl2 = true;
                        this.f.logAndAudit((AuditDetailMessage)ServiceMessages.ESM_NOTIFY_SUCCESS, uRL.toString(), Integer.toString(n2));
                        if (!a.isLoggable(Level.FINE)) break block25;
                        inputStream = genericHttpResponse.getInputStream();
                        try {
                            if (inputStream == null) break block26;
                            byte[] byArray2 = IOUtils.slurpStream((InputStream)new ByteLimitInputStream(inputStream, 16, 0xA00000L));
                            Charset charset = genericHttpResponse.getContentType().getEncoding();
                            String[] stringArray = r;
                            a.fine(stringArray[48] + new String(byArray2, charset));
                        }
                        catch (Throwable throwable) {
                            if (inputStream != null) {
                                try {
                                    inputStream.close();
                                }
                                catch (Throwable throwable2) {
                                    throwable.addSuppressed(throwable2);
                                }
                            }
                            throw throwable;
                        }
                    }
                    try {
                        if (inputStream != null) {
                            inputStream.close();
                        }
                        break block25;
                    }
                    catch (Throwable throwable) {
                        throw SubscriptionNotifier.a(throwable);
                    }
                }
                if (n2 < 300) {
                    bl2 = true;
                    this.f.logAndAudit((AuditDetailMessage)ServiceMessages.ESM_NOTIFY_SUCCESS, uRL.toString(), Integer.toString(n2));
                    break block25;
                }
                this.f.logAndAudit((AuditDetailMessage)ServiceMessages.ESM_NOTIFY_FAILURE, uRL.toString(), Integer.toString(n2));
            }
            catch (IOException iOException) {
                try {
                    this.f.logAndAudit((AuditDetailMessage)ServiceMessages.ESM_NOTIFY_IO_ERROR, new String[]{uRL.toString(), r[62], ExceptionUtils.getMessage((Throwable)iOException)}, ExceptionUtils.getDebugException((Throwable)iOException));
                }
                catch (Throwable throwable) {
                    ResourceUtils.closeQuietly((Closeable[])new Closeable[]{genericHttpRequest, genericHttpResponse});
                    policyEnforcementContext.routingFinished();
                    throw throwable;
                }
                ResourceUtils.closeQuietly((Closeable[])new Closeable[]{genericHttpRequest, genericHttpResponse});
                policyEnforcementContext.routingFinished();
            }
        }
        ResourceUtils.closeQuietly((Closeable[])new Closeable[]{genericHttpRequest, genericHttpResponse});
        policyEnforcementContext.routingFinished();
        return bl2;
    }

    private int a() {
        return this.a(r[32], 0, Integer.MAX_VALUE, 0);
    }

    private int b() {
        return this.a(r[52], 0, Integer.MAX_VALUE, 0);
    }

    private int a(String string, int n2, int n3, int n4) {
        int n5 = n4;
        try {
            String string2 = this.serverConfig.getProperty(string);
            if (string2 != null) {
                n5 = Integer.parseInt(string2);
                boolean bl2 = false;
                if (n5 < n2) {
                    bl2 = true;
                    int n6 = n4;
                    int n7 = n2;
                    String string3 = string;
                    String[] stringArray = r;
                    a.warning(stringArray[50] + string3 + stringArray[82] + n7 + stringArray[79] + n6 + stringArray[39]);
                } else if (n5 > n3) {
                    bl2 = true;
                    int n8 = n4;
                    int n9 = n3;
                    String string4 = string;
                    String[] stringArray = r;
                    a.warning(stringArray[38] + string4 + stringArray[44] + n9 + stringArray[74] + n8 + stringArray[39]);
                }
                if (bl2) {
                    n5 = n4;
                }
            }
        }
        catch (SecurityException securityException) {
            String string5 = securityException.getMessage();
            int n10 = n4;
            String string6 = string;
            String[] stringArray = r;
            a.warning(stringArray[9] + string6 + stringArray[74] + n10 + stringArray[46] + string5);
        }
        catch (NumberFormatException numberFormatException) {
            String string7 = numberFormatException.getMessage();
            int n11 = n4;
            String string8 = string;
            String[] stringArray = r;
            a.warning(stringArray[28] + string8 + stringArray[74] + n11 + stringArray[17] + string7);
        }
        return n5;
    }

    @Override
    public void onServiceCreated(Goid goid) {
        this.onServiceEnabled(goid);
    }

    @Override
    public void onServiceDeleted(Goid goid) {
        this.onServiceDisabled(goid);
    }

    public void pushMetricsNotifications(long l2) {
        Map<SubscriptionKey, Pair<Subscription, MetricsSummaryBin>> map;
        String[] stringArray = r;
        boolean bl2 = this.serverConfig.getBooleanProperty(stringArray[49], true);
        try {
            if (!bl2) {
                return;
            }
        }
        catch (FindException findException) {
            throw SubscriptionNotifier.a(findException);
        }
        try {
            map = this.subscriptionManager.findNotifiableMetricsForNode(this.k, l2);
        }
        catch (FindException findException) {
            a.log(Level.WARNING, r[1], findException);
            return;
        }
        ArrayList<ServiceStatusNotificationContext> arrayList = new ArrayList<ServiceStatusNotificationContext>();
        long l3 = System.currentTimeMillis();
        for (Pair<Subscription, MetricsSummaryBin> pair : map.values()) {
            Subscription subscription = (Subscription)((Object)pair.left);
            MetricsSummaryBin metricsSummaryBin = (MetricsSummaryBin)pair.right;
            ServiceStatusNotificationContext serviceStatusNotificationContext = new ServiceStatusNotificationContext(this);
            serviceStatusNotificationContext.subscriptionId = subscription.getUuid();
            serviceStatusNotificationContext.esmServiceGoid = subscription.getEsmServiceGoid();
            serviceStatusNotificationContext.serviceId = subscription.getPublishedServiceGoid();
            serviceStatusNotificationContext.target = subscription.getReferenceCallback();
            serviceStatusNotificationContext.refParamsXml = this.a(subscription);
            serviceStatusNotificationContext.notificationPolicyGuid = subscription.getNotificationPolicyGuid();
            serviceStatusNotificationContext.ts = l3;
            serviceStatusNotificationContext.bin = metricsSummaryBin;
            arrayList.add(serviceStatusNotificationContext);
        }
        this.p.execute(new l(this, arrayList));
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    private String a(Subscription subscription) {
        String string = subscription.getReferenceParams();
        try {
            if (string == null) {
                return "";
            }
        }
        catch (IOException iOException) {
            throw SubscriptionNotifier.a(iOException);
        }
        StringBuilder stringBuilder = new StringBuilder();
        Element element = XmlUtil.findFirstChildElement((Element)XmlUtil.stringAsDocument((String)string).getDocumentElement());
        while (element != null) {
            String[] stringArray = r;
            element.setAttributeNS(stringArray[76], stringArray[65], stringArray[26]);
            try (PoolByteArrayOutputStream poolByteArrayOutputStream = new PoolByteArrayOutputStream(1024);){
                XmlUtil.nodeToOutputStreamWithApacheXmlSec((Node)element, (OutputStream)poolByteArrayOutputStream);
                stringBuilder.append(poolByteArrayOutputStream.toString(Charsets.UTF8));
            }
            element = XmlUtil.findNextElementSibling((Element)element);
        }
        return stringBuilder.toString();
    }

    private String a(ServiceStatusNotificationContext serviceStatusNotificationContext, NotificationType notificationType) throws IOException {
        String string;
        Object[] objectArray;
        String string2;
        Logger logger;
        String string3;
        SubscriptionNotifier subscriptionNotifier;
        block5: {
            block4: {
                try {
                    subscriptionNotifier = this;
                    if (notificationType != NotificationType.ENABLED) break block4;
                    string3 = r[20];
                    break block5;
                }
                catch (IOException iOException) {
                    throw SubscriptionNotifier.a(iOException);
                }
            }
            String[] stringArray = r;
            string3 = stringArray[63];
        }
        String string4 = subscriptionNotifier.a(string3, serviceStatusNotificationContext);
        try {
            logger = a;
            string2 = r[2];
            Object[] objectArray2 = new Object[2];
            Object[] objectArray3 = objectArray2;
            objectArray = objectArray2;
            int n2 = 0;
            string = notificationType == NotificationType.ENABLED ? r[54] : r[75];
        }
        catch (IOException iOException) {
            throw SubscriptionNotifier.a(iOException);
        }
        objectArray3[n2] = string;
        objectArray[1] = serviceStatusNotificationContext.eventId;
        logger.info(MessageFormat.format(string2, objectArray));
        return string4;
    }

    private String a(ServiceStatusNotificationContext serviceStatusNotificationContext) throws IOException {
        boolean bl2;
        Object object;
        String[] stringArray = r;
        String string = this.a(stringArray[0], serviceStatusNotificationContext);
        a.info(stringArray[8] + serviceStatusNotificationContext.eventId);
        long l2 = System.currentTimeMillis() - serviceStatusNotificationContext.bin.getStartTime();
        try {
            boolean bl3;
            object = this.serviceCache.getCachedService(serviceStatusNotificationContext.serviceId);
            try {
                bl3 = !object.isDisabled();
            }
            catch (Exception exception) {
                throw SubscriptionNotifier.a(exception);
            }
            bl2 = bl3;
        }
        catch (Exception exception) {
            stringArray = r;
            a.log(Level.WARNING, stringArray[27], exception);
            bl2 = false;
        }
        object = new MetricsRequestContext(serviceStatusNotificationContext.bin, bl2, this.g, l2);
        StringBuffer stringBuffer = new StringBuffer();
        stringArray = r;
        stringBuffer.append(stringArray[56] + QoSMetricsService.outputResourceID((MetricsRequestContext)object) + stringArray[23]);
        stringBuffer.append(stringArray[6] + QoSMetricsService.outputOperationalStatus((MetricsRequestContext)object) + stringArray[85]);
        stringBuffer.append(stringArray[6] + QoSMetricsService.outputNrRequests((MetricsRequestContext)object) + stringArray[85]);
        stringBuffer.append(stringArray[6] + QoSMetricsService.outputNrSuccessRequests((MetricsRequestContext)object) + stringArray[85]);
        stringBuffer.append(stringArray[6] + QoSMetricsService.outputNrFailedRequests((MetricsRequestContext)object) + stringArray[85]);
        stringBuffer.append(stringArray[6] + QoSMetricsService.outputThroughput((MetricsRequestContext)object) + stringArray[85]);
        stringBuffer.append(stringArray[6] + QoSMetricsService.outputAvgResponseTime((MetricsRequestContext)object) + stringArray[85]);
        stringBuffer.append(stringArray[6] + QoSMetricsService.outputMaxResponseTime((MetricsRequestContext)object) + stringArray[85]);
        stringBuffer.append(stringArray[6] + QoSMetricsService.outputLastResponseTime((MetricsRequestContext)object) + stringArray[85]);
        stringBuffer.append(stringArray[6] + QoSMetricsService.outputServiceTime((MetricsRequestContext)object) + stringArray[85]);
        string = string.replace(stringArray[73], stringBuffer.toString());
        return string;
    }

    /*
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     */
    private String a(String string, ServiceStatusNotificationContext serviceStatusNotificationContext) throws IOException {
        String string2;
        ClassLoader classLoader = SubscriptionNotifier.class.getClassLoader();
        String[] stringArray = r;
        String string3 = stringArray[30] + string;
        Object object = classLoader.getResourceAsStream(string3);
        try {
            try {
                if (object == null) {
                    throw new FileNotFoundException(string3);
                }
            }
            catch (Throwable throwable) {
                throw SubscriptionNotifier.a(throwable);
            }
            string2 = new String(IOUtils.slurpStream((InputStream)object));
        }
        catch (Throwable throwable) {
            if (object == null) throw throwable;
            try {
                ((InputStream)object).close();
                throw throwable;
            }
            catch (Throwable throwable2) {
                throwable.addSuppressed(throwable2);
            }
            throw throwable;
        }
        try {
            if (object != null) {
                ((InputStream)object).close();
            }
        }
        catch (Throwable throwable) {
            throw SubscriptionNotifier.a(throwable);
        }
        serviceStatusNotificationContext.eventId = object = this.generateNewSubscriptionId();
        stringArray = r;
        string2 = string2.replace(stringArray[19], serviceStatusNotificationContext.target);
        string2 = string2.replace(stringArray[81], serviceStatusNotificationContext.refParamsXml);
        string2 = string2.replace(stringArray[33], serviceStatusNotificationContext.subscriptionId);
        string2 = string2.replace(stringArray[84], this.a(serviceStatusNotificationContext.esmServiceGoid));
        string2 = string2.replace(stringArray[31], stringArray[86] + (String)object);
        string2 = string2.replace(stringArray[43], this.g.toString() + stringArray[61] + String.valueOf(serviceStatusNotificationContext.serviceId));
        return string2.replace(stringArray[72], ISO8601Date.format((Date)new Date(serviceStatusNotificationContext.ts)));
    }

    private String a(Goid goid) {
        Object object = null;
        PublishedService publishedService = this.serviceCache.getCachedService(goid);
        if (publishedService != null) {
            object = this.g.toString() + publishedService.getRoutingUri();
        } else {
            String string = r[59];
            for (PublishedService publishedService2 : this.serviceCache.getInternalServices()) {
                if (!string.equals(publishedService2.getWsdlUrl())) continue;
                object = this.g.toString() + publishedService2.getRoutingUri();
                this.f.logAndAudit((AuditDetailMessage)ServiceMessages.ESM_SUBSCRIPTION_SERVICE_GONE, new String[]{Goid.toString((Goid)goid), object});
                break;
            }
            if (object == null) {
                object = SoapConstants.WSA_NO_ADDRESS;
                this.f.logAndAudit((AuditDetailMessage)ServiceMessages.ESM_NO_SUBSCRIPTION_SERVICE, new String[]{Goid.toString((Goid)goid), object});
            }
        }
        return object;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[89];
                var3_1 = 0;
                var2_2 = "r8q1OBvY#w1JH\u0015D:i\u001ci9d:E^\u001bH8%>@U_\u001c9j,@]R_6q1FUH&o2w.@X^\u001c,5%\tUTH>c1JZOU8kxN^UY%d,L_\u001bGfxUK$a5\u0007UTH>c1JZOU8kv@UOY%s9E\u001bXP\"v,LI\u001bL%j(LIOEwk7]\u001b]S\"k<\u0007\u001bnO>k?\tOSYwa=OZNP#%7O\u001b\r\fg5h\tVH\u0012?z8p6M\u001bxS9c1N\u001bkN8u=[OB\u001cpr+MV\u0015R8q1ORX]#l7G\u0015RR#`*_ZW\u001bwr1]S\u001bJ6i-L\u001b\u001c<u0k7[RU[wv-KHXN>u,@TU\u001c,5%\tY^_6p+L\u001bRHw` YRIY3%#\u0018F\u001bO2f7G_H\u001c6b7`\u001cw%x\t\u001b\u001b\u001cw%x\t\u0007LO%cu[K\u0001n2v7\\IXY\u0007w7Y^IH.S9EN^\u007f?d6N^uS#l>@XZH>j6\u00171\u001b\u001cw%x\t\u001b\u001b\u001cw%x\t\u001b\u0007K$w>\u0004IK\u0006\u0019`/\u007fZWI2vf#\u000f_;p+]^IT#q(YTIH\u001fq2q*@XH\u001c9j,@]R_6q1FU\u001b[2k=[ZOY3%\u0018\u007f6k6FO\u001b]4f=ZH\u001bL%j(LIOEw\"\u0002\u001by\u0017U8M,]KnO2@ Y^XH\u0014j6]RUI2\u000eY$h+D\u0016\u000b\u0012b+/Z_W\u0013r8%+LIMU4`x^ROTwL\u001c\t\u001fh?`xZNYO4w1YORS9%1M\u001bROwp6BUTK9%\u0015O2w.@X^q2q*@XHy9d:E^_\u0007T#q(\u0013\u0014\u0014\r\u001b{%=[ITNwl+\u0013\u001b\u001ci9d:E^\u001bH8%>@U_\u001c\u0004p:ZXIU'q1FUH\u0016bs[|wdlo\u0016Z\fhi|y\u0003Z\u0006\re\u001fb\u0013r8q1OBzJ6l4HYWYy}5E\u0004H%p=\rU8M,]KmY%v1FUb\u001cw%x\t\u001b\u001b\u001cw%x\t\u001b\u001b\u0000xr+[]\u0016N'?\u0016LLm];p=Z\u00051\u001cw%x\t\u001b\u001b\u001cw%x\t\u0007\u0014K$w>\u0004IK\u0006\u0005`+FNI_2U*FK^N#|\u000eHWNY\u0014m9G\\^r8q1ORX]#l7G\u00051\u0011U8M,]KuS\u001c`=YzWU!`\u001cr2rxZNYO4w1YORS9%*L\\RO#`*L_\u001b\u0004H%p= Y%w7[\u001b\\Y#q1G\\\u001bO2w.@X^\u001c1w7D\u001bX]4m=\u0017\u007f6k6FO\u001bL6w+L\u001bKN8u=[OB\u001cpYi9d:E^\u001bH8%(HIHYw@\u000bd\u001buS#l>@XZH>j6\t_^P6|xYITL2w,P\u001b\u0013K$a5\u0007UTH>c1JZOU8kv@UOY%s9E\u0012\u001bK>q0\tMZP\"`x\u000e._8hwE\fOY4mwZ^IJ2ww^H_Qxv-KHXN>u,@TU\u0013%`+FNI_2vw\u0016bs[|wd~j\u0012K\fvnnu\u0013Z\u0006\re\u001fb\u0016U8J-]xTR9`;]RTR\u0003l5LTNH\u001bbs[|wdhi\u0015V\u001b{rkh\u001eJ\u0016vr\u007fc\t!\u0006\re\u0019K$a5\u0007UTH>c1JZOU8kvLUZ^;`<\u0016\u0013 v<D\u0014^O:v-KHXN>u,@TUO\u001aK$a5\u0007UTH>c1JZOU8kv@UOY%s9EKz8p6M\u001b_I'i1JZOYwv-KHXN>u,@TU\u0010wk7]\u001bXN2d,@U\\\u001c9`/\tHN^$f*@KOU8kt\t_NL;l;HO^\u001c8cx\u000e\u001f\u007f8k>@\\NN2ax_ZWI2%>FI\u001bL%j(LIOEw\"\u0002\u001byMi9d:E^\u001bH8%(HIHYw@\u000bd\u001b^R6g4L_\u001bL%j(LIOEw-/Z_V\u00129j,@]R_6q1FU\u0015Y9d:E^_\u0015wr1]S\u001bJ6i-L\u001b\u001c+\u007f6k6FO\u001bT6s=\tZ\u001bH2w5@UZH>j6\tORQ2%1G\u001bOT2%(HHO\u0012\u000fi$l6N\u001bho\u0010%\r{w\u001b\u001b\u0017bs[|wdhn\u0014Z\u000b\u007fxdi\u0005I\u0007w\u001fe\u0018\t\u0019\u001b{%1Z\u001bz~\u0018S\u001d\tOSYwh9QRVI:%\u007f\u001fo2k<@U\\\u001c9j,@]R_6q1FU\u001bGgxx]T\u001bGfx\r\u001b{%=[ITNwl+\u0013\u001b\u001di9d:E^\u001bH8%-Y_ZH2%+\\YH_%l(]RTR'r8q1ORX]#l7G\u001bO]%b=]\u001bIY$u7G_^Xw7h\u0019\u001bLU#mx\u0015O2w.@X^q2q*@XHy9d:E^_\u001f\u007f8k>@\\NN2ax_ZWI2%>FI\u001bL%j(LIOEw\"\u0010\u001c l4E\u001b^D'l*L\u001bRRw\u0010U8J-]i^]3Q1D^TI#\b\u001c$`;FU_O\u0007Y9d:E^_\u000b_;p+]^It8v,`\u001cw%x\t\u001b\u001b\u001cw%x\t\u0007LO%cu[K\u0001n2v7\\IXY\u0007w7Y^IH.S9EN^\u007f?d6N^uS#l>@XZH>j6\u00171\u001b\u001cw%x\t\u001b\u001b\u001cw%x\t\u001b\u0007K$w>\u0004IK\u0006\u0019`/\u007fZWI2vf#\u0002\u00115\u000b\u001bwc7[\u001bnn\u001b%\u007f#Z>i=\u0013\u0014\u0014c\bv+NRUH2w6HW\u0014Y$h+D\u0016\u000b\u0012b+/Z_W\u001ei9d:E^\u001bH8%-Y_ZH2%+\\YH_%l(]RTRw\t\u0013$`*_RXYx\u0003rxD\u0015r8q1OBnR6s9@WZ^;`vQVWTK$a5\u0007UTH>c1JZOU8kvLUZ^;`<\tXWI$q=[\u001bKN8u=[OB\u001c9j,\t]TI9av\tnHU9bx]S^\u001c3`>HNWHwj>\t\r\u000b\fg5xDH\u0015\u0014u$W=O^IY9f=yZI]:`,LI\u001bp6|=[\f\u0016o2f-[^hL6kunZOY d!\u0006M\u001aK$a5\u0007UTH>c1JZOU8kv@UOY%s9E\"o\"g+JIRL#l7G\u001bKY%v1ZO^R4`xYIT^;`5\u0013\u001b\u0003\ry5>z8p6M\u001bxS9c1N\u001bkN8u=[OB\u001cpr+MV\u0015R8q1ORX]#l7G\u0015^R6g4L_\u001c\u001c l,A\u001bM];p=\t\u001c<x\"u4@XZH2%+\\YH_%l(]RTRy%\bE^ZO2%;HUXY;%=QRHH>k?\tHN^$f*@KOU8kv\u0019bs[|wdus\u0000Z\f`v~o\u0003D\u0015yde\u0018\t!\u0006\u001bbs[|wdln\u0016U\bl\u007fdq\u0012Q\n`xhc\t!\u0006\re\u0018\u001b{%-ZRU[wa=OZNP#%.HWNYw\"\bX>v9KW^X$T#q(\u0013\u0014\u0014K rv^\b\u0015S%bw\u001b\u000b\u000b\tx5`\u0006Z_X%`+ZRU[\u0013]\"a1]xTR#` ]}Z_#j*P\u0019K$a5\u0007UTH>c1JZOU8kvLUZ^;`<\u0018\u001b{%-ZRU[wa=OZNP#%.HWNYw\"\u0005Z6i+L\u001cbs[|wdiy\u0011@\nluxy\bU\u0019{zvo\b[|w\u001fe\u0019\u001b{%1Z\u001byy\u001bJ\u000f\tOSYwh1GRVI:%\u007f\u0019p6|=[\f\u0016o2f-[^hL6kunZOY d!\u001cbs[|wd~o\u001aZ\u000b|yhc\u0004S\u001bvnip\b[|w\u001feb\u001cw%x\t\u001b\u001b\u001cw%x\t\u001b\u001b\u0000xr+[]\u0016N'?\u0016LLm];p=Z\u00051\u001cw%x\t\u001b\u001b\u001cw%x\t\u0007\u0014K$w>\u0004IK\u0006\u0005`+FNI_2U*FK^N#|\u000eHWNY\u0014m9G\\^r8q1ORX]#l7G\u00051\tI%kb\\NRXm";
                var4_3 = "r8q1OBvY#w1JH\u0015D:i\u001ci9d:E^\u001bH8%>@U_\u001c9j,@]R_6q1FUH&o2w.@X^\u001c,5%\tUTH>c1JZOU8kxN^UY%d,L_\u001bGfxUK$a5\u0007UTH>c1JZOU8kv@UOY%s9E\u001bXP\"v,LI\u001bL%j(LIOEwk7]\u001b]S\"k<\u0007\u001bnO>k?\tOSYwa=OZNP#%7O\u001b\r\fg5h\tVH\u0012?z8p6M\u001bxS9c1N\u001bkN8u=[OB\u001cpr+MV\u0015R8q1ORX]#l7G\u0015RR#`*_ZW\u001bwr1]S\u001bJ6i-L\u001b\u001c<u0k7[RU[wv-KHXN>u,@TU\u001c,5%\tY^_6p+L\u001bRHw` YRIY3%#\u0018F\u001bO2f7G_H\u001c6b7`\u001cw%x\t\u001b\u001b\u001cw%x\t\u0007LO%cu[K\u0001n2v7\\IXY\u0007w7Y^IH.S9EN^\u007f?d6N^uS#l>@XZH>j6\u00171\u001b\u001cw%x\t\u001b\u001b\u001cw%x\t\u001b\u0007K$w>\u0004IK\u0006\u0019`/\u007fZWI2vf#\u000f_;p+]^IT#q(YTIH\u001fq2q*@XH\u001c9j,@]R_6q1FU\u001b[2k=[ZOY3%\u0018\u007f6k6FO\u001b]4f=ZH\u001bL%j(LIOEw\"\u0002\u001by\u0017U8M,]KnO2@ Y^XH\u0014j6]RUI2\u000eY$h+D\u0016\u000b\u0012b+/Z_W\u0013r8%+LIMU4`x^ROTwL\u001c\t\u001fh?`xZNYO4w1YORS9%1M\u001bROwp6BUTK9%\u0015O2w.@X^q2q*@XHy9d:E^_\u0007T#q(\u0013\u0014\u0014\r\u001b{%=[ITNwl+\u0013\u001b\u001ci9d:E^\u001bH8%>@U_\u001c\u0004p:ZXIU'q1FUH\u0016bs[|wdlo\u0016Z\fhi|y\u0003Z\u0006\re\u001fb\u0013r8q1OBzJ6l4HYWYy}5E\u0004H%p=\rU8M,]KmY%v1FUb\u001cw%x\t\u001b\u001b\u001cw%x\t\u001b\u001b\u0000xr+[]\u0016N'?\u0016LLm];p=Z\u00051\u001cw%x\t\u001b\u001b\u001cw%x\t\u0007\u0014K$w>\u0004IK\u0006\u0005`+FNI_2U*FK^N#|\u000eHWNY\u0014m9G\\^r8q1ORX]#l7G\u00051\u0011U8M,]KuS\u001c`=YzWU!`\u001cr2rxZNYO4w1YORS9%*L\\RO#`*L_\u001b\u0004H%p= Y%w7[\u001b\\Y#q1G\\\u001bO2w.@X^\u001c1w7D\u001bX]4m=\u0017\u007f6k6FO\u001bL6w+L\u001bKN8u=[OB\u001cpYi9d:E^\u001bH8%(HIHYw@\u000bd\u001buS#l>@XZH>j6\t_^P6|xYITL2w,P\u001b\u0013K$a5\u0007UTH>c1JZOU8kv@UOY%s9E\u0012\u001bK>q0\tMZP\"`x\u000e._8hwE\fOY4mwZ^IJ2ww^H_Qxv-KHXN>u,@TU\u0013%`+FNI_2vw\u0016bs[|wd~j\u0012K\fvnnu\u0013Z\u0006\re\u001fb\u0016U8J-]xTR9`;]RTR\u0003l5LTNH\u001bbs[|wdhi\u0015V\u001b{rkh\u001eJ\u0016vr\u007fc\t!\u0006\re\u0019K$a5\u0007UTH>c1JZOU8kvLUZ^;`<\u0016\u0013 v<D\u0014^O:v-KHXN>u,@TUO\u001aK$a5\u0007UTH>c1JZOU8kv@UOY%s9EKz8p6M\u001b_I'i1JZOYwv-KHXN>u,@TU\u0010wk7]\u001bXN2d,@U\\\u001c9`/\tHN^$f*@KOU8kt\t_NL;l;HO^\u001c8cx\u000e\u001f\u007f8k>@\\NN2ax_ZWI2%>FI\u001bL%j(LIOEw\"\u0002\u001byMi9d:E^\u001bH8%(HIHYw@\u000bd\u001b^R6g4L_\u001bL%j(LIOEw-/Z_V\u00129j,@]R_6q1FU\u0015Y9d:E^_\u0015wr1]S\u001bJ6i-L\u001b\u001c+\u007f6k6FO\u001bT6s=\tZ\u001bH2w5@UZH>j6\tORQ2%1G\u001bOT2%(HHO\u0012\u000fi$l6N\u001bho\u0010%\r{w\u001b\u001b\u0017bs[|wdhn\u0014Z\u000b\u007fxdi\u0005I\u0007w\u001fe\u0018\t\u0019\u001b{%1Z\u001bz~\u0018S\u001d\tOSYwh9QRVI:%\u007f\u001fo2k<@U\\\u001c9j,@]R_6q1FU\u001bGgxx]T\u001bGfx\r\u001b{%=[ITNwl+\u0013\u001b\u001di9d:E^\u001bH8%-Y_ZH2%+\\YH_%l(]RTR'r8q1ORX]#l7G\u001bO]%b=]\u001bIY$u7G_^Xw7h\u0019\u001bLU#mx\u0015O2w.@X^q2q*@XHy9d:E^_\u001f\u007f8k>@\\NN2ax_ZWI2%>FI\u001bL%j(LIOEw\"\u0010\u001c l4E\u001b^D'l*L\u001bRRw\u0010U8J-]i^]3Q1D^TI#\b\u001c$`;FU_O\u0007Y9d:E^_\u000b_;p+]^It8v,`\u001cw%x\t\u001b\u001b\u001cw%x\t\u0007LO%cu[K\u0001n2v7\\IXY\u0007w7Y^IH.S9EN^\u007f?d6N^uS#l>@XZH>j6\u00171\u001b\u001cw%x\t\u001b\u001b\u001cw%x\t\u001b\u0007K$w>\u0004IK\u0006\u0019`/\u007fZWI2vf#\u0002\u00115\u000b\u001bwc7[\u001bnn\u001b%\u007f#Z>i=\u0013\u0014\u0014c\bv+NRUH2w6HW\u0014Y$h+D\u0016\u000b\u0012b+/Z_W\u001ei9d:E^\u001bH8%-Y_ZH2%+\\YH_%l(]RTRw\t\u0013$`*_RXYx\u0003rxD\u0015r8q1OBnR6s9@WZ^;`vQVWTK$a5\u0007UTH>c1JZOU8kvLUZ^;`<\tXWI$q=[\u001bKN8u=[OB\u001c9j,\t]TI9av\tnHU9bx]S^\u001c3`>HNWHwj>\t\r\u000b\fg5xDH\u0015\u0014u$W=O^IY9f=yZI]:`,LI\u001bp6|=[\f\u0016o2f-[^hL6kunZOY d!\u0006M\u001aK$a5\u0007UTH>c1JZOU8kv@UOY%s9E\"o\"g+JIRL#l7G\u001bKY%v1ZO^R4`xYIT^;`5\u0013\u001b\u0003\ry5>z8p6M\u001bxS9c1N\u001bkN8u=[OB\u001cpr+MV\u0015R8q1ORX]#l7G\u0015^R6g4L_\u001c\u001c l,A\u001bM];p=\t\u001c<x\"u4@XZH2%+\\YH_%l(]RTRy%\bE^ZO2%;HUXY;%=QRHH>k?\tHN^$f*@KOU8kv\u0019bs[|wdus\u0000Z\f`v~o\u0003D\u0015yde\u0018\t!\u0006\u001bbs[|wdln\u0016U\bl\u007fdq\u0012Q\n`xhc\t!\u0006\re\u0018\u001b{%-ZRU[wa=OZNP#%.HWNYw\"\bX>v9KW^X$T#q(\u0013\u0014\u0014K rv^\b\u0015S%bw\u001b\u000b\u000b\tx5`\u0006Z_X%`+ZRU[\u0013]\"a1]xTR#` ]}Z_#j*P\u0019K$a5\u0007UTH>c1JZOU8kvLUZ^;`<\u0018\u001b{%-ZRU[wa=OZNP#%.HWNYw\"\u0005Z6i+L\u001cbs[|wdiy\u0011@\nluxy\bU\u0019{zvo\b[|w\u001fe\u0019\u001b{%1Z\u001byy\u001bJ\u000f\tOSYwh1GRVI:%\u007f\u0019p6|=[\f\u0016o2f-[^hL6kunZOY d!\u001cbs[|wd~o\u001aZ\u000b|yhc\u0004S\u001bvnip\b[|w\u001feb\u001cw%x\t\u001b\u001b\u001cw%x\t\u001b\u001b\u0000xr+[]\u0016N'?\u0016LLm];p=Z\u00051\u001cw%x\t\u001b\u001b\u001cw%x\t\u0007\u0014K$w>\u0004IK\u0006\u0005`+FNI_2U*FK^N#|\u000eHWNY\u0014m9G\\^r8q1ORX]#l7G\u00051\tI%kb\\NRXm".length();
                var1_4 = 17;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = SubscriptionNotifier.a(v0, SubscriptionNotifier.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = ",w.~\u000e\r\u0014\u0016z!;\u0019\r\u001a\fw4r\u001a\f\u0011\u0010zfu\u0005\f\u0011\u0019}%z\u001e\u0011\u0017\u001142z\u0019\u0013X\b}2sJ\b\u001d\r})\u007fJ\u0003H\u0002y55\u0019(G\u0002VJ+\r\u001dg%i\u0003\b\f\u0016{(;9\u001d\n\t}%~";
                    var4_3 = ",w.~\u000e\r\u0014\u0016z!;\u0019\r\u001a\fw4r\u001a\f\u0011\u0010zfu\u0005\f\u0011\u0019}%z\u001e\u0011\u0017\u001142z\u0019\u0013X\b}2sJ\b\u001d\r})\u007fJ\u0003H\u0002y55\u0019(G\u0002VJ+\r\u001dg%i\u0003\b\f\u0016{(;9\u001d\n\t}%~".length();
                    var1_4 = 60;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 3;
                        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++] = SubscriptionNotifier.a(v0, SubscriptionNotifier.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;
            }
        }
        SubscriptionNotifier.r = var5;
        SubscriptionNotifier.CLUSTER_PROP_ESM_ENABLED = SubscriptionNotifier.r[34];
        SubscriptionNotifier.PRODUCT = SubscriptionNotifier.r[83];
        SubscriptionNotifier.ESM_SUBSCRIPTION_SERVICE_NAME = SubscriptionNotifier.r[88];
        SubscriptionNotifier.ESM_SUBSCRIPTION_SERVICE_ROOT_WSDL = SubscriptionNotifier.r[12];
        SubscriptionNotifier.CLUSTER_PROP_NOTIFY_INTERVAL = SubscriptionNotifier.r[36];
        SubscriptionNotifier.ESM_SUBSCRIPTION_SERVICE_URI_PREFIX = SubscriptionNotifier.r[35];
        SubscriptionNotifier.a = Logger.getLogger(SubscriptionNotifier.class.getName());
        var0_6 = SubscriptionNotifier.r;
        SubscriptionNotifier.DEFAULT_USER_AGENT = var0_6[66] + BuildInfo.getProductVersion() + var0_6[57] + BuildInfo.getBuildNumber();
        SubscriptionNotifier.SERVERCONFIG_PROP_NOTIFY_INTERVAL = ClusterProperty.asServerConfigPropertyName((String)var0_6[67]);
        SubscriptionNotifier.SERVERCONFIG_PROP_ESM_ENABLED = ClusterProperty.asServerConfigPropertyName((String)var0_6[78]);
        SubscriptionNotifier.e = EnumSet.of(NotificationType.DISABLED, NotificationType.ENABLED);
    }

    private static Throwable a(Throwable throwable) {
        return throwable;
    }

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

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String a(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 -> 124;
                    case 1 -> 23;
                    case 2 -> 69;
                    case 3 -> 24;
                    case 4 -> 105;
                    case 5 -> 123;
                    default -> 123;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }

    private static final class NotificationType
    extends Enum<NotificationType> {
        public static final /* enum */ NotificationType ENABLED;
        public static final /* enum */ NotificationType DISABLED;
        public static final /* enum */ NotificationType METRICS;
        private static final /* synthetic */ NotificationType[] $VALUES;

        public static NotificationType[] values() {
            return (NotificationType[])$VALUES.clone();
        }

        public static NotificationType valueOf(String string) {
            return Enum.valueOf(NotificationType.class, string);
        }

        private static /* synthetic */ NotificationType[] $values() {
            return new NotificationType[]{ENABLED, DISABLED, METRICS};
        }

        /*
         * Enabled aggressive block sorting
         */
        static {
            String[] stringArray = new String[3];
            int n2 = 0;
            String string = "l5\u0000X\u001f<t\bm2\u0012[\u00115um\u0007d>\u0015H\u001a:c";
            int n3 = "l5\u0000X\u001f<t\bm2\u0012[\u00115um\u0007d>\u0015H\u001a:c".length();
            int n4 = 7;
            int n5 = -1;
            while (true) {
                int n6 = ++n5;
                stringArray[n2++] = NotificationType.a(39, NotificationType.a(string.substring(n6, n6 + n4)));
                if ((n5 += n4) >= n3) {
                    ENABLED = new NotificationType();
                    DISABLED = new NotificationType();
                    METRICS = new NotificationType();
                    $VALUES = NotificationType.$values();
                    return;
                }
                n4 = string.charAt(n5);
            }
        }

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

        /*
         * Handled impossible loop by duplicating code
         * Enabled aggressive block sorting
         */
        private static String a(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 -> 14;
                        case 1 -> 92;
                        case 2 -> 102;
                        case 3 -> 61;
                        case 4 -> 116;
                        case 5 -> 94;
                        default -> 23;
                    })));
                    ++n3;
                    n4 = n4;
                } while (n4 > n3);
            }
            return new String(cArray2).intern();
        }
    }

    public class ServiceStatusNotificationContext {
        public String subscriptionId;
        public Goid serviceId;
        public String target;
        public String refParamsXml;
        public long ts;
        public String eventId;
        public String notificationPolicyGuid;
        public MetricsSummaryBin bin;
        public Goid esmServiceGoid;

        public ServiceStatusNotificationContext(SubscriptionNotifier subscriptionNotifier) {
        }
    }
}

