Define missing Change API events
Core gerrit has defined a place for events which are to be exposed as an API, and newer events have often been defined there. Gerrit also has older events that it fires for most important things which were designed for the stream events. Define newer events in the API to mirror the older events that were only defined for stream events. Use the new API objects (ChangeInfo...) when appropriate in these newer events. If we want to move the hooks and stream events to plugins, we want them to listen to modern API events. This change helps define these modern events. Change-Id: Ic1fe0743d048707a9a28f467b249dab70836f79c
This commit is contained in:

committed by
David Pursehouse

parent
301a3cbf3e
commit
32c126204b
@@ -0,0 +1,29 @@
|
||||
// Copyright (C) 2015 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.events;
|
||||
|
||||
import com.google.gerrit.extensions.annotations.ExtensionPoint;
|
||||
import com.google.gerrit.extensions.common.AccountInfo;
|
||||
|
||||
/** Notified whenever a user signed up for a Contributor License Agreement. */
|
||||
@ExtensionPoint
|
||||
public interface AgreementSignupListener {
|
||||
interface Event {
|
||||
AccountInfo getAccount();
|
||||
String getAgreementName();
|
||||
}
|
||||
|
||||
void onAgreementSignup(Event e);
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
// Copyright (C) 2015 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.events;
|
||||
|
||||
import com.google.gerrit.extensions.annotations.ExtensionPoint;
|
||||
import com.google.gerrit.extensions.common.AccountInfo;
|
||||
|
||||
/** Notified whenever a Change is abandoned. */
|
||||
@ExtensionPoint
|
||||
public interface ChangeAbandonedListener {
|
||||
interface Event extends RevisionEvent {
|
||||
AccountInfo getAbandoner();
|
||||
String getReason();
|
||||
}
|
||||
|
||||
void onChangeAbandoned(Event event);
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
// Copyright (C) 2015 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.events;
|
||||
|
||||
import com.google.gerrit.extensions.common.ChangeInfo;
|
||||
|
||||
/** Interface to be extendend by Events with a Change. */
|
||||
public interface ChangeEvent {
|
||||
ChangeInfo getChange();
|
||||
}
|
||||
|
@@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2015 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.events;
|
||||
|
||||
import com.google.gerrit.extensions.annotations.ExtensionPoint;
|
||||
import com.google.gerrit.extensions.common.AccountInfo;
|
||||
|
||||
/** Notified whenever a Change is merged. */
|
||||
@ExtensionPoint
|
||||
public interface ChangeMergedListener {
|
||||
interface Event extends RevisionEvent {
|
||||
AccountInfo getMerger();
|
||||
/**
|
||||
* Represents the merged Revision when the submit strategy is cherry-pick or
|
||||
* rebase-if-necessary.
|
||||
*/
|
||||
String getNewRevisionId();
|
||||
}
|
||||
|
||||
void onChangeMerged(Event event);
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
// Copyright (C) 2015 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.events;
|
||||
|
||||
import com.google.gerrit.extensions.annotations.ExtensionPoint;
|
||||
import com.google.gerrit.extensions.common.AccountInfo;
|
||||
|
||||
/** Notified whenever a Change is restored. */
|
||||
@ExtensionPoint
|
||||
public interface ChangeRestoredListener {
|
||||
interface Event extends RevisionEvent {
|
||||
AccountInfo getRestorer();
|
||||
String getReason();
|
||||
}
|
||||
|
||||
void onChangeRestored(Event event);
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2015 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.events;
|
||||
|
||||
import com.google.gerrit.extensions.annotations.ExtensionPoint;
|
||||
import com.google.gerrit.extensions.common.AccountInfo;
|
||||
import com.google.gerrit.extensions.common.ApprovalInfo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/** Notified whenever a comment is added to a change. */
|
||||
@ExtensionPoint
|
||||
public interface CommentAddedListener {
|
||||
interface Event extends RevisionEvent {
|
||||
AccountInfo getAuthor();
|
||||
String getComment();
|
||||
Map<String, ApprovalInfo> getApprovals();
|
||||
}
|
||||
|
||||
void onCommentAdded(Event event);
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
// Copyright (C) 2015 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.events;
|
||||
|
||||
import com.google.gerrit.extensions.annotations.ExtensionPoint;
|
||||
import com.google.gerrit.extensions.common.AccountInfo;
|
||||
|
||||
/** Notified whenever a Draft is published. */
|
||||
@ExtensionPoint
|
||||
public interface DraftPublishedListener {
|
||||
interface Event extends RevisionEvent {
|
||||
AccountInfo getPublisher();
|
||||
}
|
||||
|
||||
void onDraftPublished(Event event);
|
||||
}
|
@@ -23,7 +23,7 @@ import java.util.Properties;
|
||||
*/
|
||||
@ExtensionPoint
|
||||
public interface GarbageCollectorListener {
|
||||
public interface Event {
|
||||
interface Event {
|
||||
/** @return The name of the project that has been garbage collected. */
|
||||
String getProjectName();
|
||||
|
||||
|
@@ -22,7 +22,7 @@ import com.google.gerrit.extensions.common.AccountInfo;
|
||||
@ExtensionPoint
|
||||
public interface GitReferenceUpdatedListener {
|
||||
|
||||
public interface Event {
|
||||
interface Event {
|
||||
String getProjectName();
|
||||
String getRefName();
|
||||
String getOldObjectId();
|
||||
|
@@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2015 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.events;
|
||||
|
||||
import com.google.gerrit.extensions.annotations.ExtensionPoint;
|
||||
import com.google.gerrit.extensions.common.AccountInfo;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/** Notified whenever a Change's Hashtags are edited. */
|
||||
@ExtensionPoint
|
||||
public interface HashtagsEditedListener {
|
||||
interface Event extends ChangeEvent {
|
||||
AccountInfo getEditor();
|
||||
Collection<String> getHashtags();
|
||||
Collection<String> getAddedHashtags();
|
||||
Collection<String> getRemovedHashtags();
|
||||
}
|
||||
|
||||
void onHashtagsEdited(Event event);
|
||||
}
|
@@ -19,7 +19,7 @@ import com.google.gerrit.extensions.annotations.ExtensionPoint;
|
||||
/** Notified whenever the HEAD of a project is updated. */
|
||||
@ExtensionPoint
|
||||
public interface HeadUpdatedListener {
|
||||
public interface Event {
|
||||
interface Event {
|
||||
String getProjectName();
|
||||
String getOldHeadName();
|
||||
String getNewHeadName();
|
||||
|
@@ -20,7 +20,7 @@ import com.google.gerrit.extensions.annotations.ExtensionPoint;
|
||||
/** Notified whenever a project is created on the master. */
|
||||
@ExtensionPoint
|
||||
public interface NewProjectCreatedListener {
|
||||
public interface Event {
|
||||
interface Event {
|
||||
String getProjectName();
|
||||
String getHeadName();
|
||||
}
|
||||
|
@@ -0,0 +1,26 @@
|
||||
// Copyright (C) 2015 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.events;
|
||||
|
||||
/** Notified when a plugin fires an event. */
|
||||
public interface PluginEventListener {
|
||||
interface Event {
|
||||
String pluginName();
|
||||
String getType();
|
||||
String getData();
|
||||
}
|
||||
|
||||
void onPluginEvent(Event e);
|
||||
}
|
@@ -19,7 +19,7 @@ import com.google.gerrit.extensions.annotations.ExtensionPoint;
|
||||
/** Notified whenever a project is deleted on the master. */
|
||||
@ExtensionPoint
|
||||
public interface ProjectDeletedListener {
|
||||
public interface Event {
|
||||
interface Event {
|
||||
String getProjectName();
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,28 @@
|
||||
// Copyright (C) 2015 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.events;
|
||||
|
||||
import com.google.gerrit.extensions.annotations.ExtensionPoint;
|
||||
import com.google.gerrit.extensions.common.AccountInfo;
|
||||
|
||||
/** Notified whenever a Reviewer is added to a change. */
|
||||
@ExtensionPoint
|
||||
public interface ReviewerAddedListener {
|
||||
interface Event extends ChangeEvent {
|
||||
AccountInfo getReviewer();
|
||||
}
|
||||
|
||||
void onReviewerAdded(Event event);
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
// Copyright (C) 2015 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.events;
|
||||
|
||||
import com.google.gerrit.extensions.annotations.ExtensionPoint;
|
||||
import com.google.gerrit.extensions.common.AccountInfo;
|
||||
|
||||
/** Notified whenever a Change Revision is created. */
|
||||
@ExtensionPoint
|
||||
public interface RevisionCreatedListener {
|
||||
interface Event extends RevisionEvent {
|
||||
AccountInfo getUploader();
|
||||
}
|
||||
|
||||
void onRevisionCreated(Event event);
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
// Copyright (C) 2015 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.events;
|
||||
|
||||
import com.google.gerrit.extensions.common.RevisionInfo;
|
||||
|
||||
/** Interface to be extendend by Events with a Revision. */
|
||||
public interface RevisionEvent extends ChangeEvent {
|
||||
RevisionInfo getRevision();
|
||||
}
|
||||
|
@@ -0,0 +1,29 @@
|
||||
// Copyright (C) 2015 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.extensions.events;
|
||||
|
||||
import com.google.gerrit.extensions.annotations.ExtensionPoint;
|
||||
import com.google.gerrit.extensions.common.AccountInfo;
|
||||
|
||||
/** Notified whenever a Change Topic is changed. */
|
||||
@ExtensionPoint
|
||||
public interface TopicEditedListener {
|
||||
interface Event extends ChangeEvent {
|
||||
AccountInfo getEditor();
|
||||
String getOldTopic();
|
||||
}
|
||||
|
||||
void onTopicEdited(Event event);
|
||||
}
|
@@ -23,18 +23,18 @@ import java.util.List;
|
||||
@ExtensionPoint
|
||||
public interface UsageDataPublishedListener {
|
||||
|
||||
public interface Event {
|
||||
interface Event {
|
||||
MetaData getMetaData();
|
||||
Timestamp getInstant();
|
||||
List<Data> getData();
|
||||
}
|
||||
|
||||
public interface Data {
|
||||
interface Data {
|
||||
long getValue();
|
||||
String getProjectName();
|
||||
}
|
||||
|
||||
public interface MetaData {
|
||||
interface MetaData {
|
||||
String getName();
|
||||
String getUnitName();
|
||||
String getUnitSymbol();
|
||||
|
Reference in New Issue
Block a user