Binder binder = new DefaultBinder();
try
{
AuthenticationInfo authnInfo = new AuthenticationInfo( args[1], args[2] );
AdministrationService adminService = binder.bind( AdministrationService.class, new URL( args[0] ), authnInfo );
PingService pingService = binder.bind( PingService.class, new URL( args[0] ), authnInfo );
System.out.println( "Ping : " + pingService.ping() );
List<ManagedRepository> managedRepos = adminService.getAllManagedRepositories();
System.out.println( "\n******** Managed Repositories ********" );
for( ManagedRepository managedRepo : managedRepos )
{
System.out.println( "=================================" );
System.out.println( "Id: " + managedRepo.getId() );
System.out.println( "Name: " + managedRepo.getName() );
System.out.println( "Layout: " + managedRepo.getLayout() );
System.out.println( "URL: " + managedRepo.getUrl() );
System.out.println( "Releases: " + managedRepo.isReleases() );
System.out.println( "Snapshots: " + managedRepo.isSnapshots() );
}
System.out.println( "\n******** Remote Repositories ********" );
List<RemoteRepository> remoteRepos = adminService.getAllRemoteRepositories();
for( RemoteRepository remoteRepo : remoteRepos )
{
System.out.println( "=================================" );
System.out.println( "Id: " + remoteRepo.getId() );
System.out.println( "Name: " + remoteRepo.getName() );
System.out.println( "Layout: " + remoteRepo.getLayout() );
System.out.println( "URL: " + remoteRepo.getUrl() );
}
System.out.println( "\n******** Repository Consumers ********" );
List<String> repoConsumers = adminService.getAllRepositoryConsumers();
for( String consumer : repoConsumers )
{
System.out.println( consumer );
}
System.out.println( "\n******** Database Consumers ********" );
List<String> dbConsumers = adminService.getAllDatabaseConsumers();
for( String consumer : dbConsumers )
{
System.out.println( consumer );
}
Boolean success = adminService.configureRepositoryConsumer( "internal", "repository-purge", true );
System.out.println( "\nConfigured repo consumer 'repository-purge' : " +
( (Boolean) success ).booleanValue() );
success = adminService.configureDatabaseConsumer( "update-db-bytecode-stats", false );
System.out.println( "\nConfigured db consumer 'update-db-bytecode-stats' : " +
( (Boolean) success ).booleanValue() );
success = adminService.executeRepositoryScanner( "internal" );
System.out.println( "\nExecuted repo scanner of repository 'internal' : " +
( (Boolean) success ).booleanValue() );
success = adminService.executeDatabaseScanner();
System.out.println( "\nExecuted database scanner : " + ( (Boolean) success ).booleanValue() );
/* delete artifact */
/*
* NOTE: before enabling & invoking deleteArtifact, make sure that the repository and artifact exists first!