Package org.webappos.classloader
Class PropertiesClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- java.security.SecureClassLoader
-
- java.net.URLClassLoader
-
- org.webappos.classloader.PropertiesClassLoader
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class PropertiesClassLoader extends java.net.URLClassLoader
A custom webAppOS class loader used by server-side web processors to find classes of webAppOS apps, services, and engines. Takes into a consideration classpaths configured in app.properties, service.properties, and engine.properties, if those classpaths have been added usingaddClasspathsForPropertiesId(java.lang.String)
.- Author:
- Sergejs Kozlovics
-
-
Constructor Summary
Constructors Constructor Description PropertiesClassLoader()
PropertiesClassLoader(java.net.URL[] arg0)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addClasspathsForPropertiesId(java.lang.String id)
Adds Java classpaths configured for the given web app, web service or web library.java.lang.Class<?>
findClassByName(java.lang.String fullName)
Loads the given class taking into a consideration classpaths added usingaddClasspathsForPropertiesId(java.lang.String)
.java.lang.String
getClasspathsForPropertiesId(java.lang.String id)
Returns a string of classpaths configured for the given app, service or engine.void
loadLuaClasses(java.lang.String path)
-
Methods inherited from class java.net.URLClassLoader
addURL, close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Method Detail
-
findClassByName
public java.lang.Class<?> findClassByName(java.lang.String fullName)
Loads the given class taking into a consideration classpaths added usingaddClasspathsForPropertiesId(java.lang.String)
.- Parameters:
fullName
- class full name, e.g., "org.example.MyClass"- Returns:
- the loaded Java class, or null on error
-
addClasspathsForPropertiesId
public void addClasspathsForPropertiesId(java.lang.String id)
Adds Java classpaths configured for the given web app, web service or web library.- Parameters:
id
- [appName].webapp or [serviceName].webservice or [libName].weblibrary
-
getClasspathsForPropertiesId
public java.lang.String getClasspathsForPropertiesId(java.lang.String id)
Returns a string of classpaths configured for the given app, service or engine. The string can be passed to JVM.- Parameters:
id
- [appName].webapp or [serviceName].webservice or [libName].weblibrary- Returns:
- a string of classpaths that can be directly passed to JVM
-
loadLuaClasses
public void loadLuaClasses(java.lang.String path)
-
-