Skip to content

Conversation

@imretoth-ess
Copy link
Contributor

@imretoth-ess imretoth-ess commented Dec 4, 2025

This PR adds repository, API, and service packages, and it splits up the controller code into controller and services. The PR will later be followed by one or more PRs to move business logic from the controller layer to the service layer.

This is a preparatory step in order to convert the HTTP API into a RESTful (v2) API. Early outlines for this work can be seen in e.g. #106 (comment).

- Create package for service classes and move them there
- Adjust scopes for (service) functions to not to break current functionality
- Create package for repository classes and move them there
- Create package for configuration classes and move them there
- Adjust class name to represent it's function
-  Create package for controller classes and move them there
- Create package for util classes and move them there
- Extract endpoint functions into interfaces
- Move endpoint (swagger) documentation into interfaces
- Remove unused imports from controller classes
- Move classes into corresponding packages
- Rename controller classes
- Rename controller interfaces
- Some classes had incorrect linting that has been fixed
@github-actions
Copy link

github-actions bot commented Dec 4, 2025

Copy link
Contributor

@anderslindho anderslindho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good, but I'll defer approval to the next one in line to review this.

Copy link
Contributor

@jacomago jacomago left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of other things to do

public class Application implements ApplicationRunner {

static final Logger logger = Logger.getLogger(Application.class.getName());
public static final Logger logger = Logger.getLogger(Application.class.getName());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not your fault, but we shouldn't have public loggers. They should be all private. Think you can fix this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I will take a look at that!

@@ -1,4 +1,4 @@
package org.phoebus.channelfinder.processors.aa;
package org.phoebus.channelfinder.service;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe make a sub external package for this class.

@DeleteMapping("/{propertyName}/{channelName}")
@Override
public void removeSingle(
@PathVariable("propertyName") final String propertyName,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove the pathvariable annotations now they are in the interface?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I will do that!

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we get rid of the requestparam annotation as in the interface now?

- Remove swagger related annotations from the controllers (as the documentation layer is moved to the interface level)
- Wind down scope for loggers
- Create external sub package for ArchiverClient
jacomago
jacomago previously approved these changes Dec 5, 2025
@github-actions
Copy link

github-actions bot commented Dec 5, 2025

simon-ess
simon-ess previously approved these changes Dec 5, 2025
Copy link

@simon-ess simon-ess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might suggest squashing a few of the commits (e.g. when you rename the interfaces separately from creating them), but other than that LGTM.

Copy link
Contributor

@anderslindho anderslindho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed that you have a typo in a directory name, @imretoth-ess : respository -> repository

@imretoth-ess
Copy link
Contributor Author

Just noticed that you have a typo in a directory name, @imretoth-ess : respository -> repository

Oh, good catch! I will fix that!

- Fix type in 'repository' package name
@imretoth-ess imretoth-ess dismissed stale reviews from simon-ess and jacomago via b0900ba December 8, 2025 08:05
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 8, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
7 Security Hotspots
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@github-actions
Copy link

github-actions bot commented Dec 8, 2025

@imretoth-ess imretoth-ess requested a review from shroffk December 8, 2025 10:09
@shroffk
Copy link
Collaborator

shroffk commented Dec 8, 2025

Is there an issue ticket or something with an overview of the changes and the need for it/problem being resolved?

@anderslindho
Copy link
Contributor

@shroffk the "epic" we're working towards here is enabling the v2 api

@jacomago
Copy link
Contributor

jacomago commented Dec 9, 2025

Ok, test was just flaky.

@imretoth-ess imretoth-ess merged commit ba431dd into master Dec 9, 2025
8 of 10 checks passed
@shroffk
Copy link
Collaborator

shroffk commented Dec 9, 2025

can you link the "epic" or something that describes the issues/tasks/motivations?

@anderslindho
Copy link
Contributor

@shroffk our ticketing system is not accessible from outside of ESS

@imretoth-ess can you please update your PR description/top level comment with this content (feel free to adjust as you see fit):
"""
This PR adds repository, API, and service packages, and it splits up the controller code into controller and services. The PR will later be followed by one or more PRs to move business logic from the controller layer to the service layer.

This is a preparatory step in order to convert the HTTP API into a RESTful (v2) API. Early outlines for this work can be seen in e.g. #106 (comment).
"""

@shroffk is the above clarification sufficient?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants