public String getName() { return name == null ? Seam.getComponentName(componentClass) : name; }
public static JBossClusterMonitor getInstance(ServletContext ctx) { return (JBossClusterMonitor) ctx.getAttribute(Seam.getComponentName(JBossClusterMonitor.class)); } }
public static String getComponentName(Class<?> clazz) { String componentName = Seam.getComponentName(clazz); if (componentName==null) { throw new IllegalArgumentException("No @Name annotation for class: " + clazz.getName()); } return componentName; }
public IdentityRequestWrapper(HttpServletRequest request) { super(request); identity = (Identity) request.getSession(). getAttribute(Seam.getComponentName(Identity.class)); }
public static Set<String> getHotDeployableComponents(HttpServletRequest httpRequest) { ServletContext servletContext = httpRequest.getSession().getServletContext(); Init init = (Init) servletContext.getAttribute(Seam.getComponentName(Init.class)); return init.getHotDeployableComponents(); }
public void redeploy(HttpServletRequest request) throws InterruptedException { redeploy(request, (Init) servletContext.getAttribute( Seam.getComponentName(Init.class) )); }
private Map<Locale, List<ResourceBundle>> getCachedBundle() { Init init; if(Contexts.isApplicationContextActive()) { init = (Init)Contexts.getApplicationContext().get(Seam.getComponentName(Init.class)); } else { //not sure if this is nessesary init = (Init)Lifecycle.getApplication().get(Seam.getComponentName(Init.class)); } if(!bundleCache.containsKey(init)) { bundleCache.put(init, new ConcurrentHashMap<Locale, List<ResourceBundle>>()); } return bundleCache.get(init); }
protected void initPermissionStore() { if (permissionStore == null) { permissionStore = (PermissionStore) Component.getInstance(JpaPermissionStore.class, true); } if (permissionStore == null) { log.warn("no permission store available - please install a PermissionStore with the name '" + Seam.getComponentName(JpaPermissionStore.class) + "' if persistent permissions are required."); } }
private void initNamespace(String componentName, Context applicationContext) { if (applicationContext!=null) { //for unit tests! Init init = (Init) applicationContext.get(Seam.getComponentName(Init.class)); if (init!=null) { this.namespace = init.initNamespaceForName(componentName, true); } } }
name = Seam.getComponentName(cls);
name = Seam.getComponentName(cls);
public static Set<String> reloadSeamComponents(HttpServletRequest httpRequest) { ServletContext servletContext = httpRequest.getSession().getServletContext(); Init init = (Init) servletContext.getAttribute(Seam.getComponentName(Init.class)); if (init.hasHotDeployableComponents()) { try { new Initialization(servletContext).redeploy(httpRequest); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new NuxeoException(e); } } // re-initialized by re-deployment, why removing ? // servletContext.removeAttribute(Seam.getComponentName(Pages.class)); return init.getHotDeployableComponents(); }
public void set(String name, Object value) { // We can't raise a preSetVariable event for Events itself because it doesn't exist yet... if ( !Seam.getComponentName(Events.class).equals(name) && Events.exists() ) { Events.instance().raiseEvent("org.jboss.seam.preSetVariable." + name); } map.put(name, value); if ( Events.exists() ) Events.instance().raiseEvent("org.jboss.seam.postSetVariable." + name); }
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (request instanceof HttpServletRequest) { Init init = (Init) getServletContext().getAttribute(Seam.getComponentName(Init.class)); if (init != null) { try { new Initialization(getServletContext()).redeploy((HttpServletRequest) request, init); } catch (InterruptedException e) { log.warn("Unable to redeploy, please try again"); } } } chain.doFilter(request, response); }
protected void installMockTransport() { Contexts.getApplicationContext().set(Seam.getComponentName(MailSession.class), new MailSession("mock").create()); }
private void initImports(Context applicationContext) { if (applicationContext!=null) //for unit tests! { Init init = (Init) applicationContext.get( Seam.getComponentName(Init.class) ); if (init!=null) { if ( getBeanClass().isAnnotationPresent(Import.class) ) { addImport( init, getBeanClass().getAnnotation(Import.class) ); } Package pkg = getBeanClass().getPackage(); if ( pkg!=null && pkg.isAnnotationPresent(Import.class) ) { addImport( init, getBeanClass().getPackage().getAnnotation(Import.class) ); } } } }
private List<Pattern> getAllPatterns() { List<Pattern> allPatterns = new ArrayList<Pattern>(); Pages pages = (Pages) getServletContext().getAttribute(Seam.getComponentName(Pages.class)); if (pages != null) { Collection<String> ids = pages.getKnownViewIds(); for (String id: ids) { Page page = pages.getPage(id); allPatterns.addAll(page.getRewritePatterns()); } } else { log.warn("Pages is null for incoming request!"); } ServletMapping mapping = new ServletMapping(getViewMapping()); for (Pattern pattern: allPatterns) { pattern.setViewMapping(mapping); } return allPatterns; }
String componentName = Seam.getComponentName((Class) target); target = componentName != null ? componentName : ((Class) target).getName();
Init init = (Init) applicationContext.get( Seam.getComponentName(Init.class) ); if (init!=null)
/** * Boot Seam. Can be used at class, test group or suite level (e.g. * @BeforeClass, @BeforeTest, @BeforeSuite) * Use in conjunction with {@link #stopSeam()}. * @throws Exception */ protected void startSeam() throws Exception { if (realServletContext == null && MockSeamListener.getServletContext() != null) { realServletContext = MockSeamListener.getServletContext(); } // If the Seam Filter is already initialized, we can grab the real servlet context if (realServletContext == null && ServletLifecycle.getServletContext() != null) { realServletContext = ServletLifecycle.getServletContext(); } ServletContext realContext = realServletContext; this.servletContext = createServletContext(realContext); ServletLifecycle.beginApplication(servletContext); FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY, MockApplicationFactory.class.getName()); new Initialization(servletContext).create().init(); ((Init) servletContext.getAttribute(Seam.getComponentName(Init.class))).setDebug(false); }