public SeamPhaseListener() { if (exists) { log.warn("There should only be one Seam phase listener per application"); } exists=true; }
protected void setContextClassLoader() { // JBSEAM-3555 Quick fix // Set the context classloader to the cached one originalClassLoader = Thread.currentThread().getContextClassLoader(); ServletContext ctx = request.getSession().getServletContext(); WeakReference<ClassLoader> ref = (WeakReference<ClassLoader>)ctx.getAttribute("seam.context.classLoader"); if (ref == null || ref.get() == null) { log.warn("Failed to bootstrap context classloader. Facelets may not work properly from MDBs"); } else { Thread.currentThread().setContextClassLoader(ref.get()); } }
public void setSearchScope(String value) { if ("OBJECT_SCOPE".equals(value)) { searchScope = SearchControls.OBJECT_SCOPE; } else if ("ONELEVEL_SCOPE".equals(value)) { searchScope = SearchControls.ONELEVEL_SCOPE; } else { searchScope = SearchControls.SUBTREE_SCOPE; if (!"SUBTREE_SCOPE".equals(value)) { log.warn("Invalid search scope specified (" + value + ") - search scope set to SUBTREE_SCOPE"); } } }
private void checkSerializableForComponentType() { boolean serializableScope = scope==PAGE || scope==SESSION || scope==CONVERSATION; boolean serializableType = type==JAVA_BEAN || type==ENTITY_BEAN; if ( serializableType && serializableScope && !Serializable.class.isAssignableFrom( getBeanClass() ) ) { log.warn("Component class should be serializable: " + name); } }
/** * Sanity check to warn users if they have disabled core interceptors */ public void checkDefaultInterceptors() { for (String defaultInterceptor : DEFAULT_INTERCEPTORS) { if (!interceptors.contains(defaultInterceptor)) { log.warn("The built-in interceptor " + defaultInterceptor + " is missing. This application may not function as expected"); } } if (distributable && !interceptors.contains(ManagedEntityInterceptor.class.getName())) { interceptors.add(ManagedEntityInterceptor.class.getName()); } }
protected void initIdentityStore() { // Default to JpaIdentityStore if (identityStore == null) { identityStore = (IdentityStore) Component.getInstance(JpaIdentityStore.class, true); } if (roleIdentityStore == null && identityStore != null) { roleIdentityStore = identityStore; } if (identityStore == null || roleIdentityStore == null) { log.warn("no identity store available - please configure an identityStore if identity " + "management is required."); } }
protected void add(EjbDescriptor descriptor) { try { Class ejbClass = componentClass.getClassLoader().loadClass( descriptor.getEjbClassName() ); ejbDescriptors.put(ejbClass, descriptor); } catch (ClassNotFoundException cnfe) { log.warn("Could not load EJB class: " + descriptor.getEjbClassName()); } } }
public void warn(Object object, Throwable t, Object... params) { if ( isWarnEnabled() ) { log.warn( interpolate(object, params), t ); } } public void error(Object object, Object... params)
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."); } }
@Create public void create() { if (permissionStore == null) { permissionStore = (PermissionStore) Component.getInstance(PERMISSION_STORE_COMPONENT_NAME, true); } if (permissionStore == null) { log.warn("no permission store available - please install a PermissionStore with the name '" + PERMISSION_STORE_COMPONENT_NAME + "' if permission management is required."); } }
public void warn(Object object, Object... params) { if ( isWarnEnabled() ) { log.warn( interpolate(object, params) ); } } public void warn(Object object, Throwable t, Object... params)
private NamespaceDescriptor resolveNamespace(String namespace) { if (Strings.isEmpty(namespace) || namespace.equals(COMPONENT_NAMESPACE)) { return null; } NamespaceDescriptor descriptor = namespaceMap.get(namespace); if (descriptor == null) { try { String packageName = namespacePackageResolver.resolve(namespace); descriptor = new NamespaceDescriptor(namespace, packageName); namespaceMap.put(namespace, descriptor); } catch (Exception e) { log.warn("Could not determine java package for namespace: " + namespace, e); } } return descriptor; }
private Application getApplication() { try { ApplicationFactory factory = (ApplicationFactory) FactoryFinder .getFactory(FactoryFinder.APPLICATION_FACTORY); return factory.getApplication(); } catch (IllegalStateException e) { log.warn("JSF is not properly initialized, see http://jira.jboss.org/jira/browse/JBSEAM-4401"); // just in case, for units and the like // if we can't do it, it just wan't meant to be return null; } } }
private void changeFlushModes() { for (String name: set) { PersistenceContextManager pcm = (PersistenceContextManager) Contexts.getConversationContext().get(name); if (pcm!=null) { try { pcm.changeFlushMode(flushMode); } catch (UnsupportedOperationException uoe) { // we won't be nasty and throw and exception, but we'll log a warning to the developer log.warn(uoe.getMessage()); } } } }
@Override public void afterCompletion(int status) { //Close the seam call we started if it is still active. if(ScopeType.APPLICATION.isContextActive()) { log.debug("Ending Transactional Seam Call"); Lifecycle.endCall(); } else { log.warn("Spring started a transactional Seam call but somebody else closed before it before the transaction committed."); } } }
public WarRootDeploymentStrategy(ClassLoader classLoader, File warRoot,ServletContext servletContext, File[] excludedDirectories) { this.classLoader = classLoader; this.servletContext = servletContext; this.warRoot = new File[1]; this.excludedDirectories = excludedDirectories; if (warRoot != null) { this.warRoot[0] = warRoot; getFiles().add(warRoot); } else { log.warn("Unable to discover war root, .page.xml files won't be found"); this.warRoot = new File[0]; } dotPageDotXmlDeploymentHandler = new DotPageDotXmlDeploymentHandler(); pagesDotXmlDeploymentHandler = new PagesDotXmlDeploymentHandler(); getDeploymentHandlers().put(DotPageDotXmlDeploymentHandler.NAME, dotPageDotXmlDeploymentHandler); getDeploymentHandlers().put(PagesDotXmlDeploymentHandler.NAME, pagesDotXmlDeploymentHandler); }
@Create public void initScheduler() throws SchedulerException { StdSchedulerFactory schedulerFactory = new StdSchedulerFactory(); //TODO: magical properties files are *not* the way to config Seam apps! InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("seam.quartz.properties"); if (is != null) { schedulerFactory.initialize(is); log.debug("Found seam.quartz.properties file. Using it for Quartz config."); } else { schedulerFactory.initialize(); log.warn("No seam.quartz.properties file. Using in-memory job store."); } scheduler = schedulerFactory.getScheduler(); scheduler.start(); }
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; }
public void sendContent(FacesContext context, String contentId) { try { DocumentData documentData = DocumentStore.instance().getDocumentData(contentId); if (documentData != null) { HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse(); response.setContentType(documentData.getDocumentType().getMimeType()); response.setHeader("Content-Disposition", documentData.getDisposition() + "; filename=\"" + documentData.getFileName() + "\""); documentData.writeDataToStream(response.getOutputStream()); context.responseComplete(); } } catch (IOException e) { log.warn(e); } }
void commitOrRollback(String phaseString) { try { if (Transaction.instance().isActive()) { try { log.debug("committing transaction " + phaseString); Transaction.instance().commit(); } catch (IllegalStateException e) { log.warn("TX commit failed with illegal state exception. This may be " + "because the tx timed out and was rolled back in the background.", e); } } else if ( Transaction.instance().isRolledBackOrMarkedRollback()) { log.debug("rolling back transaction " + phaseString); Transaction.instance().rollback(); } } catch (Exception e) { throw new IllegalStateException("Could not commit transaction", e); } }