All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.arjuna.webservices11.util.ServiceAction Maven / Gradle / Ivy

The newest version!
/*
   Copyright The Narayana Authors
   SPDX-License-Identifier: Apache-2.0
 */

package com.arjuna.webservices11.util;

import com.arjuna.webservices.logging.WSCLogger;

import jakarta.xml.ws.Service;
import java.security.PrivilegedAction;

/**
 * @author Gytis Trikleris
 */
public final class ServiceAction implements PrivilegedAction {

    private final Class serviceClass;

    public ServiceAction(Class serviceClass) {
        this.serviceClass = serviceClass;
    }

    public static  ServiceAction getInstance(final Class serviceClass) {
        return new ServiceAction<>(serviceClass);
    }

    @Override
    public T run() {
        try {
            return serviceClass.newInstance();
        } catch (final InstantiationException | IllegalAccessException e) {
            WSCLogger.i18NLogger.warn_cannot_create_service_instance(serviceClass, e);
            throw new RuntimeException(e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy