river-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtra...@apache.org
Subject svn commit: r1685494 - in /river/river-examples/river-examples/trunk/hello-webapp-client: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/river/ src/main/java/org/apache/river/examples/ src/main/ja...
Date Mon, 15 Jun 2015 01:48:16 GMT
Author: gtrasuk
Date: Mon Jun 15 01:48:15 2015
New Revision: 1685494

URL: http://svn.apache.org/r1685494
Log:
Webapp client does not yet work - TomEE 1.7 appears to have a problem running with security
manager enabled.  It's apparently fixed in the 2.0 development snapshot.  Need to investigate
further.

Added:
    river/river-examples/river-examples/trunk/hello-webapp-client/   (with props)
    river/river-examples/river-examples/trunk/hello-webapp-client/nb-configuration.xml
    river/river-examples/river-examples/trunk/hello-webapp-client/pom.xml
    river/river-examples/river-examples/trunk/hello-webapp-client/src/
    river/river-examples/river-examples/trunk/hello-webapp-client/src/main/
    river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/
    river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/
    river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/apache/
    river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/apache/river/
    river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/apache/river/examples/
    river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/apache/river/examples/hello/
    river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/apache/river/examples/hello/webapp/
    river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/apache/river/examples/hello/webapp/client/
    river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/apache/river/examples/hello/webapp/client/ConfigHolder.java
    river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/apache/river/examples/hello/webapp/client/HelloBean.java
    river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/
    river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/META-INF/
    river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/META-INF/context.xml
    river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/
    river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/beans.xml
    river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/hello-client.config
      - copied, changed from r1658309, river/river-examples/river-examples/trunk/home/src/main/home/hello-client.config
    river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/web.xml
    river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/index.xhtml
    river/river-examples/river-examples/trunk/hello-webapp-client/src/test/
    river/river-examples/river-examples/trunk/hello-webapp-client/src/test/java/

Propchange: river/river-examples/river-examples/trunk/hello-webapp-client/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Jun 15 01:48:15 2015
@@ -0,0 +1 @@
+target

Added: river/river-examples/river-examples/trunk/hello-webapp-client/nb-configuration.xml
URL: http://svn.apache.org/viewvc/river/river-examples/river-examples/trunk/hello-webapp-client/nb-configuration.xml?rev=1685494&view=auto
==============================================================================
--- river/river-examples/river-examples/trunk/hello-webapp-client/nb-configuration.xml (added)
+++ river/river-examples/river-examples/trunk/hello-webapp-client/nb-configuration.xml Mon
Jun 15 01:48:15 2015
@@ -0,0 +1,20 @@
+<?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-j2ee.netbeans_2e_hint_2e_j2eeVersion>1.6-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>
+        <org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>Tomcat</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
+        <org-netbeans-modules-projectapi.jsf_2e_language>Facelets</org-netbeans-modules-projectapi.jsf_2e_language>
+    </properties>
+</project-shared-configuration>

Added: river/river-examples/river-examples/trunk/hello-webapp-client/pom.xml
URL: http://svn.apache.org/viewvc/river/river-examples/river-examples/trunk/hello-webapp-client/pom.xml?rev=1685494&view=auto
==============================================================================
--- river/river-examples/river-examples/trunk/hello-webapp-client/pom.xml (added)
+++ river/river-examples/river-examples/trunk/hello-webapp-client/pom.xml Mon Jun 15 01:48:15
2015
@@ -0,0 +1,104 @@
+<?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">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>river-examples</artifactId>
+        <groupId>org.apache.river.examples</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.river.examples</groupId>
+    <artifactId>hello-webapp-client</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>war</packaging>
+
+    <name>hello-webapp-client</name>
+
+    <properties>
+        <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>javax</groupId>
+            <artifactId>javaee-web-api</artifactId>
+            <version>6.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>net.jini</groupId>
+            <artifactId>jsk-platform</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>net.jini</groupId>
+            <artifactId>jsk-lib</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>net.jini</groupId>
+            <artifactId>jsk-resources</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.river.examples</groupId>
+            <artifactId>hello-api</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.3.2</version>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                    <compilerArguments>
+                        <endorseddirs>${endorsed.dir}</endorseddirs>
+                    </compilerArguments>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                <version>2.1.1</version>
+                <configuration>
+                    <failOnMissingWebXml>false</failOnMissingWebXml>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <version>2.1</version>
+                <executions>
+                    <execution>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>copy</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${endorsed.dir}</outputDirectory>
+                            <silent>true</silent>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>javax</groupId>
+                                    <artifactId>javaee-endorsed-api</artifactId>
+                                    <version>6.0</version>
+                                    <type>jar</type>
+                                </artifactItem>
+                            </artifactItems>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+    <repositories>
+        <repository>
+            <id>unknown-jars-temp-repo</id>
+            <name>A temporary repository created by NetBeans for libraries and jars
it could not identify. Please replace the dependencies in this repository with correct ones
and delete this repository.</name>
+            <url>file:${project.basedir}/lib</url>
+        </repository>
+    </repositories>
+</project>

