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

WINDUP-253 Refactor WindupProcessor/Impl #228

Closed
wants to merge 21 commits into from

Conversation

OndraZizka
Copy link
Contributor

Refactor WindupProcessor/Impl to simplify the API, move inner classes out and offload part of the code like prettyPrintRule() out of this important class.

WINDUP-272 Refactor GraphContextFactoryImpl and GraphContextImpl
WINDUP-253 Refactor WindupProcessor/Impl
WINDUP-254 Improve error message in RuleSubset.

RecordingWindupProgressMonitor progressMonitor = new RecordingWindupProgressMonitor();
processor.execute(progressMonitor);
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is the configuration passed to the processor?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ha! I wonder the tests passed without that :) Will fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -14,12 +14,12 @@
public interface GraphConfigurationLoader
{
/**
* Loads all {@link Configuration}s from the system and returns the result.
* Loads all OCP Rewrite's {@link Configuration}s from the system and returns the result.
Copy link
Contributor

Choose a reason for hiding this comment

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

How about:

Loads all known {@link WindupRuleProvider} instances and returns the compiled {@link Rewrite} pipeline {@link Configuration}.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's way better. I added "OCP Rewrite's" to make it clear what kind of configuration that is - because the term Configuration is a bit overloaded.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


//<editor-fold defaultstate="collapsed" desc="get/set">

public Path getOutputDirectory()
Copy link
Member

Choose a reason for hiding this comment

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

Needs javadoc

@OndraZizka
Copy link
Contributor Author

Currently there's a problem: In tests, GraphContext gets initialized before WindupProcessor boots. So the graph is already located in some default location. Once again: I think we need a proper bootstrap. More that in an email.

@jsight
Copy link
Member

jsight commented Sep 3, 2014

That only happens if you try to access the graph itself before setting the
graph directory.
On Sep 3, 2014 6:26 PM, "Ondrej Zizka" notifications@github.com wrote:

Currently there's a problem: In tests, GraphContext gets initialized
before WindupProcessor boots. So the graph is already located in some
default location. Once again: I think we need a proper bootstrap. More that
in an email.


Reply to this email directly or view it on GitHub
#228 (comment).

@OndraZizka
Copy link
Contributor Author

Done, the tests pass. Rebasing after the dir structural change needs huge amout of work. I suggest rebasing that on top of this.

@OndraZizka
Copy link
Contributor Author

(22:17:01) Lincoln: ozizka: well, the code format (not a huge deal)
(22:17:18) ozizka-FN: Sure :) Sorry for that, I'll learn to find the spots.

(22:17:16) Lincoln: ozizka: there is also the strange relationship between WindupConfigurationModel and WindupConfig
(22:17:24) ozizka-FN: Right, I would like to fix that as next step in this path
(22:17:43) ozizka-FN: But this relation was there before too, only hidden.
(22:17:58) ozizka-FN: I only moved stuff to an object, now it's obvious
(22:17:58) ozizka-FN: I only moved stuff to an object, now it's obvious

(22:17:55) Lincoln: There are a few places where exceptions are created and logged just to display a trace, which is pretty confusing imo
(22:18:27) ozizka-FN: lincolnthree: It was most helpful. But I can get the stack otherwise.

(22:18:25) Lincoln: ozizka: the other issue for WINDUP-254 was included in this PR as well, and does not follow the solution we discussed afaik
(22:18:25) jbossbot: jira [WINDUP-254] Improve error message in RuleSubset.
(22:19:18) ozizka-FN: Right, without it I would not see what's happening. I can change it to log, although I don't understand why it's better.

(22:19:09) Lincoln: ozizka: and I want to look deeper at the GraphContextImpl just to maybe make some tweaks because the relationship with that and the config seem a bit strange
Lincoln lincolnthree
(22:19:47) Lincoln: ozizka: once you pass in a config, you can never figure out what config a graphContext was configured with (without getting the WCModel)
(22:20:47) ozizka-FN: lincolnthree: I agree - but as I said, that has not changed, only "objectified"
(22:21:54) Lincoln: ozizka: well, i re-added the getGraphDir method on GraphContext
(22:22:07) Lincoln: that had been removed but was used in some more recent tests. Not sure what to do with that yet, its an odd method
(22:23:06) ozizka-FN: It belongs to GraphContextConfig. Can ask that stored config. When it's stored :)
(22:23:35) Lincoln: ozizka: yeah that's what I did

I'd suggest to merge to stick with the PR state, if you consider it a bit improvement. And I'll address this next (or later).


//<editor-fold defaultstate="collapsed" desc="get/set">

public GraphLifecycleListener getGraphListener()
Copy link
Member

Choose a reason for hiding this comment

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

Needs javadoc

…nd a log message.

GCI - don't use confusing new Exception() to get the stack trace.
WindupProcessor - code format.
@lincolnthree
Copy link
Contributor

Following up on Ondra's email to windup-dev.

Regarding the passing of variables to WindupConfigurationModel, I'd really love to see us choose one method of configuration over the other. This is perhaps a non-trivial problem because of our use of implicit initialization in many test-cases, but in the end it should be doable (and should be done, IMO) I'd like to look into how much work it would actually require to do in this PR, since I don't really like the idea of leaving this kind of refactoring half complete.

What are your thoughts?

@jsight
Copy link
Member

jsight commented Sep 12, 2014

I would prefer that we deal with the configuration issue in WINDUP-131.

/**
* Whether to log a WARNING when initializing the GraphContext lazily.
*/
public boolean isWarnOnLazyInit()
Copy link
Member

Choose a reason for hiding this comment

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

These comments and method names do not appear to match the actual init code. It actually throws and Exception instead of warning.

@jsight
Copy link
Member

jsight commented Sep 12, 2014

Ok, just minor things remain at this point, IMO. It'd be nice if the commit were at least partially squashed too, IMO.

@lincolnthree
Copy link
Contributor

Yeah, I'm not sure how easy it will be to squash this, but I agree it would be realllllly nice to do that. In fact, I think it's worth it, even if it's an hour of pain.

@OndraZizka OndraZizka force-pushed the WindupProcessor-WINDUP-253 branch 2 times, most recently from 0dfb08c to b7157a0 Compare September 12, 2014 17:25
@lincolnthree
Copy link
Contributor

Merged in: #251

PhilipCattanach pushed a commit to PhilipCattanach/windup that referenced this pull request Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants