1 17 18 package tutorial; 19 20 import java.io.File ; 21 import java.util.Map ; 22 23 import org.apache.avalon.repository.Artifact; 24 import org.apache.avalon.repository.provider.Builder; 25 import org.apache.avalon.repository.provider.Factory; 26 import org.apache.avalon.repository.provider.InitialContextFactory; 27 import org.apache.avalon.repository.provider.InitialContext; 28 import org.apache.avalon.repository.main.DefaultInitialContextFactory; 29 import org.apache.avalon.repository.Artifact; 30 31 36 public class Main 37 { 38 public static void main( String [] args ) throws Exception 39 { 40 47 InitialContextFactory initial = 48 new DefaultInitialContextFactory( "merlin" ); 49 File home = initial.getHomeDirectory(); 50 initial.setCacheDirectory( new File ( home, "system" ) ); 51 InitialContext context = initial.createInitialContext(); 52 53 61 String spec = "artifact:merlin/merlin-impl#3.3-SNAPSHOT"; 62 Artifact artifact = Artifact.createArtifact( spec ); 63 Builder builder = context.newBuilder( artifact ); 64 65 75 Factory factory = builder.getFactory(); 76 Map criteria = factory.createDefaultCriteria(); 77 factory.create( criteria ); 78 } 79 } 80 | Popular Tags |