Added: river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/apache/river/examples/hello/webapp/client/ConfigHolder.java
URL: http://svn.apache.org/viewvc/river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/apache/river/examples/hello/webapp/client/ConfigHolder.java?rev=1685494&view=auto
==============================================================================
--- river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/apache/river/examples/hello/webapp/client/ConfigHolder.java
(added)
+++ river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/apache/river/examples/hello/webapp/client/ConfigHolder.java
Mon Jun 15 01:48:15 2015
@@ -0,0 +1,63 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.apache.river.examples.hello.webapp.client;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.enterprise.inject.Produces;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.annotation.WebListener;
+import net.jini.config.Configuration;
+import net.jini.config.ConfigurationFile;
+
+/**
+ *
+ * @author trasukg
+ */
+@WebListener
+public class ConfigHolder implements ServletContextListener {
+
+    private static Logger log = Logger.getLogger(ConfigHolder.class.getName());
+    
+    private static Configuration config;
+    
+    @Override
+    public void contextInitialized(ServletContextEvent sce) {
+        ServletContext sc = sce.getServletContext();
+        log.info("Got the servlet context in contextInitialized(...):" + sc);
+        log.info("This is " + this);
+                try {
+            // Load the configuration
+            // Create a TagDataStore that links to SDIM for GEM integration.
+                        /* Use the jini configuration to get a DiscoveryManager. */
+            log.info("servletContext=" + sc);
+            Object configResourceUrl
+                    = sc.getResource("/WEB-INF/hello-client.config");
+            String configResource = configResourceUrl.toString();
+
+            log.info("Attempting to open config at "
+                    + configResource);
+            config
+                    = new ConfigurationFile(new String[]{configResource});
+            log.info("Got configuration.");
+            // Get the LookupDiscoveryManager
+        } catch (Throwable t) {
+            log.log(Level.SEVERE, "Got a throwable on startup", t);
+        }
+
+    }
+
+    @Override
+    public void contextDestroyed(ServletContextEvent sce) {
+
+    }
+
+    @Produces Configuration getConfig() {
+        return config;
+    }
+}

Added: river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/apache/river/examples/hello/webapp/client/HelloBean.java
URL: http://svn.apache.org/viewvc/river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/apache/river/examples/hello/webapp/client/HelloBean.java?rev=1685494&view=auto
==============================================================================
--- river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/apache/river/examples/hello/webapp/client/HelloBean.java
(added)
+++ river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/apache/river/examples/hello/webapp/client/HelloBean.java
Mon Jun 15 01:48:15 2015
@@ -0,0 +1,90 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.apache.river.examples.hello.webapp.client;
+
+import java.util.Scanner;
+import java.util.logging.Logger;
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import net.jini.config.Configuration;
+import net.jini.core.entry.Entry;
+import net.jini.core.lookup.ServiceItem;
+import net.jini.core.lookup.ServiceTemplate;
+import net.jini.lookup.ServiceDiscoveryManager;
+import net.jini.security.ProxyPreparer;
+import org.apache.river.examples.hello.api.Greeter;
+
+
+/**
+ *
+ * @author trasukg
+ */
+@Named
+@RequestScoped
+public class HelloBean {
+
+    private static final Logger log = Logger.getLogger(HelloBean.class.getName());
+    private static final String MODULE=HelloBean.class.getPackage().getName();
+
+    String name;
+    String message="Default";
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    @Inject
+    private Configuration config;
+   
+    public void updateMessage() {
+        log.info("Running updateMessage()...");
+        log.info("Config is " + config);
+        try {
+            // From the config, get the ServiceDiscoveryManager
+            ServiceDiscoveryManager sdm=
+                    (ServiceDiscoveryManager) 
+                    config.getEntry(MODULE, "sdm", ServiceDiscoveryManager.class);
+            // We'll also need a proxy preparer.
+            ProxyPreparer preparer=(ProxyPreparer) config.getEntry(MODULE, 
+                    "greeterPreparer", ProxyPreparer.class);
+            // Query the sdm for Greeter services.
+            ServiceTemplate template=new ServiceTemplate(
+                    null,
+                    new Class[] { Greeter.class },
+                    new Entry[0]
+            );
+            ServiceItem[] serviceItems=sdm.lookup(template, 5, null);
+            if (serviceItems.length==0) {
+                message="We didn't find any greeter services.";
+                return;
+            }
+            // Pick a service item
+            ServiceItem chosen=serviceItems[0];
+            // Prepare the proxy.
+            Greeter greeter=(Greeter) preparer.prepareProxy(chosen.service);
+            // Make the call
+            String message=greeter.sayHello(name);
+            // Print the result
+            System.out.println("Greeter replied '" + message + "'.");
+        } catch (Throwable ex) {
+            message=ex.getMessage();
+            ex.printStackTrace();
+        }    
+    }
+}

