Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Committed Jazoon 2010 Showcase + Presentation

  • Loading branch information...
commit acf15cf243bce63fbee9cadb939d0a387d7d0d69 1 parent 16b9ab2
@aslakknutsen aslakknutsen authored
Showing with 12,336 additions and 18 deletions.
  1. +5 −0 .gitignore
  2. +102 −0 cdi/pom.xml
  3. +29 −0 cdi/src/main/java/com/acme/cdi/payment/Asynchronous.java
  4. +29 −0 cdi/src/main/java/com/acme/cdi/payment/AsynchronousPaymentProcessor.java
  5. +31 −0 cdi/src/main/java/com/acme/cdi/payment/MockPaymentProcessor.java
  6. +23 −0 cdi/src/main/java/com/acme/cdi/payment/PaymentProcessor.java
  7. +29 −0 cdi/src/main/java/com/acme/cdi/payment/Synchronous.java
  8. +29 −0 cdi/src/main/java/com/acme/cdi/payment/SynchronousPaymentProcessor.java
  9. +53 −0 cdi/src/test/java/com/acme/cdi/payment/SynchronousPaymentProcessorTestCase.java
  10. +6 −0 cdi/src/test/resources/com/acme/cdi/payment/beans.xml
  11. +3 −0  cdi/src/test/resources/jndi.properties
  12. +87 −0 ejb/pom.xml
  13. +22 −0 ejb/src/main/java/com/acme/ejb/GreetingManager.java
  14. +31 −0 ejb/src/main/java/com/acme/ejb/GreetingManagerBean.java
  15. +24 −0 ejb/src/main/java/com/acme/ejb/TemperatureConverter.java
  16. +35 −0 ejb/src/main/java/com/acme/ejb/TemperatureConverterBean.java
  17. +53 −0 ejb/src/test/java/com/acme/ejb/InjectionTestCase.java
  18. +57 −0 ejb/src/test/java/com/acme/ejb/TemperatureConverterTestCase.java
  19. +3 −0  ejb/src/test/resources/jndi.properties
  20. +9 −0 jaxrs/WORKLOG
  21. +9 −0 jaxrs/about.txt
  22. +185 −0 jaxrs/domain.xml
  23. +18 −0 jaxrs/nb-configuration.xml
  24. +13 −0 jaxrs/nbactions.xml
  25. +205 −0 jaxrs/pom.xml
  26. +18 −0 jaxrs/profiles.xml
  27. +135 −0 jaxrs/readme.txt
  28. +45 −0 jaxrs/src/main/java/org/jboss/example/sellmore/action/ContactEditor.java
  29. +38 −0 jaxrs/src/main/java/org/jboss/example/sellmore/action/CustomerEditor.java
  30. +78 −0 jaxrs/src/main/java/org/jboss/example/sellmore/data/Contact.java
  31. +16 −0 jaxrs/src/main/java/org/jboss/example/sellmore/data/Contact_.java
  32. +81 −0 jaxrs/src/main/java/org/jboss/example/sellmore/data/Customer.java
  33. +16 −0 jaxrs/src/main/java/org/jboss/example/sellmore/data/Customer_.java
  34. +61 −0 jaxrs/src/main/java/org/jboss/example/sellmore/data/LineItem.java
  35. +16 −0 jaxrs/src/main/java/org/jboss/example/sellmore/data/LineItem_.java
  36. +60 −0 jaxrs/src/main/java/org/jboss/example/sellmore/data/Product.java
  37. +16 −0 jaxrs/src/main/java/org/jboss/example/sellmore/data/Product_.java
  38. +78 −0 jaxrs/src/main/java/org/jboss/example/sellmore/data/SalesOrder.java
  39. +19 −0 jaxrs/src/main/java/org/jboss/example/sellmore/data/SalesOrder_.java
  40. +42 −0 jaxrs/src/main/java/org/jboss/example/sellmore/persistence/DataLoader.java
  41. +19 −0 jaxrs/src/main/java/org/jboss/example/sellmore/persistence/EntityManagerProducer.java
  42. +29 −0 jaxrs/src/main/java/org/jboss/example/sellmore/query/ContactListProducer.java
  43. +35 −0 jaxrs/src/main/java/org/jboss/example/sellmore/query/CustomerListProducer.java
  44. +29 −0 jaxrs/src/main/java/org/jboss/example/sellmore/query/LineItemListProducer.java
  45. +29 −0 jaxrs/src/main/java/org/jboss/example/sellmore/query/OrderListProducer.java
  46. +10 −0 jaxrs/src/main/java/org/jboss/example/sellmore/query/Selected.java
  47. +48 −0 jaxrs/src/main/java/org/jboss/example/sellmore/query/SelectedCustomerProducer.java
  48. +47 −0 jaxrs/src/main/java/org/jboss/example/sellmore/query/SelectedOrderProducer.java
  49. +109 −0 jaxrs/src/main/java/org/jboss/example/sellmore/resource/CustomerResource.java
  50. +9 −0 jaxrs/src/main/java/org/jboss/example/sellmore/rs/JaxRsConfig.java
  51. +30 −0 jaxrs/src/main/resources/META-INF/persistence.xml
  52. +8 −0 jaxrs/src/main/resources/import.sql
  53. BIN  jaxrs/src/main/resources/rest/app.gif
  54. BIN  jaxrs/src/main/resources/rest/cc.gif
  55. BIN  jaxrs/src/main/resources/rest/cg.gif
  56. BIN  jaxrs/src/main/resources/rest/collapse.gif
  57. +5,087 −0 jaxrs/src/main/resources/rest/css_master-all.css
  58. BIN  jaxrs/src/main/resources/rest/expand.gif
  59. BIN  jaxrs/src/main/resources/rest/images/background_border_bottom.gif
  60. BIN  jaxrs/src/main/resources/rest/images/bg_gradient.gif
  61. BIN  jaxrs/src/main/resources/rest/images/level1_selected-1lvl.jpg
  62. BIN  jaxrs/src/main/resources/rest/images/masthead.png
  63. BIN  jaxrs/src/main/resources/rest/images/pbdis.png
  64. BIN  jaxrs/src/main/resources/rest/images/pbena.png
  65. BIN  jaxrs/src/main/resources/rest/images/pbmou.png
  66. BIN  jaxrs/src/main/resources/rest/images/pbsel.png
  67. BIN  jaxrs/src/main/resources/rest/images/pname.png
  68. BIN  jaxrs/src/main/resources/rest/images/primary-enabled.gif
  69. BIN  jaxrs/src/main/resources/rest/images/primary-roll.gif
  70. BIN  jaxrs/src/main/resources/rest/images/secondary-enabled.gif
  71. BIN  jaxrs/src/main/resources/rest/images/tbsel.png
  72. BIN  jaxrs/src/main/resources/rest/images/tbuns.png
  73. BIN  jaxrs/src/main/resources/rest/item.gif
  74. BIN  jaxrs/src/main/resources/rest/og.gif
  75. +320 −0 jaxrs/src/main/resources/rest/test-resbeans.css
  76. +2,003 −0 jaxrs/src/main/resources/rest/test-resbeans.js
  77. +56 −0 jaxrs/src/main/resources/rest/test-services.html
  78. +5 −0 jaxrs/src/main/webapp/META-INF/context.xml
  79. +10 −0 jaxrs/src/main/webapp/WEB-INF/beans.xml
  80. +31 −0 jaxrs/src/main/webapp/WEB-INF/faces-config.xml
  81. +11 −0 jaxrs/src/main/webapp/WEB-INF/sun-web.xml
  82. +40 −0 jaxrs/src/main/webapp/WEB-INF/templates/default.xhtml
  83. +57 −0 jaxrs/src/main/webapp/WEB-INF/web.xml
  84. +62 −0 jaxrs/src/main/webapp/addContact.xhtml
  85. +38 −0 jaxrs/src/main/webapp/addCustomer.xhtml
  86. +49 −0 jaxrs/src/main/webapp/contacts.xhtml
  87. +40 −0 jaxrs/src/main/webapp/customers.xhtml
  88. +1 −0  jaxrs/src/main/webapp/index.jsp
  89. +54 −0 jaxrs/src/main/webapp/lineItems.xhtml
  90. +53 −0 jaxrs/src/main/webapp/orders.xhtml
  91. +103 −0 jaxrs/src/main/webapp/resources/css/screen.css
  92. BIN  jaxrs/src/main/webapp/resources/gfx/add-contact-tilt.gif
  93. BIN  jaxrs/src/main/webapp/resources/gfx/add-customer-tilt.gif
  94. BIN  jaxrs/src/main/webapp/resources/gfx/contacts-tilt.gif
  95. BIN  jaxrs/src/main/webapp/resources/gfx/customers-tilt.gif
  96. BIN  jaxrs/src/main/webapp/resources/gfx/delete.png
  97. BIN  jaxrs/src/main/webapp/resources/gfx/edit.png
  98. BIN  jaxrs/src/main/webapp/resources/gfx/feed.png
  99. BIN  jaxrs/src/main/webapp/resources/gfx/header-gradient.gif
  100. BIN  jaxrs/src/main/webapp/resources/gfx/line-items-tilt.gif
  101. BIN  jaxrs/src/main/webapp/resources/gfx/orders-tilt.gif
  102. BIN  jaxrs/src/main/webapp/resources/gfx/sellmore-logo.png
  103. BIN  jaxrs/src/main/webapp/resources/gfx/view.png
  104. BIN  jaxrs/src/main/webapp/resources/gfx/weld.png
  105. BIN  jaxrs/src/main/webapp/resources/gfx/xml.png
  106. +16 −0 jaxrs/src/main/webapp/resources/locale/outputDate.xhtml
  107. +36 −0 jaxrs/src/main/webapp/resources/sellmore/rowInputContainer.xhtml
  108. +42 −0 jaxrs/src/manual/sellmore-manual.xhtml
  109. +4 −0 jaxrs/src/test/glassfish/META-INF/MANIFEST.MF
  110. BIN  jaxrs/src/test/glassfish/__cp_jdbc_ra.rar
  111. BIN  jaxrs/src/test/glassfish/__dm_jdbc_ra.rar
  112. BIN  jaxrs/src/test/glassfish/__ds_jdbc_ra.rar
  113. BIN  jaxrs/src/test/glassfish/__xa_jdbc_ra.rar
  114. 0  jaxrs/src/test/glassfish/config/admin-keyfile
  115. +185 −0 jaxrs/src/test/glassfish/config/domain.xml
  116. 0  jaxrs/src/test/glassfish/config/keyfile
  117. +1 −0  jaxrs/src/test/glassfish/config/local-password
  118. +8 −0 jaxrs/src/test/glassfish/generated/policy/__default-web-module/__default-web-module/granted.policy
  119. +10 −0 jaxrs/src/test/glassfish/lib/install/applications/__cp_jdbc_ra/META-INF/MANIFEST.MF
  120. +266 −0 jaxrs/src/test/glassfish/lib/install/applications/__cp_jdbc_ra/META-INF/ra.xml
  121. BIN  jaxrs/src/test/glassfish/lib/install/applications/__cp_jdbc_ra/__cp_jdbc_ra.jar
  122. +10 −0 jaxrs/src/test/glassfish/lib/install/applications/__dm_jdbc_ra/META-INF/MANIFEST.MF
  123. +224 −0 jaxrs/src/test/glassfish/lib/install/applications/__dm_jdbc_ra/META-INF/ra.xml
  124. BIN  jaxrs/src/test/glassfish/lib/install/applications/__dm_jdbc_ra/__dm_jdbc_ra.jar
  125. +10 −0 jaxrs/src/test/glassfish/lib/install/applications/__ds_jdbc_ra/META-INF/MANIFEST.MF
  126. +266 −0 jaxrs/src/test/glassfish/lib/install/applications/__ds_jdbc_ra/META-INF/ra.xml
  127. BIN  jaxrs/src/test/glassfish/lib/install/applications/__ds_jdbc_ra/__ds_jdbc_ra.jar
  128. +10 −0 jaxrs/src/test/glassfish/lib/install/applications/__xa_jdbc_ra/META-INF/MANIFEST.MF
  129. +264 −0 jaxrs/src/test/glassfish/lib/install/applications/__xa_jdbc_ra/META-INF/ra.xml
  130. BIN  jaxrs/src/test/glassfish/lib/install/applications/__xa_jdbc_ra/__xa_jdbc_ra.jar
  131. +22 −0 jaxrs/src/test/java/org/jboss/example/sellmore/ArtifactResolver.java
  132. +18 −0 jaxrs/src/test/java/org/jboss/example/sellmore/CustomerClient.java
  133. +121 −0 jaxrs/src/test/java/org/jboss/example/sellmore/CustomerResourceClientTest.java
  134. +16 −0 jaxrs/src/test/java/org/jboss/example/sellmore/CustomerResourceStub.java
  135. +3 −0  jaxrs/src/test/resources-jbossas/jndi.properties
  136. +37 −0 jaxrs/src/test/resources/WEB-INF/test-web.xml
  137. +15 −0 jaxrs/src/test/resources/arquillian.xml
  138. +3 −0  jaxrs/src/test/resources/jndi.properties
  139. +140 −0 jms/pom.xml
  140. +62 −0 jms/src/main/java/com/acme/jms/MessageEcho.java
  141. +43 −0 jms/src/main/java/com/acme/web/TestServlet.java
  142. +90 −0 jms/src/test/java/com/acme/jms/InjectionTestCase.java
  143. +3 −0  jms/src/test/resources/jndi.properties
  144. +1 −0  jms/src/test/resources/log4j.properties
  145. +25 −18 pom.xml
  146. BIN  presentations/Arquillian_Jazoon-2010.pdf
  147. +154 −0 profiles/pom.xml
