Skip to content

Commit

Permalink
Initial import - running errai app
Browse files Browse the repository at this point in the history
  • Loading branch information
lincolnthree committed Jun 14, 2012
0 parents commit 1ad70fc
Show file tree
Hide file tree
Showing 48 changed files with 18,833 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.classpath
.errai
.project
.settings/
target/
src/main/webapp/app/
src/main/gwt-unitCache/
166 changes: 166 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>

<artifactId>errai-ui-demo</artifactId>
<groupId>org.jboss.errai</groupId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Errai UI::Demo</name>

<properties>
<errai.version>2.1-SNAPSHOT</errai.version>
<gwt.version>2.4.0</gwt.version>
<javaee.version>3.0.1.Final</javaee.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<slf4j.version>1.5.11</slf4j.version>
</properties>

<dependencies>
<!-- Errai -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.errai</groupId>
<artifactId>errai-javaee-all</artifactId>
<version>${errai.version}</version>
</dependency>

<!-- Java EE -->
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>${javaee.version}</version>
<type>pom</type>
<scope>provided</scope>
</dependency>

</dependencies>

<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt.version}</version>
<executions>
<execution>
<goals>
<goal>resources</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<extraJvmArgs>-Xmx2048m -XX:CompileThreshold=7000 -XX:+AggressiveOpts -XX:+UseCompressedOops -XX:MaxPermSize=128M</extraJvmArgs>
<logLevel>INFO</logLevel>
<noServer>true</noServer>
<runTarget>http://localhost:8080/errai-ui-demo</runTarget>
<soyc>false</soyc>
<webappDirectory>src/main/webapp</webappDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>src/main/webapp</directory>
<includes>
<include>app/**</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>

<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<versionRange>[2.3.0,)</versionRange>
<goals>
<goal>resources</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.jboss.errai</groupId>
<artifactId>jacoco-gwt-maven-plugin</artifactId>
<versionRange>[0.0,)</versionRange>
<goals>
<goal>prepare-agent</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

<profiles>
<profile>
<id>jboss7</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<packagingExcludes>**/javax/**/*.*,**/client/local/**/*.class</packagingExcludes>
<outputFileNameMapping>@{artifactId}@-@{baseVersion}@@{dashClassifier?}@.@{extension}@</outputFileNameMapping>
<archive>
<manifestEntries>
<Dependencies>org.jboss.as.naming,org.jboss.as.server,org.jboss.msc</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.1.1.Final</version>
<extensions>false</extensions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
17 changes: 17 additions & 0 deletions src/main/java/org/jboss/errai/ui/demo/App.gwt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.6//EN"
"http://google-web-toolkit.googlecode.com/svn/releases/1.6/distro-source/core/src/gwt-module.dtd">
<module rename-to="app">

<inherits name="org.jboss.errai.common.ErraiCommon" />
<inherits name="org.jboss.errai.bus.ErraiBus" />
<inherits name="org.jboss.errai.ioc.Container" />
<inherits name="org.jboss.errai.ui.UI" />
<inherits name="org.jboss.errai.databinding.DataBinding" />
<inherits name="org.jboss.errai.enterprise.CDI" />

<!-- Testing only
-->
<set-property name="user.agent" value="safari,gecko1_8" />

</module>
35 changes: 35 additions & 0 deletions src/main/java/org/jboss/errai/ui/demo/client/local/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2009 JBoss, a division of Red Hat Hat, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.errai.ui.demo.client.local;

import javax.annotation.PostConstruct;

import org.jboss.errai.ioc.client.api.EntryPoint;

import com.google.gwt.user.client.Window;

/**
* Main application entry point.
*/
@EntryPoint
public class App
{
@PostConstruct
public void setup()
{
Window.alert("Errai is Running");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package org.jboss.errai.ui.demo.client.shared;

import org.jboss.errai.common.client.api.annotations.Portable;

/**
* A marshallable bean that's used as the event object when sending user-entered text from the client to the server.
*
* @author Jonathan Fuerth <[email protected]>
*/
@Portable
public class HelloMessage
{
private int id;
private String message;

public HelloMessage()
{}

public HelloMessage(String message)
{
this.message = message;
}

public int getId()
{
return id;
}

public void setId(int id)
{
this.id = id;
}

public String getMessage()
{
return message;
}

public void setMessage(String message)
{
this.message = message;
}
}
11 changes: 11 additions & 0 deletions src/main/java/org/jboss/errai/ui/demo/client/shared/Profile.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.jboss.errai.ui.demo.client.shared;

import org.jboss.errai.common.client.api.annotations.Portable;
import org.jboss.errai.databinding.client.api.Bindable;

@Bindable
@Portable
public class Profile
{

}
41 changes: 41 additions & 0 deletions src/main/java/org/jboss/errai/ui/demo/client/shared/Response.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package org.jboss.errai.ui.demo.client.shared;

import org.jboss.errai.common.client.api.annotations.Portable;

/**
* A marshallable bean that carries the response event from the server back to the client.
*/
@Portable
public class Response
{
private int id;
private String message;

public Response()
{}

public Response(String message)
{
this.message = message;
}

public int getId()
{
return id;
}

public void setId(int id)
{
this.id = id;
}

public String getMessage()
{
return message;
}

public void setMessage(String message)
{
this.message = message;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.jboss.errai.ui.demo.client.shared.rpc;

import org.jboss.errai.bus.server.annotations.Remote;
import org.jboss.errai.ui.demo.client.shared.Profile;

@Remote
public interface AuthenticationService
{
/**
* Sign in the current user, using the given username / password combination.
*
* @return
*/
public Profile login(String username, String password);

/**
* Log out the current user. Terminating any active sessions. If the user was not logged in, this method is a no-op.
*/
public void logout();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2009 JBoss, a division of Red Hat Hat, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.errai.ui.demo.server.bus;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Event;
import javax.enterprise.event.Observes;
import javax.inject.Inject;

import org.jboss.errai.ui.demo.client.shared.HelloMessage;
import org.jboss.errai.ui.demo.client.shared.Response;


/**
* A very simple CDI based service.
*/
@ApplicationScoped
public class MessageListener
{
@Inject
private Event<Response> responseEvent;

public void handleMessage(@Observes HelloMessage event)
{
System.out.println("Received HelloMessage from Client: " + event.getMessage());
responseEvent.fire(new Response(event.getMessage() + " @ timemillis: " + System.currentTimeMillis()));
}
}
Loading

0 comments on commit 1ad70fc

Please sign in to comment.