Advertisement
lincolnthree

Oops, I just wrote a #SeamForge plugin

Apr 14th, 2011
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. /**
  2. * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
  3. */
  4. @Alias("faces")
  5. @RequiresFacet(FacesFacet.class)
  6. public class FacesPlugin implements Plugin
  7. {
  8. @Inject
  9. private Project project;
  10.  
  11. @Command("project-stage")
  12. public void setProjectStage(@Option(name = "set") FacesProjectStage stage, PipeOut out)
  13. {
  14. ServletFacet srv = project.getFacet(ServletFacet.class);
  15. WebAppDescriptor config = srv.getConfig();
  16. if (stage == null)
  17. {
  18. ShellMessages.info(out, "Project stage is currently: " + config.getFacesProjectStage().getStage());
  19. }
  20. else
  21. {
  22. config.facesProjectStage(stage);
  23. srv.saveConfig(config);
  24. ShellMessages.success(out, "Faces PROJECT_STAGE updated to: " + stage.getStage());
  25. }
  26. }
  27. }
  28.  
  29.  
  30. /***********************************************************/
  31.  
  32. ____ _____
  33. / ___| ___ __ _ _ __ ___ | ___|__ _ __ __ _ ___
  34. \___ \ / _ \/ _` | '_ ` _ \ | |_ / _ \| '__/ _` |/ _ \ \\
  35. ___) | __/ (_| | | | | | | | _| (_) | | | (_| | __/ //
  36. |____/ \___|\__,_|_| |_| |_| |_| \___/|_| \__, |\___|
  37. |___/
  38.  
  39. [no-project] ~/Desktop $ cd example/
  40.  
  41. [example] example $ faces project-stage
  42. ***INFO*** Project stage is currently: PRODUCTION
  43.  
  44. [example] example $ faces project-stage --set DEVELOPMENT
  45. Wrote ~/Desktop/example/src/main/webapp/WEB-INF/web.xml
  46. ***SUCCESS*** Faces PROJECT_STAGE updated to: DEVELOPMENT
  47.  
  48. [example] example $ cat ~/Desktop/example/src/main/webapp/WEB-INF/web.xml
  49. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  50. <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
  51. <display-name>example</display-name>
  52. <session-config>
  53. <session-timeout>30</session-timeout>
  54. </session-config>
  55. <welcome-file-list>
  56. <welcome-file>/index.html</welcome-file>
  57. </welcome-file-list>
  58. <context-param>
  59. <param-name>org.metawidget.faces.component.DONT_USE_PRERENDER_VIEW_EVENT</param-name>
  60. <param-value>true</param-value>
  61. </context-param>
  62. <context-param>
  63. <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
  64. <param-value>false</param-value>
  65. </context-param>
  66. <context-param>
  67. <param-name>javax.faces.PROJECT_STAGE</param-name>
  68. <param-value>Development</param-value>
  69. </context-param>
  70. </web-app>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement