graylog2-server icon indicating copy to clipboard operation
graylog2-server copied to clipboard

Avoid dependencies on content packs from other packages

Open alex-konn opened this issue 6 years ago • 0 comments

We currently have circular dependencies between org.graylog2.contentpacks and views.

In order to produce and consume content packs wrappers need to be mapped to and from our domain entities. For most contexts the mapping can be contained within org.graylog2.contentpacks. Mostly this is done in the various EntityFacade implementations.

For entities that come from a plugin this doesn't work though, because they can't be referenced from org.graylog2.contentpacks. So the mapping code must be included in the plugin instead. The current implementation for event definitions from the enterprise plugin is relying on an interface that's defined in core and implemented by the entity in the enterprise plugin, e.g., https://github.com/Graylog2/graylog-plugin-enterprise/blob/d67881db1f5bda0994d02c44c67ad2cef87c4a2c/enterprise/src/main/java/org/graylog/plugins/events/processor/correlation/CorrelationSource.java#L13

This interface was used also for mapping the entities in views to their content pack representations, which is unfortunate, because it introduces a circular dependency, e,g. between Search and SearchEntity (the content pack representation): https://github.com/Graylog2/graylog2-server/pull/6973/files#r358330395

We decided to leave it like that for the 3.2 release and clean it up afterwards, hence this issue.

Expected Behavior

The Content Packs code has to know about all entities it has to support, so dependencies on all affected packages are appropriate. Other contexts (like Views, Alerts, etc.) should not depend on content packs to avoid unnecessary coupling in general and circular dependencies in particular.

The mapping for entities coming from plugins must be defined in the respective plugin.

Current Behavior

See above

Possible Solution

tbd

Steps to Reproduce (for bugs)

n/a

Context

see above

Your Environment

  • Graylog Version: 3.2-SNAPSHOT
  • Elasticsearch Version:
  • MongoDB Version:
  • Operating System:
  • Browser version:

alex-konn avatar Dec 17 '19 14:12 alex-konn