Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul plugin to use OpenAPI vs. Swagger #7

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<!-- Keep a Changelog guide -> https://keepachangelog.com -->

# idea-plugin-1 Changelog
# event-portal-plugin Changelog

## [Unreleased]

### Added
- Initial scaffold created from [IntelliJ Platform Plugin Template](https://github.com/JetBrains/intellij-platform-plugin-template)

- Updated Event Portal API and Solace Cloud Platform API to v2.8.4 and v2.0 respectively (Oct 2024)
- Updated Java EP wrapper library to use OpenAPI generator vs. Swagger generator

21 changes: 18 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,24 @@ dependencies {
implementation(fileTree(mapOf("dir" to "lib", "include" to listOf("*.jar"))))

// needed for Swagger?
implementation("com.squareup.okhttp:okhttp:2.7.5")
implementation("io.gsonfire:gson-fire:1.8.5")
implementation("org.threeten:threetenbp:1.6.0")
//implementation("com.squareup.okhttp:okhttp:4.12.0")
//implementation("com.squareup.okio:okio-jvm:3.6.0")
//implementation("io.gsonfire:gson-fire:1.9.0")
//implementation("org.threeten:threetenbp:1.6.0")

// needed by OpenAPI apparentyly
implementation("io.swagger:swagger-annotations:1.6.8")
implementation("com.google.code.findbugs:jsr305:3.0.2")
implementation("com.squareup.okhttp3:okhttp:4.12.0")
implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")
implementation("com.google.code.gson:gson:2.9.1")
implementation("io.gsonfire:gson-fire:1.9.0")
implementation("jakarta.ws.rs:jakarta.ws.rs-api:2.1.6")
implementation("org.openapitools:jackson-databind-nullable:0.2.6")
implementation("org.apache.commons:commons-lang3:3.12.0")
implementation("jakarta.annotation:jakarta.annotation-api:1.3.5")



implementation("org.jsonschema2pojo:jsonschema2pojo-core:1.1.2") // for Java codegen

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
pluginGroup = community.solace.ep
pluginName = event-portal-plugin
# SemVer format -> https://semver.org
pluginVersion = 0.2.2
pluginVersion = 0.3.0

# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
Expand Down
Binary file added lib/aaron-solace-useful-utils-0.1.0-SNAPSHOT.jar
Binary file not shown.
Binary file added lib/ep-openapi-java-0.3.0.jar
Binary file not shown.
Binary file added lib/ep-wrapper-java-0.3.0-SNAPSHOT.jar
Binary file not shown.
Binary file added lib/sol-plat-openapi-java-0.3.0.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import community.solace.ep.idea.plugin.nextgen.TabEvents;
import community.solace.ep.idea.plugin.nextgen.TabSchema;
import community.solace.ep.idea.plugin.utils.Notify;
import community.solace.ep.wrapper.EventPortalObjectType;
import community.solace.ep.wrapper.SupportedObjectType;
import community.solace.ep.wrapper.EventPortalWrapper;
import icons.MyIcons;

Expand Down Expand Up @@ -104,7 +104,7 @@ private void open() {


public void openDownloadAsyncApi(PortalRowObjectTreeNode pro, String asyncApi) {
if (pro.getType() != EventPortalObjectType.APPLICATION_VERSION) return;
if (pro.getType() != SupportedObjectType.APPLICATION_VERSION) return;
ApplicationVersion appVer = EventPortalWrapper.INSTANCE.getApplicationVersion(pro.getId());
Application app = EventPortalWrapper.INSTANCE.getApplication(appVer.getApplicationId());
MyAsyncApiDialog dialog = new MyAsyncApiDialog(mainProject, app, appVer, asyncApi);
Expand Down Expand Up @@ -163,7 +163,7 @@ public void addEditorTab(String tabTitle, String textContent, FileType fileType,


JButton button = new JButton("Generate code...");//, MyIcons.AsyncApi2);
if (pro.getType() == EventPortalObjectType.APPLICATION_VERSION) button.setIcon(MyIcons.AsyncApi2);
if (pro.getType() == SupportedObjectType.APPLICATION_VERSION) button.setIcon(MyIcons.AsyncApi2);
button.addActionListener(new ActionListener() {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@

import community.solace.ep.idea.plugin.utils.EPObjectHelper;
import community.solace.ep.idea.plugin.utils.TimeUtils;
import community.solace.ep.wrapper.EventPortalObjectType;
import community.solace.ep.wrapper.EventPortalWrapper;
import icons.MyIcons;
import community.solace.ep.wrapper.SupportedObjectType;

public class CustomTableCellRenderer extends DefaultTableCellRenderer {

Expand Down Expand Up @@ -284,7 +283,7 @@ public Component getTableCellRendererComponent(JTable table, Object rowNode, boo
con.anchor = GridBagConstraints.LINE_START;
con.weightx = 1;
// int x = 0;
if (pro.getType() == EventPortalObjectType.APPLICATION_VERSION || pro.getType() == EventPortalObjectType.EVENT_API_VERSION) {
if (pro.getType() == SupportedObjectType.APPLICATION_VERSION || pro.getType() == SupportedObjectType.EVENT_API_VERSION) {
AnActionLink link = new AnActionLink("View AsyncAPI", new MessageAction("asyncApi " + pro.getName()));
// link.setIcon(MyIcons.AsyncApi2, false);
// externalLink.setExternalLinkIcon();
Expand All @@ -297,12 +296,12 @@ public Component getTableCellRendererComponent(JTable table, Object rowNode, boo
// panel.add(link, con);

// return externalLink;
} else if (pro.getType() == EventPortalObjectType.EVENT_VERSION) {
} else if (pro.getType() == SupportedObjectType.EVENT_VERSION) {
// ActionLink externalLink = new AnActionLink("Generate Schema POJO...", EMPTY_EVENT);
// ActionLink externalLink = new AnActionLink("Copy schema to clipboard...", EMPTY_EVENT);
// externalLink.setBackground(cellComponent.getBackground());
// panel.add(externalLink, con);
} else if (pro.getType() == EventPortalObjectType.SCHEMA_VERSION && !pro.getLink().isBlank()) {
} else if (pro.getType() == SupportedObjectType.SCHEMA_VERSION && !pro.getLink().isBlank()) {
// ActionLink externalLink = new AnActionLink("Generate Schema POJO...", EMPTY_EVENT);
ActionLink link = new AnActionLink("View schema", new MessageAction("view schema " + pro.getName()));
// externalLink.setBackground(cellComponent.getBackground());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import com.intellij.icons.AllIcons;

import community.solace.ep.wrapper.EventPortalObjectType;
import community.solace.ep.wrapper.SupportedObjectType;

public class PortalRowObjectTreeNode {

Expand All @@ -21,7 +21,7 @@ public class PortalRowObjectTreeNode {
* "topicDomainEnforcementEnabled": false, "type": "applicationDomain" },
*/

final EventPortalObjectType type;
final SupportedObjectType type;
final Object eventPortalObject;
final String id;
String name = "";
Expand All @@ -41,7 +41,7 @@ public class PortalRowObjectTreeNode {
volatile boolean expanded = true;
volatile boolean hidden = false;

public PortalRowObjectTreeNode(EventPortalObjectType type, Object eventPortalObject, String id) {
public PortalRowObjectTreeNode(SupportedObjectType type, Object eventPortalObject, String id) {
this.type = type;
this.eventPortalObject = eventPortalObject;
this.id = id;
Expand Down Expand Up @@ -70,7 +70,7 @@ public void setLink(String link) {
this.link = link;
}

public EventPortalObjectType getType() {
public SupportedObjectType getType() {
return type;
}

Expand Down Expand Up @@ -159,7 +159,7 @@ public List<PortalRowObjectTreeNode> flatten(boolean hide) {
while (!stack.isEmpty()) {
PortalRowObjectTreeNode node = stack.remove(0);
if (!hidden) {
if (node.type != EventPortalObjectType.DOMAIN || node.hasChildren()) {
if (node.type != SupportedObjectType.DOMAIN || node.hasChildren()) {
rows.add(node);
}
if (node.isExpanded() && node.hasChildren()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import java.awt.Color;
import java.awt.Cursor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
Expand Down Expand Up @@ -33,8 +31,8 @@
import community.solace.ep.client.model.SchemaVersion;
import community.solace.ep.idea.plugin.settings.AppSettingsState;
import community.solace.ep.idea.plugin.utils.EPObjectHelper;
import community.solace.ep.wrapper.EventPortalObjectType;
import community.solace.ep.wrapper.EventPortalWrapper;
import community.solace.ep.wrapper.SupportedObjectType;


public class PortalTableView extends TableView<PortalRowObjectTreeNode> {
Expand Down Expand Up @@ -73,9 +71,9 @@ private static boolean isClickable(PortalRowObjectTreeNode pro, int col) {
if (col == 1 && !pro.getLink().isEmpty()) { // the name is always clickable
return true;
} else if (col == 6) { // pull down schemas if you want?
if (pro.getType() == EventPortalObjectType.APPLICATION_VERSION
if (pro.getType() == SupportedObjectType.APPLICATION_VERSION
/* || pro.getType() == EventPortalObjectType.EVENT_VERSION */
|| (pro.getType() == EventPortalObjectType.SCHEMA_VERSION && !pro.getId().isEmpty())) {
|| (pro.getType() == SupportedObjectType.SCHEMA_VERSION && !pro.getId().isEmpty())) {
return true;
}
} else if (col == 0) {
Expand Down Expand Up @@ -166,7 +164,7 @@ public void mouseClicked(MouseEvent e) {
} else if (6 == col) {
// BrowserUtil.browse("https://news.google.com");

if (pro.getType() == EventPortalObjectType.SCHEMA_VERSION && !pro.getId().isEmpty()) {
if (pro.getType() == SupportedObjectType.SCHEMA_VERSION && !pro.getId().isEmpty()) {
SchemaVersion schemaVer = EventPortalWrapper.INSTANCE.getSchemaVersion(pro.getId());
SchemaObject schema = EventPortalWrapper.INSTANCE.getSchema(schemaVer.getSchemaId());
JsonObject jo = new Gson().fromJson(schemaVer.getContent(), JsonObject.class);
Expand All @@ -178,7 +176,7 @@ public void mouseClicked(MouseEvent e) {
fileType = JsonFileType.INSTANCE;
}
myParentTab.getFactory().addEditorTab(title, Math.random() > 0.5 ? schemaVer.getContent() : pretty, fileType, false, pro);
} else if (pro.getType() == EventPortalObjectType.EVENT_VERSION) {
} else if (pro.getType() == SupportedObjectType.EVENT_VERSION) {
if ("a".equals("a")) return;
EventVersion ev = EventPortalWrapper.INSTANCE.getEventVersion(pro.getId());
SchemaVersion schemaVer = EventPortalWrapper.INSTANCE.getSchemaVersion(ev.getSchemaVersionId());
Expand Down Expand Up @@ -209,7 +207,7 @@ public void mouseClicked(MouseEvent e) {
Notifications.Bus.notify(new Notification("ep20", "Solace Event Portal", "Could not copy schema to clipboard", NotificationType.WARNING));
}

} else if (pro.getType() == EventPortalObjectType.APPLICATION_VERSION) {
} else if (pro.getType() == SupportedObjectType.APPLICATION_VERSION) {
ApplicationVersion appVer = EventPortalWrapper.INSTANCE.getApplicationVersion(pro.getId());
Application app = EventPortalWrapper.INSTANCE.getApplication(appVer.getApplicationId());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import community.solace.ep.idea.plugin.utils.TimeUtils;
import community.solace.ep.idea.plugin.utils.TopicUtils;
import community.solace.ep.idea.plugin.utils.WordyUtils;
import community.solace.ep.wrapper.EventPortalObjectType;
import community.solace.ep.wrapper.EventPortalWrapper;
import community.solace.ep.wrapper.EventPortalWrapper.LoadStatus;
import community.solace.ep.wrapper.SupportedObjectType;
import icons.MyIcons;

/**
Expand All @@ -41,7 +41,7 @@ public void refreshSortByDomain() {
PortalRowObjectTreeNode root = new PortalRowObjectTreeNode(null, null, ""); // root
try {
for (ApplicationDomain domain : EventPortalWrapper.INSTANCE.getDomains()) {
PortalRowObjectTreeNode row = new PortalRowObjectTreeNode(EventPortalObjectType.DOMAIN, domain, domain.getId());
PortalRowObjectTreeNode row = new PortalRowObjectTreeNode(SupportedObjectType.DOMAIN, domain, domain.getId());
row.setIcon(MyIcons.DomainLarge);
// row.setIcon(MyIcons.Portal);
if (toolbar.hideEmptyDomains && domain.getStats().getApplicationCount() == 0) continue;
Expand Down Expand Up @@ -100,14 +100,14 @@ private PortalRowObjectTreeNode buildEventVerTree(Icon icon, String specificText

Event event = EventPortalWrapper.INSTANCE.getEvent(eventVer.getEventId());
ApplicationDomain origDomain = EventPortalWrapper.INSTANCE.getDomain(event.getApplicationDomainId());
PortalRowObjectTreeNode eventVerPro = new PortalRowObjectTreeNode(EventPortalObjectType.EVENT_VERSION, eventVer, eventVer.getId());
PortalRowObjectTreeNode eventVerPro = new PortalRowObjectTreeNode(SupportedObjectType.EVENT_VERSION, eventVer, eventVer.getId());
// is there a schema for this Event?
eventVerPro.setIcon(icon);
eventVerPro.setName(String.format("%s: %s%s%s v%s",
which,
origDomain.getId().equals(domain.getId()) ? "" : "(EXT) ",
event.getName(),
event.isShared() ? "*" : "",
event.getShared() ? "*" : "",
eventVer.getVersion()));
eventVerPro.setState(EventPortalWrapper.INSTANCE.getState(eventVer.getStateId()).getName());
eventVerPro.setTopic(TopicUtils.buildTopic(eventVer.getDeliveryDescriptor()));
Expand All @@ -124,27 +124,27 @@ private PortalRowObjectTreeNode buildEventVerTree(Icon icon, String specificText
SchemaVersion schemaVersion = EventPortalWrapper.INSTANCE.getSchemaVersion(eventVer.getSchemaVersionId());
SchemaObject schema = EventPortalWrapper.INSTANCE.getSchema(schemaVersion.getSchemaId());
// eventVerPro.addNote(String.format("%s Payload", TopicUtils.capitalFirst(schema.getContentType())));
PortalRowObjectTreeNode proSchemaVer = new PortalRowObjectTreeNode(EventPortalObjectType.SCHEMA_VERSION, schemaVersion, schemaVersion.getId());
proSchemaVer.setName(schema.getName() + (schema.isShared() ? "*" : "") + " v" + schemaVersion.getVersion());
proSchemaVer.addDetail(String.format("%s Payload", WordyUtils.capitalFirst(schema.getContentType())));
PortalRowObjectTreeNode proSchemaVer = new PortalRowObjectTreeNode(SupportedObjectType.SCHEMA_VERSION, schemaVersion, schemaVersion.getId());
proSchemaVer.setName(schema.getName() + (schema.getShared() ? "*" : "") + " v" + schemaVersion.getVersion());
proSchemaVer.addDetail(String.format("%s Payload", WordyUtils.capitalFirst(schema.getSchemaType())));
proSchemaVer.setLink(String.format(TopicUtils.SCHEMA_VER_URL, AppSettingsState.getInstance().baseUrl, domain.getId(), schema.getId(), schemaVersion.getId()));
proSchemaVer.setIcon(MyIcons.SchemaSmall);
if (schema.isShared()) proSchemaVer.addDetail("Shared");
if (schema.getShared()) proSchemaVer.addDetail("Shared");
proSchemaVer.setState(EventPortalWrapper.INSTANCE.getState(schemaVersion.getStateId()).getName());
proSchemaVer.setLastUpdatedTs(TimeUtils.parseTime(schemaVersion.getUpdatedTime()));
proSchemaVer.setLastUpdatedByUser(schemaVersion.getChangedBy());
proSchemaVer.setCreatedByUser(schemaVersion.getCreatedBy());
eventVerPro.addChild(proSchemaVer);
} else if (eventVer.getSchemaPrimitiveType() != null) {
// eventVerPro.addNote(String.format("%s Payload", TopicUtils.capitalFirst(eventVer.getSchemaPrimitiveType().getValue())));
PortalRowObjectTreeNode proSchemaVer = new PortalRowObjectTreeNode(EventPortalObjectType.SCHEMA_VERSION, null, "");
PortalRowObjectTreeNode proSchemaVer = new PortalRowObjectTreeNode(SupportedObjectType.SCHEMA_VERSION, null, "");
proSchemaVer.setName(String.format("Primitive %s Payload", WordyUtils.capitalFirst(eventVer.getSchemaPrimitiveType().getValue())));
proSchemaVer.setIcon(MyIcons.SchemaPrimitive);

eventVerPro.addChild(proSchemaVer);
} else {
// eventVerPro.addNote("No Schema");
PortalRowObjectTreeNode proSchemaVer = new PortalRowObjectTreeNode(EventPortalObjectType.SCHEMA_VERSION, null, "");
PortalRowObjectTreeNode proSchemaVer = new PortalRowObjectTreeNode(SupportedObjectType.SCHEMA_VERSION, null, "");
proSchemaVer.setName("No Schema");
proSchemaVer.setIcon(MyIcons.SchemaNone);
eventVerPro.addChild(proSchemaVer);
Expand All @@ -158,7 +158,7 @@ private PortalRowObjectTreeNode buildEventVerTree(Icon icon, String specificText

private void generateTree(PortalRowObjectTreeNode parent, Application app, ApplicationDomain domain, boolean domainInNotes) {
// List<PortalRowObject> rows = new ArrayList<>();
PortalRowObjectTreeNode appPro = new PortalRowObjectTreeNode(EventPortalObjectType.APPLICATION, app, app.getId());
PortalRowObjectTreeNode appPro = new PortalRowObjectTreeNode(SupportedObjectType.APPLICATION, app, app.getId());
parent.addChild(appPro);
appPro.setIcon(MyIcons.AppLarge);
appPro.setName(app.getName());
Expand All @@ -176,7 +176,7 @@ private void generateTree(PortalRowObjectTreeNode parent, Application app, Appli

for (ApplicationVersion appVer : EventPortalWrapper.INSTANCE.getApplicationVersionsForApplicationId(app.getId())) {
// appVer.get
PortalRowObjectTreeNode appVerPro = new PortalRowObjectTreeNode(EventPortalObjectType.APPLICATION_VERSION, appVer, appVer.getId());
PortalRowObjectTreeNode appVerPro = new PortalRowObjectTreeNode(SupportedObjectType.APPLICATION_VERSION, appVer, appVer.getId());
appPro.addChild(appVerPro);
appVerPro.setIcon(MyIcons.appSmall);
appVerPro.setName("v" + appVer.getVersion());
Expand Down
Loading
Loading