Permalink
Browse files

Remove checksum fail so in case that provisioning fails next start wi…

…ll re-provision automatically
  • Loading branch information...
1 parent 09921de commit 0c9895e7c0b2b1cbe2878087e20546aa1ce58444 @adreghiciu adreghiciu committed Dec 18, 2011
@@ -104,9 +104,9 @@ public Object addingService( final ServiceReference serviceReference )
}
catch ( Exception e )
{
- System.out.println( "Problem found during provisioning. See log for details." );
if ( Boolean.valueOf( (String) serviceReference.getProperty( "exit-on-error" ) ) )
{
+ System.setProperty( "provision-error", e.getMessage() );
try
{
bundleContext.getBundle( 0 ).stop();
@@ -114,6 +114,14 @@ private void boot()
final FrameworkEvent event = framework.waitForStop( 0 );
if ( event.getType() != FrameworkEvent.STOPPED_UPDATE )
{
+ final String provisionError = System.getProperty( "provision-error" );
+ if ( provisionError != null )
+ {
+ System.out.println(
+ "Problem found during provisioning (" + provisionError + "). See log for details."
+ );
+ removeChecksum( shellProperties );
+ }
break;
}
}
@@ -131,6 +139,13 @@ private void saveChecksum( final Properties shellProperties, final Properties bu
fileWrite( checksumFile, SHA1( properties ) );
}
+ private void removeChecksum( final Properties shellProperties )
+ throws Exception
+ {
+ final File checksumFile = new File( new File( shellProperties.getProperty( PROFILE ) ), "checksum" );
+ checksumFile.delete();
+ }
+
private boolean shouldForceReset( final Properties shellProperties, final Properties bundleProperties )
{
final File checksumFile = new File( new File( shellProperties.getProperty( PROFILE ) ), "checksum" );

0 comments on commit 0c9895e

Please sign in to comment.