📄 configuration.java
字号:
} /** Constructs a list of {@link EventThreadSuspend} instances and invokes * {@link EventThreadSuspend#beforeSuspend} for each relevant * listener registered by {@link #addListener}. * * <p>Used only internally. * * <p>Note: caller shall execute in the event processing thread. * * @param comp the component which the event is targeting * @param evt the event to process * @param obj which object that {@link Executions#wait} * is called with. * @exception UiException to prevent a thread from suspending * @return a list of {@link EventThreadSuspend}, or null */ public List newEventThreadSuspends(Component comp, Event evt, Object obj) { if (_evtSusps.isEmpty()) return null; //it is OK to test LinkedList.isEmpty without synchronized final List suspends = new LinkedList(); synchronized (_evtSusps) { for (Iterator it = _evtSusps.iterator(); it.hasNext();) { final Class klass = (Class)it.next(); try { final EventThreadSuspend suspend = (EventThreadSuspend)klass.newInstance(); suspend.beforeSuspend(comp, evt, obj); suspends.add(suspend); } catch (Throwable ex) { throw UiException.Aide.wrap(ex); //Don't intercept; to prevent the event being suspended } } } return suspends; } /** Invokes {@link EventThreadSuspend#afterSuspend} for each relevant * listener registered by {@link #addListener}. * Unlike {@link #invokeEventThreadSuspends}, caller shall execute in * the main thread (aka, servlet thread). * * <p>Used only internally. * * <p>Unlike {@link #invokeEventThreadSuspends}, exceptions are logged * and ignored. * * @param suspends a list of {@link EventThreadSuspend} instances returned * from {@link #newEventThreadSuspends}, or null if no instance at all. * @param comp the component which the event is targeting * @param evt the event to process */ public void invokeEventThreadSuspends(List suspends, Component comp, Event evt) throws UiException { if (suspends == null || suspends.isEmpty()) return; for (Iterator it = suspends.iterator(); it.hasNext();) { final EventThreadSuspend fn = (EventThreadSuspend)it.next(); try { fn.afterSuspend(comp, evt); } catch (Throwable ex) { log.error("Failed to invoke "+fn+" after suspended", ex); } } } /** Contructs a list of {@link EventThreadResume} instances and invokes * {@link EventThreadResume#beforeResume} for each relevant * listener registered by {@link #addListener}. * * <p>Used only internally (by {@link UiEngine} when resuming a suspended event * thread). * Notice: it executes in the main thread (i.e., the servlet thread). * * @param comp the component which the event is targeting * @param evt the event to process * @exception UiException to prevent a thread from being resumed * if {@link EventThreadResume#beforeResume} throws an exception * @return a list of {@link EventThreadResume} instances that are constructed * in this method (and their {@link EventThreadResume#beforeResume} * are called successfully), or null. */ public List newEventThreadResumes(Component comp, Event evt) throws UiException { if (_evtResus.isEmpty()) return null; //it is OK to test LinkedList.isEmpty without synchronized final List resumes = new LinkedList(); synchronized (_evtResus) { for (Iterator it = _evtResus.iterator(); it.hasNext();) { final Class klass = (Class)it.next(); try { final EventThreadResume resume = (EventThreadResume)klass.newInstance(); resume.beforeResume(comp, evt); resumes.add(resume); } catch (Throwable ex) { throw UiException.Aide.wrap(ex); //Don't intercept; to prevent the event being resumed } } } return resumes; } /** Invokes {@link EventThreadResume#afterResume} for each instance returned * by {@link #newEventThreadResumes}. * * <p>Used only internally. * * <p>It never throws an exception but logs and adds it to the errs argument, * if not null. * * @param resumes a list of {@link EventThreadResume} instances returned from * {@link #newEventThreadResumes}, or null if no instance at all. * @param comp the component which the event is targeting * @param evt the event to process * If null, all exceptions are ignored (but logged) */ public void invokeEventThreadResumes(List resumes, Component comp, Event evt) throws UiException { if (resumes == null || resumes.isEmpty()) return; for (Iterator it = resumes.iterator(); it.hasNext();) { final EventThreadResume fn = (EventThreadResume)it.next(); try { fn.afterResume(comp, evt); } catch (Throwable ex) { throw UiException.Aide.wrap(ex); } } } /** Invokes {@link EventThreadResume#abortResume} for each relevant * listener registered by {@link #addListener}. * * <p>Used only internally. * * <p>An instance of {@link EventThreadResume} is constructed first, * and then invoke {@link EventThreadResume#abortResume}. * * <p>It never throws an exception but logging. * * @param comp the component which the event is targeting * @param evt the event to process */ public void invokeEventThreadResumeAborts(Component comp, Event evt) { if (_evtResus.isEmpty()) return; //it is OK to test LinkedList.isEmpty without synchronized synchronized (_evtResus) { for (Iterator it = _evtResus.iterator(); it.hasNext();) { final Class klass = (Class)it.next(); try { ((EventThreadResume)klass.newInstance()) .abortResume(comp, evt); } catch (Throwable ex) { log.error("Failed to invoke "+klass+" for aborting", ex); } } } } /** Invokes {@link WebAppInit#init} for each relevant * listener registered by {@link #addListener}. * * <p>Used only internally. * * <p>An instance of {@link WebAppInit} is constructed first, * and then invoke {@link WebAppInit#init}. * * <p>Unlike {@link #invokeWebAppInits}, it doesn't throw any exceptions. * Rather, it only logs them. */ public void invokeWebAppInits() throws UiException { if (_appInits.isEmpty()) return; //it is OK to test LinkedList.isEmpty without synchronized synchronized (_appInits) { for (Iterator it = _appInits.iterator(); it.hasNext();) { final Class klass = (Class)it.next(); try { ((WebAppInit)klass.newInstance()).init(_wapp); } catch (Throwable ex) { log.error("Failed to invoke "+klass, ex); } } } } /** Invokes {@link WebAppCleanup#cleanup} for each relevant * listener registered by {@link #addListener}. * * <p>Used only internally. * * <p>An instance of {@link WebAppCleanup} is constructed first, * and then invoke {@link WebAppCleanup#cleanup}. * * <p>It never throws an exception. */ public void invokeWebAppCleanups() { if (_appCleans.isEmpty()) return; //it is OK to test LinkedList.isEmpty without synchronized synchronized (_appCleans) { for (Iterator it = _appCleans.iterator(); it.hasNext();) { final Class klass = (Class)it.next(); try { ((WebAppCleanup)klass.newInstance()).cleanup(_wapp); } catch (Throwable ex) { log.error("Failed to invoke "+klass, ex); } } } } /** Invokes {@link SessionInit#init} for each relevant * listener registered by {@link #addListener}. * * <p>Used only internally. * * <p>An instance of {@link SessionInit} is constructed first, * and then invoke {@link SessionInit#init}. * * @param sess the session that is created * @exception UiException to prevent a session from being created */ public void invokeSessionInits(Session sess) throws UiException { if (_sessInits.isEmpty()) return; //it is OK to test LinkedList.isEmpty without synchronized synchronized (_sessInits) { for (Iterator it = _sessInits.iterator(); it.hasNext();) { final Class klass = (Class)it.next(); try { ((SessionInit)klass.newInstance()).init(sess); } catch (Throwable ex) { throw UiException.Aide.wrap(ex); //Don't intercept; to prevent the creation of a session } } } } /** Invokes {@link SessionCleanup#cleanup} for each relevant * listener registered by {@link #addListener}. * * <p>Used only internally. * * <p>An instance of {@link SessionCleanup} is constructed first, * and then invoke {@link SessionCleanup#cleanup}. * * <p>It never throws an exception. * * @param sess the session that is being destroyed */ public void invokeSessionCleanups(Session sess) { if (_sessCleans.isEmpty()) return; //it is OK to test LinkedList.isEmpty without synchronized synchronized (_sessCleans) { for (Iterator it = _sessCleans.iterator(); it.hasNext();) { final Class klass = (Class)it.next(); try { ((SessionCleanup)klass.newInstance()).cleanup(sess); } catch (Throwable ex) { log.error("Failed to invoke "+klass, ex); } } } } /** Invokes {@link DesktopInit#init} for each relevant * listener registered by {@link #addListener}. * * <p>Used only internally. * * <p>An instance of {@link DesktopInit} is constructed first, * and then invoke {@link DesktopInit#init}. * * @param desktop the desktop that is created * @exception UiException to prevent a desktop from being created */ public void invokeDesktopInits(Desktop desktop) throws UiException { if (_dtInits.isEmpty()) return; //it is OK to test LinkedList.isEmpty without synchronized synchronized (_dtInits) { for (Iterator it = _dtInits.iterator(); it.hasNext();) { final Class klass = (Class)it.next(); try { ((DesktopInit)klass.newInstance()).init(desktop); } catch (Throwable ex) { throw UiException.Aide.wrap(ex); //Don't intercept; to prevent the creation of a session } } } } /** Invokes {@link DesktopCleanup#cleanup} for each relevant * listener registered by {@link #addListener}. * * <p>Used only internally. * * <p>An instance of {@link DesktopCleanup} is constructed first, * and then invoke {@link DesktopCleanup#cleanup}. * * <p>It never throws an exception. * * @param desktop the desktop that is being destroyed */ public void invokeDesktopCleanups(Desktop desktop) { if (_dtCleans.isEmpty()) return; //it is OK to test LinkedList.isEmpty without synchronized synchronized (_dtCleans) { for (Iterator it = _dtCleans.iterator(); it.hasNext();) { final Class klass = (Class)it.next(); try { ((DesktopCleanup)klass.newInstance()).cleanup(desktop); } catch (Throwable ex) { log.error("Failed to invoke "+klass, ex); } } } } /** Invokes {@link ExecutionInit#init} for each relevant * listener registered by {@link #addListener}. * * <p>Used only internally. * * <p>An instance of {@link ExecutionInit} is constructed first, * and then invoke {@link ExecutionInit#init}. * * @param exec the execution that is created * @param parent the previous execution, or null if no previous at all * @exception UiException to prevent an execution from being created */ public void invokeExecutionInits(Execution exec, Execution parent) throws UiException { if (_execInits.isEmpty()) return; //it is OK to test LinkedList.isEmpty without synchronized synchronized (_execInits) { for (Iterator it = _execInits.iterator(); it.hasNext();) { final Class klass = (Class)it.next(); try { ((ExecutionInit)klass.newInstance()).init(exec, parent); } catch (Throwable ex) { throw UiException.Aide.wrap(ex); //Don't intercept; to prevent the creation of a session } } } } /** Invokes {@link ExecutionCleanup#cleanup} for each relevant * listener registered by {@link #addListener}. * * <p>Used only internally. * * <p>An instance of {@link ExecutionCleanup} is constructed first, * and then invoke {@link ExecutionCleanup#cleanup}. * * <p>It never throws an exception but logs and adds it to the errs argument, * if not null. * * @param exec the execution that is being destroyed * @param parent the previous execution, or null if no previous at all * @param errs a list of exceptions (java.lang.Throwable) if any exception * occured before this method is called, or null if no exeption at all. * Note: you can manipulate the list directly to add or clean up exceptions. * For example, if exceptions are fixed correctly, you can call errs.clear() * such that no error message will be displayed at the client. */ public void invokeExecutionCleanups(Execution exec, Execution parent, List errs) { if (_execCleans.isEmpty()) return; //it is OK to test LinkedList.isEmpty without synchronized synchronized (_execCleans) { for (Iterator it = _execCleans.iterator(); it.hasNext();) { final Class klass = (Class)it.next(); try { ((ExecutionCleanup)klass.newInstance()) .cleanup(exec, parent, errs); } catch (Throwable ex) { log.error("Failed to invoke "+klass, ex); if (errs != null) errs.add(ex); } } } } /** Invokes {@link URIInterceptor#request} for each relevant listner * registered by {@link #addListener}. * * <p>Used only internally. * * <p>If any of them throws an exception, the exception is propogated to * the caller. * * @exception UiException if it is rejected by the interceptor. * Use {@link UiException#getCause} to retrieve the cause. */ public void invokeURIInterceptors(String uri) { if (_uriIntcps.isEmpty()) return; synchronized (_uriIntcps) { for (Iterator it = _uriIntcps.iterator(); it.hasNext();) { try { ((URIInterceptor)it.next()).request(uri); } catch (Exception ex) { throw UiException.Aide.wrap(ex); } } } } /** Invokes {@link RequestInterceptor#request} for each relevant listner * registered by {@link #addListener}. * * <p>Used only internally. * * <p>If any of them throws an exception, the exception is propogated to * the caller. * * @exception UiException if it is rejected by the interceptor. * Use {@link UiException#getCause} to retrieve the cause. */ public void invokeRequestInterceptors(Session sess, Object request, Object response) { if (_reqIntcps.isEmpty()) return; synchronized (_reqIntcps) { for (Iterator it = _reqIntcps.iterator(); it.hasNext();) { try { ((RequestInterceptor)it.next()) .request(sess, request, response); } catch (Exception ex) { throw UiException.Aide.wrap(ex); } } } } /** Adds an CSS resource that will be generated for each ZUML desktop. * * <p>Note: if {@link ThemeProvider} is specified ({@link #setThemeProvider}), * the final theme URIs generated depend on {@link ThemeProvider#getThemeURIs}. */ public void addThemeURI(String uri) { if (uri == null || uri.length() == 0) throw new IllegalArgumentException("empty"); synchronized (_themeURIs) { _themeURIs.add(uri); _roThemeURIs = (String[])_themeURIs.toArray(new String[_themeURIs.size()]); } } /** Returns a readonly list of the URI of the CSS resources that will be * generated for each ZUML desktop (never null). * * <p>Default: an array with zero length. */ public String[] getThemeURIs() { return _roThemeURIs; } /** Enables or disables the default theme of the specified language. * * <p>Note: if {@link ThemeProvider} is specified ({@link #setThemeProvider}), * the final theme URIs generated depend on {@link ThemeProvider#getThemeURIs}. * * @param uri the theme URI to disable * @since 3.0.0 */ public void addDisabledThemeURI(String uri) { if (uri == null || uri.length() == 0) throw new IllegalArgumentException();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -