当前位置: 首页>>代码示例>>Java>>正文


Java ClassUtils.forName方法代码示例

本文整理汇总了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();
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:23,代码来源:AdminManager.java

示例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();
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:17,代码来源:GroupManager.java

示例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();
        }
    }

}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:18,代码来源:RosterManager.java

示例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;
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:33,代码来源:MappedUserPropertyProvider.java

示例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();
        }
    }
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:19,代码来源:UserManager.java

示例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();
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:19,代码来源:AuthFactory.java

示例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 );
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:19,代码来源:AuthorizationBasedAuthProviderMapper.java

示例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();
       }
   }
 
开发者ID:coodeer,项目名称:g3server,代码行数:20,代码来源:VCardManager.java

示例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();
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:23,代码来源:LockOutManager.java

示例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());
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:28,代码来源:DbConnectionManager.java

示例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();
        }
    }
}
 
开发者ID:surevine,项目名称:openfire-bespoke,代码行数:23,代码来源:SecurityAuditManager.java

示例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;
}
 
开发者ID:surevine,项目名称:openfire-bespoke,代码行数:17,代码来源:ProxyConnectionManager.java

示例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);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:9,代码来源:InterceptorManager.java

示例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);
    }
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:9,代码来源:WorkgroupUtils.java

示例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;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:16,代码来源:AuthCheckFilter.java


注:本文中的org.jivesoftware.util.ClassUtils.forName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。