View
5 .gitignore
@@ -0,0 +1,5 @@
+classpath
+.project
+.settings/
+target/
+
View
102 cdi/pom.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ vi:ts=2:sw=2:expandtab:
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <!-- Model Information -->
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.arquillian.sandbox.showcase</groupId>
+ <artifactId>arquillian-sandbox-showcase-profiles</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../profiles/pom.xml</relativePath>
+ </parent>
+
+ <!-- Artifact Information -->
+ <artifactId>arquillian-sandbox-showcase-cdi</artifactId>
+ <packaging>jar</packaging>
+ <name>Arquillian Showcase - CDI</name>
+ <url>http://www.jboss.org</url>
+ <description>Arquillian Showcase - CDI</description>
+
+ <properties>
+ <version.weld_core>1.0.1-SP1</version.weld_core>
+ </properties>
+
+ <profiles>
+ <profile>
+ <id>weld-embedded</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-weld-embedded</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>1.2</version>
+ </dependency>
+ </dependencies>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core-bom</artifactId>
+ <version>${version.weld_core}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ </profile>
+ <profile>
+ <id>integration</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-jbossas-remote-60</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-client</artifactId>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-6.0</artifactId>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
View
29 cdi/src/main/java/com/acme/cdi/payment/Asynchronous.java
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ *
+ * 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 com.acme.cdi.payment;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
+public @interface Asynchronous {}
View
29 cdi/src/main/java/com/acme/cdi/payment/AsynchronousPaymentProcessor.java
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ *
+ * 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 com.acme.cdi.payment;
+
+import javax.enterprise.context.RequestScoped;
+
+@Asynchronous
+@RequestScoped
+public class AsynchronousPaymentProcessor implements PaymentProcessor {
+
+ public void process(String payment)
+ {
+
+ }
+}
View
31 cdi/src/main/java/com/acme/cdi/payment/MockPaymentProcessor.java
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ *
+ * 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 com.acme.cdi.payment;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Alternative;
+
+@Alternative @Asynchronous @Synchronous
+@RequestScoped
+public class MockPaymentProcessor implements PaymentProcessor {
+
+ public static Boolean HAS_BEEN_CALLED = false;
+
+ public void process(String payment) {
+ HAS_BEEN_CALLED = true;
+ }
+}
View
23 cdi/src/main/java/com/acme/cdi/payment/PaymentProcessor.java
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ *
+ * 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 com.acme.cdi.payment;
+
+public interface PaymentProcessor {
+
+ void process(String payment);
+
+}
View
29 cdi/src/main/java/com/acme/cdi/payment/Synchronous.java
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ *
+ * 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 com.acme.cdi.payment;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
+public @interface Synchronous {}
View
29 cdi/src/main/java/com/acme/cdi/payment/SynchronousPaymentProcessor.java
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ *
+ * 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 com.acme.cdi.payment;
+
+import javax.enterprise.context.RequestScoped;
+
+@Synchronous
+@RequestScoped
+public class SynchronousPaymentProcessor implements PaymentProcessor {
+
+ public void process(String payment)
+ {
+
+ }
+}
View
53 cdi/src/test/java/com/acme/cdi/payment/SynchronousPaymentProcessorTestCase.java
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ *
+ * 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 com.acme.cdi.payment;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(Arquillian.class)
+public class SynchronousPaymentProcessorTestCase {
+
+ @Deployment
+ public static JavaArchive createDeployment() {
+ return ShrinkWrap.create("test.jar", JavaArchive.class)
+ .addPackage(
+ Synchronous.class.getPackage()
+ )
+ .addManifestResource(
+ "com/acme/cdi/payment/beans.xml",
+ ArchivePaths.create("beans.xml"));
+ }
+
+ @Inject @Synchronous
+ private PaymentProcessor processor;
+
+ @Test
+ public void shouldBeReplacedByAMock() throws Exception
+ {
+ processor.process("");
+ Assert.assertTrue(MockPaymentProcessor.HAS_BEEN_CALLED);
+ }
+}
View
6 cdi/src/test/resources/com/acme/cdi/payment/beans.xml
@@ -0,0 +1,6 @@
+<beans 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/beans_1_0.xsd">
+ <alternatives>
+ <class>com.acme.cdi.payment.MockPaymentProcessor</class>
+ </alternatives>
+</beans>
View
3  cdi/src/test/resources/jndi.properties
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming\:org.jnp.interfaces
+java.naming.provider.url=jnp://localhost:1099
View
87 ejb/pom.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ vi:ts=2:sw=2:expandtab:
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <!-- Model Information -->
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.arquillian.sandbox.showcase</groupId>
+ <artifactId>arquillian-sandbox-showcase-profiles</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../profiles/pom.xml</relativePath>
+ </parent>
+
+ <!-- Artifact Information -->
+ <artifactId>arquillian-sandbox-showcase-ejb</artifactId>
+ <packaging>jar</packaging>
+ <name>Arquillian Showcase - EJB</name>
+ <url>http://www.jboss.org</url>
+ <description>Arquillian Showcase - EJB</description>
+
+ <profiles>
+ <profile>
+ <id>openejb-embedded</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-openejb</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-core</artifactId>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>integration</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-jbossas-remote-60</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-client</artifactId>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-api</artifactId>
+ <version>3.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <version>1.0-SP1</version>
+ <scope>test</scope>
+ </dependency>
+<!--
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-6.0</artifactId>
+ <type>pom</type>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
View
22 ejb/src/main/java/com/acme/ejb/GreetingManager.java
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ *
+ * 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 com.acme.ejb;
+
+public interface GreetingManager
+{
+ String greet(String userName);
+}
View
31 ejb/src/main/java/com/acme/ejb/GreetingManagerBean.java
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ *
+ * 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 com.acme.ejb;
+
+import javax.ejb.Local;
+import javax.ejb.Stateless;
+
+@Local(GreetingManager.class)
+@Stateless
+public class GreetingManagerBean implements GreetingManager
+{
+
+ public String greet(String userName)
+ {
+ return "Hello " + userName;
+ }
+}
View
24 ejb/src/main/java/com/acme/ejb/TemperatureConverter.java
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ *
+ * 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 com.acme.ejb;
+
+public interface TemperatureConverter
+{
+ double convertToCelsius(double f);
+
+ double convertToFarenheit(double c);
+}
View
35 ejb/src/main/java/com/acme/ejb/TemperatureConverterBean.java
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ *
+ * 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 com.acme.ejb;
+
+import javax.ejb.Local;
+import javax.ejb.Stateless;
+
+@Stateless
+@Local(TemperatureConverter.class)
+public class TemperatureConverterBean implements TemperatureConverter
+{
+ public double convertToCelsius(double f)
+ {
+ return ((f - 32) * 5 / 9);
+ }
+
+ public double convertToFarenheit(double c)
+ {
+ return ((c * 9 / 5) + 32);
+ }
+}
View
53 ejb/src/test/java/com/acme/ejb/InjectionTestCase.java
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ *
+ * 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 com.acme.ejb;
+
+import javax.ejb.EJB;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(Arquillian.class)
+public class InjectionTestCase
+{
+ @Deployment
+ public static JavaArchive createDeployment() {
+ return ShrinkWrap.create("blagh.jar", JavaArchive.class)
+ .addClasses(
+ GreetingManager.class,
+ GreetingManagerBean.class);
+ }
+
+ @EJB
+ private GreetingManager greetingManager;
+
+ @Test
+ public void shouldBeAbleToInjectEJB() throws Exception {
+
+ String userName = "Jazoon";
+
+ Assert.assertEquals(
+ "Hello " + userName,
+ greetingManager.greet(userName));
+ }
+}
View
57 ejb/src/test/java/com/acme/ejb/TemperatureConverterTestCase.java
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ *
+ * 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 com.acme.ejb;
+
+import javax.ejb.EJB;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(Arquillian.class)
+public class TemperatureConverterTestCase
+{
+ @Deployment
+ public static JavaArchive createTestArchive()
+ {
+ return ShrinkWrap.create("test.jar", JavaArchive.class)
+ .addClasses(
+ TemperatureConverter.class,
+ TemperatureConverterBean.class);
+ }
+
+ @EJB
+ private TemperatureConverter converter;
+
+ @Test
+ public void testConvertToCelsius()
+ {
+ Assert.assertEquals(converter.convertToCelsius(32d), 0d, 0d);
+ Assert.assertEquals(converter.convertToCelsius(212d), 100d, 0d);
+ }
+
+ @Test
+ public void testConvertToFarenheit()
+ {
+ Assert.assertEquals(converter.convertToFarenheit(0d), 32d, 0d);
+ Assert.assertEquals(converter.convertToFarenheit(100d), 212d, 0d);
+ }
+}
View
3  ejb/src/test/resources/jndi.properties
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming\:org.jnp.interfaces
+java.naming.provider.url=jnp://localhost:1099
View
9 jaxrs/WORKLOG
@@ -0,0 +1,9 @@
+- prefetch data for line items
+- format amounts
+- format dates
+- insert order
+- composite component for form
+- tests
+- review queries
+
+see http://blogs.sun.com/arungupta/entry/totd_124_using_cdi_jpa
View
9 jaxrs/about.txt
@@ -0,0 +1,9 @@
+This is an example Java EE 6 application based on the Weld Java EE 6 Maven archetype.
+
+This application demonstrates the master-detail record scenario for orders and line items.
+
+http://www.oracle.com/technology/products/enterprise-pack-for-eclipse/spring-jpa-tutorial/jpatutorial.html
+http://new.myfonts.com/fonts/typeart/label-gun/
+http://www.insidebuymore.com/
+tilt: -3.5 degrees
+small size: 50px height
View
185 jaxrs/domain.xml
@@ -0,0 +1,185 @@
+<domain log-root="${com.sun.aas.instanceRoot}/logs" application-root="${com.sun.aas.instanceRoot}/applications" version="19">
+ <system-applications />
+ <applications />
+ <resources>
+ <jdbc-resource pool-name="__TimerPool" jndi-name="jdbc/__TimerPool" object-type="system-admin" />
+ <jdbc-resource pool-name="DerbyPool" jndi-name="jdbc/__default" />
+ <jdbc-connection-pool datasource-classname="org.apache.derby.jdbc.EmbeddedXADataSource" res-type="javax.sql.XADataSource" name="__TimerPool">
+ <property name="databaseName" value="${com.sun.aas.instanceRoot}/lib/databases/ejbtimer" />
+ <property name="connectionAttributes" value=";create=true" />
+ </jdbc-connection-pool>
+ <jdbc-connection-pool datasource-classname="org.apache.derby.jdbc.ClientDataSource" is-isolation-level-guaranteed="false" res-type="javax.sql.DataSource" name="DerbyPool">
+ <property name="PortNumber" value="1527" />
+ <property name="Password" value="APP" />
+ <property name="User" value="APP" />
+ <property name="serverName" value="localhost" />
+ <property name="DatabaseName" value="default" />
+ <property name="connectionAttributes" value=";create=true" />
+ </jdbc-connection-pool>
+ </resources>
+ <servers>
+ <server name="server" config-ref="server-config">
+ <resource-ref ref="jdbc/__TimerPool" />
+ <resource-ref ref="jdbc/__default" />
+ </server>
+ </servers>
+ <configs>
+ <config name="server-config">
+ <http-service>
+ <access-log />
+ <virtual-server id="server" network-listeners="http-listener-1,http-listener-2" />
+ <virtual-server id="__asadmin" network-listeners="admin-listener" />
+ </http-service>
+ <iiop-service>
+ <orb use-thread-pool-ids="thread-pool-1" />
+ <iiop-listener id="orb-listener-1" port="3700" address="0.0.0.0" lazy-init="true" />
+ <iiop-listener id="SSL" port="3820" address="0.0.0.0" security-enabled="true">
+ <ssl cert-nickname="s1as" />
+ </iiop-listener>
+ <iiop-listener id="SSL_MUTUALAUTH" port="3920" address="0.0.0.0" security-enabled="true">
+ <ssl cert-nickname="s1as" client-auth-enabled="true" />
+ </iiop-listener>
+ </iiop-service>
+ <admin-service system-jmx-connector-name="system" type="das-and-server">
+ <jmx-connector port="8686" address="0.0.0.0" security-enabled="false" name="system" auth-realm-name="admin-realm" />
+ <das-config dynamic-reload-enabled="true" autodeploy-dir="${com.sun.aas.instanceRoot}/autodeploy" autodeploy-enabled="true" />
+ <property name="adminConsoleContextRoot" value="/admin" />
+ <property name="adminConsoleDownloadLocation" value="${com.sun.aas.installRoot}/lib/install/applications/admingui.war" />
+ <property name="ipsRoot" value="${com.sun.aas.installRoot}/.." />
+ </admin-service>
+ <connector-service />
+ <web-container>
+ <session-config>
+ <session-manager>
+ <manager-properties />
+ <store-properties />
+ </session-manager>
+ <session-properties />
+ </session-config>
+ </web-container>
+ <ejb-container session-store="${com.sun.aas.instanceRoot}/session-store">
+ <ejb-timer-service />
+ </ejb-container>
+ <mdb-container />
+ <jms-service default-jms-host="default_JMS_host" type="EMBEDDED">
+ <jms-host host="localhost" name="default_JMS_host" lazy-init="true" />
+ </jms-service>
+ <security-service>
+ <auth-realm name="admin-realm" classname="com.sun.enterprise.security.auth.realm.file.FileRealm">
+ <property name="file" value="${com.sun.aas.instanceRoot}/config/admin-keyfile" />
+ <property name="jaas-context" value="fileRealm" />
+ </auth-realm>
+ <auth-realm name="file" classname="com.sun.enterprise.security.auth.realm.file.FileRealm">
+ <property name="file" value="${com.sun.aas.instanceRoot}/config/keyfile" />
+ <property name="jaas-context" value="fileRealm" />
+ </auth-realm>
+ <auth-realm name="certificate" classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" />
+ <jacc-provider policy-provider="com.sun.enterprise.security.provider.PolicyWrapper" name="default" policy-configuration-factory-provider="com.sun.enterprise.security.provider.PolicyConfigurationFactoryImpl">
+ <property name="repository" value="${com.sun.aas.instanceRoot}/generated/policy" />
+ </jacc-provider>
+ <jacc-provider policy-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyProvider" name="simple" policy-configuration-factory-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyConfigurationFactory" />
+ <audit-module name="default" classname="com.sun.enterprise.security.Audit">
+ <property name="auditOn" value="false" />
+ </audit-module>
+ <message-security-config auth-layer="SOAP">
+ <provider-config provider-type="client" provider-id="XWS_ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule">
+ <request-policy auth-source="content" />
+ <response-policy auth-source="content" />
+ <property name="encryption.key.alias" value="s1as" />
+ <property name="signature.key.alias" value="s1as" />
+ <property name="dynamic.username.password" value="false" />
+ <property name="debug" value="false" />
+ </provider-config>
+ <provider-config provider-type="client" provider-id="ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule">
+ <request-policy auth-source="content" />
+ <response-policy auth-source="content" />
+ <property name="encryption.key.alias" value="s1as" />
+ <property name="signature.key.alias" value="s1as" />
+ <property name="dynamic.username.password" value="false" />
+ <property name="debug" value="false" />
+ <property name="security.config" value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml" />
+ </provider-config>
+ <provider-config provider-type="server" provider-id="XWS_ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule">
+ <request-policy auth-source="content" />
+ <response-policy auth-source="content" />
+ <property name="encryption.key.alias" value="s1as" />
+ <property name="signature.key.alias" value="s1as" />
+ <property name="debug" value="false" />
+ </provider-config>
+ <provider-config provider-type="server" provider-id="ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule">
+ <request-policy auth-source="content" />
+ <response-policy auth-source="content" />
+ <property name="encryption.key.alias" value="s1as" />
+ <property name="signature.key.alias" value="s1as" />
+ <property name="debug" value="false" />
+ <property name="security.config" value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml" />
+ </provider-config>
+ </message-security-config>
+ </security-service>
+ <transaction-service tx-log-dir="${com.sun.aas.instanceRoot}/logs" />
+ <monitoring-service>
+ <module-monitoring-levels />
+ </monitoring-service>
+ <java-config debug-options="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009" system-classpath="" classpath-suffix="">
+ <jvm-options>-XX:MaxPermSize=192m</jvm-options>
+ <jvm-options>-client</jvm-options>
+ <jvm-options>-XX:+UnlockDiagnosticVMOptions</jvm-options>
+ <jvm-options>-XX:+LogVMOutput</jvm-options>
+ <jvm-options>-XX:LogFile=${com.sun.aas.instanceRoot}/logs/jvm.log</jvm-options>
+ <jvm-options>-Djava.endorsed.dirs=${com.sun.aas.installRoot}/modules/endorsed${path.separator}${com.sun.aas.installRoot}/lib/endorsed</jvm-options>
+ <jvm-options>-Djava.security.policy=${com.sun.aas.instanceRoot}/config/server.policy</jvm-options>
+ <jvm-options>-Djava.security.auth.login.config=${com.sun.aas.instanceRoot}/config/login.conf</jvm-options>
+ <jvm-options>-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as</jvm-options>
+ <jvm-options>-Xmx512m</jvm-options>
+ <jvm-options>-Djavax.net.ssl.keyStore=${com.sun.aas.instanceRoot}/config/keystore.jks</jvm-options>
+ <jvm-options>-Djavax.net.ssl.trustStore=${com.sun.aas.instanceRoot}/config/cacerts.jks</jvm-options>
+ <jvm-options>-Djava.ext.dirs=${com.sun.aas.javaRoot}/lib/ext${path.separator}${com.sun.aas.javaRoot}/jre/lib/ext${path.separator}${com.sun.aas.instanceRoot}/lib/ext</jvm-options>
+ <jvm-options>-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver</jvm-options>
+ <jvm-options>-DANTLR_USE_DIRECT_CLASS_LOADING=true</jvm-options>
+ <jvm-options>-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-options>
+ <jvm-options>-Dosgi.shell.telnet.port=6666</jvm-options>
+ <jvm-options>-Dosgi.shell.telnet.maxconn=1</jvm-options>
+ <jvm-options>-Dosgi.shell.telnet.ip=127.0.0.1</jvm-options>
+ <jvm-options>-Dfelix.fileinstall.dir=${com.sun.aas.installRoot}/modules/autostart/</jvm-options>
+ <jvm-options>-Dfelix.fileinstall.poll=5000</jvm-options>
+ <jvm-options>-Dfelix.fileinstall.debug=1</jvm-options>
+ <jvm-options>-Dfelix.fileinstall.bundles.new.start=true</jvm-options>
+ <jvm-options>-Dorg.glassfish.web.rfc2109_cookie_names_enforced=false</jvm-options>
+ <jvm-options>-XX:NewRatio=2</jvm-options>
+ </java-config>
+ <network-config>
+ <protocols>
+ <protocol name="http-listener-1">
+ <http max-connections="250" default-virtual-server="server" server-name="">
+ <file-cache enabled="false" />
+ </http>
+ </protocol>
+ <protocol security-enabled="true" name="http-listener-2">
+ <http max-connections="250" default-virtual-server="server" server-name="">
+ <file-cache enabled="false" />
+ </http>
+ <ssl ssl3-enabled="false" cert-nickname="s1as" />
+ </protocol>
+ <protocol name="admin-listener">
+ <http max-connections="250" default-virtual-server="__asadmin" server-name="">
+ <file-cache enabled="false" />
+ </http>
+ </protocol>
+ </protocols>
+ <network-listeners>
+ <network-listener port="7171" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool" />
+ <network-listener port="7272" protocol="http-listener-2" transport="tcp" name="http-listener-2" thread-pool="http-thread-pool" />
+ <network-listener port="4747" protocol="admin-listener" transport="tcp" name="admin-listener" thread-pool="http-thread-pool" />
+ </network-listeners>
+ <transports>
+ <transport name="tcp" />
+ </transports>
+ </network-config>
+ <thread-pools>
+ <thread-pool name="http-thread-pool" />
+ <thread-pool max-thread-pool-size="200" name="thread-pool-1" />
+ </thread-pools>
+ </config>
+ </configs>
+ <property name="administrative.domain.name" value="default" />
+</domain>
View
18 jaxrs/nb-configuration.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-shared-configuration>
+ <!--
+This file contains additional configuration written by modules in the NetBeans IDE.
+The configuration is intended to be shared among all the users of project and
+therefore it is assumed to be part of version control checkout.
+Without this configuration present, some functionality in the IDE may be limited or fail altogether.
+-->
+ <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
+ <!--
+Properties that influence various parts of the IDE, especially code formatting and the like.
+You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
+That way multiple projects can share the same settings (useful for formatting rules for example).
+Any value defined here will override the pom.xml file value but is only applicable to the current project.
+-->
+ <org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>user</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>
+ </properties>
+</project-shared-configuration>
View
13 jaxrs/nbactions.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<actions>
+ <action>
+ <actionName>run</actionName>
+ <goals>
+ <goal>package</goal>
+ </goals>
+ <properties>
+ <netbeans.deploy>true</netbeans.deploy>
+ <maven.test.skip>true</maven.test.skip>
+ </properties>
+ </action>
+ </actions>
View
205 jaxrs/pom.xml
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.arquillian.sandbox.showcase</groupId>
+ <artifactId>arquillian-sandbox-showcase-profiles</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../profiles/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>arquillian-sandbox-showcase-jaxrs</artifactId>
+ <packaging>war</packaging>
+ <name>Arquillian Showcase - JAX-RS</name>
+ <description>An application which tracks customers and orders.</description>
+
+ <properties>
+ <!--
+ Explicitly declaring the source encoding eliminates the following message:
+ [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
+ -->
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <!--
+ Timestamp format for the maven.build.timestamp property; you can reference property in pom.xml or filtered resources (must enable third-party plugin if using Maven < 2.1)
+ -->
+ <maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>
+ <!--
+ To set the jboss.home environment variable the Maven way, set the jboss.home property in an active profile in
+ the Maven 2 settings.xml file
+ -->
+ <jboss.home>${env.JBOSS_HOME}</jboss.home>
+ <jboss.domain>default</jboss.domain>
+ <!-- The version of Weld extensions in use -->
+ <jboss-javaee6-spec.version>1.0.0.Beta4</jboss-javaee6-spec.version>
+ <arquillian.version>1.0.0-SNAPSHOT</arquillian.version>
+ <weld.version>1.0.1-Final</weld.version>
+ <netbeans.hint.deploy.server>gfv3ee6</netbeans.hint.deploy.server>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-6.0</artifactId>
+ <version>${jboss-javaee6-spec.version}</version>
+ <type>pom</type>
+ <scope>provided</scope>
+ <exclusions>
+ <!-- causing problems with embedded glassfish -->
+ <exclusion>
+ <groupId>org.jboss.spec.javax.security.auth.message</groupId>
+ <artifactId>jboss-jaspi-api_1.0_spec</artifactId>
+ </exclusion><!--
+ <exclusion>
+ <artifactId>jsf-api</artifactId>
+ <groupId>javax.faces</groupId>
+ </exclusion>
+ --></exclusions>
+ </dependency>
+
+ <!-- Bean Validation Implementation -->
+ <!-- Provides portable constraints such as @NotEmpty, @Email and @Url -->
+ <!-- Hibernate Validator is the only JSR-303 implementation at the moment, so we can assume it's provided -->
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>4.0.0.GA</version>
+ <scope>provided</scope>
+ </dependency>
+
+<!--
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>2.0.2-b10</version>
+ <scope>provided</scope>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-cdi</artifactId>
+ <version>2.0-beta-3-SNAPSHOT</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>jaxrs-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency><!--
+
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>2.0.2-FCS</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>2.0.2-FCS</version>
+ <scope>provided</scope>
+ </dependency>
+
+ --><dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-jpamodelgen</artifactId>
+ <version>1.0.0.Final</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ <version>2.0-beta-2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+ <build>
+ <plugins>
+
+ <!-- Eclipse plugin can force download of source and JavaDoc jars -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <configuration>
+ <wtpversion>2.0</wtpversion>
+ <!--
+ <downloadSources>true</downloadSources>
+ <downloadJavadocs>true</downloadJavadocs>
+ -->
+ </configuration>
+ </plugin>
+
+ <!-- Uncomment if using Maven < 2.1 to set maven.build.timestamp property -->
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>integration</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-jbossas-remote-60</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-client</artifactId>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ </testResource>
+ <testResource>
+ <directory>src/test/resources-jbossas</directory>
+ </testResource>
+ </testResources>
+ </build>
+ </profile>
+ <profile>
+ <id>glassfish-embedded-30</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-glassfish-embedded-30</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.extras</groupId>
+ <artifactId>glassfish-embedded-all</artifactId>
+ <version>3.0.1-b02</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <!-- likely being introduced by jboss specs -->
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ <version>2.2.17.GA</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+</project>
+
View
18 jaxrs/profiles.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<profilesXml xmlns="http://maven.apache.org/PROFILES/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/PROFILES/1.0.0 http://maven.apache.org/xsd/profiles-1.0.0.xsd">
+ <profiles>
+ <profile>
+ <id>netbeans-private</id>
+ <activation>
+ <property>
+ <name>netbeans.execution</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <properties>
+ <netbeans.deployment.server.id>[/home/dallen/opt/glassfish-v3/glassfish]deployer:gfv3ee6:localhost:4848</netbeans.deployment.server.id>
+ </properties>
+ </profile>
+ </profiles>
+</profilesXml>
View
135 jaxrs/readme.txt
@@ -0,0 +1,135 @@
+
+ sellmore
+
+ Source archetype: weld-jsf-jee
+
+ What is it?
+ ===========
+
+ This is your project! It's a sample, deployable Maven 2 project to help you
+ get your foot in the door developing with Java EE 6. This project is setup to
+ allow you to create a compliant Java EE 6 application using JSF 2.0, CDI 1.0,
+ EJB 3.1 and JPA 2.0) that can run on a certified application server (Complete
+ or Web Profile). It includes a persistence unit and some sample persistence
+ and transaction code to help you get your feet wet with database access in
+ enterprise Java.
+
+ System requirements
+ ===================
+
+ All you need to run this project is Java 5.0 (Java SDK 1.5) or greator and
+ Maven 2.0.10 or greater. This application is setup to be run on a Java EE 6
+ certified application server. It has been tested with GlassFish V3 and JBoss
+ AS 6.0.
+
+ If you want to deploy the application to a standalone Servlet Container, then
+ you will need to set one up. Alternatively, you can use a Maven command to run
+ the application in place on an embedded version of GlassFish.
+
+ Please note that Maven 2 project needs to use the JBoss Maven repository
+ because there are certain Java EE API JARs that are not yet publised to the
+ Maven Central Repository (see https://jira.jboss.org/jira/browse/WELD-222)
+
+ Deploying the application
+ =========================
+
+ To deploy the application to JBoss AS (standalone), first make sure that the
+ JBOSS_HOME environment variable points to a JBoss AS 6.0 installation.
+ Alternatively, you can set the location of JBoss AS using the following
+ profile defintion in the .m2/settings.xml file in your home directory:
+
+<?xml version="1.0" encoding="UTF-8"?>
+<settings
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
+
+ <profiles>
+ <profile>
+ <id>environment</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <properties>
+ <jboss.home>/path/to/jboss-as-6.0.0.M2</jboss.home>
+ </properties>
+ </profile>
+ </profiles>
+
+</settings>
+
+ You can now deploy to JBoss AS by executing the following command:
+
+ mvn package jboss:hard-deploy
+
+ Start JBoss AS. The application will be running at the following URL:
+
+ http://localhost:8080/sellmore
+
+ If you want to deploy to GlassFish (standalone), you first need to change
+ the name of the DataSource used by the persistence unit! Open this file:
+
+ src/main/resources/META-INF/persistence.xml
+
+ Change the value of <jta-data-source> to the following:
+
+ <jta-data-source>jdbc/__default</jta-data-source>
+
+ This configuration uses the built-in default Derby DataSource in GlassFish.
+ Optionally, you can use an alternative DataSource of your choice.
+
+ Now, execute the command:
+
+ mvn package
+
+ You can now deploy the target/sellmore.war archive and launch the
+ application the through GlassFish administration console.
+
+ Alternatively, you can deploy the application without moving any files around
+ using the embedded GlassFish application server.
+
+ To run the application using embedded GlassFish, execute this command:
+
+ mvn package embedded-glassfish:run
+
+ The application will be running at the following URL:
+
+ http://localhost:7070/sellmore
+
+ To redeploy the application, hit ENTER in the same window. To shutdown
+ GlassFish, type the letter 'x' then hit ENTER.
+
+ Importing the project into an IDE
+ =================================
+
+ If you created the project using the Maven 2 archetype wizard in your IDE
+ (Eclipse, NetBeans or IntelliJ IDEA), then there is nothing to do. You should
+ already have an IDE project.
+
+ If you created the project from the commandline using archetype:generate, then
+ you need to bring the project into your IDE. If you are using NetBeans 6.8 or
+ IntelliJ IDEA 9, then all you have to do is open the project as an existing
+ project. Both of these IDEs recognize Maven 2 projects natively.
+
+ To import into Eclipse, you first need to install the m2eclipse plugin. To get
+ started, add the m2eclipse update site (http://m2eclipse.sonatype.org/update/)
+ to Eclipse and install the m2eclipse plugin and required dependencies. Once
+ that is installed, you'll be ready to import the project into Eclipse.
+
+ Select File > Import... and select "Import... > Maven Projects" and select
+ your project directory. m2eclipse should take it from there.
+
+ Once in the IDE, you can execute the Maven commands through the IDE controls
+ to run the application on an embedded Servlet Container.
+
+ Resources
+ =========
+
+ Weld archetypes:
+ - Quickstart: http://seamframework.org/Documentation/WeldQuickstartForMavenUsers
+ - Issue tracker: https://jira.jboss.org/jira/browse/WELDX
+ - Source code: http://anonsvn.jboss.org/repos/weld/archetypes
+ - Forums: http://seamframework.org/Community/WeldUsers
+ JSR-299 overview: http://seamframework.org/Weld
+ JSF community site: http://www.javaserverfaces.org
+
View
45 jaxrs/src/main/java/org/jboss/example/sellmore/action/ContactEditor.java
@@ -0,0 +1,45 @@
+package org.jboss.example.sellmore.action;
+
+import org.jboss.example.sellmore.data.Customer;
+import org.jboss.example.sellmore.data.Contact;
+import java.io.Serializable;
+import javax.ejb.Stateful;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.persistence.EntityManager;
+import org.jboss.example.sellmore.query.Selected;
+
+//@Stateful
+@Named
+@ConversationScoped
+public class ContactEditor
+ implements Serializable // NOTE implement Serializable for SE tests
+{
+ @Inject EntityManager em;
+
+ @Inject @Selected Customer customer;
+
+ private Contact contact;
+
+ @Produces @Named
+ public Contact getContact() {
+ if (contact == null) {
+ initNewContact();
+ }
+ return contact;
+ }
+
+ public void add() {
+ // this should really be set when the editor is loaded
+ contact.setCustomer(customer);
+ em.persist(contact);
+ }
+
+ protected void initNewContact() {
+ Contact c = new Contact();
+ contact = c;
+ }
+}
View
38 jaxrs/src/main/java/org/jboss/example/sellmore/action/CustomerEditor.java
@@ -0,0 +1,38 @@
+package org.jboss.example.sellmore.action;
+
+import org.jboss.example.sellmore.data.Customer;
+import java.io.Serializable;
+import javax.ejb.Stateful;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.persistence.EntityManager;
+
+//@Stateful
+@Named
+@ConversationScoped
+public class CustomerEditor
+ implements Serializable // NOTE implement Serializable for SE tests
+{
+ @Inject EntityManager em;
+
+ private Customer customer;
+
+ @Produces @Named
+ public Customer getCustomer() {
+ if (customer == null) {
+ initNewCustomer();
+ }
+ return customer;
+ }
+
+ public void add() {
+ em.persist(customer);
+ }
+
+ protected void initNewCustomer() {
+ Customer c = new Customer();
+ customer = c;
+ }
+}
View
78 jaxrs/src/main/java/org/jboss/example/sellmore/data/Contact.java
@@ -0,0 +1,78 @@
+package org.jboss.example.sellmore.data;
+
+import java.io.Serializable;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
+
+@Entity
+@Table(name = "contact")
+public class Contact implements Serializable {
+ private Long id;
+ private String address;
+ private String city;
+ private Customer customer;
+ private String phone;
+
+ @Id @GeneratedValue
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ @NotNull
+ @Size(min = 1, max = 50)
+ public String getAddress()
+ {
+ return address;
+ }
+
+ public void setAddress(String address)
+ {
+ this.address = address;
+ }
+
+ @NotNull
+ @Size(min = 2, max = 50)
+ public String getCity()
+ {
+ return city;
+ }
+
+ public void setCity(String city)
+ {
+ this.city = city;
+ }
+
+ @ManyToOne
+ public Customer getCustomer()
+ {
+ return customer;
+ }
+
+ public void setCustomer(Customer customer)
+ {
+ this.customer = customer;
+ }
+
+ @Pattern(regexp = "^\\d{3}-\\d{3}-\\d{4}")
+ public String getPhone()
+ {
+ return phone;
+ }
+
+ public void setPhone(String phone)
+ {
+ this.phone = phone;
+ }
+}
View
16 jaxrs/src/main/java/org/jboss/example/sellmore/data/Contact_.java
@@ -0,0 +1,16 @@
+package org.jboss.example.sellmore.data;
+
+import javax.persistence.metamodel.SingularAttribute;
+import javax.persistence.metamodel.StaticMetamodel;
+
+@StaticMetamodel(Contact.class)
+public abstract class Contact_ {
+
+ public static volatile SingularAttribute<Contact, Long> id;
+ public static volatile SingularAttribute<Contact, String> phone;
+ public static volatile SingularAttribute<Contact, String> address;
+ public static volatile SingularAttribute<Contact, Customer> customer;
+ public static volatile SingularAttribute<Contact, String> city;
+
+}
+
View
81 jaxrs/src/main/java/org/jboss/example/sellmore/data/Customer.java
@@ -0,0 +1,81 @@
+package org.jboss.example.sellmore.data;
+
+import java.io.Serializable;
+import java.util.Set;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.UniqueConstraint;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+/**
+ * A <strong>Customer</strong> is an entity for whom orders are created.
+ */
+@Entity
+@XmlRootElement
+@Table(name = "customer", uniqueConstraints = @UniqueConstraint(columnNames = "name"))
+public class Customer implements Serializable {
+ private Long id;
+ private Set<Contact> contacts;
+ private String name;
+ private Set<SalesOrder> orders;
+
+ public Customer() {}
+
+ public Customer(String name)
+ {
+ this.name = name;
+ }
+
+ @Id @GeneratedValue
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ @XmlTransient
+ @OneToMany(mappedBy = "customer")
+ public Set<Contact> getContacts()
+ {
+ return contacts;
+ }
+
+ public void setContacts(Set<Contact> contacts)
+ {
+ this.contacts = contacts;
+ }
+
+ @NotNull
+ @Size(min = 3, max = 50)
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ @XmlTransient
+ @OneToMany(mappedBy = "customer")
+ public Set<SalesOrder> getOrders()
+ {
+ return orders;
+ }
+
+ public void setOrders(Set<SalesOrder> orders)
+ {
+ this.orders = orders;
+ }
+}
View
16 jaxrs/src/main/java/org/jboss/example/sellmore/data/Customer_.java
@@ -0,0 +1,16 @@
+package org.jboss.example.sellmore.data;
+
+import javax.persistence.metamodel.SetAttribute;
+import javax.persistence.metamodel.SingularAttribute;
+import javax.persistence.metamodel.StaticMetamodel;
+
+@StaticMetamodel(Customer.class)
+public abstract class Customer_ {
+
+ public static volatile SingularAttribute<Customer, Long> id;
+ public static volatile SingularAttribute<Customer, String> name;
+ public static volatile SetAttribute<Customer, SalesOrder> orders;
+ public static volatile SetAttribute<Customer, Contact> contacts;
+
+}
+
View
61 jaxrs/src/main/java/org/jboss/example/sellmore/data/LineItem.java
@@ -0,0 +1,61 @@
+package org.jboss.example.sellmore.data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "line_item")
+public class LineItem implements Serializable {
+ private Long id;
+ private SalesOrder order;
+ private Product product;
+ private BigDecimal quantity;
+
+ @Id @GeneratedValue
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ @ManyToOne
+ public SalesOrder getOrder()
+ {
+ return order;
+ }
+
+ public void setOrder(SalesOrder order)
+ {
+ this.order = order;
+ }
+
+ @ManyToOne
+ public Product getProduct()
+ {
+ return product;
+ }
+
+ public void setProduct(Product product)
+ {
+ this.product = product;
+ }
+
+ public BigDecimal getQuantity()
+ {
+ return quantity;
+ }
+
+ public void setQuantity(BigDecimal quantity)
+ {
+ this.quantity = quantity;
+ }
+}
View
16 jaxrs/src/main/java/org/jboss/example/sellmore/data/LineItem_.java
@@ -0,0 +1,16 @@
+package org.jboss.example.sellmore.data;
+
+import java.math.BigDecimal;
+import javax.persistence.metamodel.SingularAttribute;
+import javax.persistence.metamodel.StaticMetamodel;
+
+@StaticMetamodel(LineItem.class)
+public abstract class LineItem_ {
+
+ public static volatile SingularAttribute<LineItem, Product> product;
+ public static volatile SingularAttribute<LineItem, Long> id;
+ public static volatile SingularAttribute<LineItem, SalesOrder> order;
+ public static volatile SingularAttribute<LineItem, BigDecimal> quantity;
+
+}
+
View
60 jaxrs/src/main/java/org/jboss/example/sellmore/data/Product.java
@@ -0,0 +1,60 @@
+package org.jboss.example.sellmore.data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "product")
+public class Product implements Serializable {
+ private Long id;
+ private String code;
+ private String name;
+ private BigDecimal unitPrice;
+
+ @Id @GeneratedValue
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public String getCode()
+ {
+ return code;
+ }
+
+ public void setCode(String code)
+ {
+ this.code = code;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ @Column(name = "unit_price")
+ public BigDecimal getUnitPrice()
+ {
+ return unitPrice;
+ }
+
+ public void setUnitPrice(BigDecimal unitPrice)
+ {
+ this.unitPrice = unitPrice;
+ }
+}
View
16 jaxrs/src/main/java/org/jboss/example/sellmore/data/Product_.java
@@ -0,0 +1,16 @@
+package org.jboss.example.sellmore.data;
+
+import java.math.BigDecimal;
+import javax.persistence.metamodel.SingularAttribute;
+import javax.persistence.metamodel.StaticMetamodel;
+
+@StaticMetamodel(Product.class)
+public abstract class Product_ {
+
+ public static volatile SingularAttribute<Product, Long> id;
+ public static volatile SingularAttribute<Product, String> name;
+ public static volatile SingularAttribute<Product, BigDecimal> unitPrice;
+ public static volatile SingularAttribute<Product, String> code;
+
+}
+
View
78 jaxrs/src/main/java/org/jboss/example/sellmore/data/SalesOrder.java
@@ -0,0 +1,78 @@
+package org.jboss.example.sellmore.data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.Set;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+@Entity
+@Table(name = "sales_order")
+public class SalesOrder implements Serializable {
+ private Long id;
+ private BigDecimal amount;
+ private Date created;
+ private Customer customer;
+ private Set<LineItem> lineItems;
+
+ @Id @GeneratedValue
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ public BigDecimal getAmount()
+ {
+ return amount;
+ }
+
+ public void setAmount(BigDecimal amount)
+ {
+ this.amount = amount;
+ }
+
+ @Temporal(TemporalType.DATE)
+ public Date getCreated()
+ {
+ return created;
+ }
+
+ public void setCreated(Date created)
+ {
+ this.created = created;
+ }
+
+ @ManyToOne
+ public Customer getCustomer()
+ {
+ return customer;
+ }
+
+ public void setCustomer(Customer customer)
+ {
+ this.customer = customer;
+ }
+
+ @OneToMany(mappedBy = "order")
+ public Set<LineItem> getLineItems()
+ {
+ return lineItems;
+ }
+
+ public void setLineItems(Set<LineItem> lineItems)
+ {
+ this.lineItems = lineItems;
+ }
+}
View
19 jaxrs/src/main/java/org/jboss/example/sellmore/data/SalesOrder_.java
@@ -0,0 +1,19 @@
+package org.jboss.example.sellmore.data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import javax.persistence.metamodel.SetAttribute;
+import javax.persistence.metamodel.SingularAttribute;
+import javax.persistence.metamodel.StaticMetamodel;
+
+@StaticMetamodel(SalesOrder.class)
+public abstract class SalesOrder_ {
+
+ public static volatile SingularAttribute<SalesOrder, BigDecimal> amount;
+ public static volatile SingularAttribute<SalesOrder, Long> id;
+ public static volatile SingularAttribute<SalesOrder, Date> created;
+ public static volatile SingularAttribute<SalesOrder, Customer> customer;
+ public static volatile SetAttribute<SalesOrder, LineItem> lineItems;
+
+}
+
View
42 jaxrs/src/main/java/org/jboss/example/sellmore/persistence/DataLoader.java
@@ -0,0 +1,42 @@
+package org.jboss.example.sellmore.persistence;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Date;
+import javax.annotation.PostConstruct;
+import javax.ejb.Singleton;
+import javax.ejb.Startup;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import org.jboss.example.sellmore.data.Contact;
+import org.jboss.example.sellmore.data.Customer;
+import org.jboss.example.sellmore.data.SalesOrder;
+
+//@Singleton
+//@Startup
+public class DataLoader {
+ @PersistenceContext EntityManager em;
+
+ @PostConstruct
+ @TransactionAttribute(TransactionAttributeType.REQUIRED)
+ public void load() {
+ Customer acme = new Customer("Acme Corporation");
+ em.persist(acme);
+ em.persist(new Customer("Starbucks"));
+ Contact contact = new Contact();
+ contact.setAddress("100 Broadway");
+ contact.setCity("New York");
+ contact.setPhone("212-555-1212");
+ contact.setCustomer(acme);
+ em.persist(contact);
+ SalesOrder order = new SalesOrder();
+ order.setCreated(new Date());
+ order.setAmount(new BigDecimal(100));
+ order.setCustomer(acme);
+ em.persist(order);
+ }
+}
View
19 jaxrs/src/main/java/org/jboss/example/sellmore/persistence/EntityManagerProducer.java
@@ -0,0 +1,19 @@
+package org.jboss.example.sellmore.persistence;
+
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.Disposes;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+public class EntityManagerProducer
+{
+ // NOTE cannot use producer field because Weld attempts to close EntityManager
+ // https://jira.jboss.org/jira/browse/WELD-341
+ @PersistenceContext EntityManager em;
+
+ public @Produces EntityManager retrieveEntityManager() {
+ return em;
+ }
+
+ public void disposeEntityManager(@Disposes EntityManager em) {}
+}
View
29 jaxrs/src/main/java/org/jboss/example/sellmore/query/ContactListProducer.java
@@ -0,0 +1,29 @@
+package org.jboss.example.sellmore.query;
+
+import org.jboss.example.sellmore.data.Customer;
+import org.jboss.example.sellmore.data.Contact;
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.persistence.EntityManager;
+
+@RequestScoped
+public class ContactListProducer {
+ @Inject EntityManager em;
+ @Inject @Selected Customer selectedCustomer;
+ private List<Contact> contacts;
+
+ @Produces @Named public List<Contact> getContacts() {
+ return contacts;
+ }
+
+ @PostConstruct
+ public void fetch() {
+ contacts = em.createQuery("select c from Contact c where c.customer.id = :customerId order by c.city")
+ .setParameter("customerId", selectedCustomer.getId())
+ .getResultList();
+ }
+}
View
35 jaxrs/src/main/java/org/jboss/example/sellmore/query/CustomerListProducer.java
@@ -0,0 +1,35 @@
+package org.jboss.example.sellmore.query;
+
+import org.jboss.example.sellmore.data.Customer;
+import java.util.List;
+import javax.annotation.PostConstruct;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.event.Reception;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.persistence.EntityManager;
+
+@RequestScoped
+public class CustomerListProducer
+{
+ @Inject EntityManager em;
+
+ private List<Customer> customers;
+
+ @Produces @Named
+ public List<Customer> getCustomers() {
+ return customers;
+ }
+
+ public void update(@Observes(notifyObserver = Reception.IF_EXISTS) Customer item) {
+ fetch();
+ }
+
+ @PostConstruct
+ public void fetch() {
+ customers = em.createQuery("select c from Customer c order by c.name").getResultList();
+ }
+}
View
29 jaxrs/src/main/java/org/jboss/example/sellmore/query/LineItemListProducer.java
@@ -0,0 +1,29 @@
+package org.jboss.example.sellmore.query;
+
+import org.jboss.example.sellmore.data.SalesOrder;
+import org.jboss.example.sellmore.data.LineItem;
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.persistence.EntityManager;
+
+@RequestScoped
+public class LineItemListProducer {
+ @Inject EntityManager em;
+ @Inject @Selected SalesOrder order;
+ private List<LineItem> lineItems;
+
+ @Produces @Named public List<LineItem> getLineItems() {
+ return lineItems;
+ }
+
+ @PostConstruct
+ public void fetch() {
+ lineItems = em.createQuery("select l from LineItem l where l.order.id = :orderId order by l.id")
+ .setParameter("orderId", order.getId())
+ .getResultList();
+ }
+}
View
29 jaxrs/src/main/java/org/jboss/example/sellmore/query/OrderListProducer.java
@@ -0,0 +1,29 @@
+package org.jboss.example.sellmore.query;
+
+import org.jboss.example.sellmore.data.Customer;
+import org.jboss.example.sellmore.data.SalesOrder;
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.persistence.EntityManager;
+
+@RequestScoped
+public class OrderListProducer {
+ @Inject EntityManager em;
+ @Inject @Selected Customer selectedCustomer;
+ private List<SalesOrder> orders;
+
+ @Produces @Named public List<SalesOrder> getOrders() {
+ return orders;
+ }
+
+ @PostConstruct
+ public void fetch() {
+ orders = em.createQuery("select o from SalesOrder o where o.customer.id = :customerId order by o.created")
+ .setParameter("customerId", selectedCustomer.getId())
+ .getResultList();
+ }
+}
View
10 jaxrs/src/main/java/org/jboss/example/sellmore/query/Selected.java
@@ -0,0 +1,10 @@
+package org.jboss.example.sellmore.query;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import javax.inject.Qualifier;
+
+@Qualifier
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Selected {
+}
View
48 jaxrs/src/main/java/org/jboss/example/sellmore/query/SelectedCustomerProducer.java
@@ -0,0 +1,48 @@
+package org.jboss.example.sellmore.query;
+
+import org.jboss.example.sellmore.data.Customer;
+import javax.enterprise.inject.Model;
+import javax.enterprise.inject.Produces;
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.persistence.EntityManager;
+
+@Model
+public class SelectedCustomerProducer {
+
+ @Inject EntityManager em;
+ private Long customerId;
+ private Customer customer;
+
+ public Long getCustomerId()
+ {
+ return customerId;
+ }
+
+ public void setCustomerId(Long customerId)
+ {