use of org.commonjava.indy.data.StoreEventDispatcher in project indy by Commonjava.
the class AbstractStoreDataManager method postDelete.
protected void postDelete(final ArtifactStore store, final ChangeSummary summary, final boolean fireEvents, final EventMetadata eventMetadata) throws IndyDataException {
StoreEventDispatcher dispatcher = getStoreEventDispatcher();
if (dispatcher != null && isStarted() && fireEvents) {
dispatcher.deleted(eventMetadata, store);
}
refreshAffectedBy(store, null, DELETE);
}
use of org.commonjava.indy.data.StoreEventDispatcher in project indy by Commonjava.
the class AbstractStoreDataManager method postStore.
protected void postStore(final ArtifactStore store, final ArtifactStore original, final ChangeSummary summary, final boolean exists, final boolean fireEvents, final EventMetadata eventMetadata) throws IndyDataException {
StoreEventDispatcher dispatcher = getStoreEventDispatcher();
if (dispatcher != null && isStarted() && fireEvents) {
logger.debug("Firing store post-update event for: {} (originally: {})", store, original);
dispatcher.updated(exists ? ArtifactStoreUpdateType.UPDATE : ArtifactStoreUpdateType.ADD, eventMetadata, Collections.singletonMap(store, original));
if (exists) {
if (store.isDisabled() && !original.isDisabled()) {
dispatcher.disabled(eventMetadata, store);
} else if (!store.isDisabled() && original.isDisabled()) {
dispatcher.enabled(eventMetadata, store);
}
}
}
// Hosted or Remote update does not change affectedBy relationships
if (store instanceof Group) {
refreshAffectedBy(store, original, STORE);
}
}
use of org.commonjava.indy.data.StoreEventDispatcher in project indy by Commonjava.
the class AbstractStoreDataManager method preDelete.
protected void preDelete(final ArtifactStore store, final ChangeSummary summary, final boolean fireEvents, final EventMetadata eventMetadata) throws IndyDataException {
StoreEventDispatcher dispatcher = getStoreEventDispatcher();
if (dispatcher != null && isStarted() && fireEvents) {
eventMetadata.set(StoreDataManager.CHANGE_SUMMARY, summary);
dispatcher.deleting(eventMetadata, store);
}
}
use of org.commonjava.indy.data.StoreEventDispatcher in project indy by Commonjava.
the class AbstractStoreDataManager method preStore.
protected void preStore(final ArtifactStore store, final ArtifactStore original, final ChangeSummary summary, final boolean exists, final boolean fireEvents, final EventMetadata eventMetadata) throws IndyDataException {
StoreEventDispatcher dispatcher = getStoreEventDispatcher();
if (dispatcher != null && isStarted() && fireEvents) {
logger.debug("Firing store pre-update event for: {} (originally: {})", store, original);
dispatcher.updating(exists ? ArtifactStoreUpdateType.UPDATE : ArtifactStoreUpdateType.ADD, eventMetadata, Collections.singletonMap(store, original));
if (exists) {
if (store.isDisabled() && !original.isDisabled()) {
dispatcher.disabling(eventMetadata, store);
} else if (!store.isDisabled() && original.isDisabled()) {
dispatcher.enabling(eventMetadata, store);
}
}
}
}
use of org.commonjava.indy.data.StoreEventDispatcher in project indy by Commonjava.
the class LegacyDataMigrationActionTest method setup.
@Before
public void setup() throws Exception {
dfm = new DataFileManager(temp.newFolder("stores"), new DataFileEventManager());
IndyObjectMapper mapper = new IndyObjectMapper(true);
final StoreEventDispatcher sed = new StoreEventDispatcherStub();
action = new LegacyDataMigrationAction(dfm, new DataFileStoreDataManager(dfm, mapper, sed), mapper);
}
Aggregations