Author: ilya_shaikovsky
Date: 2011-01-27 06:00:20 -0500 (Thu, 27 Jan 2011)
New Revision: 21264
Added:
sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
Modified:
sandbox/trunk/examples/irc-client/pom.xml
sandbox/trunk/examples/irc-client/src/main/java/org/ircclient/controller/ChatBean.java
sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/faces-config.xml
sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/web.xml
sandbox/trunk/examples/irc-client/src/main/webapp/welcome.xhtml
Log:
IRC-Client ready in draft
Modified: sandbox/trunk/examples/irc-client/pom.xml
===================================================================
--- sandbox/trunk/examples/irc-client/pom.xml 2011-01-27 10:56:14 UTC (rev 21263)
+++ sandbox/trunk/examples/irc-client/pom.xml 2011-01-27 11:00:20 UTC (rev 21264)
@@ -1,158 +1,135 @@
<?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/xsd/maven-4.0.0.xsd">
+
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>
+ <modelVersion>4.0.0</modelVersion>
- <groupId>org.demo</groupId>
- <artifactId>irc-client</artifactId>
- <name>irc-client</name>
- <version>1.0-SNAPSHOT</version>
- <packaging>war</packaging>
+ <groupId>org.demo</groupId>
+ <artifactId>irc-client</artifactId>
+ <name>irc-client</name>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>war</packaging>
- <
url>http://jboss.org/richfaces</url>
+ <
url>http://jboss.org/richfaces</url>
- <repositories>
- <repository>
- <id>jboss-public-repository-group</id>
- <name>Jboss Repository for Maven</name>
-
<
url>https://repository.jboss.org/nexus/content/groups/public/</url>
- </repository>
- <repository>
- <id>java-net</id>
- <
name>Java.net Maven Repository</name>
- <
url>http://download.java.net/maven/2</url>
- </repository>
- </repositories>
+ <repositories>
+ <repository>
+ <id>jboss-public-repository-group</id>
+ <name>Jboss Repository for Maven</name>
+ <
url>https://repository.jboss.org/nexus/content/groups/public/</url>
+ </repository>
+ <repository>
+ <id>java-net</id>
+ <
name>Java.net Maven Repository</name>
+ <
url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <hornetq.version>2.1.2.Final</hornetq.version>
-
<org.richfaces.bom.version>4.0.0-SNAPSHOT</org.richfaces.bom.version>
- </properties>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <hornetq.version>2.1.2.Final</hornetq.version>
+ <org.richfaces.bom.version>4.0.0-SNAPSHOT</org.richfaces.bom.version>
+ </properties>
- <build>
- <finalName>irc-client-${project.version}</finalName>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <webResources>
- <resource>
- <directory>${basedir}/src/main/java</directory>
- <targetPath>/WEB-INF/src</targetPath>
- </resource>
- </webResources>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <build>
+ <finalName>irc-client-${project.version}</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webResources>
+ <resource>
+ <directory>${basedir}/src/main/java</directory>
+ <targetPath>/WEB-INF/src</targetPath>
+ </resource>
+ </webResources>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.richfaces</groupId>
- <artifactId>richfaces-bom</artifactId>
- <version>${org.richfaces.bom.version}</version>
- <scope>import</scope>
- <type>pom</type>
- </dependency>
- </dependencies>
- </dependencyManagement>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-bom</artifactId>
+ <version>${org.richfaces.bom.version}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.richfaces.ui</groupId>
- <artifactId>richfaces-components-ui</artifactId>
- </dependency>
- <dependency>
- <groupId>org.richfaces.ui</groupId>
- <artifactId>richfaces-components-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.richfaces.core</groupId>
- <artifactId>richfaces-core-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-api</artifactId>
- </dependency>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet.jsp</groupId>
- <artifactId>jsp-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>jstl</artifactId>
- </dependency>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-components-ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-components-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ </dependency>
- <dependency>
- <groupId>net.sf.ehcache</groupId>
- <artifactId>ehcache</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hornetq</groupId>
- <artifactId>hornetq-core</artifactId>
- <version>${hornetq.version}</version>
- </dependency>
- <dependency>
- <groupId>org.hornetq</groupId>
- <artifactId>hornetq-jms</artifactId>
- <version>${hornetq.version}</version>
- </dependency>
- <dependency>
- <groupId>org.hornetq</groupId>
- <artifactId>hornetq-logging</artifactId>
- <version>${hornetq.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.netty</groupId>
- <artifactId>netty</artifactId>
- <version>3.2.2.Final</version>
- </dependency>
- <dependency>
- <groupId>javax.jms</groupId>
- <artifactId>jms</artifactId>
- <version>1.1</version>
- </dependency>
- <dependency>
- <groupId>org.atmosphere</groupId>
- <artifactId>atmosphere-runtime</artifactId>
- </dependency>
<dependency>
- <groupId>pircbot</groupId>
- <artifactId>pircbot</artifactId>
- <version>1.4.2</version>
- </dependency>
- <!-- Tests -->
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <version>5.10</version>
- <classifier>jdk15</classifier>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <groupId>net.sf.ehcache</groupId>
+ <artifactId>ehcache</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.atmosphere</groupId>
+ <artifactId>atmosphere-runtime</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>pircbot</groupId>
+ <artifactId>pircbot</artifactId>
+ <version>1.4.2</version>
+ </dependency>
+ <!-- Tests -->
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.10</version>
+ <classifier>jdk15</classifier>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
Modified:
sandbox/trunk/examples/irc-client/src/main/java/org/ircclient/controller/ChatBean.java
===================================================================
---
sandbox/trunk/examples/irc-client/src/main/java/org/ircclient/controller/ChatBean.java 2011-01-27
10:56:14 UTC (rev 21263)
+++
sandbox/trunk/examples/irc-client/src/main/java/org/ircclient/controller/ChatBean.java 2011-01-27
11:00:20 UTC (rev 21264)
@@ -29,7 +29,8 @@
private static final String SERVER_URL = "irc.freenode.org";
private static final int SERVER_PORT = 6667;
private static final String CHANNEL_PREFIX = "#";
- private static final String DEFAULT_CHANNEL = "richfaces_push";
+ private static final String SUBTOPIC_SEPARATOR = "_";
+ private static final String DEFAULT_CHANNEL = "richfaces";
private static final Logger LOGGER = LogFactory.getLogger(ChatBean.class);
private String channelName;
@@ -60,22 +61,22 @@
}
}
- public void leave(){
+ public void leave() {
this.disconnect();
}
-
+
private TopicsContext getTopicsContext() {
- if (topicsContext == null){
+ if (topicsContext == null) {
topicsContext = TopicsContext.lookup();
}
return topicsContext;
}
-
+
@Override
protected void onMessage(String channel, String sender, String login, String
hostname, String message) {
String channelName = channel.replace(CHANNEL_PREFIX, "");
try {
- getTopicsContext().publish(new TopicKey("chat", channelName),
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName),
MessageFormat.format("{0,time,medium} {1}: {2}", new Date(),
sender, message));
} catch (MessageException e) {
LOGGER.error(e.getMessage(), e);
@@ -85,7 +86,7 @@
@Override
protected void onUserList(String channel, User[] users) {
try {
- getTopicsContext().publish(new TopicKey("chat", channelName +
"List"), null);
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName + "List"), null);
} catch (MessageException e) {
LOGGER.error(e.getMessage(), e);
}
@@ -94,8 +95,8 @@
@Override
protected void onJoin(String channel, String sender, String login, String hostname)
{
try {
- getTopicsContext().publish(new TopicKey("chat", channelName +
"List"), null);
- getTopicsContext().publish(new TopicKey("chat", channelName),
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName + "List"), null);
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName),
MessageFormat.format("{0,time,medium} {1}: {2}", new Date(),
sender, "joined channel"));
} catch (MessageException e) {
LOGGER.error(e.getMessage(), e);
@@ -105,30 +106,30 @@
@Override
protected void onPart(String channel, String sender, String login, String hostname)
{
try {
- getTopicsContext().publish(new TopicKey("chat", channelName +
"List"), null);
- getTopicsContext().publish(new TopicKey("chat", channelName),
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName + "List"), null);
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName),
MessageFormat.format("{0,time,medium} {1}: {2}", new Date(),
sender, "left channel"));
} catch (MessageException e) {
LOGGER.error(e.getMessage(), e);
}
}
-
+
@Override
protected void onNickChange(String oldNick, String login, String hostname, String
newNick) {
try {
- getTopicsContext().publish(new TopicKey("chat", channelName +
"List"), null);
- getTopicsContext().publish(new TopicKey("chat", channelName),
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName + "List"), null);
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName),
MessageFormat.format("{0,time,medium} {1}", new Date(), oldNick
+ " changed nick to " + newNick));
} catch (MessageException e) {
LOGGER.error(e.getMessage(), e);
}
}
-
+
@Override
protected void onQuit(String sourceNick, String sourceLogin, String sourceHostname,
String reason) {
try {
- getTopicsContext().publish(new TopicKey("chat", channelName +
"List"), null);
- getTopicsContext().publish(new TopicKey("chat", channelName),
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName + "List"), null);
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName),
MessageFormat.format("{0,time,medium} {1}: {2} {3}", new
Date(), sourceNick, "joined channel", reason));
} catch (MessageException e) {
LOGGER.error(e.getMessage(), e);
@@ -142,13 +143,13 @@
public void send() {
this.sendMessage(CHANNEL_PREFIX + channelName, message);
try {
- getTopicsContext().publish(new TopicKey("chat", channelName),
+ getTopicsContext().publish(new TopicKey("chat", this.getUserName()
+ SUBTOPIC_SEPARATOR + channelName),
MessageFormat.format("{0,time,medium} {1}: {2}", new Date(),
this.getName(), message));
} catch (MessageException e) {
LOGGER.error(e.getMessage(), e);
}
}
-
+
public void changeNick(ValueChangeEvent event) {
this.changeNick((String) event.getNewValue());
}
Added: sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
===================================================================
--- sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
(rev 0)
+++
sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia 2011-01-27
11:00:20 UTC (rev 21264)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<PROCESS model-entity="JSFProcess"/>
Modified: sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/faces-config.xml 2011-01-27
10:56:14 UTC (rev 21263)
+++ sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/faces-config.xml 2011-01-27
11:00:20 UTC (rev 21264)
@@ -5,12 +5,9 @@
<application>
<system-event-listener>
- <system-event-listener-class>org.ircclient.listeners.HornetQInitializer</system-event-listener-class>
- <system-event-class>javax.faces.event.PostConstructApplicationEvent</system-event-class>
- </system-event-listener>
- <system-event-listener>
<system-event-listener-class>org.ircclient.listeners.TopicsInitializer</system-event-listener-class>
<system-event-class>javax.faces.event.PostConstructApplicationEvent</system-event-class>
</system-event-listener>
</application>
+
</faces-config>
Modified: sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/web.xml
===================================================================
--- sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/web.xml 2011-01-27 10:56:14
UTC (rev 21263)
+++ sandbox/trunk/examples/irc-client/src/main/webapp/WEB-INF/web.xml 2011-01-27 11:00:20
UTC (rev 21264)
@@ -16,6 +16,14 @@
<param-name>org.richfaces.skin</param-name>
<param-value>#{skinBean.skin}</param-value>
</context-param>
+ <context-param>
+ <param-name>org.richfaces.push.jms.connectionUsername</param-name>
+ <param-value>guest</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.push.jms.connectionPassword</param-name>
+ <param-value>guest</param-value>
+ </context-param>
<filter>
<filter-name>PushFilter</filter-name>
<filter-class>org.richfaces.webapp.PushFilter</filter-class>
Modified: sandbox/trunk/examples/irc-client/src/main/webapp/welcome.xhtml
===================================================================
--- sandbox/trunk/examples/irc-client/src/main/webapp/welcome.xhtml 2011-01-27 10:56:14
UTC (rev 21263)
+++ sandbox/trunk/examples/irc-client/src/main/webapp/welcome.xhtml 2011-01-27 11:00:20
UTC (rev 21264)
@@ -55,11 +55,11 @@
<br clear="all" />
<hr />
<h:form>
- <a4j:push address="#{chatBean.channelName}List@chat"
+ <a4j:push
address="#{chatBean.userName}_#{chatBean.channelName}List@chat"
onerror="alert(event.rf.data)">
<a4j:ajax event="dataavailable" render="users"
execute="@none" />
</a4j:push>
- <a4j:push address="#{chatBean.channelName}@chat"
+ <a4j:push address="#{chatBean.userName}_#{chatBean.channelName}@chat"
onerror="alert(event.rf.data)"
ondataavailable="jQuery('<div
/>').prependTo('.#{chatBean.channelName}Output').text(event.rf.data)"
/>
<h:inputTextarea value="#{chatBean.message}" rows="3"