@Override public void reload() throws IndyDataException { // NOTE: Call to super for this, because the local implementation DELETES THE DB DIR!!! super.clear( new ChangeSummary( ChangeSummary.SYSTEM_USER, "Reloading from storage" ) ); readDefinitions(); }
private String buildMessage( final ChangeSummary summary, final Collection<String> paths ) { final StringBuilder message = new StringBuilder().append( summary.getSummary() ); if ( config.isCommitFileManifestsEnabled() ) { message.append( "\n\nFiles changed:\n" ) .append( join( paths, "\n" ) ); } return message.toString(); }
public GitManager deletePaths( final ChangeSummary summary, final Collection<String> paths ) throws GitSubsystemException { lockAnd(me->{ try { RmCommand rm = git.rm(); for ( final String path : paths ) { rm = rm.addFilepattern( path ); } logger.info( "Deleting:\n " + join( paths, "\n " ) + "\n\nSummary: " + summary ); rm.call(); changelogEntries.add( new ChangelogEntry( summary.getUser(), buildMessage( summary, paths ), paths ) ); } catch ( final NoFilepatternException e ) { throw new GitSubsystemException( "Cannot remove from git: " + e.getMessage(), e ); } catch ( final JGitInternalException | GitAPIException e ) { throw new GitSubsystemException( "Cannot remove from git: " + e.getMessage(), e ); } return me; }); return this; }
changelogEntries.add( new ChangelogEntry( summary.getUser(), buildMessage( summary, paths ), paths ) );
private ChangeSummary toChangeSummary( final RevCommit commit ) { final PersonIdent who = commit.getAuthorIdent(); final Date when = new Date( TimeUnit.MILLISECONDS.convert( commit.getCommitTime(), TimeUnit.SECONDS ) ); return new ChangeSummary( who.getName(), commit.getFullMessage(), when, commit.getId() .name() ); }
public void onLifecycleEvent( @Observes final IndyLifecycleEvent event ) { if ( !revisionsConfig.isEnabled() ) { return; } if ( IndyLifecycleEvent.Type.started == event.getType() ) { started = true; try { logger.info( "Indy started; committing externally changed files." ); ChangeSummary summary = new ChangeSummary( SYSTEM_USER, CATCHUP_CHANGELOG_MODIFIED ); dataFileGit.addExternallyChangedFiles( summary ); summary = new ChangeSummary( SYSTEM_USER, CATCHUP_CHANGELOG_DELETED ); dataFileGit.deleteExternallyRemovedFiles( summary ); dataFileGit.commit(); if ( revisionsConfig.isPushEnabled() ) { dataFileGit.pushUpdates(); } } catch ( final GitSubsystemException e ) { logger.error( "Failed to commit pre-existing uncommitted changes in revisions manager: " + e.getMessage(), e ); } } }
final ChangeSummary changeSummary = new ChangeSummary( ChangeSummary.SYSTEM_USER, String.format( "Disabling %s due to error: %s\n\nStack Trace:\n %s", key, error, StringUtils.join( error.getStackTrace(), "\n " ) ) );
storeDataManager.storeArtifactStore( store, new ChangeSummary( ChangeSummary.SYSTEM_USER, "Re-enabling " + key ), false, true, new EventMetadata() );
private void processChanged( final ArtifactStore store ) { final StoreKey key = store.getKey(); try { final Set<Group> groups = storeDataManager.query().getGroupsContaining( key ); logger.trace( "For repo: {}, containing groups are: {}", key, groups ); for ( final Group group : groups ) { logger.debug( "Removing {} from membership of group: {}", key, group.getKey() ); Group g = group.copyOf(); g.removeConstituent( key ); storeDataManager.storeArtifactStore( g, new ChangeSummary( ChangeSummary.SYSTEM_USER, "Auto-update groups containing: " + key + " (to maintain consistency)" ), false, false, new EventMetadata().set( StoreDataManager.EVENT_ORIGIN, GROUP_CONSISTENCY_ORIGIN ) ); } } catch ( final IndyDataException e ) { logger.error( String.format( "Failed to remove group constituent listings for: %s. Error: %s", key, e.getMessage() ), e ); } }
.mkdirs(); settingsXml.writeString( rendered, "UTF-8", new ChangeSummary( ChangeSummary.SYSTEM_USER, "SETBACK: Updating generated SetBack settings.xml for: " + key ) );
public boolean store( final ArtifactStore store, final String user, final boolean skipExisting ) throws IndyWorkflowException { try { String changelog = store.getMetadata( ArtifactStore.METADATA_CHANGELOG ); if ( changelog == null ) { changelog = "Changelog not provided"; } final ChangeSummary summary = new ChangeSummary( user, changelog ); logger.info( "Persisting artifact store: {} using: {}", store, storeManager ); return storeManager.storeArtifactStore( store, summary, skipExisting, true, new EventMetadata() ); } catch ( final IndyDataException e ) { throw new IndyWorkflowException( ApplicationStatus.SERVER_ERROR.code(), "Failed to store: {}. Reason: {}", e, store.getKey(), e.getMessage() ); } }
new ChangeSummary( ChangeSummary.SYSTEM_USER, "Migrating legacy store definitions." );
storeDataManager.storeArtifactStore( repo, new ChangeSummary( ChangeSummary.SYSTEM_USER, "Adding implied-repository origin metadata" ), false, true, new EventMetadata() );
job.transfer.getPath() ); final ChangeSummary summary = new ChangeSummary( ChangeSummary.SYSTEM_USER, changelog ); try
StringUtils.join( job.implied, "\n " ) ); final ChangeSummary summary = new ChangeSummary( ChangeSummary.SYSTEM_USER, message ); for ( final Group g : groups )
public void delete( final StoreKey key, final String user, final String changelog ) throws IndyWorkflowException { try { storeManager.deleteArtifactStore( key, new ChangeSummary( user, changelog ), new EventMetadata() ); } catch ( final IndyDataException e ) { int status = ApplicationStatus.SERVER_ERROR.code(); if ( e.getStatus() > 0 ) { status = e.getStatus(); } throw new IndyWorkflowException( status, "Failed to delete: {}. Reason: {}", e, key, e.getMessage() ); } }
new ChangeSummary( ChangeSummary.SYSTEM_USER, "Reading definitions from disk, culling invalid definition files." );
public boolean deleteStoreSettings( final ArtifactStore store ) throws SetBackDataException { if ( !config.isEnabled() ) { throw new SetBackDataException( "SetBack is disabled!" ); } final StoreKey key = store.getKey(); if ( StoreType.hosted == key.getType() ) { return false; } final DataFile settingsXml = getSettingsXml( key ); if ( settingsXml.exists() ) { try { settingsXml.delete( new ChangeSummary( ChangeSummary.SYSTEM_USER, "SETBACK: Deleting generated SetBack settings.xml for: " + store ) ); } catch ( final IOException e ) { throw new SetBackDataException( "Failed to delete SetBack settings.xml for: %s.\n at: %s\n Reason: %s", e, store, settingsXml, e.getMessage() ); } return true; } return false; }
addPaths( new ChangeSummary( SYSTEM_USER, "Committing pre-existing files." ), preExistingFromCreate ); commit();
@Override public void install() throws IndyDataException { if ( !manager.getDataFile( INDY_STORE ) .isDirectory() ) { final ChangeSummary summary = new ChangeSummary( ChangeSummary.SYSTEM_USER, "Initializing defaults" ); storeArtifactStore( new RemoteRepository( MAVEN_PKG_KEY, "central", "http://repo.maven.apache.org/maven2/" ), summary, true, false, new EventMetadata() ); storeArtifactStore( new Group( MAVEN_PKG_KEY, "public", new StoreKey( StoreType.remote, "central" ) ), summary, true, false, new EventMetadata() ); } }