001 /* 002 * JBoss, Home of Professional Open Source. 003 * Copyright 2008, Red Hat Middleware LLC, and individual contributors 004 * as indicated by the @author tags. See the copyright.txt file in the 005 * distribution for a full listing of individual contributors. 006 * 007 * This is free software; you can redistribute it and/or modify it 008 * under the terms of the GNU Lesser General Public License as 009 * published by the Free Software Foundation; either version 2.1 of 010 * the License, or (at your option) any later version. 011 * 012 * This software is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * You should have received a copy of the GNU Lesser General Public 018 * License along with this software; if not, write to the Free 019 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 020 * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 021 */ 022 package org.jboss.dna.graph; 023 024 import java.security.AccessControlContext; 025 import javax.security.auth.Subject; 026 import javax.security.auth.login.LoginContext; 027 import org.jboss.dna.common.component.ClassLoaderFactory; 028 import org.jboss.dna.common.util.Logger; 029 import org.jboss.dna.graph.properties.NamespaceRegistry; 030 import org.jboss.dna.graph.properties.Property; 031 import org.jboss.dna.graph.properties.PropertyFactory; 032 import org.jboss.dna.graph.properties.ValueFactories; 033 034 /** 035 * An ExecutionContext is a representation of the environment or context in which a component or operation is operating. Some 036 * components require this context to be passed into individual methods, allowing the context to vary with each method invocation. 037 * Other components require the context to be provided before it's used, and will use that context for all its operations (until 038 * it is given a different one). 039 * 040 * @author Randall Hauch 041 * @author John Verhaeg 042 * @see ExecutionContextFactory 043 */ 044 public interface ExecutionContext extends ClassLoaderFactory { 045 046 /** 047 * @return the access control context; may be <code>null</code> 048 */ 049 AccessControlContext getAccessControlContext(); 050 051 /** 052 * @return the login context; may be <code>null</code> 053 */ 054 LoginContext getLoginContext(); 055 056 /** 057 * Get the factories that should be used to create values for {@link Property properties}. 058 * 059 * @return the property value factory; never null 060 */ 061 ValueFactories getValueFactories(); 062 063 /** 064 * Get the namespace registry for this context. 065 * 066 * @return the namespace registry; never null 067 */ 068 NamespaceRegistry getNamespaceRegistry(); 069 070 /** 071 * Get the factory for creating {@link Property} objects. 072 * 073 * @return the property factory; never null 074 */ 075 PropertyFactory getPropertyFactory(); 076 077 /** 078 * Get the JAAS subject for which this context was created. 079 * 080 * @return the subject; never null 081 */ 082 Subject getSubject(); 083 084 /** 085 * Return a logger associated with this context. This logger records only those activities within the context and provide a 086 * way to capture the context-specific activities. All log messages are also sent to the system logger, so classes that log 087 * via this mechanism should <i>not</i> also {@link Logger#getLogger(Class) obtain a system logger}. 088 * 089 * @param clazz the class that is doing the logging 090 * @return the logger, named after <code>clazz</code>; never null 091 * @see #getLogger(String) 092 */ 093 Logger getLogger( Class<?> clazz ); 094 095 /** 096 * Return a logger associated with this context. This logger records only those activities within the context and provide a 097 * way to capture the context-specific activities. All log messages are also sent to the system logger, so classes that log 098 * via this mechanism should <i>not</i> also {@link Logger#getLogger(Class) obtain a system logger}. 099 * 100 * @param name the name for the logger 101 * @return the logger, named after <code>clazz</code>; never null 102 * @see #getLogger(Class) 103 */ 104 Logger getLogger( String name ); 105 }