From: Gautam J. <ga...@us...> - 2007-07-30 23:56:49
|
Update of /cvsroot/jaffa/JaffaCore/source/java/org/jaffa/presentation/portlet/component In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv26373/source/java/org/jaffa/presentation/portlet/component Modified Files: ComponentManager.java Log Message: Undid the previous change. Instead the component Loader class has been modified to display an INFO message, if a component does not have any mandatory-function Index: ComponentManager.java =================================================================== RCS file: /cvsroot/jaffa/JaffaCore/source/java/org/jaffa/presentation/portlet/component/ComponentManager.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ComponentManager.java 30 Jul 2007 23:26:32 -0000 1.7 --- ComponentManager.java 30 Jul 2007 23:56:37 -0000 1.8 *************** *** 63,70 **** public class ComponentManager { private static Logger log = Logger.getLogger(ComponentManager.class); ! // This field will hold a cache of ComponentDefinitions private static Map c_componentPool = null; ! /** Creates an instance of the named component. This component is then added to the UserSession. This may throw the runtime ComponentCreationRuntimeException * @param comp The name of the component to create. There should be a valid definition for this name in the 'components.xml' file --- 63,70 ---- public class ComponentManager { private static Logger log = Logger.getLogger(ComponentManager.class); ! // This field will hold a cache of ComponentDefinitions private static Map c_componentPool = null; ! /** Creates an instance of the named component. This component is then added to the UserSession. This may throw the runtime ComponentCreationRuntimeException * @param comp The name of the component to create. There should be a valid definition for this name in the 'components.xml' file *************** *** 76,84 **** log.debug("Create Component " + comp + " for user " + (us==null?"null":us.getUserId())); try { ! // see if this user has access to this component if(!SecurityManager.checkComponentAccess(comp)) throw new AccessControlException("No Access To Component " + comp); ! //Find the Definition ComponentDefinition cd = find(comp); --- 76,84 ---- log.debug("Create Component " + comp + " for user " + (us==null?"null":us.getUserId())); try { ! // see if this user has access to this component if(!SecurityManager.checkComponentAccess(comp)) throw new AccessControlException("No Access To Component " + comp); ! //Find the Definition ComponentDefinition cd = find(comp); *************** *** 89,96 **** throw new ComponentCreationRuntimeException(str); } ! // Get the ClassObject of the component Class clazz = Class.forName( cd.getComponentClass() ); ! // Create an instance of the component Component compInst = (Component) clazz.newInstance(); --- 89,96 ---- throw new ComponentCreationRuntimeException(str); } ! // Get the ClassObject of the component Class clazz = Class.forName( cd.getComponentClass() ); ! // Create an instance of the component Component compInst = (Component) clazz.newInstance(); *************** *** 98,102 **** compInst.setComponentDefinition(cd); compInst.setUserSession(us); ! // Add the component to the UserSession us.addComponent(compInst); --- 98,102 ---- compInst.setComponentDefinition(cd); compInst.setUserSession(us); ! // Add the component to the UserSession us.addComponent(compInst); *************** *** 118,124 **** } } ! ! ! /** Locate the named component. This routine uses a cache of ComponentDefinitions. * If the cache has not been initialized, this will initialize it by reading in --- 118,124 ---- } } ! ! ! /** Locate the named component. This routine uses a cache of ComponentDefinitions. * If the cache has not been initialized, this will initialize it by reading in *************** *** 129,137 **** */ public static ComponentDefinition find(String comp) { ! // Make sure the pool is loaded if(c_componentPool == null) { c_componentPool = Loader.buildComponentPool(); ! // Bail if the pool did not get loaded if(c_componentPool == null) { --- 129,137 ---- */ public static ComponentDefinition find(String comp) { ! // Make sure the pool is loaded if(c_componentPool == null) { c_componentPool = Loader.buildComponentPool(); ! // Bail if the pool did not get loaded if(c_componentPool == null) { *************** *** 143,147 **** } } ! if(c_componentPool.containsKey(comp)) return (ComponentDefinition) c_componentPool.get(comp); --- 143,147 ---- } } ! if(c_componentPool.containsKey(comp)) return (ComponentDefinition) c_componentPool.get(comp); *************** *** 153,158 **** } } ! ! /** Get the component requirements, this is Map of mandatory business functions * that a user must have access to, to run this component. Each entry in the map is a --- 153,158 ---- } } ! ! /** Get the component requirements, this is Map of mandatory business functions * that a user must have access to, to run this component. Each entry in the map is a *************** *** 165,169 **** public static Map getComponentRequirements() { HashMap m = new HashMap(); ! // Make sure the pool is loaded if(c_componentPool == null) { --- 165,169 ---- public static Map getComponentRequirements() { HashMap m = new HashMap(); ! // Make sure the pool is loaded if(c_componentPool == null) { *************** *** 174,183 **** return m; } ! if(log.isDebugEnabled()) { log.debug("Loaded Component Definitions - Total=" + c_componentPool.size()); } } ! // Loop through all the definitions for(Iterator it = c_componentPool.keySet().iterator(); it.hasNext();) { --- 174,183 ---- return m; } ! if(log.isDebugEnabled()) { log.debug("Loaded Component Definitions - Total=" + c_componentPool.size()); } } ! // Loop through all the definitions for(Iterator it = c_componentPool.keySet().iterator(); it.hasNext();) { *************** *** 187,197 **** if(funcs != null && funcs.length!=0) m.put(comp,funcs); ! else { ! if (log.isInfoEnabled()) ! log.info("Component '" + comp + "' does not have any mandatory-function"); m.put(comp, null); - } } ! return m; } --- 187,194 ---- if(funcs != null && funcs.length!=0) m.put(comp,funcs); ! else m.put(comp, null); } ! return m; } |