Weld SVN: r6463 - in examples/trunk/jsf/pastecode: src/main/java/org/jboss/weld/examples/pastecode/servlets and 1 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-16 16:30:44 -0400 (Wed, 16 Jun 2010)
New Revision: 6463
Modified:
examples/trunk/jsf/pastecode/pom.xml
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/servlets/DownloadServlet.java
examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/web.xml
Log:
use Servlet 3.0 features
Modified: examples/trunk/jsf/pastecode/pom.xml
===================================================================
--- examples/trunk/jsf/pastecode/pom.xml 2010-06-16 20:05:50 UTC (rev 6462)
+++ examples/trunk/jsf/pastecode/pom.xml 2010-06-16 20:30:44 UTC (rev 6463)
@@ -38,9 +38,9 @@
</dependency>
<dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
+ <groupId>org.jboss.spec.javax.servlet</groupId>
+ <artifactId>jboss-servlet-api_3.0_spec</artifactId>
+ <version>1.0.0.Beta2</version>
<scope>provided</scope>
</dependency>
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/servlets/DownloadServlet.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/servlets/DownloadServlet.java 2010-06-16 20:05:50 UTC (rev 6462)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/servlets/DownloadServlet.java 2010-06-16 20:30:44 UTC (rev 6463)
@@ -23,10 +23,10 @@
import java.io.IOException;
-import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
+import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -34,25 +34,19 @@
import org.jboss.weld.examples.pastecode.model.CodeFragment;
import org.jboss.weld.examples.pastecode.session.CodeFragmentManager;
+@WebServlet("/download")
public class DownloadServlet extends HttpServlet
{
private static final long serialVersionUID = 1L;
@Inject
- Instance<CodeFragmentManager> eaoIn;
- CodeFragmentManager eao;
+ private CodeFragmentManager codeFragmentManager;
- public DownloadServlet()
- {
- }
-
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
-
- this.eao = eaoIn.get();
String id = request.getParameter("id");
- CodeFragment c = eao.getCodeFragment(id);
+ CodeFragment c = codeFragmentManager.getCodeFragment(id);
String fileName = c.getUser() + "." + c.getLanguage();
String txt = c.getText();
Modified: examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/web.xml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/web.xml 2010-06-16 20:05:50 UTC (rev 6462)
+++ examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/web.xml 2010-06-16 20:30:44 UTC (rev 6463)
@@ -28,14 +28,4 @@
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
- <servlet>
- <description></description>
- <display-name>DownloadServlet</display-name>
- <servlet-name>DownloadServlet</servlet-name>
- <servlet-class>org.jboss.weld.examples.pastecode.servlets.DownloadServlet</servlet-class>
- </servlet>
- <servlet-mapping>
- <servlet-name>DownloadServlet</servlet-name>
- <url-pattern>/download</url-pattern>
- </servlet-mapping>
</web-app>
\ No newline at end of file
14 years, 6 months
Weld SVN: r6462 - in examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode: session and 1 other directory.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-16 16:05:50 -0400 (Wed, 16 Jun 2010)
New Revision: 6462
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/session/CodeFragmentManagerImpl.java
Log:
get the history working again
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 19:33:43 UTC (rev 6461)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java 2010-06-16 20:05:50 UTC (rev 6462)
@@ -83,7 +83,6 @@
this.note = "";
this.text = "";
this.user = "";
- this.language = Language.TEXT;
}
public int getId()
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java 2010-06-16 19:33:43 UTC (rev 6461)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java 2010-06-16 20:05:50 UTC (rev 6462)
@@ -145,7 +145,7 @@
@Produces @Named
public List<CodeFragment> getRecentCodeFragments()
{
- Query query = entityManager.createQuery("SELECT c FROM CodeFragment c WHERE hash=null ORDER BY datetime DESC ");
+ Query query = entityManager.createQuery("SELECT c FROM CodeFragment c WHERE c.hash=null ORDER BY datetime DESC ");
query.setMaxResults(MAX_RECENT_FRAGMENTS);
@SuppressWarnings("unchecked")
@@ -156,28 +156,23 @@
public List<CodeFragment> searchCodeFragments(CodeFragment code, int page, Paginator paginator)
{
- StringBuilder sb = new StringBuilder();
-
- String delim = "";
+ StringBuilder sb = new StringBuilder().append("SELECT c FROM CodeFragment c WHERE c.hash=null");
+
if (!code.getUser().trim().equals(""))
{
- sb.append("c.user = \'" + code.getUser().trim().toLowerCase() + "\'");
- delim = " AND";
+ sb.append(" AND c.user = \'").append(code.getUser().trim().toLowerCase()).append("\'");
}
if (code.getLanguage() != null)
{
- sb.append(delim).append(" c.language = \'" + code.getLanguage().name() + "\'");
- delim = " AND";
+ sb.append(" AND c.language = \'").append(code.getLanguage().name()).append(("\'"));
}
if (!code.getNote().trim().equals(""))
{
- sb.append(delim).append(" c.note LIKE \'%" + code.getNote().trim().toLowerCase() + "%\'");
- delim = " AND";
+ sb.append(" AND c.note LIKE \'%").append(code.getNote().trim().toLowerCase()).append("%\'");
}
if (!code.getText().trim().equals(""))
{
- sb.append(delim).append(" c.text LIKE \'%" + code.getText().toLowerCase() + "%\'");
- delim = " AND";
+ sb.append(" AND c.text LIKE \'%").append(code.getText().toLowerCase()).append("%\'");
}
if (code.getDatetime() != null)
{
@@ -189,15 +184,13 @@
String formattedDate1 = formatter.format(code.getDatetime());
String formattedDate2 = formatter.format(date2);
- sb.append(delim).append(" c.datetime between \'" + formattedDate1 + "\' and \'" + formattedDate2 + "\'");
- delim = " AND";
+ sb.append(" AND c.datetime between \'").append(formattedDate1).append("\' and \'").append(formattedDate2).append("\'");
}
-
- if (sb.toString().length() == 0)
- sb.append("1 = \'1\'");
-
- Query q = entityManager.createQuery("SELECT c FROM CodeFragment c WHERE hash=null AND " + sb.toString() + " ORDER BY datetime DESC");
- int allRecords = q.getResultList().size();
+ sb.append(" ORDER BY datetime DESC");
+ String queryString = sb.toString();
+
+ Query q = entityManager.createQuery(queryString);
+
q.setFirstResult(page * PAGE_SIZE);
q.setMaxResults(PAGE_SIZE);
@@ -205,8 +198,8 @@
List<CodeFragment> codes = q.getResultList();
paginator.setPage(page);
- paginator.setRecordsCount(allRecords);
- paginator.setPagesCount(allRecords / PAGE_SIZE);
+ paginator.setRecordsCount(codes.size());
+ paginator.setPagesCount(codes.size() / PAGE_SIZE);
return codes;
}
14 years, 6 months
Weld SVN: r6461 - in examples/trunk/jsf/pastecode/src/main: webapp and 1 other directory.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-16 15:33:43 -0400 (Wed, 16 Jun 2010)
New Revision: 6461
Added:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paginator.java
Removed:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/QueryInfo.java
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManager.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java
examples/trunk/jsf/pastecode/src/main/webapp/pagination.xhtml
Log:
Rename QueryInfo
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManager.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManager.java 2010-06-16 19:26:39 UTC (rev 6460)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManager.java 2010-06-16 19:33:43 UTC (rev 6461)
@@ -36,5 +36,5 @@
public List<CodeFragment> getRecentCodeFragments();
- public List<CodeFragment> searchCodeFragments(CodeFragment code, int page, QueryInfo info);
+ public List<CodeFragment> searchCodeFragments(CodeFragment code, int page, Paginator info);
}
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java 2010-06-16 19:26:39 UTC (rev 6460)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java 2010-06-16 19:33:43 UTC (rev 6461)
@@ -28,8 +28,6 @@
import java.util.List;
import javax.ejb.Stateless;
-import javax.ejb.TransactionAttribute;
-import javax.ejb.TransactionAttributeType;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Named;
@@ -156,14 +154,7 @@
return codes;
}
- /**
- * getting codes from database needs new transaction so that we can further
- * modify returned Codes without affecting database (when we call this
- * function from another session bean
- */
-
- @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
- public List<CodeFragment> searchCodeFragments(CodeFragment code, int page, QueryInfo info)
+ public List<CodeFragment> searchCodeFragments(CodeFragment code, int page, Paginator paginator)
{
StringBuilder sb = new StringBuilder();
@@ -213,9 +204,9 @@
@SuppressWarnings("unchecked")
List<CodeFragment> codes = q.getResultList();
- info.setPage(page);
- info.setRecordsCount(allRecords);
- info.setPagesCount(allRecords / PAGE_SIZE);
+ paginator.setPage(page);
+ paginator.setRecordsCount(allRecords);
+ paginator.setPagesCount(allRecords / PAGE_SIZE);
return codes;
}
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 19:26:39 UTC (rev 6460)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java 2010-06-16 19:33:43 UTC (rev 6461)
@@ -50,7 +50,7 @@
@Inject
private CodeFragmentManager codeFragmentManager;
- private QueryInfo info;
+ private Paginator paginator;
private List<CodeFragment> codes;
@@ -85,12 +85,12 @@
// Do the search, called as a "page action"
public String search()
{
- this.info = new QueryInfo();
+ this.paginator = new Paginator();
this.codes = null;
// Perform a seach
- this.codes = codeFragmentManager.searchCodeFragments(this.codeFragmentPrototype, this.page, this.info);
+ this.codes = codeFragmentManager.searchCodeFragments(this.codeFragmentPrototype, this.page, this.paginator);
for (int i = 0; i != this.codes.size(); i++)
{
@@ -110,13 +110,13 @@
this.page = page;
}
- public QueryInfo getInfo()
+ public Paginator getPaginator()
{
- return info;
+ return paginator;
}
- public void setInfo(QueryInfo info)
+ public void setPaginator(Paginator paginator)
{
- this.info = info;
+ this.paginator = paginator;
}
}
Copied: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paginator.java (from rev 6452, examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/QueryInfo.java)
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paginator.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paginator.java 2010-06-16 19:33:43 UTC (rev 6461)
@@ -0,0 +1,145 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.session;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Paginator
+{
+
+ private int recordsCount = 0;
+ private int pagesCount = 0;
+ private int numLinks = 8;
+ private int startIndex;
+ private int endIndex;
+ private int page = 0;
+ private List<Integer> indexes;
+
+ public int getNumLinks()
+ {
+ return numLinks;
+ }
+
+ public int getPage()
+ {
+ return page;
+ }
+
+ public void setPage(int page)
+ {
+ this.page = page;
+ }
+
+ public int getPagesCount()
+ {
+ return pagesCount;
+ }
+
+ public void setPagesCount(int pagesCount)
+ {
+ this.pagesCount = pagesCount;
+
+ if (pagesCount == 1)
+ {
+ this.setBoundedIndexes(0, 0);
+ }
+
+ if (this.page > (numLinks / 2))
+ {
+ this.setStartIndex(this.page - (numLinks / 2));
+ }
+ else
+ {
+ this.setStartIndex(0);
+ this.setEndIndex((numLinks > this.pagesCount) ? this.pagesCount : numLinks);
+ }
+
+ if (this.page + (numLinks / 2) >= this.pagesCount)
+ {
+ this.setEndIndex(this.pagesCount);
+ this.setStartIndex((this.pagesCount - numLinks) < 0 ? 0 : this.pagesCount - numLinks);
+ }
+ else
+ {
+ if (this.page < (numLinks / 2))
+ {
+ this.setEndIndex((numLinks > this.pagesCount) ? this.pagesCount : numLinks);
+ }
+ else
+ {
+ this.setEndIndex(this.page + (numLinks / 2));
+ }
+
+ }
+ this.setBoundedIndexes(this.startIndex, this.endIndex);
+ }
+
+ public void setBoundedIndexes(int startIndex, int endIndex)
+ {
+ this.indexes = new ArrayList<Integer>(endIndex - startIndex);
+ for (int i = startIndex; i <= endIndex; i++)
+ {
+ this.indexes.add(new Integer(i));
+ }
+ }
+
+ public List<Integer> getIndexes()
+ {
+ return indexes;
+ }
+
+ public void setIndexes(List<Integer> indexes)
+ {
+ this.indexes = indexes;
+ }
+
+ public int getRecordsCount()
+ {
+ return recordsCount;
+ }
+
+ public void setRecordsCount(int recordsCount)
+ {
+ this.recordsCount = recordsCount;
+ }
+
+ public int getStartIndex()
+ {
+ return startIndex;
+ }
+
+ public void setStartIndex(int startIndex)
+ {
+ this.startIndex = startIndex;
+ }
+
+ public int getEndIndex()
+ {
+ return endIndex;
+ }
+
+ public void setEndIndex(int endIndex)
+ {
+ this.endIndex = endIndex;
+ }
+}
Deleted: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/QueryInfo.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/QueryInfo.java 2010-06-16 19:26:39 UTC (rev 6460)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/QueryInfo.java 2010-06-16 19:33:43 UTC (rev 6461)
@@ -1,145 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, 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.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.weld.examples.pastecode.session;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class QueryInfo
-{
-
- private int recordsCount = 0;
- private int pagesCount = 0;
- private int numLinks = 8;
- private int startIndex;
- private int endIndex;
- private int page = 0;
- private List<Integer> indexes;
-
- public int getNumLinks()
- {
- return numLinks;
- }
-
- public int getPage()
- {
- return page;
- }
-
- public void setPage(int page)
- {
- this.page = page;
- }
-
- public int getPagesCount()
- {
- return pagesCount;
- }
-
- public void setPagesCount(int pagesCount)
- {
- this.pagesCount = pagesCount;
-
- if (pagesCount == 1)
- {
- this.setBoundedIndexes(0, 0);
- }
-
- if (this.page > (numLinks / 2))
- {
- this.setStartIndex(this.page - (numLinks / 2));
- }
- else
- {
- this.setStartIndex(0);
- this.setEndIndex((numLinks > this.pagesCount) ? this.pagesCount : numLinks);
- }
-
- if (this.page + (numLinks / 2) >= this.pagesCount)
- {
- this.setEndIndex(this.pagesCount);
- this.setStartIndex((this.pagesCount - numLinks) < 0 ? 0 : this.pagesCount - numLinks);
- }
- else
- {
- if (this.page < (numLinks / 2))
- {
- this.setEndIndex((numLinks > this.pagesCount) ? this.pagesCount : numLinks);
- }
- else
- {
- this.setEndIndex(this.page + (numLinks / 2));
- }
-
- }
- this.setBoundedIndexes(this.startIndex, this.endIndex);
- }
-
- public void setBoundedIndexes(int startIndex, int endIndex)
- {
- this.indexes = new ArrayList(endIndex - startIndex);
- for (int i = startIndex; i <= endIndex; i++)
- {
- this.indexes.add(new Integer(i));
- }
- }
-
- public List<Integer> getIndexes()
- {
- return indexes;
- }
-
- public void setIndexes(List<Integer> indexes)
- {
- this.indexes = indexes;
- }
-
- public int getRecordsCount()
- {
- return recordsCount;
- }
-
- public void setRecordsCount(int recordsCount)
- {
- this.recordsCount = recordsCount;
- }
-
- public int getStartIndex()
- {
- return startIndex;
- }
-
- public void setStartIndex(int startIndex)
- {
- this.startIndex = startIndex;
- }
-
- public int getEndIndex()
- {
- return endIndex;
- }
-
- public void setEndIndex(int endIndex)
- {
- this.endIndex = endIndex;
- }
-}
Modified: examples/trunk/jsf/pastecode/src/main/webapp/pagination.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/pagination.xhtml 2010-06-16 19:26:39 UTC (rev 6460)
+++ examples/trunk/jsf/pastecode/src/main/webapp/pagination.xhtml 2010-06-16 19:33:43 UTC (rev 6461)
@@ -6,22 +6,22 @@
<ui:composition>
- <h:panelGroup rendered="#{history.info.pagesCount gt 1}">
+ <h:panelGroup rendered="#{history.paginator.pagesCount gt 1}">
<div id="paging" style="width:99%;text-align:center;">
- <a href="history.jsf?page=#{(history.info.page-1)>=0?(history.info.page-1):0}" style="text-decoration:none;">
+ <a href="history.jsf?page=#{(history.paginator.page-1)>=0?(history.paginator.page-1):0}" style="text-decoration:none;">
<span id="edgelink"><<</span>
</a>
- <ui:repeat var="page" value="#{history.info.indexes}">
+ <ui:repeat var="page" value="#{history.paginator.indexes}">
<a href="history.jsf?page=#{page}" style="text-decoration:none;">
- <span id="normallink" style="width:23px;display: inline-block;}">#{(history.info.page eq page)?'(':''}#{page+1}#{(history.info.page eq page)?')':''}</span>
+ <span id="normallink" style="width:23px;display: inline-block;}">#{(history.paginator.page eq page)?'(':''}#{page+1}#{(history.paginator.page eq page)?')':''}</span>
</a>
</ui:repeat>
- <a href="history.jsf?page=#{(history.info.page+1)>history.info.pagesCount?history.info.pagesCount:(history.info.page+1)}" style="text-decoration:none;">
+ <a href="history.jsf?page=#{(history.paginator.page+1)>history.paginator.pagesCount?history.paginator.pagesCount:(history.paginator.page+1)}" style="text-decoration:none;">
<span id="edgelink">>></span>
</a>
14 years, 6 months
Weld SVN: r6460 - examples/trunk/jsf/pastecode/src/main/webapp.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-16 15:26:39 -0400 (Wed, 16 Jun 2010)
New Revision: 6460
Modified:
examples/trunk/jsf/pastecode/src/main/webapp/template.xhtml
Log:
minor
Modified: examples/trunk/jsf/pastecode/src/main/webapp/template.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/template.xhtml 2010-06-16 19:21:32 UTC (rev 6459)
+++ examples/trunk/jsf/pastecode/src/main/webapp/template.xhtml 2010-06-16 19:26:39 UTC (rev 6460)
@@ -70,11 +70,9 @@
<table bgcolor="#E9E9F8">
<tr valign="top">
<td bordercolor="#E9E9F8" >
-
<ui:insert name="rightmenu">
Menu right
</ui:insert>
-
</td>
</tr>
</table>
@@ -88,7 +86,7 @@
<div id="footer">
<ui:insert name="footer">
- Powered by WELD (Context and Dependency Injection RI)
+ Powered by Weld, the Reference Implementation for Contexts and Dependency Injection for Java EE
</ui:insert>
</div>
14 years, 6 months
Weld SVN: r6459 - in examples/trunk/jsf/pastecode/src/main: webapp and 1 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-16 15:21:32 -0400 (Wed, 16 Jun 2010)
New Revision: 6459
Added:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PasteWindow.java
Removed:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paster.java
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java
examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/faces-config.xml
examples/trunk/jsf/pastecode/src/main/webapp/display.xhtml
examples/trunk/jsf/pastecode/src/main/webapp/help.xhtml
examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml
examples/trunk/jsf/pastecode/src/main/webapp/rightMenuDefault.xhtml
Log:
tidy up paster, tidy up xhtml
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java 2010-06-16 19:15:22 UTC (rev 6458)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java 2010-06-16 19:21:32 UTC (rev 6459)
@@ -30,7 +30,9 @@
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
+import javax.enterprise.inject.Produces;
import javax.inject.Inject;
+import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
@@ -142,6 +144,7 @@
}
}
+ @Produces @Named
public List<CodeFragment> getRecentCodeFragments()
{
Query query = entityManager.createQuery("SELECT c FROM CodeFragment c WHERE hash=null ORDER BY datetime DESC ");
Copied: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PasteWindow.java (from rev 6456, examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paster.java)
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PasteWindow.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PasteWindow.java 2010-06-16 19:21:32 UTC (rev 6459)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.session;
+
+import javax.ejb.EJBException;
+import javax.enterprise.inject.Model;
+import javax.inject.Inject;
+
+import org.jboss.weld.examples.pastecode.model.CodeFragment;
+
+/**
+ * PasteWindow holds the code fragment and other selections when a code fragment is viewed and entered
+ *
+ */
+@Model
+public class PasteWindow
+{
+ private CodeFragment codeFragment;
+
+ private String codeFragmentId;
+
+ private Theme theme;
+
+ private boolean privateFragment;
+
+ @Inject
+ private CodeFragmentManager codeFragmentManager;
+
+ public PasteWindow()
+ {
+ this.codeFragment = new CodeFragment();
+ this.theme = Theme.DEFAULT;
+ }
+
+ // The send method is called when we hit the Send button
+ public String send()
+ {
+ codeFragmentManager.addCodeFragment(codeFragment, privateFragment);
+ return "success";
+ }
+
+ // loadCodeFragment is a view action called to load the code fragment from
+ // the database when requested for viewing
+ public void loadCodeFragment()
+ {
+ this.codeFragment = codeFragmentManager.getCodeFragment(codeFragmentId);
+
+ if (this.codeFragment == null)
+ {
+ throw new EJBException("Could not read entity with given id value");
+ }
+ }
+
+ public CodeFragment getCodeFragment()
+ {
+ return codeFragment;
+ }
+
+ public String getCodeFragmentId()
+ {
+ return codeFragmentId;
+ }
+
+ public void setCodeFragmentId(String codeFragmentId)
+ {
+ this.codeFragmentId = codeFragmentId;
+ }
+
+ public Theme getTheme()
+ {
+ return theme;
+ }
+
+ public void setTheme(Theme theme)
+ {
+ this.theme = theme;
+ }
+
+ public boolean isPrivateFragment()
+ {
+ return privateFragment;
+ }
+
+ public void setPrivateFragment(boolean privateFragment)
+ {
+ this.privateFragment = privateFragment;
+ }
+}
Deleted: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paster.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paster.java 2010-06-16 19:15:22 UTC (rev 6458)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paster.java 2010-06-16 19:21:32 UTC (rev 6459)
@@ -1,124 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, 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.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.weld.examples.pastecode.session;
-
-import java.util.List;
-
-import javax.ejb.EJBException;
-import javax.enterprise.inject.Model;
-import javax.enterprise.inject.Produces;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jboss.weld.examples.pastecode.model.CodeFragment;
-
-@Model
-public class Paster
-{
- private CodeFragment code;
-
- private String codeId;
-
- private String brush;
-
- private Theme theme;
-
- private boolean secured = false;
-
- @Inject
- private CodeFragmentManager codeFragmentManager;
-
- public Paster()
- {
- this.code = new CodeFragment();
- this.theme = Theme.DEFAULT;
- }
-
- public String paste()
- {
- this.codeId = codeFragmentManager.addCodeFragment(code, secured);
- return "success";
- }
-
- /* used for access from jsf page */
- @Produces
- @Named("code")
- public CodeFragment getPasterCodeInstance()
- {
- return this.code;
- }
-
- public void loadCode()
- {
- this.code = codeFragmentManager.getCodeFragment(codeId);
-
- if (this.code == null)
- throw new EJBException("Could not read entity with given id value");
-
- this.brush = this.code.getLanguage().getBrush();
- }
-
- public List<CodeFragment> getCodes()
- {
- return codeFragmentManager.getRecentCodeFragments();
- }
-
- public String getCodeId()
- {
- return codeId;
- }
-
- public void setCodeId(String codeId)
- {
- this.codeId = codeId;
- }
-
- public Theme getTheme()
- {
- return theme;
- }
-
- public void setTheme(Theme theme)
- {
- this.theme = theme;
- }
-
- public String getBrush()
- {
- return brush;
- }
-
- public void setBrush(String brush)
- {
- this.brush = brush;
- }
-
- public boolean isSecured()
- {
- return secured;
- }
-
- public void setSecured(boolean secured)
- {
- this.secured = secured;
- }
-}
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 19:15:22 UTC (rev 6458)
+++ examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/faces-config.xml 2010-06-16 19:21:32 UTC (rev 6459)
@@ -8,8 +8,8 @@
<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>
+ <from-action>#{pasteWindow.send}</from-action>
+ <to-view-id>/#{pasteWindow.codeFragmentId}</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>
Modified: examples/trunk/jsf/pastecode/src/main/webapp/display.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/display.xhtml 2010-06-16 19:15:22 UTC (rev 6458)
+++ examples/trunk/jsf/pastecode/src/main/webapp/display.xhtml 2010-06-16 19:21:32 UTC (rev 6459)
@@ -8,8 +8,10 @@
<ui:composition template="template.xhtml">
<ui:define name="viewMetadata">
<f:metadata>
- <f:viewParam name="id" value="#{paster.codeId}"/>
- <f:event type="preRenderView" listener="#{paster.loadCode}"/>
+ <!-- Bind the id to the pasteWindow, this allows us to load the correct fragment -->
+ <f:viewParam name="id" value="#{pasteWindow.codeFragmentId}"/>
+ <!-- Ask for the fragment to be loaded -->
+ <f:event type="preRenderView" listener="#{pasteWindow.loadCodeFragment}"/>
</f:metadata>
</ui:define>
@@ -36,15 +38,15 @@
<h:panelGroup>
<h:outputLabel for="user" value="User: "/>
- <h:outputText id="user" maxlength="30" size="30" value="#{code.user}"/>
+ <h:outputText id="user" maxlength="30" size="30" value="#{pasteWindow.codeFragment.user}"/>
</h:panelGroup>
<h:panelGroup>
<h:outputLabel for="theme" value="Choose theme: "/>
- <h:selectOneMenu id="theme" value="#{paster.theme}" onchange="chooseStyle(this.value);"> <!-- this.form.submit() -->
+ <h:selectOneMenu id="theme" value="#{pasteWindow.theme}" onchange="chooseStyle(this.value);"> <!-- this.form.submit() -->
<f:selectItems value="#{themes}" var="theme" itemLabel="#{theme.name}" itemValue="#{theme.name}" />
</h:selectOneMenu>
- <a href="download?id=#{code.hash == null ? code.id : code.hash}" style="text-decoration: none;"><input type="button" value="Download file" /></a>
+ <a href="download?id=#{pasteWindow.codeFragment.hash == null ? pasteWindow.codeFragment.id : pasteWindow.codeFragment.hash}" style="text-decoration: none;"><input type="button" value="Download file" /></a>
</h:panelGroup>
<h:panelGroup style="text-align:right;">
@@ -56,13 +58,13 @@
<h:outputText value="Pasted code: "/>
<div id="codearea" style="width:99%; border: 1px solid #7F7F7F; height:450px; overflow:scroll;">
- <pre class="brush: #{paster.brush}">#{code.text}</pre>
+ <pre class="brush: #{pasteWindow.codeFragment.language.brush}">#{pasteWindow.codeFragment.text}</pre>
</div>
<br/>
<h:outputLabel for="note" value="Note: "/>
<div >
- <h:outputText id="note" value="#{code.note}"/>
+ <h:outputText id="note" value="#{pasteWindow.codeFragment.note}"/>
</div>
</div>
</ui:define>
Modified: examples/trunk/jsf/pastecode/src/main/webapp/help.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/help.xhtml 2010-06-16 19:15:22 UTC (rev 6458)
+++ examples/trunk/jsf/pastecode/src/main/webapp/help.xhtml 2010-06-16 19:21:32 UTC (rev 6459)
@@ -15,30 +15,31 @@
<br/>
<strong>Paste Code:</strong><br/>
<ul>
- <li>Enter your nick - This is optional, if it is not entered the code will be listed under "Anonymous" user</li>
- <li>Choose a language of your code - This way you can define formatting of code after submitting the form</li>
- <li>Choose if this code is private - When this option is chosen the application will generate a hash value of your code and will provide you with
- a unique link (something like http://localhost:8080/weld-pastecode/582ad4b5ed409ec8b81c6e33ee8b72377890...). Furthemore your code will not be
- listed in the right panel and cannot even be found through a search capability. </li>
- <li>Enter your code and a note you would like to send with the code</li>
- <li>Submit the form and forward the resulting link</li>
+ <li>Enter your nick - this is optional, if omitted, your paste will be anonymous</li>
+ <li>Choose the language of your code - this allows syntax highlighting</li>
+ <li>Choose if this code is private - when this option is chosen the application will generate a hash value of your code and will provide you with
+ a unique link (something like http://localhost:8080/weld-pastecode/582ad4). Furthemore your code will not be
+ listed in the right panel and cannot be found through the search.</li>
+ <li>Enter your code - you can also add a note</li>
+ <li>Submit the form!</li>
</ul>
- <strong>Search Code:</strong><br/>
+ <strong>Search Pastes:</strong><br/>
<ul>
- <li>Go to a history page - Now you can see all the posts with pagination</li>
- <li>Enter data for searching - You can combine all the data together.</li>
+ <li>Go to a history page - now you can see all the posts with pagination</li>
+ <li>You can narrow down the pastes by using the search form</li>
</ul>
<strong>Weld Features Covered:</strong><br/>
<ul>
- <li>Injecting into POJO, EJB (SFSB), Servlet</li>
- <li>Annotations @ApplicationScoped, @Model, @SessionScoped et al.</li>
- <li>Producer named methods</li>
- <li>Decorators - This feature is used to log transactions during which a code larger than 65kB is stored to a database</li>
+ <li>Injection into POJO, EJBs and Servlets</li>
+ <li>Use of WAR packaging</li>
+ <li>Producers</li>
+ <li>JPA access</li>
+ <li>Decorators</li>
</ul>
- <br/><br/><strong>Enjoy work with WELD !</strong>
+ <br/><br/><strong>Enjoy work with Weld!</strong>
</div>
</ui:define>
Modified: examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml 2010-06-16 19:15:22 UTC (rev 6458)
+++ examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml 2010-06-16 19:21:32 UTC (rev 6459)
@@ -18,28 +18,28 @@
<h:panelGrid columns="3" style="width: 100%">
<h:panelGroup>
<h:outputLabel for="user" value="Your nick: "/>
- <h:inputText id="user" maxlength="30" size="30" value="#{code.user}"/>
+ <h:inputText id="user" maxlength="30" size="30" value="#{pasteWindow.codeFragment.user}"/>
</h:panelGroup>
<h:panelGroup>
<h:outputLabel for="language" value="Language: "/>
- <h:selectOneMenu id="language" value="#{code.language}">
+ <h:selectOneMenu id="language" value="#{pasteWindow.codeFragment.language}">
<f:selectItems value="#{languages}" var="language" itemLabel="#{language.name}" itemValue="#{language}" />
</h:selectOneMenu>
</h:panelGroup>
<h:panelGroup style="text-align:right;">
<h:outputLabel for="secured" value="Private: "/>
- <h:selectBooleanCheckbox id="secured" value="#{paster.secured}"/>
+ <h:selectBooleanCheckbox id="secured" value="#{pasteWindow.privateFragment}"/>
</h:panelGroup>
</h:panelGrid>
<h:outputLabel for="text" value="Code: "/>
- <h:inputTextarea id="text" style="width: 98%" cols="17" rows="18" value="#{code.text}"/>
+ <h:inputTextarea id="text" style="width: 98%" cols="17" rows="18" value="#{pasteWindow.codeFragment.text}"/>
<h:outputLabel for="note" value="Note: (optional) "/>
- <h:inputTextarea style="width: 98%" cols="17" rows="4" id="note" value="#{code.note}"/>
+ <h:inputTextarea style="width: 98%" cols="17" rows="4" id="note" value="#{pasteWindow.codeFragment.note}"/>
<div style="width: 98%; text-align:right;">
<h:outputLabel for="send" value="Paste code: "/>
- <h:commandButton action="#{paster.paste}" id="send" value=" Send "/>
+ <h:commandButton action="#{pasteWindow.send}" id="send" value=" Send "/>
</div>
</div>
Modified: examples/trunk/jsf/pastecode/src/main/webapp/rightMenuDefault.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/rightMenuDefault.xhtml 2010-06-16 19:15:22 UTC (rev 6458)
+++ examples/trunk/jsf/pastecode/src/main/webapp/rightMenuDefault.xhtml 2010-06-16 19:21:32 UTC (rev 6459)
@@ -9,10 +9,10 @@
<div class="recentPastes">
<div class="recentPastesHeader">Recent pastes</div>
- <ui:repeat value="#{paster.codes}" var="varcode">
+ <ui:repeat value="#{recentCodeFragments}" var="codeFragment">
<div class="recentPaste">
- <h:outputLink id="user" value="#{varcode.id}">#{varcode.user}</h:outputLink>
- <span class="recentPasteLang">#{varcode.language}</span><span> | </span>#{varcode.friendlyDate}
+ <h:outputLink id="user" value="#{codeFragment.id}">#{codeFragment.user}</h:outputLink>
+ <span class="recentPasteLang">#{codeFragment.language.name}</span><span> | </span>#{codeFragment.friendlyDate}
</div>
</ui:repeat>
14 years, 6 months
Weld SVN: r6458 - core/branches/1.0.1-SP2/impl/src/main/java/org/jboss/weld/bean.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-16 15:15:22 -0400 (Wed, 16 Jun 2010)
New Revision: 6458
Modified:
core/branches/1.0.1-SP2/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java
core/branches/1.0.1-SP2/impl/src/main/java/org/jboss/weld/bean/SessionBean.java
Log:
WELD-556
Modified: core/branches/1.0.1-SP2/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java
===================================================================
--- core/branches/1.0.1-SP2/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java 2010-06-16 18:58:16 UTC (rev 6457)
+++ core/branches/1.0.1-SP2/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java 2010-06-16 19:15:22 UTC (rev 6458)
@@ -135,7 +135,7 @@
// Decorators
private List<Decorator<?>> decorators;
- private Class<T> proxyClassForDecorators;
+ protected Class<T> proxyClassForDecorators;
// Interceptors
private boolean hasSerializationOrInvocationInterceptorMethods;
Modified: core/branches/1.0.1-SP2/impl/src/main/java/org/jboss/weld/bean/SessionBean.java
===================================================================
--- core/branches/1.0.1-SP2/impl/src/main/java/org/jboss/weld/bean/SessionBean.java 2010-06-16 18:58:16 UTC (rev 6457)
+++ core/branches/1.0.1-SP2/impl/src/main/java/org/jboss/weld/bean/SessionBean.java 2010-06-16 19:15:22 UTC (rev 6458)
@@ -52,6 +52,7 @@
import javax.interceptor.Interceptor;
import org.jboss.interceptor.model.InterceptionModel;
+import org.jboss.interceptor.util.proxy.TargetInstanceProxy;
import org.jboss.weld.bean.interceptor.InterceptorBindingsAdapter;
import org.jboss.weld.bean.proxy.EnterpriseBeanInstance;
import org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler;
@@ -220,6 +221,12 @@
{
this.proxyClass = Proxies.createProxyClass(TypeInfo.of(getTypes()).add(EnterpriseBeanInstance.class).add(Serializable.class));
}
+
+ @Override
+ protected void initProxyClassForDecoratedBean()
+ {
+ super.proxyClassForDecorators = Proxies.createProxyClass(TypeInfo.of(getTypes()).add(TargetInstanceProxy.class).add(EnterpriseBeanInstance.class).add(Serializable.class));
+ }
/**
* Validates for non-conflicting roles
14 years, 6 months
Weld SVN: r6457 - core/trunk/jboss-as.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-16 14:58:16 -0400 (Wed, 16 Jun 2010)
New Revision: 6457
Modified:
core/trunk/jboss-as/pom.xml
Log:
fix jboss-as updater since weld-int moved to jboss-as trunk
Modified: core/trunk/jboss-as/pom.xml
===================================================================
--- core/trunk/jboss-as/pom.xml 2010-06-16 18:25:53 UTC (rev 6456)
+++ core/trunk/jboss-as/pom.xml 2010-06-16 18:58:16 UTC (rev 6457)
@@ -34,12 +34,6 @@
<dependencies>
<dependency>
- <groupId>org.jboss.weld.integration</groupId>
- <artifactId>weld-jboss-int-deployer-assembly</artifactId>
- <version>${weld-deployer.version}</version>
- <type>zip</type>
- </dependency>
- <dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-core</artifactId>
<version>${project.version}</version>
@@ -62,7 +56,7 @@
<outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
<overWriteSnapshots>true</overWriteSnapshots>
<stripVersion>true</stripVersion>
- <includeArtifactIds>cdi-api,weld-api,weld-core,weld-spi,weld-jboss-int-deployer-assembly</includeArtifactIds>
+ <includeArtifactIds>cdi-api,weld-api,weld-core,weld-spi</includeArtifactIds>
</configuration>
</execution>
</executions>
@@ -82,34 +76,37 @@
<property file="${basedir}/local.build.properties" />
<property file="${basedir}/build.properties" />
<property name="jboss.home" value="${env.JBOSS_HOME}" />
- <delete
- dir="${jboss.home}/server/default/deployers/weld.deployer"
- failonerror="false" />
- <delete
- dir="${jboss.home}/server/default/deployers/webbeans.deployer"
- failonerror="false" />
- <delete
- dir="${jboss.home}/server/all/deployers/weld.deployer"
- failonerror="false" />
-
- <unzip dest="${project.build.directory}"
- src="${project.build.directory}/dependency/lib/weld-jboss-int-deployer-assembly.zip" />
+ <property name="all.deployer.dir" value="${jboss.home}/server/all/deployers/weld.deployer" />
+ <property name="default.deployer.dir" value="${jboss.home}/server/default/deployers/weld.deployer" />
- <copy todir="target/weld.deployer/lib-int/"
+ <copy todir="${all.deployer.dir}/lib-int/"
overwrite="true">
<fileset dir="target/dependency/lib">
<include name="weld-core.jar" />
</fileset>
</copy>
+
+ <copy todir="${default.deployer.dir}/lib-int/"
+ overwrite="true">
+ <fileset dir="target/dependency/lib">
+ <include name="weld-core.jar" />
+ </fileset>
+ </copy>
- <copy todir="target/weld.deployer/"
+ <copy todir="${all.deployer.dir}/"
overwrite="true">
<fileset dir="target/dependency/lib">
<include name="weld-spi.jar" />
</fileset>
</copy>
+
+ <copy todir="${default.deployer.dir}/"
+ overwrite="true">
+ <fileset dir="target/dependency/lib">
+ <include name="weld-spi.jar" />
+ </fileset>
+ </copy>
-
<copy todir="${jboss.home}/client"
overwrite="true">
<fileset dir="target/dependency/lib">
@@ -117,6 +114,7 @@
<include name="cdi-api.jar" />
</fileset>
</copy>
+
<copy todir="${jboss.home}/common/lib"
overwrite="true">
<fileset dir="target/dependency/lib">
@@ -124,20 +122,7 @@
<include name="cdi-api.jar" />
</fileset>
</copy>
-
- <copy
- todir="${jboss.home}/server/default/deployers/weld.deployer">
- <fileset dir="target/weld.deployer">
- <include name="**/*" />
- </fileset>
- </copy>
-
- <copy
- todir="${jboss.home}/server/all/deployers/weld.deployer">
- <fileset dir="target/weld.deployer">
- <include name="**/*" />
- </fileset>
- </copy>
+
</tasks>
</configuration>
</execution>
14 years, 6 months
Weld SVN: r6456 - in examples/trunk/jsf/pastecode/src/main: resources/META-INF and 1 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-16 14:25:53 -0400 (Wed, 16 Jun 2010)
New Revision: 6456
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paster.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/ThemeManager.java
examples/trunk/jsf/pastecode/src/main/resources/META-INF/persistence.xml
examples/trunk/jsf/pastecode/src/main/webapp/display.xhtml
Log:
Use enum for Themes
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paster.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paster.java 2010-06-16 18:13:17 UTC (rev 6455)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paster.java 2010-06-16 18:25:53 UTC (rev 6456)
@@ -23,7 +23,6 @@
import java.util.List;
-import javax.annotation.PostConstruct;
import javax.ejb.EJBException;
import javax.enterprise.inject.Model;
import javax.enterprise.inject.Produces;
@@ -41,28 +40,22 @@
private String brush;
- private String theme;
+ private Theme theme;
private boolean secured = false;
- @Inject LanguageManager data;
+ @Inject
+ private CodeFragmentManager codeFragmentManager;
- transient @Inject CodeFragmentManager eao;
-
public Paster()
{
- }
-
- @PostConstruct
- public void postConstruct()
- {
this.code = new CodeFragment();
- this.theme = "shThemeDefault.css";
+ this.theme = Theme.DEFAULT;
}
public String paste()
{
- this.codeId = eao.addCodeFragment(code, secured);
+ this.codeId = codeFragmentManager.addCodeFragment(code, secured);
return "success";
}
@@ -76,7 +69,7 @@
public void loadCode()
{
- this.code = eao.getCodeFragment(codeId);
+ this.code = codeFragmentManager.getCodeFragment(codeId);
if (this.code == null)
throw new EJBException("Could not read entity with given id value");
@@ -86,7 +79,7 @@
public List<CodeFragment> getCodes()
{
- return eao.getRecentCodeFragments();
+ return codeFragmentManager.getRecentCodeFragments();
}
public String getCodeId()
@@ -99,16 +92,16 @@
this.codeId = codeId;
}
- public String getTheme()
+ public Theme getTheme()
{
return theme;
}
-
- public void setTheme(String theme)
+
+ public void setTheme(Theme theme)
{
this.theme = theme;
}
-
+
public String getBrush()
{
return brush;
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/ThemeManager.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/ThemeManager.java 2010-06-16 18:13:17 UTC (rev 6455)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/ThemeManager.java 2010-06-16 18:25:53 UTC (rev 6456)
@@ -21,7 +21,7 @@
*/
package org.jboss.weld.examples.pastecode.session;
-import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -34,19 +34,15 @@
{
// The supported themes
- private final List<String> themes;
+ private final List<Theme> themes;
public ThemeManager()
{
- this.themes = new ArrayList<String>();
- for (Theme theme : Theme.values())
- {
- this.themes.add(theme.getName());
- }
+ this.themes = Arrays.asList(Theme.values());
}
@Produces @Named
- public List<String> getThemes()
+ public List<Theme> getThemes()
{
return Collections.unmodifiableList(themes);
}
Modified: examples/trunk/jsf/pastecode/src/main/resources/META-INF/persistence.xml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/resources/META-INF/persistence.xml 2010-06-16 18:13:17 UTC (rev 6455)
+++ examples/trunk/jsf/pastecode/src/main/resources/META-INF/persistence.xml 2010-06-16 18:25:53 UTC (rev 6456)
@@ -7,7 +7,7 @@
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/pastecodeDatasource</jta-data-source>
<properties>
- <property name="hibernate.hbm2ddl.auto" value="create-drop"/> <!-- create-drop update-->
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="false"/>
</properties>
</persistence-unit>
Modified: examples/trunk/jsf/pastecode/src/main/webapp/display.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/display.xhtml 2010-06-16 18:13:17 UTC (rev 6455)
+++ examples/trunk/jsf/pastecode/src/main/webapp/display.xhtml 2010-06-16 18:25:53 UTC (rev 6456)
@@ -42,7 +42,7 @@
<h:panelGroup>
<h:outputLabel for="theme" value="Choose theme: "/>
<h:selectOneMenu id="theme" value="#{paster.theme}" onchange="chooseStyle(this.value);"> <!-- this.form.submit() -->
- <f:selectItems value="#{themes}"/>
+ <f:selectItems value="#{themes}" var="theme" itemLabel="#{theme.name}" itemValue="#{theme.name}" />
</h:selectOneMenu>
<a href="download?id=#{code.hash == null ? code.id : code.hash}" style="text-decoration: none;"><input type="button" value="Download file" /></a>
</h:panelGroup>
14 years, 6 months
Weld SVN: r6455 - 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:13:17 -0400 (Wed, 16 Jun 2010)
New Revision: 6455
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java
Log:
minor
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java 2010-06-16 18:10:04 UTC (rev 6454)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java 2010-06-16 18:13:17 UTC (rev 6455)
@@ -158,6 +158,7 @@
* modify returned Codes without affecting database (when we call this
* function from another session bean
*/
+
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public List<CodeFragment> searchCodeFragments(CodeFragment code, int page, QueryInfo info)
{
@@ -205,6 +206,8 @@
int allRecords = q.getResultList().size();
q.setFirstResult(page * PAGE_SIZE);
q.setMaxResults(PAGE_SIZE);
+
+ @SuppressWarnings("unchecked")
List<CodeFragment> codes = q.getResultList();
info.setPage(page);
14 years, 6 months
Weld SVN: r6454 - 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:10:04 -0400 (Wed, 16 Jun 2010)
New Revision: 6454
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/ThemeManager.java
Log:
better
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/ThemeManager.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/ThemeManager.java 2010-06-16 18:09:37 UTC (rev 6453)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/ThemeManager.java 2010-06-16 18:10:04 UTC (rev 6454)
@@ -25,7 +25,6 @@
import java.util.Collections;
import java.util.List;
-import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Named;
@@ -35,22 +34,21 @@
{
// The supported themes
- private final List<String> THEMES = new ArrayList<String>();
+ private final List<String> themes;
- @SuppressWarnings("unused")
- @PostConstruct
- private void populateThemes()
+ public ThemeManager()
{
+ this.themes = new ArrayList<String>();
for (Theme theme : Theme.values())
{
- THEMES.add(theme.getName());
+ this.themes.add(theme.getName());
}
}
@Produces @Named
public List<String> getThemes()
{
- return Collections.unmodifiableList(THEMES);
+ return Collections.unmodifiableList(themes);
}
}
14 years, 6 months