1 17 18 package org.apache.avalon.fortress.impl.role; 19 20 import org.apache.avalon.fortress.MetaInfoEntry; 21 import org.apache.avalon.fortress.MetaInfoManager; 22 import org.apache.avalon.fortress.RoleEntry; 23 import org.apache.avalon.fortress.RoleManager; 24 25 31 public final class Role2MetaInfoManager implements MetaInfoManager 32 { 33 private final RoleManager m_manager; 34 private final MetaInfoManager m_parent; 35 36 public Role2MetaInfoManager( final RoleManager manager ) 37 { 38 this( manager, null ); 39 } 40 41 public Role2MetaInfoManager( final RoleManager manager, final MetaInfoManager parent ) 42 { 43 m_manager = manager; 44 m_parent = parent; 45 } 46 47 55 public MetaInfoEntry getMetaInfoForShortName( final String shortname ) 56 { 57 final RoleEntry roleEntry = m_manager.getRoleForShortName( shortname ); 58 59 if ( roleEntry != null ) 60 { 61 return new MetaInfoEntry( roleEntry ); 62 } 63 else 64 { 65 return null != m_parent ? m_parent.getMetaInfoForShortName(shortname ) : null; 66 } 67 } 68 69 79 public MetaInfoEntry getMetaInfoForClassname( final String classname ) 80 { 81 final RoleEntry roleEntry = m_manager.getRoleForClassname( classname ); 82 83 if ( roleEntry != null ) 84 { 85 return new MetaInfoEntry( roleEntry ); 86 } 87 else 88 { 89 return null != m_parent ? m_parent.getMetaInfoForClassname( classname ) : null; 90 } 91 } 92 } 93 | Popular Tags |