|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.lib.util.J2DoPrivHelper
public abstract class J2DoPrivHelper
Helper class to obtain the Privilege(Exception)Action object to perform Java 2 doPrivilege security sensitive function call in the following methods:
1) No security risk method call. E.g. private static final String SEP = J2DoPrivHelper.getLineSeparator(); 2) Methods with no exception thrown. PrivilegedAction is returned from J2DoPrivHelper.*Action(). E.g. ClassLoader loader = AccessController.doPrivileged( J2DoPrivHelper.getClassLoaderAction(clazz)); ClassLoader loader = (ClassLoader) (System.getSecurityManager() == null) ? clazz.getClassLoader() : AccessController.doPrivileged( J2DoPrivHelper.getClassLoaderAction(clazz)); 3) Methods with exception thrown. PrivilegedExceptionAction is returned from J2DoPrivHelper.*Action(). E.g. try { method = AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodAction(clazz, name, parameterType)); } catch (PrivilegedActionException pae) { throw (NoSuchMethodException) pae.getException(); } try { method = (System.getSecurityManager() == null) ? clazz.getDeclaredMethod(name,parameterType) : AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodAction( clazz, name, parameterType)); } catch (PrivilegedActionException pae) { throw (NoSuchMethodException) pae.getException() }
Constructor Summary | |
---|---|
J2DoPrivHelper()
|
Method Summary | ||
---|---|---|
static PrivilegedExceptionAction<Socket> |
acceptAction(ServerSocket ss)
Return a PrivilegedExceptionAction object for ServerSocket.accept(). |
|
static
|
buildDefaultValidatorFactoryAction()
Return a PrivilegeAction object for javax.validation.Validation.buildDefaultValidatorFactory(). |
|
static PrivilegedAction<Boolean> |
deleteAction(File f)
Return a PrivilegeAction object for f.delete(). |
|
static PrivilegedAction<Boolean> |
deleteOnExitAction(File f)
Return a PrivilegeAction object for f.deleteOnExit(). |
|
static PrivilegedAction<Boolean> |
existsAction(File f)
Return a PrivilegeAction object for f.exists(). |
|
static PrivilegedAction<File> |
getAbsoluteFileAction(File f)
Return a PrivilegeAction object for f.getAbsoluteFile(). |
|
static PrivilegedAction<String> |
getAbsolutePathAction(File f)
Return a PrivilegeAction object for f.getAbsolutePath(). |
|
static
|
getAnnotationAction(AnnotatedElement element,
Class<T> annotationClazz)
Return a PrivilegedAction object for AnnotatedElement.getAnnotation(). |
|
static PrivilegedAction<Annotation[]> |
getAnnotationsAction(AnnotatedElement element)
Return a PrivilegeAction object for AnnotatedElement.getAnnotations(). |
|
static PrivilegedAction<serp.bytecode.BCField[]> |
getBCClassFieldsAction(serp.bytecode.BCClass bcClass,
String fieldName)
Return a PrivilegeAction object for BCClass.getFields(). |
|
static PrivilegedExceptionAction<InetAddress> |
getByNameAction(String hostname)
Return a PrivilegedExceptionAction object for InetAdress.getByName(). |
|
static PrivilegedExceptionAction<String> |
getCanonicalPathAction(File f)
Return a PrivilegedExceptionAction object for f.getCanonicalPath(). |
|
static PrivilegedAction<ClassLoader> |
getClassLoaderAction(Class<?> clazz)
Return a PrivilegeAction object for clazz.getClassloader(). |
|
static PrivilegedExceptionAction<Object> |
getContentAction(URLConnection con)
Return a PrivilegedExceptionAction object con.getContent(). |
|
static PrivilegedAction<ClassLoader> |
getContextClassLoaderAction()
Return a PrivilegeAction object for Thread.currentThread .getContextClassLoader(). |
|
static PrivilegedAction<Annotation[]> |
getDeclaredAnnotationsAction(AnnotatedElement element)
Return a PrivilegeAction object for AnnotatedElement.getDeclaredAnnotations(). |
|
static PrivilegedExceptionAction<Field> |
getDeclaredFieldAction(Class<?> clazz,
String name)
Return a PrivilegedExceptionAction object for clazz.getDeclaredField(). |
|
static PrivilegedAction<Field[]> |
getDeclaredFieldsAction(Class<?> clazz)
Return a PrivilegeAction object for class.getDeclaredFields(). |
|
static PrivilegedExceptionAction<Method> |
getDeclaredMethodAction(Class<?> clazz,
String name,
Class<?>[] parameterTypes)
Return a PrivilegedExceptionAction object for clazz.getDeclaredMethod(). |
|
static PrivilegedAction<Method[]> |
getDeclaredMethodsAction(Class<?> clazz)
Return a PrivilegeAction object for clazz.getDeclaredMethods(). |
|
static PrivilegedAction<serp.bytecode.BCField> |
getFieldInstructionFieldAction(serp.bytecode.FieldInstruction instruction)
Return a PrivilegeAction object for FieldInstruction.getField(). |
|
static PrivilegedExceptionAction<Class<?>> |
getForNameAction(String className,
boolean initializeBoolean,
ClassLoader classLoader)
Return a PrivilegeAction object for Class.forName(). |
|
static PrivilegedExceptionAction<JarEntry> |
getJarEntryAction(JarURLConnection con)
Return a PrivilegedExceptionAction object for con.getJarEntry(). |
|
static PrivilegedExceptionAction<JarFile> |
getJarFileAction(JarURLConnection con)
Return a PrivilegedExceptionAction object for con.getJarFile(). |
|
static String |
getLineSeparator()
Return the value of the "line.separator" system property. |
|
static PrivilegedAction<ClassLoader> |
getParentAction(ClassLoader loader)
Return a PrivilegeAction object for loader.getParent(). |
|
static String |
getPathSeparator()
Return the value of the "path.separator" system property. |
|
static PrivilegedAction<Properties> |
getPropertiesAction()
Return a PrivilegeAction object for System.getProperties(). |
|
static PrivilegedAction<String> |
getPropertyAction(String name)
Return a PrivilegeAction object for System.getProperty(). |
|
static PrivilegedAction<String> |
getPropertyAction(String name,
String def)
Return a PrivilegeAction object for System.getProperty(). |
|
static PrivilegedAction<URL> |
getResourceAction(Class<?> clazz,
String resource)
Return a PrivilegeAction object for clazz.getResource(). |
|
static PrivilegedAction<URL> |
getResourceAction(ClassLoader loader,
String resource)
Return a PrivilegeAction object for loader.getResource(). |
|
static PrivilegedExceptionAction<Enumeration<URL>> |
getResourcesAction(ClassLoader loader,
String resource)
Return a PrivilegedExceptionAction object for loader.getResources(). |
|
static PrivilegedAction<ClassLoader> |
getSystemClassLoaderAction()
Return a PrivilegeAction object for ClassLoader.getSystemClassLoader(). |
|
static PrivilegedAction<Boolean> |
isAnnotationPresentAction(AnnotatedElement element,
Class<? extends Annotation> annotationClazz)
Return a PrivilegeAction object for AnnotatedElement.isAnnotationPresent(). |
|
static PrivilegedAction<Boolean> |
isDirectoryAction(File f)
Return a PrivilegeAction object for f.isDirectory(). |
|
static PrivilegedAction<Boolean> |
isFileAction(File f)
Return a PrivilegeAction object for f.isFile(). |
|
static PrivilegedAction<Long> |
lengthAction(File f)
Return a PrivilegeAction object for f.length(). |
|
static PrivilegedAction<File[]> |
listFilesAction(File f)
Return a PrivilegeAction object for f.listFiles(). |
|
static PrivilegedAction<serp.bytecode.BCClass> |
loadProjectClassAction(serp.bytecode.Project project,
Class<?> clazz)
Return a PrivilegeAction object for Project.loadClass(). |
|
static PrivilegedAction<serp.bytecode.BCClass> |
loadProjectClassAction(serp.bytecode.Project project,
String clazzName)
Return a PrivilegeAction object for Project.loadClass(). |
|
static PrivilegedAction<Boolean> |
mkdirsAction(File f)
Return a PrivilegeAction object for f.mkdirs(). |
|
static PrivilegedAction<serp.bytecode.BCClassLoader> |
newBCClassLoaderAction(serp.bytecode.Project project)
|
|
static PrivilegedAction<serp.bytecode.BCClassLoader> |
newBCClassLoaderAction(serp.bytecode.Project project,
ClassLoader parent)
Return a PrivilegeAction object for new BCClassLoader(). |
|
static PrivilegedAction<serp.bytecode.Code> |
newCodeAction()
Return a PrivilegeAction object for new serp.bytecode.Code(). |
|
static PrivilegedAction<Thread> |
newDaemonThreadAction(Runnable target,
String name)
Return a PrivilegedAction object for new Thread(). |
|
static PrivilegedExceptionAction<FileInputStream> |
newFileInputStreamAction(File f)
Return a PrivilegedExceptionAction object for new FileInputStream(). |
|
static PrivilegedExceptionAction<FileOutputStream> |
newFileOutputStreamAction(File f)
Return a PrivilegedExceptionAction object for new FileOutputStream(). |
|
static PrivilegedExceptionAction<FileOutputStream> |
newFileOutputStreamAction(String f,
boolean append)
Return a PrivilegedExceptionAction object for new FileOutputStream(). |
|
static
|
newInstanceAction(Class<T> clazz)
Return a PrivilegedExceptionAction object for clazz.newInstance(). |
|
static PrivilegedAction<MultiClassLoader> |
newMultiClassLoaderAction()
Return a PrivilegeAction object for new MultiClassLoader(). |
|
static PrivilegedExceptionAction<ServerSocket> |
newServerSocketAction(int port)
Return a PrivilegedExceptionAction object for new ServerSocket(). |
|
static PrivilegedExceptionAction<Socket> |
newSocketAction(InetAddress host,
int port)
Return a PrivilegedExceptionAction object for new Socket(). |
|
static PrivilegedAction<TemporaryClassLoader> |
newTemporaryClassLoaderAction(ClassLoader parent)
Return a PrivilegeAction object for new TemporaryClassLoader(). |
|
static PrivilegedExceptionAction<ZipFile> |
newZipFileAction(File f)
Return a PrivilegedExceptionAction object for new ZipFile(). |
|
static PrivilegedExceptionAction<InputStream> |
openStreamAction(URL url)
Return a PrivilegedExceptionAction object for url.openStream(). |
|
static PrivilegedAction<Boolean> |
renameToAction(File from,
File to)
Return a PrivilegeAction object for f.renameTo(). |
|
static PrivilegedAction<Object> |
setAccessibleAction(AccessibleObject aObj,
boolean flag)
Return a PrivilegeAction object for aObj.setAccessible(). |
|
static PrivilegedAction<Boolean> |
setContextClassLoaderAction(ClassLoader loader)
Return a PrivilegeAction object for Thread.currentThread .setContextClassLoader(). |
|
static PrivilegedExceptionAction<URL> |
toURLAction(File file)
Return a PrivilegedExceptionAction object for f.toURL(). |
|
static
|
validateAction(Validator validator,
T arg0,
Class<?>[] groups)
Return a PrivilegeAction object for javax.validation.Validator.validate(). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public J2DoPrivHelper()
Method Detail |
---|
public static final String getLineSeparator()
public static final String getPathSeparator()
public static final PrivilegedAction<Object> setAccessibleAction(AccessibleObject aObj, boolean flag)
public static final PrivilegedExceptionAction<Class<?>> getForNameAction(String className, boolean initializeBoolean, ClassLoader classLoader)
public static final PrivilegedAction<ClassLoader> getClassLoaderAction(Class<?> clazz)
public static final PrivilegedExceptionAction<Field> getDeclaredFieldAction(Class<?> clazz, String name)
NoSuchFieldException
public static final PrivilegedAction<Field[]> getDeclaredFieldsAction(Class<?> clazz)
public static final PrivilegedExceptionAction<Method> getDeclaredMethodAction(Class<?> clazz, String name, Class<?>[] parameterTypes)
NoSuchMethodException
public static final PrivilegedAction<Method[]> getDeclaredMethodsAction(Class<?> clazz)
public static final PrivilegedAction<URL> getResourceAction(Class<?> clazz, String resource)
public static final <T> PrivilegedExceptionAction<T> newInstanceAction(Class<T> clazz) throws IllegalAccessException, InstantiationException
IllegalAccessException
InstantiationException
public static final PrivilegedAction<ClassLoader> getParentAction(ClassLoader loader)
public static final PrivilegedAction<URL> getResourceAction(ClassLoader loader, String resource)
public static final PrivilegedExceptionAction<Enumeration<URL>> getResourcesAction(ClassLoader loader, String resource) throws IOException
IOException
public static final PrivilegedAction<ClassLoader> getSystemClassLoaderAction()
public static final PrivilegedAction<Boolean> deleteAction(File f)
public static final PrivilegedAction<Boolean> existsAction(File f)
public static final PrivilegedAction<Boolean> deleteOnExitAction(File f)
public static final PrivilegedAction<File> getAbsoluteFileAction(File f)
public static final PrivilegedAction<String> getAbsolutePathAction(File f)
public static final PrivilegedExceptionAction<String> getCanonicalPathAction(File f) throws IOException
IOException
public static final PrivilegedAction<Boolean> isDirectoryAction(File f)
public static final PrivilegedAction<Boolean> isFileAction(File f)
public static final PrivilegedAction<Long> lengthAction(File f)
public static final PrivilegedAction<File[]> listFilesAction(File f)
public static final PrivilegedAction<Boolean> mkdirsAction(File f)
public static final PrivilegedAction<Boolean> renameToAction(File from, File to)
public static final PrivilegedExceptionAction<URL> toURLAction(File file) throws MalformedURLException
MalformedURLException
public static final PrivilegedExceptionAction<FileInputStream> newFileInputStreamAction(File f) throws FileNotFoundException
FileNotFoundException
public static final PrivilegedExceptionAction<FileOutputStream> newFileOutputStreamAction(File f) throws FileNotFoundException
FileNotFoundException
public static final PrivilegedExceptionAction<FileOutputStream> newFileOutputStreamAction(String f, boolean append) throws FileNotFoundException
FileNotFoundException
public static final PrivilegedExceptionAction<InetAddress> getByNameAction(String hostname) throws UnknownHostException
UnknownHostException
public static final PrivilegedExceptionAction<Socket> newSocketAction(InetAddress host, int port) throws IOException
IOException
public static final PrivilegedExceptionAction<ServerSocket> newServerSocketAction(int port) throws IOException
IOException
public static final PrivilegedExceptionAction<Socket> acceptAction(ServerSocket ss) throws IOException
IOException
public static final PrivilegedAction<Properties> getPropertiesAction()
public static final PrivilegedAction<String> getPropertyAction(String name)
public static final PrivilegedAction<String> getPropertyAction(String name, String def)
public static final PrivilegedAction<ClassLoader> getContextClassLoaderAction()
public static final PrivilegedAction<Boolean> setContextClassLoaderAction(ClassLoader loader)
public static final PrivilegedAction<Thread> newDaemonThreadAction(Runnable target, String name)
public static final PrivilegedExceptionAction<InputStream> openStreamAction(URL url) throws IOException
IOException
public static final PrivilegedExceptionAction<Object> getContentAction(URLConnection con) throws IOException
IOException
public static final PrivilegedExceptionAction<ZipFile> newZipFileAction(File f) throws IOException
IOException
public static final PrivilegedExceptionAction<JarFile> getJarFileAction(JarURLConnection con) throws IOException
IOException
public static final PrivilegedExceptionAction<JarEntry> getJarEntryAction(JarURLConnection con) throws IOException
IOException
public static final PrivilegedAction<serp.bytecode.Code> newCodeAction()
public static final PrivilegedAction<TemporaryClassLoader> newTemporaryClassLoaderAction(ClassLoader parent)
public static final PrivilegedAction<MultiClassLoader> newMultiClassLoaderAction()
public static final PrivilegedAction<serp.bytecode.BCClassLoader> newBCClassLoaderAction(serp.bytecode.Project project, ClassLoader parent)
public static final PrivilegedAction<serp.bytecode.BCClassLoader> newBCClassLoaderAction(serp.bytecode.Project project)
public static final PrivilegedAction<serp.bytecode.BCField[]> getBCClassFieldsAction(serp.bytecode.BCClass bcClass, String fieldName)
public static final PrivilegedAction<serp.bytecode.BCField> getFieldInstructionFieldAction(serp.bytecode.FieldInstruction instruction)
public static final PrivilegedAction<serp.bytecode.BCClass> loadProjectClassAction(serp.bytecode.Project project, Class<?> clazz)
public static final PrivilegedAction<serp.bytecode.BCClass> loadProjectClassAction(serp.bytecode.Project project, String clazzName)
public static final PrivilegedAction<Annotation[]> getAnnotationsAction(AnnotatedElement element)
public static final PrivilegedAction<Annotation[]> getDeclaredAnnotationsAction(AnnotatedElement element)
public static final PrivilegedAction<Boolean> isAnnotationPresentAction(AnnotatedElement element, Class<? extends Annotation> annotationClazz)
public static final <T extends Annotation> PrivilegedAction<T> getAnnotationAction(AnnotatedElement element, Class<T> annotationClazz)
public static final <T> PrivilegedAction<Set<ConstraintViolation<T>>> validateAction(Validator validator, T arg0, Class<?>[] groups)
public static final <T> PrivilegedAction<ValidatorFactory> buildDefaultValidatorFactoryAction()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |