Package net.hasor.core

Examples of net.hasor.core.AppContext


public class Simple_DeleteJDBCTest {
    @Test
    public void simple_DeleteJDBCTest() throws SQLException {
        System.out.println("--->>simple_DeleteJDBCTest<<--");
        //
        AppContext app = Hasor.createAppContext("net/test/simple/db/jdbc-config.xml", new OneDataSourceWarp());
        JdbcTemplate jdbc = app.getInstance(JdbcTemplate.class);
        //
    }
View Full Code Here


*/
public class CustomAnnoAopTest {
    @Test
    public void customAnnoAopTest() throws IOException, URISyntaxException, InterruptedException {
        System.out.println("--->>customAnnoAopTest<<--");
        AppContext appContext = Hasor.createAppContext(new WarpAnnoAop());
        //
        FooBean fooBean1 = appContext.getInstance(FooBean.class);
        FooBean fooBean2 = appContext.getInstance(CustomAnnoFooBean.class);
        //
        System.out.println("---fooBean1.fooCall()---");
        fooBean1.fooCall();
        System.out.println("---fooBean2.fooCall()---");
        fooBean2.fooCall();
View Full Code Here

*/
public class AopTest {
    @Test
    public void aopTest() throws IOException, URISyntaxException, InterruptedException {
        System.out.println("--->>aopTest<<--");
        AppContext appContext = Hasor.createAppContext(new WarpAop());
        //
        FooBean fooBean = appContext.getInstance(FooBean.class);
        fooBean.fooCall();
    }
View Full Code Here

        this.loadAnnoSettings(apiBinder);
        //
        final Environment env = apiBinder.getEnvironment();
        apiBinder.pushListener(ContextEvent_Started, new EventListener() {
            public void onEvent(String event, Object[] params) {
                AppContext appContext = (AppContext) params[0];
                List<Provider<SettingsListener>> settingProvider = appContext.findBindingProvider(SettingsListener.class);
                if (settingProvider == null)
                    return;
                for (Provider<SettingsListener> provider : settingProvider) {
                    SettingsListener target = provider.get();
                    target.reload(appContext.getSettings());
                    env.addSettingsListener(target);
                    Hasor.logInfo("%s SettingsListener created.", target);
                }
            }
        });
View Full Code Here

* @version : 2013-12-24
* @author 赵永春(zyc@hasor.net)
*/
public class Functions {
    protected static AppContext getAppContext() {
        AppContext appContext = RuntimeListener.getLocalAppContext();
        if (appContext != null) {
            return appContext;
        }
        throw new NullPointerException("AppContext is undefined.");
    }
View Full Code Here

public abstract class AbstractHasorTag extends TagSupport {
    private static final long serialVersionUID = 954597728447849929L;
    //
    protected AppContext getAppContext() {
        ServletContext sc = this.pageContext.getServletContext();
        AppContext appContext = (AppContext) sc.getAttribute(RuntimeListener.AppContextName);
        if (appContext != null) {
            return appContext;
        }
        throw new NullPointerException("AppContext is undefined.");
    }
View Full Code Here

    private static ContextClassLoaderLocal<File>             CacheDir         = new ContextClassLoaderLocal<File>();
    private Map<String, ReadWriteLock>                       cachingRes       = new HashMap<String, ReadWriteLock>();
    private boolean                                          isDebug;
    //
    public synchronized void init(ServletConfig config) throws ServletException {
        AppContext appContext = RuntimeListener.getLocalAppContext();
        this.isDebug = appContext.getEnvironment().isDebug();
        //
        ResourceLoader[] resLoaderArray = LoaderList.get();
        if (resLoaderArray != null)
            return;
        ResourceLoaderFactory factory = appContext.getInstance(ResourceLoaderFactory.class);
        resLoaderArray = factory.loaderArray(appContext);
        if (resLoaderArray != null && resLoaderArray.length != 0)
            LoaderList.set(resLoaderArray);
    }
View Full Code Here

*/
class ControllerFilter implements Filter {
    private RootController rootController = null;
    //
    public void init(FilterConfig filterConfig) throws ServletException {
        AppContext appContext = RuntimeListener.getLocalAppContext();
        this.rootController = appContext.getInstance(RootController.class);
        if (this.rootController == null) {
            throw new NullPointerException("RootController is null.");
        }
    }
View Full Code Here

TOP

Related Classes of net.hasor.core.AppContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.