You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by gt...@apache.org on 2015/07/03 22:43:30 UTC
svn commit: r1689087 - in
/river/river-examples/river-examples/trunk/hello-webapp-client: lib/
src/main/java/org/apache/river/examples/hello/webapp/client/
src/main/webapp/ src/main/webapp/WEB-INF/
Author: gtrasuk
Date: Fri Jul 3 20:43:30 2015
New Revision: 1689087
URL: http://svn.apache.org/r1689087
Log:
hello-webapp-client application and documentation are complete.
Added:
river/river-examples/river-examples/trunk/hello-webapp-client/lib/
river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/client.config
- copied, changed from r1685494, river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/hello-client.config
Removed:
river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/hello-client.config
Modified:
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/index.xhtml
Modified: 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=1689087&r1=1689086&r2=1689087&view=diff
==============================================================================
--- river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/apache/river/examples/hello/webapp/client/ConfigHolder.java (original)
+++ river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/apache/river/examples/hello/webapp/client/ConfigHolder.java Fri Jul 3 20:43:30 2015
@@ -1,8 +1,21 @@
/*
- * 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.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.river.examples.hello.webapp.client;
import java.util.logging.Level;
@@ -14,10 +27,12 @@ import javax.servlet.ServletContextListe
import javax.servlet.annotation.WebListener;
import net.jini.config.Configuration;
import net.jini.config.ConfigurationFile;
+import net.jini.lookup.ServiceDiscoveryManager;
/**
- *
- * @author trasukg
+ * This class acts as a ServletContextListener to load the configuration on
+ * startup of the application, and then acts as a CDI resource provider to allow
+ * automatic injection of the Configuration to any other CDI components.
*/
@WebListener
public class ConfigHolder implements ServletContextListener {
@@ -31,13 +46,11 @@ public class ConfigHolder implements Ser
ServletContext sc = sce.getServletContext();
log.info("Got the servlet context in contextInitialized(...):" + sc);
log.info("This is " + this);
- try {
+ 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");
+ = sc.getResource("/WEB-INF/client.config");
String configResource = configResourceUrl.toString();
log.info("Attempting to open config at "
@@ -45,7 +58,11 @@ public class ConfigHolder implements Ser
config
= new ConfigurationFile(new String[]{configResource});
log.info("Got configuration.");
- // Get the LookupDiscoveryManager
+ /* Get the ServiceDiscoveryManager. This call effectively causes discovery to
+ begin at application startup.
+ */
+ config.getEntry(this.getClass().getPackage().getName(),
+ "sdm", ServiceDiscoveryManager.class);
} catch (Throwable t) {
log.log(Level.SEVERE, "Got a throwable on startup", t);
}
Modified: 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=1689087&r1=1689086&r2=1689087&view=diff
==============================================================================
--- river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/apache/river/examples/hello/webapp/client/HelloBean.java (original)
+++ river/river-examples/river-examples/trunk/hello-webapp-client/src/main/java/org/apache/river/examples/hello/webapp/client/HelloBean.java Fri Jul 3 20:43:30 2015
@@ -1,8 +1,21 @@
/*
- * 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.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.river.examples.hello.webapp.client;
import java.util.Scanner;
@@ -20,8 +33,7 @@ import org.apache.river.examples.hello.a
/**
- *
- * @author trasukg
+ * A Managed Bean that uses a Jini Service.
*/
@Named
@RequestScoped
@@ -79,9 +91,7 @@ public class HelloBean {
// 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 + "'.");
+ message=greeter.sayHello(name);
} catch (Throwable ex) {
message=ex.getMessage();
ex.printStackTrace();
Copied: river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/client.config (from r1685494, river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/hello-client.config)
URL: http://svn.apache.org/viewvc/river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/client.config?p2=river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/client.config&p1=river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/hello-client.config&r1=1685494&r2=1689087&rev=1689087&view=diff
==============================================================================
--- river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/hello-client.config (original)
+++ river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/WEB-INF/client.config Fri Jul 3 20:43:30 2015
@@ -22,10 +22,12 @@ org.apache.river.examples.hello.webapp.c
new BasicILFactory());
serviceInvocationConstraints=InvocationConstraints.EMPTY;
-
+
+ permissionsToGrant=new Permission[] { new RuntimePermission("accessClassInPackage.com.sun.proxy") };
+
basicPreparer =
new BasicProxyPreparer(false, new BasicMethodConstraints(serviceInvocationConstraints),
- new Permission[] { new RuntimePermission("accessClassInPackage.com.sun.proxy") } );
+ null);
static discoveryManager =
new LookupDiscovery( groups, this);
Modified: 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=1689087&r1=1689086&r2=1689087&view=diff
==============================================================================
--- river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/index.xhtml (original)
+++ river/river-examples/river-examples/trunk/hello-webapp-client/src/main/webapp/index.xhtml Fri Jul 3 20:43:30 2015
@@ -1,11 +1,29 @@
<?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">
+<!--
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+-->
<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>
-
+ <title>Hello WebApp Client</title>
</h:head>
<h:body>
<h:form>