com.arjuna.webservices11.util.PrivilegedServiceHelper Maven / Gradle / Ivy
/*
Copyright The Narayana Authors
SPDX-License-Identifier: Apache-2.0
*/
package com.arjuna.webservices11.util;
import javax.xml.namespace.QName;
import jakarta.xml.ws.EndpointReference;
import jakarta.xml.ws.Service;
import jakarta.xml.ws.WebServiceFeature;
import java.security.AccessController;
import java.security.PrivilegedAction;
/**
* @author Gytis Trikleris
*/
public class PrivilegedServiceHelper {
private static final PrivilegedServiceHelper INSTANCE = new PrivilegedServiceHelper();
private PrivilegedServiceHelper() {
}
public static PrivilegedServiceHelper getInstance() {
return INSTANCE;
}
public T getPort(final Service service, final QName portName, final Class serviceEndpointInterface) {
if (System.getSecurityManager() == null) {
return service.getPort(portName, serviceEndpointInterface);
}
return AccessController.doPrivileged(new PrivilegedAction() {
@Override
public T run() {
return service.getPort(portName, serviceEndpointInterface);
}
});
}
public T getPort(final Service service, final QName portName, final Class serviceEndpointInterface,
final WebServiceFeature... features) {
if (System.getSecurityManager() == null) {
return service.getPort(portName, serviceEndpointInterface, features);
}
return AccessController.doPrivileged(new PrivilegedAction() {
@Override
public T run() {
return service.getPort(portName, serviceEndpointInterface, features);
}
});
}
public T getPort(final Service service, final EndpointReference endpointReference,
final Class serviceEndpointInterface, final WebServiceFeature... features) {
if (System.getSecurityManager() == null) {
return service.getPort(endpointReference, serviceEndpointInterface, features);
}
return AccessController.doPrivileged(new PrivilegedAction() {
@Override
public T run() {
return service.getPort(endpointReference, serviceEndpointInterface, features);
}
});
}
public T getPort(final Service service, final Class serviceEndpointInterface,
final WebServiceFeature... features) {
if (System.getSecurityManager() == null) {
return service.getPort(serviceEndpointInterface, features);
}
return AccessController.doPrivileged(new PrivilegedAction() {
@Override
public T run() {
return service.getPort(serviceEndpointInterface, features);
}
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy