1 8 package org.apache.avalon.phoenix.components.embeddor; 9 10 import java.io.File ; 11 import org.apache.avalon.framework.component.Component; 12 import org.apache.avalon.framework.component.ComponentException; 13 import org.apache.avalon.framework.component.ComponentManager; 14 import org.apache.avalon.phoenix.interfaces.Application; 15 16 29 public class SingleAppEmbeddor 30 extends DefaultEmbeddor 31 implements ComponentManager 32 { 33 private Application m_application; 35 36 41 protected void deployDefaultApplications() 42 throws Exception 43 { 44 final String applicationName = 45 getParameters().getParameter( "application-name", "default" ); 46 final String applicationLocation = getParameters().getParameter( "application-location" ); 47 final File directory = new File ( applicationLocation ); 48 deployFile( applicationName, directory ); 49 m_application = getKernel().getApplication( applicationName ); 50 } 51 52 57 public String [] list() 58 { 59 return m_application.getBlockNames(); 60 } 61 62 67 public Component lookup( final String role ) 68 throws ComponentException 69 { 70 final Object component = m_application.getBlock( role ); 71 if( null == component ) 72 { 73 throw new ComponentException( role, "Could not find component" ); 74 } 75 return (Component)component; 76 } 77 78 public boolean hasComponent( final String role ) 79 { 80 return (null != m_application.getBlock( role )); 81 } 82 83 88 public void release( final Component component ) 89 { 90 } 91 } 92 | Popular Tags |