Author: antelder
Date: Fri Feb 27 08:35:01 2009
New Revision: 748427

URL: http://svn.apache.org/viewvc?rev=748427&view=rev
Log:
Start of a helloworld sample showing SCA integration with the Wicket web 
framework

Added:
    tuscany/java/sca/samples/webapps/helloworld-wicket/   (with props)
    tuscany/java/sca/samples/webapps/helloworld-wicket/pom.xml
    tuscany/java/sca/samples/webapps/helloworld-wicket/src/
    tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/
    tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/
    tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/
    
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/HelloworldService.java
    
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/HelloworldServiceImpl.java
    
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/
    
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/HomePage.html
    
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/HomePage.java
    
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/IMyService.java
    
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/MyService.java
    
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/WicketApplication.java
    tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/resources/
    
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/resources/log4j.properties
    tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/webapp/
    tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/webapp/WEB-INF/
    
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/webapp/WEB-INF/web.composite
    
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/webapp/WEB-INF/web.xml

Propchange: tuscany/java/sca/samples/webapps/helloworld-wicket/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Feb 27 08:35:01 2009
@@ -0,0 +1,20 @@
+target
+work
+dojo
+*.iws
+*.ipr
+*.iml
+derby.log
+maven.log
+maven-eclipse.xml
+build.xml
+build-dependency.xml
+velocity.log*
+junit*.properties
+surefire*.properties
+.project
+.classpath
+.settings
+.deployables
+.wtpmodules
+.externalToolBuilders

Added: tuscany/java/sca/samples/webapps/helloworld-wicket/pom.xml
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/samples/webapps/helloworld-wicket/pom.xml?rev=748427&view=auto
==============================================================================
--- tuscany/java/sca/samples/webapps/helloworld-wicket/pom.xml (added)
+++ tuscany/java/sca/samples/webapps/helloworld-wicket/pom.xml Fri Feb 27 
08:35:01 2009
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-sca</artifactId>
+        <version>2.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>helloworld-wicket</artifactId>
+    <packaging>war</packaging>
+    <name>Apache Tuscany SCA Helloworld Sample using Wicket</name>
+
+    <dependencies>
+
+        <!--  Tuscany dependencies -->
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-sca-api</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-wicket</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
+
+        <!--  Wicket dependencies -->
+        <dependency>
+            <groupId>org.apache.wicket</groupId>
+            <artifactId>wicket</artifactId>
+            <version>1.4-rc2</version>
+         </dependency>
+         <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <version>1.4.2</version>
+         </dependency>
+         <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <version>1.2.14</version>
+         </dependency>
+
+    </dependencies>
+
+    <build>
+       <finalName>${artifactId}</finalName>
+    </build>
+
+</project>

Added: 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/HelloworldService.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/HelloworldService.java?rev=748427&view=auto
==============================================================================
--- 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/HelloworldService.java
 (added)
+++ 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/HelloworldService.java
 Fri Feb 27 08:35:01 2009
