Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
NEXUS-3056: added task and some cleanups.
Browse files Browse the repository at this point in the history
git-svn-id: file:///opt/svn/repositories/sonatype.org/nexus/trunk/nexus@5705 2aa8b3fc-8ebb-4439-a84f-95066eaea8ab
  • Loading branch information
cstamas committed Dec 10, 2009
1 parent 4805750 commit 6cab966
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 4 deletions.
2 changes: 1 addition & 1 deletion nexus-core-plugins/nexus-buup-plugin/pom.xml
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.sonatype.nexus.plugins</groupId>
<artifactId>nexus-core-plugins</artifactId>
<version>1.4.1-SNAPSHOT</version>
<version>1.4.2-SNAPSHOT</version>
</parent>

<artifactId>nexus-buup-plugin</artifactId>
Expand Down
@@ -0,0 +1,55 @@
package org.sonatype.nexus.buup;

import java.io.File;

import org.codehaus.plexus.component.annotations.Component;
import org.sonatype.nexus.scheduling.AbstractNexusTask;
import org.sonatype.scheduling.SchedulerTask;

@Component( role = SchedulerTask.class, hint = "BundleDownloadTask", instantiationStrategy = "per-lookup" )
public class BundleDownloadTask
extends AbstractNexusTask<Object>
{
private boolean successful;

private File targetDirectory;

public boolean isSuccessful()
{
return successful;
}

public File getTargetDirectory()
{
return targetDirectory;
}

public void setTargetDirectory( File targetDirectory )
{
this.targetDirectory = targetDirectory;
}

@Override
protected Object doRun()
throws Exception
{
// downloads bundle from somewhere (from where?)
// checks it's checksum (similar is applied as to maven artifacts)
// unzip it to targetDirectory

return null;
}

@Override
protected String getAction()
{
return "BUUP";
}

@Override
protected String getMessage()
{
return "Downloading bundle for OneClickUpgrade";
}

}
Expand Up @@ -10,6 +10,7 @@
import org.sonatype.nexus.buup.invoke.NexusBuupInvocationException;
import org.sonatype.nexus.buup.invoke.NexusBuupInvocationRequest;
import org.sonatype.nexus.buup.invoke.NexusBuupInvoker;
import org.sonatype.nexus.scheduling.NexusScheduler;

@Component( role = NexusBuupPlugin.class )
public class DefaultNexusBuupPlugin
Expand All @@ -18,6 +19,9 @@ public class DefaultNexusBuupPlugin
@Requirement
private NexusBuupInvoker invoker;

@Requirement
private NexusScheduler nexusScheduler;

@Requirement
private FSPermissionChecker permissionChecker;

Expand All @@ -33,6 +37,8 @@ public class DefaultNexusBuupPlugin
@Configuration( value = "${nexus-work}/upgrade-bundle" )
private File upgradeBundleDir;

private BundleDownloadTask downloadTask;

public void initiateBundleDownload()
throws IOException
{
Expand All @@ -47,13 +53,22 @@ public void initiateBundleDownload()
}

// start download thread
downloadTask = nexusScheduler.createTaskInstance( BundleDownloadTask.class );
downloadTask.setTargetDirectory( upgradeBundleDir );
nexusScheduler.submit( "Bundle Download", downloadTask );
}

public boolean isUpgradeProcessReady()
{
// check download thread is done, and check for exploded bundle dir content
// TODO Auto-generated method stub
return true;
if ( downloadTask != null && downloadTask.isSuccessful() )
{
// check for unziped files
return true;
}
else
{
return false;
}
}

public boolean initiateUpgradeProcess()
Expand Down

0 comments on commit 6cab966

Please sign in to comment.