From 24d6f4068c4a87bb58b23e9d78f66d765ff4ded3 Mon Sep 17 00:00:00 2001 From: antelder Date: Thu, 9 Apr 2009 15:34:36 +0000 Subject: Tag 2.0 M2 release git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@763703 13f79535-47bb-0310-9956-ffa450edef68 --- .../samples/webapps/helloworld-wicket/pom.xml | 76 ++++++++++++++++++++++ .../src/main/java/sample/HelloworldService.java | 25 +++++++ .../main/java/sample/HelloworldServiceImpl.java | 28 ++++++++ .../src/main/java/sample/wicket/HomePage.html | 48 ++++++++++++++ .../src/main/java/sample/wicket/HomePage.java | 66 +++++++++++++++++++ .../src/main/java/sample/wicket/IMyService.java | 35 ++++++++++ .../src/main/java/sample/wicket/MyService.java | 38 +++++++++++ .../main/java/sample/wicket/WicketApplication.java | 47 +++++++++++++ .../src/main/resources/log4j.properties | 29 +++++++++ .../src/main/webapp/WEB-INF/web.composite | 34 ++++++++++ .../src/main/webapp/WEB-INF/web.xml | 50 ++++++++++++++ 11 files changed, 476 insertions(+) create mode 100644 tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/pom.xml create mode 100644 tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/HelloworldService.java create mode 100644 tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/HelloworldServiceImpl.java create mode 100644 tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/HomePage.html create mode 100644 tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/HomePage.java create mode 100644 tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/IMyService.java create mode 100644 tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/MyService.java create mode 100644 tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/WicketApplication.java create mode 100644 tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/resources/log4j.properties create mode 100644 tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/webapp/WEB-INF/web.composite create mode 100644 tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/webapp/WEB-INF/web.xml (limited to 'tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket') diff --git a/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/pom.xml b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/pom.xml new file mode 100644 index 0000000000..42a817123e --- /dev/null +++ b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/pom.xml @@ -0,0 +1,76 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-M2 + ../../pom.xml + + + helloworld-wicket + war + Apache Tuscany SCA Sample Helloworld using Wicket + + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M2 + + + org.apache.tuscany.sca + tuscany-wicket + 2.0-M2 + + + javax.servlet + servlet-api + 2.5 + provided + + + + + org.apache.wicket + wicket + 1.4-rc2 + + + org.slf4j + slf4j-log4j12 + 1.4.2 + + + log4j + log4j + 1.2.14 + + + + + + ${artifactId} + + + diff --git a/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/HelloworldService.java b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/HelloworldService.java new file mode 100644 index 0000000000..123774b936 --- /dev/null +++ b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/HelloworldService.java @@ -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); + +} diff --git a/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/HelloworldServiceImpl.java b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/HelloworldServiceImpl.java new file mode 100644 index 0000000000..66cef71a25 --- /dev/null +++ b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/HelloworldServiceImpl.java @@ -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; + } + +} diff --git a/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/HomePage.html b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/HomePage.html new file mode 100644 index 0000000000..61eb207e23 --- /dev/null +++ b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/HomePage.html @@ -0,0 +1,48 @@ + + + + + Wicket Examples - guice + + + +

+ This page uses Google Guice. + There is a service interface called IMyService, with an implementation POJO called MyService. + Guice is used to wire the implementation into the Page using an @Inject annotation. You can use this + annotation on the fields of any Component subclass. +

+

+ The value of the Label component below will be updated with the return value from one of the service's methods when you click the link. +

+
+
+ Value: Message goes here +
+ To update the label above, click here. +
+
+

+ 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 GuiceComponentInjector. +

+ + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/HomePage.java b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/HomePage.java new file mode 100644 index 0000000000..89b8d7eba4 --- /dev/null +++ b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/HomePage.java @@ -0,0 +1,66 @@ +/* + * 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.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 = ""; + + /** + * 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() + { + + @Override + public String getObject() + { + return labelValue; + } + + })); + } +} \ No newline at end of file diff --git a/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/IMyService.java b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/IMyService.java new file mode 100644 index 0000000000..ab72a2b0f5 --- /dev/null +++ b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/IMyService.java @@ -0,0 +1,35 @@ +/* + * 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.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 diff --git a/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/MyService.java b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/MyService.java new file mode 100644 index 0000000000..34d4dad625 --- /dev/null +++ b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/MyService.java @@ -0,0 +1,38 @@ +/* + * 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.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 diff --git a/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/WicketApplication.java b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/WicketApplication.java new file mode 100644 index 0000000000..d26b729898 --- /dev/null +++ b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/java/sample/wicket/WicketApplication.java @@ -0,0 +1,47 @@ +/* + * 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.wicket; + +import org.apache.wicket.Page; +import org.apache.wicket.protocol.http.WebApplication; +import org.apache.tuscany.sca.wicket.TuscanyComponentInjector;; + +/** + * 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 TuscanyComponentInjector(this)); + } + + /** + * @see org.apache.wicket.Application#getHomePage() + */ + @Override + public Class< ? extends Page> getHomePage() + { + return HomePage.class; + } +} \ No newline at end of file diff --git a/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/resources/log4j.properties b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/resources/log4j.properties new file mode 100644 index 0000000000..822153c0e2 --- /dev/null +++ b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/resources/log4j.properties @@ -0,0 +1,29 @@ +# +# 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. +# + +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 + + diff --git a/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/webapp/WEB-INF/web.composite b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/webapp/WEB-INF/web.composite new file mode 100644 index 0000000000..7e2ca0a158 --- /dev/null +++ b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/webapp/WEB-INF/web.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/webapp/WEB-INF/web.xml b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..7b8490b2be --- /dev/null +++ b/tags/java/sca/2.0-M2/samples/webapps/helloworld-wicket/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,50 @@ + + + + + Apache Tuscany Helloworld Wicket Sample + + + org.apache.tuscany.sca.host.webapp.TuscanyContextListener + + + + + + wicket.tuscany + org.apache.wicket.protocol.http.WicketFilter + + applicationClassName + sample.wicket.WicketApplication + + + + + wicket.tuscany + /* + + + -- cgit v1.2.3