@@ -0,0 +1,25 @@
+/*
+ * 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 sample;
+
+public interface HelloworldService {
+
+    String sayHello(String name);
+
+}

Added: 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/HelloworldServiceImpl.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/HelloworldServiceImpl.java?rev=748427&view=auto
==============================================================================
--- 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/HelloworldServiceImpl.java
 (added)
+++ 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/HelloworldServiceImpl.java
 Fri Feb 27 08:35:01 2009
@@ -0,0 +1,28 @@
+/*
+ * 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 sample;
+
+
+public class HelloworldServiceImpl implements HelloworldService {
+
+    public String sayHello(String name) {
+        return "Hello " + name;
+    }
+
+}

Added: 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/HomePage.html
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/HomePage.html?rev=748427&view=auto
==============================================================================
--- 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/HomePage.html
 (added)
+++ 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/HomePage.html
 Fri Feb 27 08:35:01 2009
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<html xmlns="http://www.w3.org/1999/xhtml"; >
+<head>
+    <title>Wicket Examples - guice</title>
+    <link rel="stylesheet" type="text/css" href="style.css"/>
+</head>
+<body>
+    <p>
+    This page uses <a href="http://code.google.com/p/google-guice/";>Google 
Guice</a>.
+    There is a service interface called <code>IMyService</code>, with an 
implementation POJO called <code>MyService</code>.
+    Guice is used to wire the implementation into the <code>Page</code> using 
an <code>@Inject</code> annotation. You can use this
+    annotation on the fields of any <code>Component</code> subclass.    
+    </p>
+    <p>
+    The value of the <code>Label</code> component below will be updated with 
the return value from one of the service's methods when you click the link.
+    </p>
+    <hr />
+    <blockquote>
+    Value: <b wicket:id="message" id="message">Message goes here</b>
+    <br />
+    To update the label above, <a href="#" wicket:id="link">click here</a>.
+    </blockquote>
+    <hr />
+    <p>
+    The wicket-guice project will take care of proxying the injected beans so 
that your pages can be serialized safely.
+    To configure your application for Guice injection, see the javadoc for 
<code>GuiceComponentInjector</code>.
+    </p>
+    
+</body>
+</html>
\ No newline at end of file

Added: 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/HomePage.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/HomePage.java?rev=748427&view=auto
==============================================================================
--- 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/HomePage.java
 (added)
+++ 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/HomePage.java
 Fri Feb 27 08:35:01 2009
@@ -0,0 +1,48 @@
+package sample.wicket;
+
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.model.AbstractReadOnlyModel;
+import org.oasisopen.sca.annotation.Reference;
+
+/**
+ * Everybody's favorite example (Hello World), modified to use Guice.
+ * 
+ * @author Alastair Maw
+ */
+public class HomePage extends WebPage
+{
+    @Reference
+    IMyService service;
+
+    private String labelValue = "<not yet initialized>";
+
+    /**
+     * Constructor
+     */
+    public HomePage()
+    {
+        add(new Link("link")
+        {
+            /**
+             * @see org.apache.wicket.markup.html.link.Link#onClick()
+             */
+            @Override
+            public void onClick()
+            {
+                labelValue = service.getHelloWorldText();
+            }
+        });
+        add(new Label("message", new AbstractReadOnlyModel<String>()
+        {
+
+            @Override
+            public String getObject()
+            {
+                return labelValue;
+            }
+
+        }));
+    }
+}
\ No newline at end of file

Added: 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/IMyService.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/IMyService.java?rev=748427&view=auto
==============================================================================
--- 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/IMyService.java
 (added)
+++ 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/IMyService.java
 Fri Feb 27 08:35:01 2009
@@ -0,0 +1,17 @@
+package sample.wicket;
+
+
+/**
+ * Service interface for a simple "Hello World" app.
+ * 
+ * @author Alastair Maw
+ */
+public interface IMyService
+{
+    /**
+     * Retrieves the text to say "Hello World".
+     * 
+     * @return "Hello World"
+     */
+    public String getHelloWorldText();
+}
\ No newline at end of file

Added: 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/MyService.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/MyService.java?rev=748427&view=auto
==============================================================================
--- 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/MyService.java
 (added)
+++ 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/MyService.java
 Fri Feb 27 08:35:01 2009
@@ -0,0 +1,20 @@
+package sample.wicket;
+
+
+/**
+ * Implementation of IService.
+ * 
+ * @author Alastair Maw
+ */
+public class MyService implements IMyService
+{
+
+    /**
+     * @see 
org.apache.wicket.examples.guice.service.IMyService#getHelloWorldText()
+     */
+    public String getHelloWorldText()
+    {
+        return "Hello World";
+    }
+
+}
\ No newline at end of file

Added: 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/WicketApplication.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/WicketApplication.java?rev=748427&view=auto
==============================================================================
--- 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/WicketApplication.java
 (added)
