Weld SVN: r6453 - examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-16 14:09:37 -0400 (Wed, 16 Jun 2010)
New Revision: 6453
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabaseBean.java
Log:
minor tidyup
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabaseBean.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabaseBean.java 2010-06-16 18:03:38 UTC (rev 6452)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabaseBean.java 2010-06-16 18:09:37 UTC (rev 6453)
@@ -29,7 +29,6 @@
import java.util.StringTokenizer;
import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import javax.inject.Named;
@@ -53,9 +52,7 @@
private static final String DATA_FILE_NAME = "data.sql";
@Inject
- private Instance<CodeFragmentManager> eaoIn;
- private CodeFragmentManager eao;
- private boolean secured;
+ private CodeFragmentManager codeFragmentManager;
private boolean populated;
@@ -67,8 +64,6 @@
return;
}
- eao = eaoIn.get();
-
try
{
String fileContent = readFileData(DATA_FILE_NAME);
@@ -89,9 +84,8 @@
st.nextToken();
c.setText(st.nextToken());
- eao.addCodeFragment(c, secured);
+ codeFragmentManager.addCodeFragment(c, false);
}
-
}
catch (Exception e)
{
@@ -106,14 +100,14 @@
InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName);
BufferedReader br = new BufferedReader(new InputStreamReader(is));
- String radek;
- StringBuffer sb = new StringBuffer();
+ String line;
+ StringBuilder sb = new StringBuilder();
- while ((radek = br.readLine()) != null)
+ while ((line = br.readLine()) != null)
{
- sb.append(radek).append("\n");
+ sb.append(line).append("\n");
}
- return new String(sb);
+ return sb.toString();
}
}
14 years, 6 months
Weld SVN: r6452 - examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-16 14:03:38 -0400 (Wed, 16 Jun 2010)
New Revision: 6452
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java
Log:
A default language
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java 2010-06-16 18:03:18 UTC (rev 6451)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java 2010-06-16 18:03:38 UTC (rev 6452)
@@ -83,6 +83,7 @@
this.note = "";
this.text = "";
this.user = "";
+ this.language = Language.TEXT;
}
public int getId()
14 years, 6 months
Weld SVN: r6451 - examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-16 14:03:18 -0400 (Wed, 16 Jun 2010)
New Revision: 6451
Modified:
examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/
Log:
ignores
Property changes on: examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF
___________________________________________________________________
Name: svn:ignore
- lib
+ lib
.faces-config.xml.jsfdia
14 years, 6 months
Weld SVN: r6450 - examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-16 14:03:01 -0400 (Wed, 16 Jun 2010)
New Revision: 6450
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabaseBean.java
Log:
minor
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabaseBean.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabaseBean.java 2010-06-16 18:02:37 UTC (rev 6449)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabaseBean.java 2010-06-16 18:03:01 UTC (rev 6450)
@@ -46,20 +46,20 @@
// TODO Make into an EJB Singleton which executes at startup
@ApplicationScoped
@Named("database")
+//TODO @Singleton @Startup
public class PopulateDatabaseBean
{
+
+ private static final String DATA_FILE_NAME = "data.sql";
@Inject
private Instance<CodeFragmentManager> eaoIn;
private CodeFragmentManager eao;
- private boolean secured = false;
- private static final String file = "data.sql";
- private boolean populated = false;
+ private boolean secured;
+
+ private boolean populated;
- public PopulateDatabaseBean()
- {
- }
-
+ // TODO @PostConstruct
public void populate()
{
if (populated)
@@ -71,7 +71,7 @@
try
{
- String fileContent = readFileData(file);
+ String fileContent = readFileData(DATA_FILE_NAME);
StringTokenizer st = new StringTokenizer(fileContent, "'");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -95,7 +95,7 @@
}
catch (Exception e)
{
- System.err.println("Unable to read all records from " + file + " file");
+ System.err.println("Unable to read all records from " + DATA_FILE_NAME + " file");
}
populated = true;
14 years, 6 months
Weld SVN: r6449 - examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-16 14:02:37 -0400 (Wed, 16 Jun 2010)
New Revision: 6449
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java
Log:
no interface views now working
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java 2010-06-16 18:02:14 UTC (rev 6448)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java 2010-06-16 18:02:37 UTC (rev 6449)
@@ -24,6 +24,7 @@
import java.io.Serializable;
import java.util.List;
+import javax.ejb.Stateful;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
@@ -37,7 +38,7 @@
@SessionScoped
@Named("history")
-//TODO @Stateful
+@Stateful
public class History implements Serializable
{
14 years, 6 months
Weld SVN: r6448 - examples/trunk/jsf/pastecode/src/main/webapp.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-16 14:02:14 -0400 (Wed, 16 Jun 2010)
New Revision: 6448
Modified:
examples/trunk/jsf/pastecode/src/main/webapp/history.xhtml
Log:
minor
Modified: examples/trunk/jsf/pastecode/src/main/webapp/history.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/history.xhtml 2010-06-16 17:55:12 UTC (rev 6447)
+++ examples/trunk/jsf/pastecode/src/main/webapp/history.xhtml 2010-06-16 18:02:14 UTC (rev 6448)
@@ -68,9 +68,12 @@
<h:outputLabel for="user" value="User:"></h:outputLabel>
<h:inputText id="user" maxlength="30" style="width:97%;"
value="#{codeFragmentPrototype.user}" />
- <h:outputLabel for="language" value="Language:"></h:outputLabel>
- <h:inputText id="language" maxlength="30" style="width:97%;"
- value="#{codeFragmentPrototype.language}" />
+ <h:outputLabel for="language" value="Language:" />
+ <h:selectOneMenu id="language" value="#{codeFragmentPrototype.language}">
+ <f:selectItem itemLabel="Any" itemValue="" />
+ <f:selectItems value="#{languages}" var="language"
+ itemLabel="#{language.name}" itemValue="#{language}" />
+ </h:selectOneMenu>
<h:outputLabel for="note" value="Note:"></h:outputLabel>
<h:inputText id="note" maxlength="30" style="width:97%;"
value="#{codeFragmentPrototype.note}" />
14 years, 6 months
Weld SVN: r6447 - in core/trunk/tests/src/test/java/org/jboss/weld/tests/ejb: singleton and 1 other directory.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-16 13:55:12 -0400 (Wed, 16 Jun 2010)
New Revision: 6447
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/ejb/singleton/
core/trunk/tests/src/test/java/org/jboss/weld/tests/ejb/singleton/Foo.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/ejb/singleton/SingletonStartupTest.java
Log:
Tests for JBAS-8107
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/ejb/singleton/Foo.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/ejb/singleton/Foo.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/ejb/singleton/Foo.java 2010-06-16 17:55:12 UTC (rev 6447)
@@ -0,0 +1,32 @@
+package org.jboss.weld.tests.ejb.singleton;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Singleton;
+import javax.ejb.Startup;
+import javax.enterprise.context.ApplicationScoped;
+
+@Singleton
+@Startup
+@ApplicationScoped
+public class Foo
+{
+
+ private static boolean postConstructCalled;
+
+ public static boolean isPostConstructCalled()
+ {
+ return postConstructCalled;
+ }
+
+ public static void reset()
+ {
+ postConstructCalled = false;
+ }
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ postConstructCalled = true;
+ }
+
+}
Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/ejb/singleton/Foo.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/ejb/singleton/SingletonStartupTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/ejb/singleton/SingletonStartupTest.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/ejb/singleton/SingletonStartupTest.java 2010-06-16 17:55:12 UTC (rev 6447)
@@ -0,0 +1,22 @@
+package org.jboss.weld.tests.ejb.singleton;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.jboss.weld.test.AbstractWeldTest;
+import org.testng.annotations.Test;
+
+@Artifact
+@IntegrationTest
+(a)Packaging(PackagingType.EAR)
+public class SingletonStartupTest extends AbstractWeldTest
+{
+
+ @Test(enabled=false) // JBAS-8107
+ public void testSingletonStartup()
+ {
+ assert Foo.isPostConstructCalled();
+ }
+
+}
Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/tests/ejb/singleton/SingletonStartupTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
14 years, 6 months
Weld SVN: r6445 - in examples/trunk/jsf/pastecode/src/main: java/org/jboss/weld/examples/pastecode/jsf and 2 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-16 10:40:09 -0400 (Wed, 16 Jun 2010)
New Revision: 6445
Added:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/jsf/
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/jsf/LanguageConverter.java
Modified:
examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/faces-config.xml
examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml
Log:
fix lang conversion
Added: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/jsf/LanguageConverter.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/jsf/LanguageConverter.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/jsf/LanguageConverter.java 2010-06-16 14:40:09 UTC (rev 6445)
@@ -0,0 +1,13 @@
+package org.jboss.weld.examples.pastecode.jsf;
+
+import javax.faces.convert.EnumConverter;
+
+import org.jboss.weld.examples.pastecode.model.Language;
+
+public class LanguageConverter extends EnumConverter
+{
+ public LanguageConverter()
+ {
+ super(Language.class);
+ }
+}
Property changes on: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/jsf/LanguageConverter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/faces-config.xml 2010-06-16 13:52:37 UTC (rev 6444)
+++ examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/faces-config.xml 2010-06-16 14:40:09 UTC (rev 6445)
@@ -19,5 +19,10 @@
<to-view-id>/history.xhtml?page=#{history.page}</to-view-id>
</navigation-case>
</navigation-rule>
+
+ <converter>
+ <converter-for-class>org.jboss.weld.examples.pastecode.model.Language</converter-for-class>
+ <converter-class>org.jboss.weld.examples.pastecode.jsf.LanguageConverter</converter-class>
+ </converter>
</faces-config>
Modified: examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml 2010-06-16 13:52:37 UTC (rev 6444)
+++ examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml 2010-06-16 14:40:09 UTC (rev 6445)
@@ -24,7 +24,7 @@
<h:panelGroup>
<h:outputLabel for="language" value="Language: "/>
<h:selectOneMenu id="language" value="#{code.language}">
- <f:selectItems value="#{languages}" var="language" itemLabel="#{language.name}" itemValue="#{language.extension}" />
+ <f:selectItems value="#{languages}" var="language" itemLabel="#{language.name}" itemValue="#{language}" />
</h:selectOneMenu>
</h:panelGroup>
<h:panelGroup style="text-align:right;">
14 years, 6 months
Weld SVN: r6444 - examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-16 09:52:37 -0400 (Wed, 16 Jun 2010)
New Revision: 6444
Modified:
examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/faces-config.xml
Log:
ws
Modified: examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/faces-config.xml 2010-06-16 13:49:30 UTC (rev 6443)
+++ examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/faces-config.xml 2010-06-16 13:52:37 UTC (rev 6444)
@@ -1,24 +1,23 @@
<?xml version='1.0' encoding='UTF-8'?>
-<faces-config version="2.0"
- xmlns="http://java.sun.com/xml/ns/javaee"
- 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-facesconfig_2_0.xsd">
+<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
+ 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-facesconfig_2_0.xsd">
-<navigation-rule>
- <from-view-id>/home.xhtml</from-view-id>
- <navigation-case>
- <from-action>#{paster.paste}</from-action>
- <to-view-id>/#{paster.codeId}</to-view-id>
- <redirect/>
- </navigation-case>
-</navigation-rule>
+ <navigation-rule>
+ <from-view-id>/home.xhtml</from-view-id>
+ <navigation-case>
+ <from-action>#{paster.paste}</from-action>
+ <to-view-id>/#{paster.codeId}</to-view-id>
+ <redirect />
+ </navigation-case>
+ </navigation-rule>
- <navigation-rule>
- <from-view-id>/history.xhtml</from-view-id>
- <navigation-case>
- <from-action>#{history.newSearch}</from-action>
- <to-view-id>/history.xhtml?page=#{history.page}</to-view-id>
- </navigation-case>
-</navigation-rule>
+ <navigation-rule>
+ <from-view-id>/history.xhtml</from-view-id>
+ <navigation-case>
+ <from-action>#{history.newSearch}</from-action>
+ <to-view-id>/history.xhtml?page=#{history.page}</to-view-id>
+ </navigation-case>
+ </navigation-rule>
</faces-config>
14 years, 6 months