-
Notifications
You must be signed in to change notification settings - Fork 682
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SRP: split CorePlugin to EnhancerPlugin and PlayStatusPlugin
* these 2 plugins have totally different responsibilities and priorities * splitting them allows users to easily override/disable/reorder any of them
- Loading branch information
Showing
7 changed files
with
67 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package play.plugins; | ||
|
||
import play.Logger; | ||
import play.PlayPlugin; | ||
import play.classloading.ApplicationClasses.ApplicationClass; | ||
import play.classloading.enhancers.*; | ||
import play.exceptions.UnexpectedException; | ||
|
||
/** | ||
* Plugin used for core tasks | ||
*/ | ||
public class EnhancerPlugin extends PlayPlugin { | ||
|
||
protected Enhancer[] defaultEnhancers() { | ||
return new Enhancer[] { new PropertiesEnhancer(), new ContinuationEnhancer(), new SigEnhancer(), new ControllersEnhancer(), | ||
new MailerEnhancer(), new LocalvariablesNamesEnhancer() }; | ||
} | ||
|
||
@Override | ||
public void enhance(ApplicationClass applicationClass) { | ||
for (Enhancer enhancer : defaultEnhancers()) { | ||
try { | ||
long start = System.currentTimeMillis(); | ||
enhancer.enhanceThisClass(applicationClass); | ||
if (Logger.isTraceEnabled()) { | ||
Logger.trace("%sms to apply %s to %s", System.currentTimeMillis() - start, enhancer.getClass().getSimpleName(), | ||
applicationClass.name); | ||
} | ||
} catch (Exception e) { | ||
throw new UnexpectedException("While applying " + enhancer + " on " + applicationClass.name, e); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
framework/test-src/play/plugins/custom-play-with-blank-lines.plugins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
0:play.CorePlugin | ||
0:play.plugins.EnhancerPlugin | ||
|
||
1:play.plugins.TestPlugin | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
0:play.CorePlugin | ||
0:play.plugins.EnhancerPlugin | ||
1:play.plugins.TestPlugin |