+++ 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/WicketApplication.java
 Fri Feb 27 08:35:01 2009
@@ -0,0 +1,29 @@
+package sample.wicket;
+
+import org.apache.wicket.Page;
+import org.apache.tuscany.sca.wicket.TuscanyInjector;
+import org.apache.wicket.protocol.http.WebApplication;
+
+/**
+ * Application object for your web application. If you want to run this 
application without deploying, run the Start class.
+ * 
+ * @see com.mycompany.Start#main(String[])
+ */
+public class WicketApplication extends WebApplication
+{    
+
+    @Override
+    protected void init()
+    {
+        addComponentInstantiationListener(new TuscanyInjector(this));
+    }
+
+    /**
+     * @see org.apache.wicket.Application#getHomePage()
+     */
+    @Override
+    public Class< ? extends Page> getHomePage()
+    {
+        return HomePage.class;
+    }
+}
\ No newline at end of file

Added: 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/resources/log4j.properties
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/resources/log4j.properties?rev=748427&view=auto
==============================================================================
--- 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/resources/log4j.properties
 (added)
+++ 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/resources/log4j.properties
 Fri Feb 27 08:35:01 2009
@@ -0,0 +1,12 @@
+log4j.appender.Stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.Stdout.layout.conversionPattern=%-5p - %-26.26c{1} - %m\n
+
+log4j.rootLogger=INFO,Stdout
+
+log4j.logger.org.apache.wicket=INFO
+log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO
+log4j.logger.org.apache.wicket.version=INFO
+log4j.logger.org.apache.wicket.RequestCycle=INFO
+
+

Added: 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/webapp/WEB-INF/web.composite
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/webapp/WEB-INF/web.composite?rev=748427&view=auto
==============================================================================
--- 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/webapp/WEB-INF/web.composite
 (added)
+++ 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/webapp/WEB-INF/web.composite
 Fri Feb 27 08:35:01 2009
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
+           xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0";
+           targetNamespace="http://samples";
+           name="Helloworld">
+
+    <component name="foo">
+        <implementation.web web-uri=""/>
+        <reference name="service" target="HelloworldComponent"/>
+    </component>
+
+    <component name="HelloworldComponent">
+        <implementation.java class="sample.HelloworldServiceImpl"/>
+    </component>
+
+</composite>

Added: 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/webapp/WEB-INF/web.xml
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/webapp/WEB-INF/web.xml?rev=748427&view=auto
==============================================================================
--- 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/webapp/WEB-INF/web.xml
 (added)
+++ 
tuscany/java/sca/samples/webapps/helloworld-wicket/src/main/webapp/WEB-INF/web.xml
 Fri Feb 27 08:35:01 2009
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+       <!--
+               * 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.
+       -->
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
+
+       <display-name>Apache Tuscany Helloworld Wicket Sample</display-name>
+
+       <listener>
+               
<listener-class>org.apache.tuscany.sca.host.webapp.TuscanyContextListener</listener-class>
+       </listener>
+
+        <!--  
+             There are three means to configure Wickets configuration mode and 
they are
+             tested in the order given. 
+             1) A system property: -Dwicket.configuration
+             2) servlet specific <init-param>
+             3) context specific <context-param>
+             The value might be either "development" (reloading when templates 
change)
+             or "deployment". If no configuration is found, "development" is 
the default.
+      -->
+
+       <filter>
+               <filter-name>wicket.tuscany</filter-name>
+               
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
+               <init-param>
+                       <param-name>applicationClassName</param-name>
+                       
<param-value>sample.wicket.WicketApplication</param-value>
+               </init-param>
+       </filter>
+
+      <filter-mapping>
+         <filter-name>wicket.tuscany</filter-name>
+          <url-pattern>/*</url-pattern>
+      </filter-mapping>
+
+</web-app>


Reply via email to