Weld SVN: r4351 - in examples/trunk/wicket/numberguess: src/main/java/org/jboss and 4 other directories.
by weld-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-10-27 14:16:18 -0400 (Tue, 27 Oct 2009)
New Revision: 4351
Added:
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/NumberGuessApplication.java
Removed:
examples/trunk/wicket/numberguess/src/main/java/org/jboss/webbeans/
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/SampleApplication.java
examples/trunk/wicket/numberguess/src/test/java/org/jboss/webbeans/
Modified:
examples/trunk/wicket/numberguess/pom.xml
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Game.java
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Generator.java
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/HomePage.html
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/HomePage.java
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/MaxNumber.java
examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Random.java
examples/trunk/wicket/numberguess/src/main/webapp/WEB-INF/jetty-additions-to-web.xml
examples/trunk/wicket/numberguess/src/main/webapp/WEB-INF/web.xml
examples/trunk/wicket/numberguess/src/test/java/org/jboss/weld/examples/wicket/Start.java
Log:
get wicket example into working state
reformat some code so that it follows conventions
Modified: examples/trunk/wicket/numberguess/pom.xml
===================================================================
--- examples/trunk/wicket/numberguess/pom.xml 2009-10-27 18:15:01 UTC (rev 4350)
+++ examples/trunk/wicket/numberguess/pom.xml 2009-10-27 18:16:18 UTC (rev 4351)
@@ -12,7 +12,7 @@
<groupId>org.jboss.weld.examples</groupId>
<artifactId>weld-wicket-numberguess</artifactId>
<packaging>war</packaging>
- <name>Weld Examples: Numberguess with wicket</name>
+ <name>Weld Examples: Wicket Numberguess</name>
<dependencies>
@@ -39,7 +39,6 @@
<scope>test</scope>
</dependency>
-
</dependencies>
<build>
@@ -82,6 +81,9 @@
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
+ <configuration>
+ <overrideWebXml>src/main/webapp/WEB-INF/jetty-additions-to-web.xml</overrideWebXml>
+ </configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -126,7 +128,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.4.2</version>
+ <version>1.5.8</version>
</dependency>
<!-- JETTY DEPENDENCIES FOR IN IDE TESTING -->
@@ -140,15 +142,10 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
- <scope>test</scope>
+ <scope>runtime</scope>
<version>1.5.8</version>
</dependency>
- <dependency>
- <groupId>javax.servlet.jsp</groupId>
- <artifactId>jsp-api</artifactId>
- </dependency>
-
</dependencies>
</profile>
<profile>
Modified: examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Game.java
===================================================================
--- examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Game.java 2009-10-27 18:15:01 UTC (rev 4350)
+++ examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Game.java 2009-10-27 18:16:18 UTC (rev 4351)
@@ -1,92 +1,81 @@
-package org.jboss.weld.examples.wicket;
-
-
-import java.io.Serializable;
-
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.SessionScoped;
-import javax.enterprise.inject.Instance;
-import javax.inject.Inject;
-import javax.naming.NamingException;
-
-@SessionScoped
-public class Game implements Serializable
-{
- private int number;
-
- private int guess;
- private int smallest;
-
- @Inject
- @MaxNumber
- private int maxNumber;
-
- private int biggest;
- private int remainingGuesses;
-
- @Inject
- @Random
- Instance<Integer> randomNumber;
-
- public Game() throws NamingException {}
-
- public int getNumber()
- {
- return number;
- }
-
- public int getGuess()
- {
- return guess;
- }
-
- public void setGuess(int guess)
- {
- this.guess = guess;
- }
-
- public int getSmallest()
- {
- return smallest;
- }
-
- public int getBiggest()
- {
- return biggest;
- }
-
- public int getRemainingGuesses()
- {
- return remainingGuesses;
- }
-
- public boolean check()
- {
- if (guess>number)
- {
- biggest = guess - 1;
- }
- if (guess<number)
- {
- smallest = guess + 1;
- }
- remainingGuesses--;
- return (guess == number);
- }
+package org.jboss.weld.examples.wicket;
-
- @Inject
- Generator generator;
-
- @PostConstruct
- public void reset()
- {
- this.smallest = 0;
- this.guess = 0;
- this.remainingGuesses = 10;
- this.biggest = maxNumber;
- this.number = randomNumber.get();
- }
-
+import java.io.Serializable;
-}
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+import javax.naming.NamingException;
+
+@SessionScoped
+public class Game implements Serializable
+{
+ private int number;
+ private int guess;
+ private int smallest;
+ private int biggest;
+ private int remainingGuesses;
+
+ @Inject @MaxNumber private int maxNumber;
+
+ @Inject Generator generator;
+
+ @Inject @Random Instance<Integer> randomNumber;
+
+ public Game() throws NamingException {}
+
+ public int getNumber()
+ {
+ return number;
+ }
+
+ public int getGuess()
+ {
+ return guess;
+ }
+
+ public void setGuess(int guess)
+ {
+ this.guess = guess;
+ }
+
+ public int getSmallest()
+ {
+ return smallest;
+ }
+
+ public int getBiggest()
+ {
+ return biggest;
+ }
+
+ public int getRemainingGuesses()
+ {
+ return remainingGuesses;
+ }
+
+ public boolean check()
+ {
+ if (guess>number)
+ {
+ biggest = guess - 1;
+ }
+ if (guess<number)
+ {
+ smallest = guess + 1;
+ }
+ remainingGuesses--;
+ return (guess == number);
+ }
+
+ @PostConstruct
+ public void reset()
+ {
+ this.smallest = 0;
+ this.guess = 0;
+ this.remainingGuesses = 10;
+ this.biggest = maxNumber;
+ this.number = randomNumber.get();
+ }
+}
Modified: examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Generator.java
===================================================================
--- examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Generator.java 2009-10-27 18:15:01 UTC (rev 4350)
+++ examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Generator.java 2009-10-27 18:16:18 UTC (rev 4351)
@@ -1,20 +1,16 @@
package org.jboss.weld.examples.wicket;
-
import java.io.Serializable;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
-
-
@ApplicationScoped
public class Generator implements Serializable
{
-
private static final long serialVersionUID = -7213673465118041882L;
- private java.util.Random random = new java.util.Random( System.currentTimeMillis() );
+ private java.util.Random random = new java.util.Random(System.currentTimeMillis());
private int maxNumber = 100;
@@ -23,7 +19,8 @@
return random;
}
- @Produces @Random int next() {
+ @Produces @Random int next()
+ {
return getRandom().nextInt(maxNumber);
}
@@ -31,5 +28,4 @@
{
return maxNumber;
}
-
}
Modified: examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/HomePage.html
===================================================================
--- examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/HomePage.html 2009-10-27 18:15:01 UTC (rev 4350)
+++ examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/HomePage.html 2009-10-27 18:16:18 UTC (rev 4351)
@@ -1,29 +1,28 @@
<html>
- <head>
- <title>Wicket Weld example</title>
- </head>
- <body>
- <h1>Guess a number...</h1>
- <form wicket:id="NumberGuessMain">
- <div style="color: red">
- <span wicket:id="messages"/>
- </div>
+ <head>
+ <title>Wicket Weld example</title>
+ </head>
+ <body>
+ <h1>Guess a number...</h1>
+ <form wicket:id="NumberGuessMain">
+ <div style="color: red">
+ <span wicket:id="messages"/>
+ </div>
- <div wicket:id="prompt">
- I'm thinking of a number between 0 and 100. You have 10 guesses.
- </div>
+ <div wicket:id="prompt">
+ I'm thinking of a number between 0 and 100. You have 10 guesses.
+ </div>
- <div>
- <span wicket:id="guessLabel">Your guess:</span>
- <input wicket:id="inputGuess" type="text" size="3"/>
- <input wicket:id="GuessButton" type="submit" value="Guess"/>
- <input wicket:id="RestartButton" type="submit" value="Reset"/>
+ <div>
+ <span wicket:id="guessLabel">Your guess:</span>
+ <input wicket:id="inputGuess" type="text" size="3"/>
+ <input wicket:id="GuessButton" type="submit" value="Guess"/>
+ <input wicket:id="RestartButton" type="submit" value="Reset"/>
<h:commandButton id="GuessButton" value="Guess" action="#{game.check}" disabled="#{game.number eq game.guess}"/>
- </div>
- <div>
- <h:commandButton id="RestartButton" value="Reset" action="#{game.reset}" immediate="true" />
- </div>
- </form>
- </body>
+ </div>
+ <div>
+ <h:commandButton id="RestartButton" value="Reset" action="#{game.reset}" immediate="true"/>
+ </div>
+ </form>
+ </body>
</html>
-
Modified: examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/HomePage.java
===================================================================
--- examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/HomePage.java 2009-10-27 18:15:01 UTC (rev 4350)
+++ examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/HomePage.java 2009-10-27 18:16:18 UTC (rev 4351)
@@ -1,90 +1,101 @@
-package org.jboss.weld.examples.wicket;
-
-import java.io.Serializable;
-
-import javax.inject.Inject;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.form.AjaxButton;
-import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.form.TextField;
-import org.apache.wicket.markup.html.panel.FeedbackPanel;
-import org.apache.wicket.model.Model;
-
-public class HomePage extends WebPage {
-
- private static final long serialVersionUID = 1L;
-
- @Inject
- Game game;
-
- public HomePage() {
-
-
- Form form = new Form("NumberGuessMain");
- add(form);
- form.add(new FeedbackPanel("messages").setOutputMarkupId(true));
-
- final Component prompt = new Label("prompt", new Model() {
- @Override
- public Serializable getObject()
- {
- return "I'm thinking of a number between " + game.getSmallest() + " and " + game.getBiggest() +
- ". You have " + game.getRemainingGuesses() + " guesses.";
- }
- });
- form.add(prompt);
-
- final Component guessLabel = new Label("guessLabel","Your Guess:");
- form.add(guessLabel);
- final Component inputGuess = new TextField("inputGuess",new Model() {
- public Serializable getObject()
- {
- return game.getGuess();
- }
- public void setObject(Object object) {
- game.setGuess(Integer.parseInt((String)object));
- }
- });
- form.add(inputGuess);
-
- final Component guessButton = new AjaxButton("GuessButton") {
- protected void onSubmit(AjaxRequestTarget target, Form form) {
- if (game.check()) {
- info("Correct!");
- setVisible(false);
- prompt.setVisible(false);
- guessLabel.setVisible(false);
- inputGuess.setVisible(false);
- }
- else if (game.getRemainingGuesses() == 0) {
- info("Sorry, the answer was " + game.getNumber());
- setVisible(false);
- guessLabel.setVisible(false);
- inputGuess.setVisible(false);
- }
- else if (game.getNumber() > game.getGuess())
- info("Higher!");
- else if (game.getNumber() < game.getGuess())
- info("Lower");
- target.addComponent(form);
- }
- };
- form.add(guessButton);
-
- form.add(new AjaxButton("RestartButton") {
- protected void onSubmit(AjaxRequestTarget target, Form form) {
- game.reset();
- guessButton.setVisible(true);
- prompt.setVisible(true);
- guessLabel.setVisible(true);
- inputGuess.setVisible(true);
- target.addComponent(form);
- }
- });
-
- }
-}
+package org.jboss.weld.examples.wicket;
+
+import java.io.Serializable;
+
+import javax.inject.Inject;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.markup.html.panel.FeedbackPanel;
+import org.apache.wicket.model.Model;
+
+public class HomePage extends WebPage
+{
+ private static final long serialVersionUID = 1L;
+
+ @Inject Game game;
+
+ public HomePage()
+ {
+ Form form = new Form("NumberGuessMain");
+ add(form);
+ form.add(new FeedbackPanel("messages").setOutputMarkupId(true));
+
+ final Component prompt = new Label("prompt", new Model()
+ {
+ @Override
+ public Serializable getObject()
+ {
+ return "I'm thinking of a number between " + game.getSmallest() + " and " + game.getBiggest() +
+ ". You have " + game.getRemainingGuesses() + " guesses.";
+ }
+ });
+
+ form.add(prompt);
+
+ final Component guessLabel = new Label("guessLabel","Your Guess:");
+ form.add(guessLabel);
+ final Component inputGuess = new TextField("inputGuess",new Model()
+ {
+ public Serializable getObject()
+ {
+ return game.getGuess();
+ }
+ public void setObject(Object object)
+ {
+ game.setGuess(Integer.parseInt((String)object));
+ }
+ });
+ form.add(inputGuess);
+
+ final Component guessButton = new AjaxButton("GuessButton")
+ {
+ protected void onSubmit(AjaxRequestTarget target, Form form)
+ {
+ if (game.check())
+ {
+ info("Correct!");
+ setVisible(false);
+ prompt.setVisible(false);
+ guessLabel.setVisible(false);
+ inputGuess.setVisible(false);
+ }
+ else if (game.getRemainingGuesses() == 0)
+ {
+ info("Sorry, the answer was " + game.getNumber());
+ setVisible(false);
+ guessLabel.setVisible(false);
+ inputGuess.setVisible(false);
+ }
+ else if (game.getNumber() > game.getGuess())
+ {
+ info("Higher!");
+ }
+ else if (game.getNumber() < game.getGuess())
+ {
+ info("Lower");
+ }
+ target.addComponent(form);
+ }
+ };
+ form.add(guessButton);
+
+ form.add(new AjaxButton("RestartButton")
+ {
+ protected void onSubmit(AjaxRequestTarget target, Form form)
+ {
+ game.reset();
+ guessButton.setVisible(true);
+ prompt.setVisible(true);
+ guessLabel.setVisible(true);
+ inputGuess.setVisible(true);
+ target.addComponent(form);
+ }
+ });
+ }
+}
Modified: examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/MaxNumber.java
===================================================================
--- examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/MaxNumber.java 2009-10-27 18:15:01 UTC (rev 4350)
+++ examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/MaxNumber.java 2009-10-27 18:16:18 UTC (rev 4351)
@@ -1,6 +1,5 @@
package org.jboss.weld.examples.wicket;
-
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
@@ -13,12 +12,10 @@
import javax.inject.Qualifier;
-
@Target( { TYPE, METHOD, PARAMETER, FIELD })
@Retention(RUNTIME)
@Documented
@Qualifier
public @interface MaxNumber
{
-
}
Copied: examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/NumberGuessApplication.java (from rev 4215, examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/SampleApplication.java)
===================================================================
--- examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/NumberGuessApplication.java (rev 0)
+++ examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/NumberGuessApplication.java 2009-10-27 18:16:18 UTC (rev 4351)
@@ -0,0 +1,12 @@
+package org.jboss.weld.examples.wicket;
+
+import org.jboss.weld.wicket.WeldApplication;
+
+public class NumberGuessApplication extends WeldApplication
+{
+ @Override
+ public Class getHomePage()
+ {
+ return HomePage.class;
+ }
+}
Modified: examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Random.java
===================================================================
--- examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Random.java 2009-10-27 18:15:01 UTC (rev 4350)
+++ examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/Random.java 2009-10-27 18:16:18 UTC (rev 4351)
@@ -1,6 +1,5 @@
package org.jboss.weld.examples.wicket;
-
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
@@ -13,12 +12,10 @@
import javax.inject.Qualifier;
-
@Target( { TYPE, METHOD, PARAMETER, FIELD })
@Retention(RUNTIME)
@Documented
@Qualifier
public @interface Random
{
-
}
Deleted: examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/SampleApplication.java
===================================================================
--- examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/SampleApplication.java 2009-10-27 18:15:01 UTC (rev 4350)
+++ examples/trunk/wicket/numberguess/src/main/java/org/jboss/weld/examples/wicket/SampleApplication.java 2009-10-27 18:16:18 UTC (rev 4351)
@@ -1,14 +0,0 @@
-package org.jboss.weld.examples.wicket;
-
-import org.jboss.weld.wicket.WeldApplication;
-
-public class SampleApplication extends WeldApplication
-{
-
- @Override
- public Class getHomePage()
- {
- return HomePage.class;
- }
-
-}
Modified: examples/trunk/wicket/numberguess/src/main/webapp/WEB-INF/jetty-additions-to-web.xml
===================================================================
--- examples/trunk/wicket/numberguess/src/main/webapp/WEB-INF/jetty-additions-to-web.xml 2009-10-27 18:15:01 UTC (rev 4350)
+++ examples/trunk/wicket/numberguess/src/main/webapp/WEB-INF/jetty-additions-to-web.xml 2009-10-27 18:16:18 UTC (rev 4351)
@@ -1,10 +1,12 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
- version="2.4">
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
-<!-- Jboss AS has a deployer that bootstraps weld, but in jetty we need this listener -->
+ <!-- Jboss AS has a deployer that bootstraps weld, but in jetty we need this listener -->
<listener>
<listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
</listener>
Modified: examples/trunk/wicket/numberguess/src/main/webapp/WEB-INF/web.xml
===================================================================
--- examples/trunk/wicket/numberguess/src/main/webapp/WEB-INF/web.xml 2009-10-27 18:15:01 UTC (rev 4350)
+++ examples/trunk/wicket/numberguess/src/main/webapp/WEB-INF/web.xml 2009-10-27 18:16:18 UTC (rev 4351)
@@ -1,23 +1,25 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
- version="2.4">
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
- <display-name>weld-numberguess-wicket</display-name>
+ <display-name>weld-numberguess-wicket</display-name>
- <filter>
- <filter-name>wicket.numberguess-example</filter-name>
- <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
- <init-param>
- <param-name>applicationClassName</param-name>
- <param-value>org.jboss.weld.examples.wicket.SampleApplication</param-value>
- </init-param>
- </filter>
+ <filter>
+ <filter-name>Wicket Filter</filter-name>
+ <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
+ <init-param>
+ <param-name>applicationClassName</param-name>
+ <param-value>org.jboss.weld.examples.wicket.NumberGuessApplication</param-value>
+ </init-param>
+ </filter>
- <filter-mapping>
- <filter-name>wicket.numberguess-example</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
-
+ <filter-mapping>
+ <filter-name>Wicket Filter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
</web-app>
Modified: examples/trunk/wicket/numberguess/src/test/java/org/jboss/weld/examples/wicket/Start.java
===================================================================
--- examples/trunk/wicket/numberguess/src/test/java/org/jboss/weld/examples/wicket/Start.java 2009-10-27 18:15:01 UTC (rev 4350)
+++ examples/trunk/wicket/numberguess/src/test/java/org/jboss/weld/examples/wicket/Start.java 2009-10-27 18:16:18 UTC (rev 4351)
@@ -5,33 +5,38 @@
import org.mortbay.jetty.bio.SocketConnector;
import org.mortbay.jetty.webapp.WebAppContext;
-public class Start {
+public class Start
+{
+ public static void main(String[] args) throws Exception
+ {
+ Server server = new Server();
+ SocketConnector connector = new SocketConnector();
+ connector.setPort(8080);
+ server.setConnectors(new Connector[] { connector });
- public static void main(String[] args) throws Exception {
- Server server = new Server();
- SocketConnector connector = new SocketConnector();
- connector.setPort(8080);
- server.setConnectors(new Connector[] { connector });
+ WebAppContext bb = new WebAppContext();
+ bb.setServer(server);
+ bb.setContextPath("/");
+ bb.setWar("src/main/webapp");
+ bb.setOverrideDescriptor("src/main/webapp/WEB-INF/jetty-additions-to-web.xml");
+
+ server.addHandler(bb);
- WebAppContext bb = new WebAppContext();
- bb.setServer(server);
- bb.setContextPath("/");
- bb.setWar("src/main/webapp");
- bb.setOverrideDescriptor("src/main/webapp/WEB-INF/jetty-additions-to-web.xml");
-
- server.addHandler(bb);
-
- try {
- System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP");
- server.start();
- while (System.in.available() == 0) {
- Thread.sleep(500);
- }
- server.stop();
- server.join();
- } catch (Exception e) {
- e.printStackTrace();
- System.exit(100);
- }
- }
+ try
+ {
+ System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP");
+ server.start();
+ while (System.in.available() == 0)
+ {
+ Thread.sleep(500);
+ }
+ server.stop();
+ server.join();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(100);
+ }
+ }
}
15 years, 1 month
Weld SVN: r4350 - api/trunk/cdi/src/main/java/javax/enterprise/inject/spi.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-10-27 14:15:01 -0400 (Tue, 27 Oct 2009)
New Revision: 4350
Modified:
api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/InjectionTarget.java
Log:
get rid of imports
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/InjectionTarget.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/InjectionTarget.java 2009-10-27 17:31:19 UTC (rev 4349)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/InjectionTarget.java 2009-10-27 18:15:01 UTC (rev 4350)
@@ -16,8 +16,6 @@
*/
package javax.enterprise.inject.spi;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
import javax.enterprise.context.spi.CreationalContext;
/**
@@ -49,23 +47,23 @@
/**
* <p>
- * Calls the {@link PostConstruct} callback, if it exists,
+ * Calls the {@link javax.annotation.PostConstruct} callback, if it exists,
* according to the semantics required by the Java EE platform specification.
* </p>
*
* @param instance The instance on which to invoke the
- * {@link PostConstruct} method
+ * {@link javax.annotation.PostConstruct} method
*/
public void postConstruct(T instance);
/**
* <p>
- * Calls the {@link PreDestroy} callback, if it exists,
+ * Calls the {@link javax.annotation.PreDestroy} callback, if it exists,
* according to the semantics required by the Java EE platform specification.
* </p>
*
* @param instance The instance on which to invoke the
- * {@link PreDestroy} method
+ * {@link javax.annotation.PreDestroy} method
*/
public void preDestroy(T instance);
15 years, 1 month
Weld SVN: r4349 - in core/trunk/impl/src/main/java/org/jboss/weld: bootstrap/events and 1 other directories.
by weld-commits@lists.jboss.org
Author: dallen6
Date: 2009-10-27 13:31:19 -0400 (Tue, 27 Oct 2009)
New Revision: 4349
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java
Log:
Updated JavaDocs and the ObserverMethod API to latest spec.
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java 2009-10-27 17:30:59 UTC (rev 4348)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java 2009-10-27 17:31:19 UTC (rev 4349)
@@ -146,7 +146,7 @@
}
for (ObserverMethodImpl<?, ?> observerMethod : extensionBeanDeployerEnvironment.getObservers())
{
- if (deployment.loadBeanDeploymentArchive(observerMethod.getBean().getBeanClass()).equals(beanDeploymentArchive))
+ if (deployment.loadBeanDeploymentArchive(observerMethod.getBeanClass()).equals(beanDeploymentArchive))
{
beanDeployer.getManager().addObserver(observerMethod);
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java 2009-10-27 17:30:59 UTC (rev 4348)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java 2009-10-27 17:31:19 UTC (rev 4349)
@@ -68,7 +68,7 @@
public void addObserverMethod(ObserverMethod<?, ?> observerMethod)
{
- getOrCreateBeanDeployment(observerMethod.getBean().getBeanClass()).getBeanManager().addObserver(observerMethod);
+ getOrCreateBeanDeployment(observerMethod.getBeanClass()).getBeanManager().addObserver(observerMethod);
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java 2009-10-27 17:30:59 UTC (rev 4348)
+++ core/trunk/impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java 2009-10-27 17:31:19 UTC (rev 4349)
@@ -33,7 +33,6 @@
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.New;
import javax.enterprise.inject.Produces;
-import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.ObserverMethod;
import javax.inject.Inject;
@@ -164,10 +163,9 @@
}
- @SuppressWarnings("unchecked")
- public Bean<X> getBean()
+ public Class<X> getBeanClass()
{
- return declaringBean;
+ return declaringBean.getType();
}
public Annotation[] getBindingsAsArray()
15 years, 1 month
Weld SVN: r4348 - cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer and 1 other directories.
by weld-commits@lists.jboss.org
Author: dallen6
Date: 2009-10-27 13:30:59 -0400 (Tue, 27 Oct 2009)
New Revision: 4348
Modified:
api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedType.java
api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/Bean.java
api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/Decorator.java
api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/Interceptor.java
api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/ObserverMethod.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/ObserverTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/resolve/ResolveEventObserversTest.java
Log:
Updated JavaDocs and the ObserverMethod API to latest spec.
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedType.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedType.java 2009-10-27 11:57:40 UTC (rev 4347)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedType.java 2009-10-27 17:30:59 UTC (rev 4348)
@@ -32,7 +32,7 @@
/**
* Get the underlying {@linkplain java.lang.Class class} instance.
*
- * @return
+ * @return the {@link java.lang.Class} of the instance
*/
public Class<X> getJavaClass();
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/Bean.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/Bean.java 2009-10-27 11:57:40 UTC (rev 4347)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/Bean.java 2009-10-27 17:30:59 UTC (rev 4348)
@@ -23,70 +23,84 @@
import javax.enterprise.context.spi.Contextual;
+/**
+ * <p>
+ * This interface defines everything the container needs to manage instances of
+ * a certain bean.
+ * </p>
+ *
+ * @author David Allen
+ * @param <T> the class of the bean instance
+ */
public interface Bean<T> extends Contextual<T>
{
/**
- * The client-visible types of a bean
+ * Returns the client-visible {@linkplain Type types} of a bean.
*
- * @return the bean types
+ * @return the bean {@linkplain Type types}
*/
public Set<Type> getTypes();
/**
- * The bindings of a bean
+ * Returns the {@linkplain javax.inject.Qualifier qualifiers} of a bean.
*
- * @return the bindings
+ * @return the {@linkplain javax.inject.Qualifier qualifiers}
*/
public Set<Annotation> getQualifiers();
/**
- * The scope of a bean
+ * Returns the {@linkplain javax.enterprise.context scope} of a bean.
*
- * @return the scope
+ * @return the {@linkplain javax.enterprise.context scope}
*/
public Class<? extends Annotation> getScope();
/**
- * The name of a bean
+ * Returns the name of a bean, if it has one.
*
* @return the name
*/
public String getName();
/**
- * The stereotypes applied to this bean
+ * The {@linkplain javax.enterprise.inject.Stereotype stereotypes} applied to
+ * this bean
*
- * @return stereotypes if any
+ * @return {@linkplain javax.enterprise.inject.Stereotype stereotypes} if any
*/
public Set<Class<? extends Annotation>> getStereotypes();
/**
- * The bean class of the managed bean or session bean or of the bean that
- * declares the producer method or field
+ * The bean {@linkplain Class class} of the managed bean or session bean or
+ * of the bean that declares the producer method or field
*
- * @return the class of the managed bean
+ * @return the {@linkplain Class class} of the managed bean
*/
public Class<?> getBeanClass();
/**
- * Test to see if the bean is a policy
+ * Test to see if the bean is an
+ * {@linkplain javax.enterprise.inject.Alternative alternative}.
*
- * @return true if the bean is a policy
+ * @return true if the bean is an
+ * {@linkplain javax.enterprise.inject.Alternative alternative}
*/
public boolean isAlternative();
/**
- * The nullability of a bean
+ * Determines if the {@code create()} method may sometimes return a null
+ * value.
*
- * @return true if the bean is nullable
+ * @return true if the {@code create()} method may return a null
*/
public boolean isNullable();
/**
- * The injection points of a bean
+ * A set of {@link InjectionPoint} objects representing injection points of
+ * the bean, that will be validated by the container at initialization time.
*
- * @return the injection points of a bean
+ * @return the {@linkplain InjectionPoint injection points} of a bean
*/
public Set<InjectionPoint> getInjectionPoints();
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/Decorator.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/Decorator.java 2009-10-27 11:57:40 UTC (rev 4347)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/Decorator.java 2009-10-27 17:30:59 UTC (rev 4348)
@@ -22,7 +22,7 @@
import java.util.Set;
/**
- * The bean object for a decorator
+ * The bean object for a decorator must implement this interface.
*
* @author Pete Muir
*
@@ -32,23 +32,23 @@
{
/**
- * Obtains the delegate type
+ * Obtains the delegate {@linkplain Type type}.
*
- * @return
+ * @return the delegate {@linkplain Type type}
*/
public Type getDelegateType();
/**
- * Obtains the delegate bindings
+ * Obtains the {@linkplain javax.inject.Qualifier qualifiers} of the delegate.
*
- * @return
+ * @return the {@linkplain javax.inject.Qualifier qualifiers} of the delegate
*/
public Set<Annotation> getDelegateQualifiers();
/**
- * Obtains the decorated types
+ * Obtains the decorated {@linkplain Type types} of the decorator
*
- * @return
+ * @return the set of decorated {@linkplain Type types} of the decorator
*/
public Set<Type> getDecoratedTypes();
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/Interceptor.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/Interceptor.java 2009-10-27 11:57:40 UTC (rev 4347)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/Interceptor.java 2009-10-27 17:30:59 UTC (rev 4348)
@@ -29,20 +29,20 @@
* @author Pete Muir
* @author David Allen
*
- * @param <T>
+ * @param <T> the {@link java.lang.Class} of bean intercepted
*/
public interface Interceptor<T> extends Bean<T>
{
/**
- * The interceptor bindings used to bind an interceptor to a bean
+ * Returns the set of interceptor bindings used to bind an interceptor to a bean.
*
* @return the interceptor bindings
*/
public Set<Annotation> getInterceptorBindingTypes();
/**
- * Tests if this intercepts callbacks or business methods of the given type
+ * Tests if this intercepts callbacks or business methods of the given type.
*
* @param type The type of interception
* @return true if this intercepts the given type of methods
@@ -51,7 +51,7 @@
/**
* Invokes the specified kind of lifecycle callback or business method upon the
- * given instance
+ * given instance.
*
* @param type the interception type
* @param instance the instance to invoke
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/ObserverMethod.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/ObserverMethod.java 2009-10-27 11:57:40 UTC (rev 4347)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/ObserverMethod.java 2009-10-27 17:30:59 UTC (rev 4348)
@@ -7,17 +7,59 @@
import javax.enterprise.event.Reception;
import javax.enterprise.event.TransactionPhase;
+/**
+ * <p>
+ * This interface defines everything the container needs to know about an
+ * observer method.
+ * </p>
+ *
+ * @author David Allen
+ * @param <X> the type of bean with the observer method
+ * @param <T> the type of event
+ */
public interface ObserverMethod<X, T>
{
- public Bean<X> getBean();
+ /**
+ * Obtains the {@linkplain Class class} of bean defining the observer method.
+ *
+ * @return the defining {@linkplain Class class}
+ */
+ public Class<X> getBeanClass();
+ /**
+ * Obtains the {@linkplain Type type} of event being observed.
+ *
+ * @return the event {@linkplain Type type}
+ */
public Type getObservedType();
+ /**
+ * Obtains the set of {@linkplain javax.inject.Qualifier qualifiers} for the
+ * event being observed.
+ *
+ * @return the {@linkplain javax.inject.Qualifier qualifiers} for the event
+ */
public Set<Annotation> getObservedQualifiers();
+ /**
+ * Obtains the specified {@link Reception} for the observer method. This
+ * indicates if the observer is conditional or not.
+ *
+ * @return the {@link Reception}
+ */
public Reception getReception();
+ /**
+ * Obtains the specified {@link TransactionPhase} for the observer method.
+ *
+ * @return the {@link TransactionPhase}
+ */
public TransactionPhase getTransactionPhase();
+ /**
+ * Calls the observer method passing the given event object.
+ *
+ * @param event The event object
+ */
public void notify(T event);
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/ObserverTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/ObserverTest.java 2009-10-27 11:57:40 UTC (rev 4347)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/ObserverTest.java 2009-10-27 17:30:59 UTC (rev 4348)
@@ -55,7 +55,7 @@
Set<ObserverMethod<?, StockPrice>> observers = getCurrentManager().resolveObserverMethods(new StockPrice());
assert observers.size() == 1;
ObserverMethod<?, StockPrice> observerMethod = observers.iterator().next();
- assert observerMethod.getBean().getBeanClass().equals(StockWatcher.class);
+ assert observerMethod.getBeanClass().equals(StockWatcher.class);
}
@Test(groups = { "events" })
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/resolve/ResolveEventObserversTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/resolve/ResolveEventObserversTest.java 2009-10-27 11:57:40 UTC (rev 4347)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/resolve/ResolveEventObserversTest.java 2009-10-27 17:30:59 UTC (rev 4348)
@@ -43,7 +43,7 @@
Set<ObserverMethod<?, Temperature>> temperatureObservers = getCurrentManager().resolveObserverMethods(new Temperature(0d));
assert temperatureObservers.size() == 1;
ObserverMethod<?, Temperature> temperatureObserver = temperatureObservers.iterator().next();
- assert temperatureObserver.getBean() == getUniqueBean(AirConditioner.class);
+ assert temperatureObserver.getBeanClass().equals(AirConditioner.class);
assert temperatureObserver.getObservedType().equals(Temperature.class);
Method method = AirConditioner.class.getMethod("temperatureChanged", Temperature.class);
15 years, 1 month
Weld SVN: r4347 - in cdi-tck/trunk/impl/src/main: resources/org/jboss/jsr299/tck/tests/context/application and 1 other directory.
by weld-commits@lists.jboss.org
Author: jharting
Date: 2009-10-27 07:57:40 -0400 (Tue, 27 Oct 2009)
New Revision: 4347
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/Result.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/TestHttpSessionListener.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/TestServlet.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/TestServletContextListener.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/TestServletRequestListener.java
Removed:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ServiceMethodServlet.java
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ApplicationContextTest.java
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/application/web.xml
Log:
Tests for section 6.7.3
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ApplicationContextTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ApplicationContextTest.java 2009-10-27 06:48:52 UTC (rev 4346)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ApplicationContextTest.java 2009-10-27 11:57:40 UTC (rev 4347)
@@ -1,3 +1,19 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.jboss.jsr299.tck.tests.context.application;
import org.jboss.jsr299.tck.AbstractJSR299Test;
@@ -15,6 +31,7 @@
/**
* @author David Allen
+ * @author Jozef Hartinger
*/
@Artifact
@IntegrationTest(runLocally=true)
@@ -32,7 +49,7 @@
{
WebClient webClient = new WebClient();
webClient.setThrowExceptionOnFailingStatusCode(true);
- webClient.getPage(getContextPath() + "serviceMethodTest");
+ webClient.getPage(getContextPath() + "TestServlet?test=servlet");
}
@Test(groups = { "contexts", "servlet", "integration" })
@@ -43,6 +60,31 @@
webClient.setThrowExceptionOnFailingStatusCode(true);
webClient.getPage(getContextPath() + "SimplePage.html");
}
+
+
+ @Test(groups = { "contexts", "integration" })
+ @SpecAssertion(section = "6.7.3", id = "ac")
+ public void testApplicationScopeActiveDuringServletContextListenerInvocation() throws Exception {
+ WebClient webClient = new WebClient();
+ webClient.setThrowExceptionOnFailingStatusCode(true);
+ webClient.getPage(getContextPath() + "TestServlet?test=servletContextListener");
+ }
+
+ @Test(groups = { "contexts", "integration" })
+ @SpecAssertion(section = "6.7.3", id = "ad")
+ public void testApplicationScopeActiveDuringHttpSessionListenerInvocation() throws Exception {
+ WebClient webClient = new WebClient();
+ webClient.setThrowExceptionOnFailingStatusCode(true);
+ webClient.getPage(getContextPath() + "TestServlet?test=httpSessionListener");
+ }
+
+ @Test(groups = { "contexts", "integration" })
+ @SpecAssertion(section = "6.7.3", id = "af")
+ public void testApplicationScopeActiveDuringServletRequestListenerInvocation() throws Exception {
+ WebClient webClient = new WebClient();
+ webClient.setThrowExceptionOnFailingStatusCode(true);
+ webClient.getPage(getContextPath() + "TestServlet?test=servletRequestListener");
+ }
@Test(groups = { "contexts", "integration" })
@SpecAssertion(section = "6.7.3", id = "e")
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/Result.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/Result.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/Result.java 2009-10-27 11:57:40 UTC (rev 4347)
@@ -0,0 +1,36 @@
+package org.jboss.jsr299.tck.tests.context.application;
+
+import javax.enterprise.context.ApplicationScoped;
+
+@ApplicationScoped
+class Result
+{
+ private boolean applicationScopeActiveForServletContextListener = false;
+ private boolean applicationScopeActiveForHttpSessionListener = false;
+ private boolean applicationScopeActiveForServletRequestListener = false;
+
+ public boolean isApplicationScopeActiveForServletContextListener()
+ {
+ return applicationScopeActiveForServletContextListener;
+ }
+ public void setApplicationScopeActiveForServletContextListener(boolean applicationScopeActiveForServletContextListener)
+ {
+ this.applicationScopeActiveForServletContextListener = applicationScopeActiveForServletContextListener;
+ }
+ public boolean isApplicationScopeActiveForHttpSessionListener()
+ {
+ return applicationScopeActiveForHttpSessionListener;
+ }
+ public void setApplicationScopeActiveForHttpSessionListener(boolean applicationScopeActiveForHttpSessionListener)
+ {
+ this.applicationScopeActiveForHttpSessionListener = applicationScopeActiveForHttpSessionListener;
+ }
+ public boolean isApplicationScopeActiveForServletRequestListener()
+ {
+ return applicationScopeActiveForServletRequestListener;
+ }
+ public void setApplicationScopeActiveForServletRequestListener(boolean applicationScopeActiveForServletRequestListener)
+ {
+ this.applicationScopeActiveForServletRequestListener = applicationScopeActiveForServletRequestListener;
+ }
+}
Deleted: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ServiceMethodServlet.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ServiceMethodServlet.java 2009-10-27 06:48:52 UTC (rev 4346)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ServiceMethodServlet.java 2009-10-27 11:57:40 UTC (rev 4347)
@@ -1,63 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jboss.jsr299.tck.tests.context.application;
-
-import java.io.IOException;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.inject.Inject;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Servlet used just to test context during service method.
- *
- * @author David Allen
- *
- */
-public class ServiceMethodServlet extends HttpServlet
-{
-
- private static final long serialVersionUID = 1L;
-
- @Inject
- private BeanManager jsr299Manager;
-
- @Override
- protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
- {
- if (!jsr299Manager.getContext(ApplicationScoped.class).isActive())
- {
- throw new ServletException("Application context is not active");
- }
- else
- {
- super.service(req, resp);
- }
- }
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
- {
- resp.setContentType("text/text");
- resp.getWriter().println("It worked!");
- }
-}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/TestHttpSessionListener.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/TestHttpSessionListener.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/TestHttpSessionListener.java 2009-10-27 11:57:40 UTC (rev 4347)
@@ -0,0 +1,26 @@
+package org.jboss.jsr299.tck.tests.context.application;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.servlet.http.HttpSessionEvent;
+import javax.servlet.http.HttpSessionListener;
+
+public class TestHttpSessionListener implements HttpSessionListener
+{
+ @Inject
+ private BeanManager manager;
+ @Inject
+ private Result result;
+
+ public void sessionCreated(HttpSessionEvent hsc)
+ {
+ boolean result = manager.getContext(ApplicationScoped.class).isActive();
+ this.result.setApplicationScopeActiveForHttpSessionListener(result);
+ }
+
+ public void sessionDestroyed(HttpSessionEvent hsc)
+ {
+ }
+
+}
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/TestServlet.java (from rev 4217, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ServiceMethodServlet.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/TestServlet.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/TestServlet.java 2009-10-27 11:57:40 UTC (rev 4347)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.jsr299.tck.tests.context.application;
+
+import java.io.IOException;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Servlet used to test application context during service method and also for reporting
+ * test results of testing the context during a method invocation on ServletContextListener,
+ * HttpSessionListener and ServlerRequestListener.
+ *
+ * @author David Allen
+ *
+ */
+public class TestServlet extends HttpServlet
+{
+
+ private static final long serialVersionUID = 1L;
+
+ @Inject
+ private BeanManager jsr299Manager;
+ @Inject
+ private Result result;
+
+ @Override
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ if ("servlet".equals(req.getParameter("test"))) {
+ if (jsr299Manager.getContext(ApplicationScoped.class).isActive()) {
+ resp.setStatus(200);
+ } else {
+ resp.setStatus(500);
+ }
+ } else if ("servletContextListener".equals(req.getParameter("test"))) {
+ testServletContextListener(req, resp);
+ } else if ("httpSessionListener".equals(req.getParameter("test"))) {
+ testHttpSessionListener(req, resp);
+ } else if ("servletRequestListener".equals(req.getParameter("test"))) {
+ testServletRequestListener(req, resp);
+ } else {
+ resp.setStatus(404);
+ }
+ }
+
+ private void testServletContextListener(HttpServletRequest req, HttpServletResponse resp) {
+ resp.setStatus((result.isApplicationScopeActiveForServletContextListener()) ? 200 : 500);
+ }
+
+ private void testHttpSessionListener(HttpServletRequest req, HttpServletResponse resp) {
+ req.getSession().setAttribute("foo", "bar");
+ resp.setStatus((result.isApplicationScopeActiveForHttpSessionListener()) ? 200 : 500);
+ }
+
+ private void testServletRequestListener(HttpServletRequest req, HttpServletResponse resp) {
+ resp.setStatus((result.isApplicationScopeActiveForServletRequestListener()) ? 200 : 500);
+ }
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/TestServletContextListener.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/TestServletContextListener.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/TestServletContextListener.java 2009-10-27 11:57:40 UTC (rev 4347)
@@ -0,0 +1,26 @@
+package org.jboss.jsr299.tck.tests.context.application;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+public class TestServletContextListener implements ServletContextListener
+{
+ @Inject
+ private BeanManager manager;
+ @Inject
+ private Result result;
+
+ public void contextDestroyed(ServletContextEvent sce)
+ {
+ }
+
+ public void contextInitialized(ServletContextEvent sce)
+ {
+ boolean result = manager.getContext(ApplicationScoped.class).isActive();
+ this.result.setApplicationScopeActiveForServletContextListener(result);
+ }
+
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/TestServletRequestListener.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/TestServletRequestListener.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/TestServletRequestListener.java 2009-10-27 11:57:40 UTC (rev 4347)
@@ -0,0 +1,27 @@
+package org.jboss.jsr299.tck.tests.context.application;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.servlet.ServletRequestEvent;
+import javax.servlet.ServletRequestListener;
+
+public class TestServletRequestListener implements ServletRequestListener
+{
+
+ @Inject
+ private BeanManager manager;
+ @Inject
+ private Result result;
+
+ public void requestDestroyed(ServletRequestEvent sre)
+ {
+ }
+
+ public void requestInitialized(ServletRequestEvent sre)
+ {
+ boolean result = manager.getContext(ApplicationScoped.class).isActive();
+ this.result.setApplicationScopeActiveForServletRequestListener(result);
+ }
+
+}
Modified: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/application/web.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/application/web.xml 2009-10-27 06:48:52 UTC (rev 4346)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/application/web.xml 2009-10-27 11:57:40 UTC (rev 4347)
@@ -3,6 +3,15 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<description>Test servlets used to test session contexts.</description>
<display-name>Session Context Tests</display-name>
+ <listener>
+ <listener-class>org.jboss.jsr299.tck.tests.context.application.TestServletContextListener</listener-class>
+</listener>
+<listener>
+ <listener-class>org.jboss.jsr299.tck.tests.context.application.TestHttpSessionListener</listener-class>
+</listener>
+<listener>
+ <listener-class>org.jboss.jsr299.tck.tests.context.application.TestServletRequestListener</listener-class>
+</listener>
<filter>
<display-name>Test Filter for Sessions</display-name>
<filter-name>filterTest</filter-name>
@@ -16,9 +25,9 @@
<listener-class>org.jboss.testharness.impl.runner.servlet.HarnessServletListener</listener-class>
</listener>
<servlet>
- <display-name>serviceMethod</display-name>
- <servlet-name>service</servlet-name>
- <servlet-class>org.jboss.jsr299.tck.tests.context.application.ServiceMethodServlet</servlet-class>
+ <display-name>TestServlet</display-name>
+ <servlet-name>TestServlet</servlet-name>
+ <servlet-class>org.jboss.jsr299.tck.tests.context.application.TestServlet</servlet-class>
</servlet>
<servlet>
<display-name>Introspection Service for Application Context</display-name>
@@ -26,8 +35,8 @@
<servlet-class>org.jboss.jsr299.tck.tests.context.application.IntrospectApplication</servlet-class>
</servlet>
<servlet-mapping>
- <servlet-name>service</servlet-name>
- <url-pattern>/serviceMethodTest</url-pattern>
+ <servlet-name>TestServlet</servlet-name>
+ <url-pattern>/TestServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>applicationIntrospector</servlet-name>
15 years, 1 month
Weld SVN: r4346 - api/trunk/cdi/src/main/java/javax/enterprise/inject.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-10-27 02:48:52 -0400 (Tue, 27 Oct 2009)
New Revision: 4346
Modified:
api/trunk/cdi/src/main/java/javax/enterprise/inject/Alternative.java
api/trunk/cdi/src/main/java/javax/enterprise/inject/Typed.java
Log:
ws
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/Alternative.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/Alternative.java 2009-10-26 23:16:29 UTC (rev 4345)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/Alternative.java 2009-10-27 06:48:52 UTC (rev 4346)
@@ -68,7 +68,6 @@
* @author Gavin King
* @author Pete Muir
*/
-
@Target({TYPE, METHOD, FIELD})
@Retention(RUNTIME)
@Documented
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/Typed.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/Typed.java 2009-10-26 23:16:29 UTC (rev 4345)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/Typed.java 2009-10-27 06:48:52 UTC (rev 4346)
@@ -48,7 +48,6 @@
* @author Gavin King
*
*/
-
@Target( { FIELD, METHOD, TYPE })
@Retention(RUNTIME)
@Documented
15 years, 1 month
Weld SVN: r4345 - api/trunk/cdi/src/main/java/javax/enterprise/inject/spi.
by weld-commits@lists.jboss.org
Author: dallen6
Date: 2009-10-26 19:16:29 -0400 (Mon, 26 Oct 2009)
New Revision: 4345
Modified:
api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedCallable.java
api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedConstructor.java
api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedField.java
api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedMember.java
api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedMethod.java
api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedParameter.java
api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedType.java
api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/InjectionTarget.java
Log:
Additional JavaDocs for SPI package
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedCallable.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedCallable.java 2009-10-26 22:02:12 UTC (rev 4344)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedCallable.java 2009-10-26 23:16:29 UTC (rev 4345)
@@ -33,7 +33,7 @@
{
/**
- * Get the parameters of the callable member
+ * Get the parameters of the callable member.
*
* @return the parameters
*/
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedConstructor.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedConstructor.java 2009-10-26 22:02:12 UTC (rev 4344)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedConstructor.java 2009-10-26 23:16:29 UTC (rev 4345)
@@ -23,7 +23,7 @@
* The metadata for an annotated constructor which can be parsed by the
* {@link BeanManager}.
*
- * The semantics are similar to {@link Constructor}
+ * The semantics are similar to {@link Constructor}.
*
* @author Pete Muir
*
@@ -33,7 +33,7 @@
{
/**
- * Get the underlying {@link Constructor} instance
+ * Get the underlying {@link Constructor} instance.
*
* @return the constructor instance
*/
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedField.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedField.java 2009-10-26 22:02:12 UTC (rev 4344)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedField.java 2009-10-26 23:16:29 UTC (rev 4345)
@@ -20,9 +20,9 @@
import java.lang.reflect.Member;
/**
- * The metadata for an annotated field which can be parsed by the {@link BeanManager}
+ * The metadata for an annotated field which can be parsed by the {@link BeanManager}.
*
- * The semantics are similar to {@link Field}
+ * The semantics are similar to {@link Field}.
*
* @author Pete Muir
*
@@ -31,7 +31,7 @@
public interface AnnotatedField<X> extends AnnotatedMember<X> {
/**
- * Get the underlying {@link Member} instance
+ * Get the underlying {@link Member} instance.
*
* @return the member instance
*/
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedMember.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedMember.java 2009-10-26 22:02:12 UTC (rev 4344)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedMember.java 2009-10-26 23:16:29 UTC (rev 4345)
@@ -21,32 +21,31 @@
/**
* The metadata for an annotated member which can be parsed by the
- * {@link BeanManager}.
+ * {@link BeanManager}. The semantics are similar to {@link Member}.
*
- * The semantics are similar to {@link Member}
- *
* @author Pete Muir
- *
* @param <X> the type of the declaring type
*/
-public interface AnnotatedMember<X> extends Annotated
+public interface AnnotatedMember<X> extends Annotated
{
/**
- * Get the underlying {@link Member} instance
+ * Get the underlying {@link Member} instance.
*
- * @return the member
+ * @return the {@linkplain Member member}
*/
public Member getJavaMember();
/**
- * Determine if the member is static
- * @return
+ * Determines if the member is static.
+ *
+ * @return true if the member is static
*/
public boolean isStatic();
/**
- * Get the type which declares this member
- * @return the type of which declares this member
+ * Get the {@linkplain AnnotatedType type} which declares this member.
+ *
+ * @return the {@linkplain AnnotatedType type} of which declares this member
*/
public AnnotatedType<X> getDeclaringType();
}
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedMethod.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedMethod.java 2009-10-26 22:02:12 UTC (rev 4344)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedMethod.java 2009-10-26 23:16:29 UTC (rev 4345)
@@ -20,21 +20,17 @@
/**
* The metadata for an annotated method which can be parsed by the
- * {@link BeanManager}
+ * {@link BeanManager}. The semantics are similar to {@link Method}.
*
- * The semantics are similar to {@link Method}
- *
* @author Pete Muir
- *
* @param <X> the return type of the method
*/
public interface AnnotatedMethod<X> extends AnnotatedCallable<X>
{
/**
- * Get the underlying {@link Method} instance
- *
- * return the method
+ * Get the underlying {@link Method} instance. return the {@linkplain Method
+ * method}
*/
public Method getJavaMember();
}
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedParameter.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedParameter.java 2009-10-26 22:02:12 UTC (rev 4344)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedParameter.java 2009-10-26 23:16:29 UTC (rev 4345)
@@ -19,7 +19,7 @@
/**
* The metadata for an annotated parameter which can be parsed by the
- * {@link BeanManager}
+ * {@link BeanManager}.
*
* @author Pete Muir
*
@@ -29,16 +29,16 @@
{
/**
- * The position of the parameter in the callable's argument list
+ * The position of the parameter in the callable's argument list.
*
* @return the position of the parameter
*/
public int getPosition();
/**
- * The declaring callable
+ * The declaring {@linkplain AnnotatedCallable callable}.
*
- * @return the declaring callable
+ * @return the declaring {@linkplain AnnotatedCallable callable}
*/
public AnnotatedCallable<X> getDeclaringCallable();
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedType.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedType.java 2009-10-26 22:02:12 UTC (rev 4344)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/AnnotatedType.java 2009-10-26 23:16:29 UTC (rev 4345)
@@ -20,44 +20,41 @@
import java.util.Set;
/**
- * The metadata for an annotated type which can be parsed by the {@link BeanManager}
+ * The metadata for an annotated type which can be parsed by the
+ * {@link BeanManager}. The semantics are similar to {@link Class}.
*
- * The semantics are similar to {@link Class}.
- *
* @author Pete Muir
- *
* @param <X> the type of the class
*/
-public interface AnnotatedType<X> extends Annotated {
+public interface AnnotatedType<X> extends Annotated
+{
/**
- * Get the underlying class instance
+ * Get the underlying {@linkplain java.lang.Class class} instance.
*
* @return
*/
public Class<X> getJavaClass();
/**
- * Get the constructors belonging to the class
+ * Get the {@linkplain AnnotatedConstructor constructors} belonging to the class If an empty set is returned, a
+ * default (no-args) constructor will be assumed.
*
- * If an empty set is returned, a default (no-args) constructor will be
- * assumed.
- *
- * @return the constructors, or an empty set if none are defined
+ * @return the {@linkplain AnnotatedConstructor constructors}, or an empty set if none are defined
*/
public Set<AnnotatedConstructor<X>> getConstructors();
/**
- * Get the business methods belonging to the class.
+ * Get the {@linkplain AnnotatedMethod business methods} belonging to the class.
*
- * @return the methods, or an empty set if none are defined
+ * @return the {@linkplain AnnotatedMethod methods}, or an empty set if none are defined
*/
public Set<AnnotatedMethod<? super X>> getMethods();
/**
- * Get the fields belonging to the class
+ * Get the {@linkplain AnnotatedField fields} belonging to the class.
*
- * @return the fields, or an empty set if none are defined
+ * @return the {@linkplain AnnotatedField fields}, or an empty set if none are defined
*/
public Set<AnnotatedField<? super X>> getFields();
}
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/InjectionTarget.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/InjectionTarget.java 2009-10-26 22:02:12 UTC (rev 4344)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/spi/InjectionTarget.java 2009-10-26 23:16:29 UTC (rev 4345)
@@ -16,6 +16,8 @@
*/
package javax.enterprise.inject.spi;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
import javax.enterprise.context.spi.CreationalContext;
/**
@@ -47,23 +49,23 @@
/**
* <p>
- * Calls the {@code PostConstruct} callback, if it exists,
+ * Calls the {@link PostConstruct} callback, if it exists,
* according to the semantics required by the Java EE platform specification.
* </p>
- * @see javax.annotation.PostConstruct
+ *
* @param instance The instance on which to invoke the
- * {@code PostConstruct} method
+ * {@link PostConstruct} method
*/
public void postConstruct(T instance);
/**
* <p>
- * Calls the {@code PreDestroy} callback, if it exists,
+ * Calls the {@link PreDestroy} callback, if it exists,
* according to the semantics required by the Java EE platform specification.
* </p>
- * @see javax.annotation.PreDestroy
+ *
* @param instance The instance on which to invoke the
- * {@code PreDestroy} method
+ * {@link PreDestroy} method
*/
public void preDestroy(T instance);
15 years, 1 month
Weld SVN: r4344 - api/trunk/cdi/src/main/java/javax/enterprise/inject.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-10-26 18:02:12 -0400 (Mon, 26 Oct 2009)
New Revision: 4344
Modified:
api/trunk/cdi/src/main/java/javax/enterprise/inject/TypeLiteral.java
Log:
minor
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/TypeLiteral.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/TypeLiteral.java 2009-10-26 21:58:49 UTC (rev 4343)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/TypeLiteral.java 2009-10-26 22:02:12 UTC (rev 4344)
@@ -63,9 +63,7 @@
}
/**
- * Get the actual type represented by type literal
- *
- * @return
+ * @return the actual type represented by type literal
*/
public final Type getType()
{
@@ -73,9 +71,7 @@
}
/**
- * Get the raw type represented by the type literal
- *
- * @return
+ * @return the raw type represented by the type literal
*/
@SuppressWarnings("unchecked")
public final Class<T> getRawType() {
15 years, 1 month
Weld SVN: r4343 - in api/trunk/cdi/src/main: javadoc and 1 other directory.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-10-26 17:58:49 -0400 (Mon, 26 Oct 2009)
New Revision: 4343
Added:
api/trunk/cdi/src/main/javadoc/
api/trunk/cdi/src/main/javadoc/overview.html
Log:
top-level javadoc
Added: api/trunk/cdi/src/main/javadoc/overview.html
===================================================================
--- api/trunk/cdi/src/main/javadoc/overview.html (rev 0)
+++ api/trunk/cdi/src/main/javadoc/overview.html 2009-10-26 21:58:49 UTC (rev 4343)
@@ -0,0 +1,49 @@
+<html>
+
+<body>
+
+<p>Contexts and Dependency Injection (CDI) defines the following
+complementary services:</p>
+
+<ul>
+<li>The lifecycle and interactions of stateful
+{@linkplain javax.enterprise.inject beans} bound to well-defined
+lifecycle {@linkplain javax.enterprise.context contexts}, where
+the set of contexts is {@linkplain javax.enterprise.context.spi
+extensible}</li>
+<li>A sophisticated, typesafe {@linkplain javax.enterprise.inject
+dependency injection mechanism}, including a
+{@linkplain javax.enterprise.inject.Alternative facility} for
+choosing between various beans that implement the same Java
+interface at deployment time</li>
+<li>{@linkplain javax.enterprise.inject Integration} with the
+Unified Expression Language, allowing any bean to be used directly
+within a JSF or JSP page</li>
+<li>The ability to {@linkplain javax.decorator decorate} injected
+components</li>
+<li>The ability to associate
+{@linkplain javax.interceptor interceptors} with beans via
+{@linkplain javax.enterprise.inject typesafe interceptor bindings}</li>
+<li>An {@linkplain javax.enterprise.event event} notification model</li>
+<li>A web {@linkplain javax.enterprise.context.ConversationScoped
+conversation context} in addition to the three standard
+web contexts defined by the Java Servlets specification</li>
+<li>An {@linkplain javax.enterprise.inject.spi SPI} allowing portable
+extensions to integrate cleanly with the Java EE environment</li>
+</ul>
+
+<p>CDI allows objects to be bound to lifecycle contexts, to be
+injected, to be associated with interceptors and decorators, and to
+interact in a loosely coupled fashion by
+{@linkplain javax.enterprise.event.Event firing} and
+{@linkplain javax.enterprise.event.Observes observing} events.
+{@linkplain javax.enterprise.inject Various kinds} of objects are
+injectable, including EJB 3 session beans, managed beans,
+{@linkplain javax.enterprise.inject.Produces producer methods } and
+Java EE resources. We refer to these objects in general terms as beans
+and to instances of beans that are bound to contexts as contextual
+instances.</p>
+
+</body>
+
+</html>
\ No newline at end of file
15 years, 1 month
Weld SVN: r4342 - api/trunk/cdi/src/main/java/javax/enterprise/inject.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-10-26 17:58:32 -0400 (Mon, 26 Oct 2009)
New Revision: 4342
Modified:
api/trunk/cdi/src/main/java/javax/enterprise/inject/AnnotationLiteral.java
api/trunk/cdi/src/main/java/javax/enterprise/inject/TypeLiteral.java
Log:
doc helpers
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/AnnotationLiteral.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/AnnotationLiteral.java 2009-10-26 20:03:04 UTC (rev 4341)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/AnnotationLiteral.java 2009-10-26 21:58:32 UTC (rev 4342)
@@ -26,13 +26,32 @@
/**
- * Supports inline instantiation of annotation type instances.
+ * <p>Supports inline instantiation of annotation type instances.</p>
*
+ * <p>An instance of an annotation type may be obtained by subclassing
+ * <tt>AnnotationLiteral</tt>.</p>
+ *
+ * <pre>
+ * public abstract class PayByQualifier
+ * extends AnnotationLiteral<PayBy>
+ * implements PayBy {}
+ * </pre>
+ *
+ * <pre>
+ * PayBy payby = new PayByQualifier() { public value() { return CHEQUE; } };
+ * </pre>
+ *
+ * <p>Annotation values are often passed to APIs that perform typesafe
+ * resolution.</p>
+ *
* @author Pete Muir
* @author Gavin King
*
- * @param <T>
- * the annotation type
+ * @param <T> the annotation type
+ *
+ * @see javax.enterprise.inject.Instance#select(Annotation...)
+ * @see javax.enterprise.event.Event#select(Annotation...)
+ *
*/
public abstract class AnnotationLiteral<T extends Annotation> implements
Annotation
Modified: api/trunk/cdi/src/main/java/javax/enterprise/inject/TypeLiteral.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/TypeLiteral.java 2009-10-26 20:03:04 UTC (rev 4341)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/TypeLiteral.java 2009-10-26 21:58:32 UTC (rev 4342)
@@ -22,14 +22,26 @@
import java.lang.reflect.Type;
/**
- * Supports inline instantiation of objects that represent parameterized types
- * with actual type parameters.
+ * <p>Supports inline instantiation of objects that represent parameterized types
+ * with actual type parameters.</p>
*
+ * <p>An object that represents any parameterized type may be obtained by
+ * subclassing <tt>TypeLiteral</tt>.
+ *
+ * <pre>
+ * TypeLiteral<List<String>> type = new TypeLiteral<List<String>>() {};
+ * </pre>
+ *
+ * <p>This object may be passed to APIs that perform typesafe resolution.</p>
+ *
* @author Gavin King
* @author Pete Muir
*
- * @param <T>
- * the type, including all actual type parameters
+ * @param <T> the type, including all actual type parameters
+ *
+ * @see javax.enterprise.inject.Instance#select(TypeLiteral, Annotation...)
+ * @see javax.enterprise.event.Event#select(TypeLiteral, Annotation...)
+ *
*/
public abstract class TypeLiteral<T>
{
15 years, 1 month