Permalink
Browse files

Import the project

  • Loading branch information...
0 parents commit af80f59ac15bdc906bc28498a315b90ee121429e Jeremy committed Jul 10, 2012
@@ -0,0 +1,62 @@
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.stackato</groupId>
+ <artifactId>stackato</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>war</packaging>
+
+
+
+ <dependencies>
+ <dependency>
+ <groupId>javax</groupId>
+ <artifactId>javaee-web-api</artifactId>
+ <scope>provided</scope>
+ <version>6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.argo</groupId>
+ <artifactId>argo</artifactId>
+ <version>2.23</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.ext.openejb</groupId>
+ <artifactId>openejb-api</artifactId>
+ <scope>provided</scope>
+ <version>3.1.3.0</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>hello</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+ <repositories>
+ <repository>
+ <id>java.net</id>
+ <url>http://download.java.net/maven/glassfish</url>
+ </repository>
+ <repository>
+ <id>repository.jboss.org-public</id>
+ <name>JBoss repository</name>
+ <url>https://repository.jboss.org/nexus/content/groups/public</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>maven2.java.net</id>
+ <url>http://download.java.net/maven/glassfish</url>
+ </pluginRepository>
+ </pluginRepositories>
+</project>
+
@@ -0,0 +1,32 @@
+package org.stackato;
+
+import java.io.Serializable;
+
+import javax.ejb.EJB;
+import javax.enterprise.context.SessionScoped;
+import javax.faces.bean.ManagedBean;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named
+@SessionScoped
+public class Example implements Serializable {
+
+ @Inject
+ private InjectionExample ie;
+
+ private String name = "Coucou";
+
+ public Example(){
+// name = ie.getProperties();
+
+ }
+
+ public String getName() {
+ return ie.getProperties();
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
@@ -0,0 +1,54 @@
+package org.stackato;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+@Stateless
+public class InjectionExample implements Serializable {
+
+ private String properties;
+
+ @PersistenceContext
+ private EntityManager em;
+
+ @PostConstruct
+ public void initialize() {
+ if (em == null) {
+ properties = "No Entity Manager!";
+ return;
+ }
+ if (em.getProperties() == null) {
+ properties = "No properties!";
+ return;
+ }
+ if (em.getProperties().values() == null) {
+ properties = "No properties!";
+ return;
+ }
+
+ String version = (String) em.createNativeQuery("SELECT VERSION();")
+ .getResultList().get(0);
+ String database = (String) em.createNativeQuery("SELECT DATABASE();")
+ .getResultList().get(0);
+ String user = (String) em.createNativeQuery("SELECT CURRENT_USER();")
+ .getResultList().get(0);
+
+ properties = "You are connected on the database \"" + database
+ + "\" as the user \""+user+"\" (Mysql version: " + version + ")";
+
+ }
+
+ public String getProperties() {
+ return properties;
+ }
+
+ public void setProperties(String properties) {
+ this.properties = properties;
+ }
+
+}
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence version="2.0"
+ xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
+ <persistence-unit name="catalog" />
+</persistence>
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+
+
+</beans>
@@ -0,0 +1,33 @@
+<web-app version="2.5"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" metadata-complete="false">
+
+ <display-name>
+ Java EE Example
+ </display-name>
+
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <!-- Map these files with JSF -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.faces</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.xhtml</url-pattern>
+ </servlet-mapping>
+
+</web-app>
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+<h:head>
+ <title>JSF 2.0 Hello World</title>
+</h:head>
+<h:body>
+ <h3>JSF 2.0 Hello World Example - hello.xhtml</h3>
+ <h:form>
+ <h:outputText value="#{example.name}"></h:outputText>
+ </h:form>
+</h:body>
+</html>
@@ -0,0 +1,5 @@
+<html>
+<head>
+ <meta http-equiv="Refresh" content="0; URL=home.xhtml">
+</head>
+</html>
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence version="2.0"
+ xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
+ <persistence-unit name="example" transaction-type="JTA">
+ </persistence-unit>
+</persistence>

0 comments on commit af80f59

Please sign in to comment.