Added: river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/META-INF/context.xml
URL: http://svn.apache.org/viewvc/river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/META-INF/context.xml?rev=1685494&view=auto
==============================================================================
--- river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/META-INF/context.xml
(added)
+++ river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/META-INF/context.xml
Mon Jun 15 01:48:15 2015
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Context antiJARLocking="true" path=""/>

Added: river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/beans.xml?rev=1685494&view=auto
==============================================================================
--- river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/beans.xml
(added)
+++ river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/beans.xml
Mon Jun 15 01:48:15 2015
@@ -0,0 +1,5 @@
+<?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>

Copied: river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/hello-client.config
(from r1658309, river/river-examples/river-examples/trunk/home/src/main/home/hello-client.config)
URL: http://svn.apache.org/viewvc/river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/hello-client.config?p2=river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/hello-client.config&p1=river/river-examples/river-examples/trunk/home/src/main/home/hello-client.config&r1=1658309&r2=1685494&rev=1685494&view=diff
==============================================================================
--- river/river-examples/river-examples/trunk/home/src/main/home/hello-client.config (original)
+++ river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/hello-client.config
Mon Jun 15 01:48:15 2015
@@ -12,7 +12,7 @@ import net.jini.lookup.ServiceDiscoveryM
 import net.jini.lookup.entry.Name;
 import net.jini.security.BasicProxyPreparer;
 
-org.apache.river.examples.hello.client {
+org.apache.river.examples.hello.webapp.client {
 	
     discoveryGroup="example-group";
 

Added: river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/web.xml?rev=1685494&view=auto
==============================================================================
--- river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/web.xml
(added)
+++ river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/web.xml
Mon Jun 15 01:48:15 2015
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="3.0" 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_3_0.xsd">
+    <context-param>
+        <param-name>javax.faces.PROJECT_STAGE</param-name>
+        <param-value>Development</param-value>
+    </context-param>
+    <servlet>
+        <servlet-name>Faces Servlet</servlet-name>
+        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>Faces Servlet</servlet-name>
+        <url-pattern>/faces/*</url-pattern>
+    </servlet-mapping>
+    <session-config>
+        <session-timeout>
+            30
+        </session-timeout>
+    </session-config>
+    <welcome-file-list>
+        <welcome-file>faces/index.xhtml</welcome-file>
+    </welcome-file-list>
+</web-app>

Added: river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/index.xhtml
URL: http://svn.apache.org/viewvc/river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/index.xhtml?rev=1685494&view=auto
==============================================================================
--- river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/index.xhtml
(added)
+++ river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/index.xhtml
Mon Jun 15 01:48:15 2015
@@ -0,0 +1,18 @@
+<?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:h="http://java.sun.com/jsf/html"
+      xmlns:f="http://java.sun.com/jsf/core">
+    <h:head>
+        <title>Facelet Title</title>
+
+    </h:head>
+    <h:body>
+        <h:form>
+            Please enter your name:<h:inputText value="#{helloBean.name}"/><br/>
+            Message is: #{helloBean.message}.
+            <h:commandButton value="Update" action="#{helloBean.updateMessage()}"/>
+        </h:form>
+    </h:body>
+</html>
+



Mime
View raw message