-
Notifications
You must be signed in to change notification settings - Fork 2
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
Remove Server's dependency on Controller classes #479
Conversation
@19mdavenport Since this moves the main() method into a different file, how will this affect the existing deployment system? Does anything else need to happen? The good news is that it's now in a dedicated Main class, so it will probably never need to move again. |
00344a5
to
3a7241d
Compare
# Conflicts: # src/main/java/edu/byu/cs/server/Server.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Seems like a clean solution to make things more independent of each other and more flexible. It does look like adding new endpoints now requires a little more work, but its marginal so I'm not too worried about it. Great work!
|
||
private static EndpointProvider endpointProvider = new EndpointProviderImpl(); | ||
|
||
public static void main(String[] args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you fix the main class configuration in pom.xml?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated mainClass, is that all that needs to happen?
Sorry, I know absolutely nothing about Maven 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so, you could try testing this by running mvn exec:java
in the base directory and seeing if the server starts normally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, did you commit/push that update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but in the wrong branch. RIP.
`git rebase —onto NEW_BRANCH HEAD^`
…On Thu, Nov 21, 2024 at 12:18 PM Nathaniel Gerlek ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/main/java/Main.java
<#479 (comment)>
:
> +import edu.byu.cs.service.SubmissionService;
+import edu.byu.cs.util.ResourceUtils;
+import org.apache.commons.cli.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+
+public class Main {
+ private static Logger LOGGER = LoggerFactory.getLogger(Main.class);
+
+ private static EndpointProvider endpointProvider = new EndpointProviderImpl();
+
+ public static void main(String[] args) {
Yes, but in the wrong branch. RIP.
—
Reply to this email directly, view it on GitHub
<#479 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEXEBOCQ45CVU3J3GJPZXAD2BYWZ7AVCNFSM6AAAAABRZM3QRSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDINJSGQYTSNZRGM>
.
You are receiving this because your review was requested.Message ID:
***@***.***>
|
`git checkout CORRECT_BRANCH; git cherry-pick -x CORRECT_COMMIT`
…On Thu, Nov 21, 2024 at 12:20 PM James ***@***.***> wrote:
`git rebase —onto NEW_BRANCH HEAD^`
On Thu, Nov 21, 2024 at 12:18 PM Nathaniel Gerlek <
***@***.***> wrote:
> ***@***.**** commented on this pull request.
> ------------------------------
>
> In src/main/java/Main.java
> <#479 (comment)>
> :
>
> > +import edu.byu.cs.service.SubmissionService;
> +import edu.byu.cs.util.ResourceUtils;
> +import org.apache.commons.cli.*;
> +import org.slf4j.Logger;
> +import org.slf4j.LoggerFactory;
> +
> +import java.io.File;
> +import java.io.IOException;
> +import java.util.Properties;
> +
> +public class Main {
> + private static Logger LOGGER = LoggerFactory.getLogger(Main.class);
> +
> + private static EndpointProvider endpointProvider = new EndpointProviderImpl();
> +
> + public static void main(String[] args) {
>
> Yes, but in the wrong branch. RIP.
>
> —
> Reply to this email directly, view it on GitHub
> <#479 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AEXEBOCQ45CVU3J3GJPZXAD2BYWZ7AVCNFSM6AAAAABRZM3QRSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDINJSGQYTSNZRGM>
> .
> You are receiving this because your review was requested.Message ID:
> ***@***.***
> com>
>
|
@19mdavenport Apparently |
# Conflicts: # src/main/java/edu/byu/cs/server/Server.java
2759b38
to
33829fa
Compare
Introduces an EndpointProvider interface which Server now uses for all its endpoint calls. Also extracts startup logic (getOptions, initializeDaos, etc) out of the Server class and into a Main class.
Warning
This moves the location of the main() method (from
java/server/Server.java
tojava/Main.java
). Existing run configurations will likely break and will need to be updated.