PlatformPeerImpl.java 4.21 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  javax.transaction.HeuristicMixedException
 *  javax.transaction.HeuristicRollbackException
 *  javax.transaction.NotSupportedException
 *  javax.transaction.RollbackException
 *  javax.transaction.SystemException
 *  javax.transaction.TransactionManager
 *  org.apache.commons.io.FilenameUtils
 *  org.slf4j.Logger
 *  org.slf4j.LoggerFactory
 */
package com.adobe.service.impl;

import com.adobe.aemds.bedrock.CoreConfigService;
import com.adobe.aemds.bedrock.internal.OSGiUtils;
import com.adobe.aemds.bedrock.internal.Utilities;
import com.adobe.service.ConnectionFactory;
import com.adobe.service.impl.Platform;
import java.io.File;
import java.util.Properties;
import javax.naming.NameNotFoundException;
import javax.transaction.HeuristicMixedException;
import javax.transaction.HeuristicRollbackException;
import javax.transaction.NotSupportedException;
import javax.transaction.RollbackException;
import javax.transaction.SystemException;
import javax.transaction.TransactionManager;
import org.apache.commons.io.FilenameUtils;
import org.omg.CORBA.Object;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

class PlatformPeerImpl
extends Platform {
    private static final Logger logger = LoggerFactory.getLogger(PlatformPeerImpl.class);

    PlatformPeerImpl() {
    }

    public Object lookup(String resourceType) throws NameNotFoundException {
        ConnectionFactory svcDataSource = Utilities.serviceLookup(resourceType);
        return (Object)svcDataSource.getConnection();
    }

    public TransactionManager getTransactionManager() {
        return OSGiUtils.getTransactionManager();
    }

    public void beginTransaction() {
        try {
            TransactionManager tman = this.getTransactionManager();
            tman.begin();
        }
        catch (NotSupportedException e) {
            logger.warn("Error beginning transaction", (Throwable)e);
            throw new IllegalStateException("Transactions not supported " + (java.lang.Object)e);
        }
        catch (SystemException e) {
            logger.warn("Error beginning transaction", (Throwable)e);
            throw new IllegalStateException("System exception from TransactionManager.begin() " + (java.lang.Object)e);
        }
    }

    public void commitTransaction() {
        try {
            TransactionManager tman = this.getTransactionManager();
            tman.commit();
        }
        catch (RollbackException e) {
            logger.warn("Error committing transaction", (Throwable)e);
            throw new IllegalStateException("Commit failure - rollbackException " + (java.lang.Object)e);
        }
        catch (HeuristicMixedException e) {
            logger.warn("Error committing transaction", (Throwable)e);
            throw new IllegalStateException("Commit failure - HeuristicMixedException " + (java.lang.Object)e);
        }
        catch (HeuristicRollbackException e) {
            logger.warn("Error committing transaction", (Throwable)e);
            throw new IllegalStateException("Commit failure - HeuristicRollbackException " + (java.lang.Object)e);
        }
        catch (SystemException e) {
            logger.warn("Error committing transaction", (Throwable)e);
            throw new IllegalStateException("Commit failure - SystemException " + (java.lang.Object)e);
        }
    }

    public Properties getEnvironmentVariables() {
        return Utilities.getEnvironment();
    }

    public File getCommonNativeDir() {
        String dirPath = FilenameUtils.concat((String)this.getCoreConfigService().getServerNativeDir(), (String)"CommonNatives/lib");
        return new File(dirPath);
    }

    public File getLegacyCommonNativeDir() {
        return this.getCommonNativeDir();
    }

    public File getSSLNativeDir() {
        return this.getCommonNativeDir();
    }

    public File getSSLCertDir() {
        return new File(this.getCoreConfigService().getServerDataDir());
    }

    public String getSystemTempDirectory() {
        return this.getCoreConfigService().getServerTempDir();
    }

    private CoreConfigService getCoreConfigService() {
        return OSGiUtils.getCoreConfigService();
    }

    public String getAppServer() {
        return "Adobe-OSGi";
    }
}