本文整理汇总了Java中org.jivesoftware.util.ClassUtils.forName方法的典型用法代码示例。如果您正苦于以下问题:Java ClassUtils.forName方法的具体用法?Java ClassUtils.forName怎么用?Java ClassUtils.forName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.util.ClassUtils
的用法示例。
在下文中一共展示了ClassUtils.forName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initProvider
import org.jivesoftware.util.ClassUtils; //导入方法依赖的package包/类
/**
* Initializes the server's admin provider, based on configuration and defaults to
* DefaultAdminProvider if the specified provider is not valid or not specified.
*/
private void initProvider() {
// Convert XML based provider setup to Database based
JiveGlobals.migrateProperty("provider.admin.className");
String className = JiveGlobals.getProperty("provider.admin.className",
"org.jivesoftware.openfire.admin.DefaultAdminProvider");
// Check if we need to reset the provider class
if (provider == null || !className.equals(provider.getClass().getName())) {
try {
Class c = ClassUtils.forName(className);
provider = (AdminProvider) c.newInstance();
}
catch (Exception e) {
Log.error("Error loading admin provider: " + className, e);
provider = new DefaultAdminProvider();
}
}
}
示例2: initProvider
import org.jivesoftware.util.ClassUtils; //导入方法依赖的package包/类
private void initProvider() {
// Convert XML based provider setup to Database based
JiveGlobals.migrateProperty("provider.group.className");
// Load a group provider.
String className = JiveGlobals.getProperty("provider.group.className",
"org.jivesoftware.openfire.group.DefaultGroupProvider");
try {
Class c = ClassUtils.forName(className);
provider = (GroupProvider) c.newInstance();
}
catch (Exception e) {
Log.error("Error loading group provider: " + className, e);
provider = new DefaultGroupProvider();
}
}
示例3: initProvider
import org.jivesoftware.util.ClassUtils; //导入方法依赖的package包/类
private void initProvider() {
JiveGlobals.migrateProperty("provider.roster.className");
String className = JiveGlobals.getProperty("provider.roster.className",
"org.jivesoftware.openfire.roster.DefaultRosterItemProvider");
if (provider == null || !className.equals(provider.getClass().getName())) {
try {
Class c = ClassUtils.forName(className);
provider = (RosterItemProvider) c.newInstance();
}
catch (Exception e) {
Log.error("Error loading roster provider: " + className, e);
provider = new DefaultRosterItemProvider();
}
}
}
示例4: instantiate
import org.jivesoftware.util.ClassUtils; //导入方法依赖的package包/类
/**
* Instantiates a UserPropertyProvider based on a property value (that is expected to be a class name). When the
* property is not set, this method returns null. When the property is set, but an exception occurs while
* instantiating the class, this method logs the error and returns null.
*
* UserProvider classes are required to have a public, no-argument constructor.
*
* @param propertyName A property name (cannot ben ull).
* @return A user provider (can be null).
*/
public static UserPropertyProvider instantiate( String propertyName )
{
final String className = JiveGlobals.getProperty( propertyName );
if ( className == null )
{
Log.debug( "Property '{}' is undefined. Skipping.", propertyName );
return null;
}
Log.debug( "About to to instantiate an UserPropertyProvider '{}' based on the value of property '{}'.", className, propertyName );
try
{
final Class c = ClassUtils.forName( className );
final UserPropertyProvider provider = (UserPropertyProvider) c.newInstance();
Log.debug( "Instantiated UserPropertyProvider '{}'", className );
return provider;
}
catch ( Exception e )
{
Log.error( "Unable to load UserPropertyProvider '{}'. Users in this provider will be disabled.", className, e );
return null;
}
}
示例5: initProvider
import org.jivesoftware.util.ClassUtils; //导入方法依赖的package包/类
private void initProvider() {
// Convert XML based provider setup to Database based
JiveGlobals.migrateProperty("provider.user.className");
String className = JiveGlobals.getProperty("provider.user.className",
"org.jivesoftware.openfire.user.DefaultUserProvider");
// Check if we need to reset the provider class
if (provider == null || !className.equals(provider.getClass().getName())) {
try {
Class c = ClassUtils.forName(className);
provider = (UserProvider) c.newInstance();
}
catch (Exception e) {
Log.error("Error loading user provider: " + className, e);
provider = new DefaultUserProvider();
}
}
}
示例6: initProvider
import org.jivesoftware.util.ClassUtils; //导入方法依赖的package包/类
private static void initProvider() {
// Convert XML based provider setup to Database based
JiveGlobals.migrateProperty("provider.auth.className");
String className = JiveGlobals.getProperty("provider.auth.className",
"org.jivesoftware.openfire.auth.DefaultAuthProvider");
// Check if we need to reset the auth provider class
if (authProvider == null || !className.equals(authProvider.getClass().getName())) {
try {
Class c = ClassUtils.forName(className);
authProvider = (AuthProvider)c.newInstance();
}
catch (Exception e) {
Log.error("Error loading auth provider: " + className, e);
authProvider = new DefaultAuthProvider();
}
}
}
示例7: instantiateProvider
import org.jivesoftware.util.ClassUtils; //导入方法依赖的package包/类
protected static AuthProvider instantiateProvider( String propertyName )
{
final String className = JiveGlobals.getProperty( propertyName );
if ( className == null )
{
throw new IllegalStateException( "A class name must be specified via openfire.xml or the system properties." );
}
try
{
final Class c = ClassUtils.forName( className );
return (AuthProvider) c.newInstance();
}
catch ( Exception e )
{
throw new IllegalStateException( "Unable to create new instance of AuthProvider: " + className, e );
}
}
示例8: initialize
import org.jivesoftware.util.ClassUtils; //导入方法依赖的package包/类
@Override
public void initialize(XMPPServer server) {
instance = this;
// Convert XML based provider setup to Database based
JiveGlobals.migrateProperty("provider.vcard.className");
// Load a VCard provider.
String className = JiveGlobals.getProperty("provider.vcard.className",
DefaultVCardProvider.class.getName());
try {
Class c = ClassUtils.forName(className);
provider = (VCardProvider) c.newInstance();
}
catch (Exception e) {
Log.error("Error loading vcard provider: " + className, e);
provider = new DefaultVCardProvider();
}
}
示例9: initProvider
import org.jivesoftware.util.ClassUtils; //导入方法依赖的package包/类
/**
* Initializes the server's lock out provider, based on configuration and defaults to
* DefaultLockOutProvider if the specified provider is not valid or not specified.
*/
private void initProvider() {
// Convert XML based provider setup to Database based
JiveGlobals.migrateProperty("provider.lockout.className");
String className = JiveGlobals.getProperty("provider.lockout.className",
"org.jivesoftware.openfire.lockout.DefaultLockOutProvider");
// Check if we need to reset the provider class
if (provider == null || !className.equals(provider.getClass().getName())) {
try {
Class c = ClassUtils.forName(className);
provider = (LockOutProvider) c.newInstance();
}
catch (Exception e) {
Log.error("Error loading lockout provider: " + className, e);
provider = new DefaultLockOutProvider();
}
}
}
示例10: ensureConnectionProvider
import org.jivesoftware.util.ClassUtils; //导入方法依赖的package包/类
/**
* Ensures that the connection provider exists and is set
*/
private static void ensureConnectionProvider() {
if (connectionProvider != null) return;
synchronized (providerLock) {
if (connectionProvider != null) return;
// Attempt to load the connection provider classname as a Jive property.
String className = JiveGlobals.getXMLProperty("connectionProvider.className");
if (className != null) {
// Attempt to load the class.
try {
Class conClass = ClassUtils.forName(className);
setConnectionProvider((ConnectionProvider)conClass.newInstance());
} catch (Exception e) {
Log.warn("Failed to create the " +
"connection provider specified by connection" +
"Provider.className. Using the default pool.", e);
setConnectionProvider(new DefaultConnectionProvider());
}
} else {
setConnectionProvider(new DefaultConnectionProvider());
}
}
}
示例11: initProvider
import org.jivesoftware.util.ClassUtils; //导入方法依赖的package包/类
/**
* Initializes the server's security audit provider, based on configuration and defaults to
* DefaultSecurityAuditProvider if the specified provider is not valid or not specified.
*/
private void initProvider() {
// Convert XML based provider setup to Database based
JiveGlobals.migrateProperty("provider.securityAudit.className");
String className = JiveGlobals.getProperty("provider.securityAudit.className",
"org.jivesoftware.openfire.security.DefaultSecurityAuditProvider");
// Check if we need to reset the provider class
if (provider == null || !className.equals(provider.getClass().getName())) {
try {
Class c = ClassUtils.forName(className);
provider = (SecurityAuditProvider) c.newInstance();
}
catch (Exception e) {
Log.error("Error loading security audit provider: " + className, e);
provider = new DefaultSecurityAuditProvider();
}
}
}
示例12: createProxyTransfer
import org.jivesoftware.util.ClassUtils; //导入方法依赖的package包/类
private ProxyTransfer createProxyTransfer(String transferDigest, Socket targetSocket)
throws IOException {
ProxyTransfer provider;
try {
Class c = ClassUtils.forName(className);
provider = (ProxyTransfer) c.newInstance();
}
catch (Exception e) {
Log.error("Error loading proxy transfer provider: " + className, e);
provider = new DefaultProxyTransfer();
}
provider.setTransferDigest(transferDigest);
provider.setOutputStream(targetSocket.getOutputStream());
return provider;
}
示例13: loadClass
import org.jivesoftware.util.ClassUtils; //导入方法依赖的package包/类
private Class loadClass(String className) throws ClassNotFoundException {
try {
return ClassUtils.forName(className);
}
catch (ClassNotFoundException e) {
return this.getClass().getClassLoader().loadClass(className);
}
}
示例14: loadClass
import org.jivesoftware.util.ClassUtils; //导入方法依赖的package包/类
private static Class loadClass(String className) throws ClassNotFoundException {
try {
return ClassUtils.forName(className);
}
catch (ClassNotFoundException e) {
return WorkgroupUtils.class.getClassLoader().loadClass(className);
}
}
示例15: AuthCheckFilter
import org.jivesoftware.util.ClassUtils; //导入方法依赖的package包/类
AuthCheckFilter(final AdminManager adminManager, final LoginLimitManager loginLimitManager, final String servletRequestAuthenticatorClassName) {
this.adminManager = adminManager;
this.loginLimitManager = loginLimitManager;
AuthCheckFilter.instance = this;
ServletRequestAuthenticator authenticator = null;
if (!servletRequestAuthenticatorClassName.isEmpty()) {
try {
final Class clazz = ClassUtils.forName(servletRequestAuthenticatorClassName);
authenticator = (ServletRequestAuthenticator) clazz.newInstance();
} catch (final Exception e) {
Log.error("Error loading ServletRequestAuthenticator: " + servletRequestAuthenticatorClassName, e);
}
}
this.servletRequestAuthenticator = authenticator;
}