Resource$.java 4.6 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.forms.common.utils.URIUtils
 *  org.slf4j.Logger
 *  scala.Function0
 *  scala.Function1
 *  scala.None
 *  scala.None$
 *  scala.Option
 *  scala.Predef
 *  scala.Predef$
 *  scala.Predef$ArrowAssoc
 *  scala.ScalaObject
 *  scala.Some
 *  scala.Tuple2
 *  scala.collection.GenMap
 *  scala.collection.Seq
 *  scala.collection.immutable.Map
 *  scala.collection.immutable.Map$
 *  scala.collection.immutable.Nil
 *  scala.collection.immutable.Nil$
 *  scala.collection.mutable.StringBuilder
 */
package com.adobe.forms.rm;

import com.adobe.forms.common.utils.URIUtils;
import com.adobe.forms.logging.Loggable;
import com.adobe.forms.logging.Loggable$class;
import com.adobe.forms.rm.Resource;
import com.adobe.forms.rm.Resource$EmptyResource$;
import com.adobe.forms.rm.ResourceResolver;
import com.adobe.forms.rm.ResourceResolver$;
import java.io.File;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.net.URI;
import org.slf4j.Logger;
import scala.Function0;
import scala.Function1;
import scala.None;
import scala.Option;
import scala.Predef;
import scala.ScalaObject;
import scala.Some;
import scala.Tuple2;
import scala.collection.GenMap;
import scala.collection.Seq;
import scala.collection.immutable.Map;
import scala.collection.immutable.Nil;
import scala.collection.mutable.StringBuilder;

/*
 * This class specifies class file version 49.0 but uses Java 6 signatures.  Assumed Java 6.
 */
public final class Resource$
implements Loggable,
ScalaObject {
    public static final Resource$ MODULE$;
    private final long INVALID_TIME;
    private final Logger logger;
    public volatile int bitmap$0;

    public static {
        new com.adobe.forms.rm.Resource$();
    }

    public long INVALID_TIME() {
        return this.INVALID_TIME;
    }

    public <A> A using(InputStream r, Function1<InputStream, A> f) {
        Object exceptionResult1 = null;
        try {
            exceptionResult1 = f.apply((Object)r);
            return (A)exceptionResult1;
        }
        finally {
            r.close();
        }
    }

    public Resource.RichInputStream enrichInputStream(InputStream xs) {
        return new Resource.RichInputStream(xs);
    }

    public String absolutize(Option<String> context, String resId) {
        URI resIdUri;
        Some some;
        String parent;
        String string;
        Option<String> option = context;
        return (option instanceof Some && this.gd1$1(parent = (string = (String)(some = (Some)option).x())) ? ((resIdUri = URIUtils.getUri((String)resId, (boolean)false)).isAbsolute() ? resId : new StringBuilder().append((Object)parent).append((Object)File.separator).append((Object)resId).toString()) : resId).replace('\\', '/');
    }

    public Resource apply() {
        return Resource$EmptyResource$.MODULE$;
    }

    /*
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     */
    public Resource apply(Object content, Option<String> context, Map<String, Object> map) {
        void exceptionResult222;
        Class class_2;
        Resource$EmptyResource$ resource$EmptyResource$;
        ResourceResolver.RegisteredResource resource = ResourceResolver$.MODULE$.apply(content, context, map);
        Class class_ = resource.cls();
        if (!(class_ instanceof Class)) {
            resource$EmptyResource$ = Resource$EmptyResource$.MODULE$;
            return resource$EmptyResource$;
        }
        Class c = class_2 = class_;
        Object exceptionResult322 = null;
        try {
            Constructor ctor = c.getConstructor(Object.class, Option.class, Map.class);
            Resource exceptionResult322 = (Resource)ctor.newInstance(new Object[]{content, context, map.$plus(Predef..MODULE$.any2ArrowAssoc((Object)"userData").$minus$greater(resource.userData()))});
        }
        catch (NoSuchMethodException noSuchMethodException) {
            this.logger().warn("No resource type registered.");
            Resource$EmptyResource$ exceptionResult222 = Resource$EmptyResource$.MODULE$;
        }
        resource$EmptyResource$ = exceptionResult222;
        return resource$EmptyResource$;
    }

    public Map apply$default$3() {
        return (Map)Predef..MODULE$.Map().apply((Seq)Nil..MODULE$);
    }

    public Option apply$default$2() {
        return None..MODULE$;
    }

    private final boolean gd1$1(String string) {
        return !string.isEmpty();
    }

    private Resource$() {
        MODULE$ = this;
        Loggable$class.$init$(this);
        this.INVALID_TIME = Long.MAX_VALUE;
    }
}