IBMAttachAPIResolver.java 1.42 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  javax.annotation.Nullable
 *  org.osgi.framework.BundleContext
 *  org.osgi.framework.ServiceRegistration
 *  org.slf4j.Logger
 *  org.slf4j.LoggerFactory
 */
package com.adobe.cq.deserfw.impl.attach;

import com.adobe.cq.deserfw.api.AttachAPIResolver;
import java.util.Dictionary;
import java.util.Hashtable;
import javax.annotation.Nullable;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class IBMAttachAPIResolver
implements AttachAPIResolver {
    private static final Logger log = LoggerFactory.getLogger(AttachAPIResolver.class);

    @Nullable
    @Override
    public Class<?> getAttachAPIClass() {
        try {
            return ClassLoader.getSystemClassLoader().loadClass("com.ibm.tools.attach.VirtualMachine");
        }
        catch (ClassNotFoundException cnfe) {
            log.info("IBM Attach API not found.");
            return null;
        }
    }

    public static ServiceRegistration registerService(BundleContext ctx) {
        Hashtable<String, Object> props = new Hashtable<String, Object>();
        props.put("service.ranking", 90);
        props.put("service.description", "AttachAPIResolver for IBM JVMs");
        return ctx.registerService(AttachAPIResolver.class.getName(), (Object)new IBMAttachAPIResolver(), props);
    }
}