Author: mvanco(a)redhat.com
Date: 2010-08-31 13:23:13 -0400 (Tue, 31 Aug 2010)
New Revision: 3984
Modified:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EventConsumerPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EventGeneratorPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EventObjectConsumerPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EventObjectGeneratorPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/PortletModesPortlet.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/utils/TestObject.java
Log:
WSRP sample portets:
- added copyrights at java classes and edited code conventions
Modified:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EventConsumerPortlet.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EventConsumerPortlet.java 2010-08-31
14:09:06 UTC (rev 3983)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EventConsumerPortlet.java 2010-08-31
17:23:13 UTC (rev 3984)
@@ -1,3 +1,25 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
package org.gatein.wsrp.portlet;
import java.io.IOException;
@@ -13,22 +35,22 @@
/**
* EventConsumer Portlet Class
*/
-public class EventConsumerPortlet extends GenericPortlet {
+public class EventConsumerPortlet extends GenericPortlet
+{
@Override
- public void doView(RenderRequest request, RenderResponse response)
- throws PortletException, IOException {
+ public void doView(RenderRequest request, RenderResponse response) throws
PortletException, IOException
+ {
response.setContentType("text/html");
String param = request.getParameter("parameter-event");
request.setAttribute("parameter", param);
- PortletRequestDispatcher dispatcher = getPortletContext()
- .getRequestDispatcher("/view_consumer.jsp");
+ PortletRequestDispatcher dispatcher =
getPortletContext().getRequestDispatcher("/view_consumer.jsp");
dispatcher.include(request, response);
}
@Override
- public void processEvent(EventRequest request, EventResponse response)
- throws PortletException, IOException {
+ public void processEvent(EventRequest request, EventResponse response) throws
PortletException, IOException
+ {
String param = (String) request.getEvent().getValue();
response.setRenderParameter("parameter-event", param);
}
Modified:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EventGeneratorPortlet.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EventGeneratorPortlet.java 2010-08-31
14:09:06 UTC (rev 3983)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EventGeneratorPortlet.java 2010-08-31
17:23:13 UTC (rev 3984)
@@ -1,3 +1,25 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
package org.gatein.wsrp.portlet;
import java.io.IOException;
@@ -14,20 +36,20 @@
/**
* EventGenerator Portlet Class
*/
-public class EventGeneratorPortlet extends GenericPortlet {
+public class EventGeneratorPortlet extends GenericPortlet
+{
@Override
- public void doView(RenderRequest request, RenderResponse response)
- throws PortletException, IOException {
+ public void doView(RenderRequest request, RenderResponse response) throws
PortletException, IOException
+ {
response.setContentType("text/html");
- PortletRequestDispatcher dispatcher = getPortletContext()
- .getRequestDispatcher("/view_generator.jsp");
+ PortletRequestDispatcher dispatcher =
getPortletContext().getRequestDispatcher("/view_generator.jsp");
dispatcher.include(request, response);
}
@Override
- public void processAction(ActionRequest request, ActionResponse response)
- throws PortletException, IOException {
+ public void processAction(ActionRequest request, ActionResponse response) throws
PortletException, IOException
+ {
String param = request.getParameter("parameter");
response.setEvent(new QName("urn:jboss:gatein:samples:event",
"eventsample"), param);
}
Modified:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EventObjectConsumerPortlet.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EventObjectConsumerPortlet.java 2010-08-31
14:09:06 UTC (rev 3983)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EventObjectConsumerPortlet.java 2010-08-31
17:23:13 UTC (rev 3984)
@@ -1,3 +1,25 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
package org.gatein.wsrp.portlet;
import java.io.IOException;
@@ -17,29 +39,29 @@
/**
* EventObjectConsumer Portlet Class
*/
-public class EventObjectConsumerPortlet extends GenericPortlet {
+public class EventObjectConsumerPortlet extends GenericPortlet
+{
@Override
- public void doView(RenderRequest request, RenderResponse response)
- throws PortletException, IOException {
+ public void doView(RenderRequest request, RenderResponse response) throws
PortletException, IOException
+ {
response.setContentType("text/html");
TestObject object = (TestObject)
request.getPortletSession().getAttribute("object");
request.setAttribute("object", object);
- PortletRequestDispatcher dispatcher = getPortletContext()
- .getRequestDispatcher("/view_consumer.jsp");
+ PortletRequestDispatcher dispatcher =
getPortletContext().getRequestDispatcher("/view_consumer.jsp");
dispatcher.include(request, response);
}
@Override
- public void processEvent(EventRequest request, EventResponse response)
- throws PortletException, IOException {
+ public void processEvent(EventRequest request, EventResponse response) throws
PortletException, IOException
+ {
TestObject object = (TestObject) request.getEvent().getValue();
request.getPortletSession().setAttribute("object", object);
}
@Override
- public void processAction(ActionRequest request, ActionResponse response)
- throws PortletException, IOException {
+ public void processAction(ActionRequest request, ActionResponse response) throws
PortletException, IOException
+ {
request.getPortletSession().removeAttribute("object");
}
Modified:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EventObjectGeneratorPortlet.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EventObjectGeneratorPortlet.java 2010-08-31
14:09:06 UTC (rev 3983)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/EventObjectGeneratorPortlet.java 2010-08-31
17:23:13 UTC (rev 3984)
@@ -1,3 +1,25 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
package org.gatein.wsrp.portlet;
import java.io.IOException;
@@ -18,12 +40,14 @@
/**
* EventObjectGenerator Portlet Class
*/
-public class EventObjectGeneratorPortlet extends GenericPortlet {
+public class EventObjectGeneratorPortlet extends GenericPortlet
+{
private List<TestObject> objects;
@Override
- public void init() throws PortletException {
+ public void init() throws PortletException
+ {
super.init();
objects = new ArrayList<TestObject>();
objects.add(new TestObject("Prabhat", "Jha", "pjha",
654321, "pjha(a)redhat.com"));
@@ -32,9 +56,12 @@
objects.add(new TestObject("Viliam", "Rockai", "vrockai",
223311, "vrockai(a)redhat.com"));
}
- public TestObject getTestObjectByUserName(String username) {
- for (TestObject object : objects) {
- if (object.getUsername().equals(username)) {
+ public TestObject getTestObjectByUserName(String username)
+ {
+ for (TestObject object : objects)
+ {
+ if (object.getUsername().equals(username))
+ {
return object;
}
}
@@ -42,18 +69,17 @@
}
@Override
- public void doView(RenderRequest request, RenderResponse response)
- throws PortletException, IOException {
+ public void doView(RenderRequest request, RenderResponse response) throws
PortletException, IOException
+ {
response.setContentType("text/html");
request.setAttribute("objects", objects);
- PortletRequestDispatcher dispatcher = getPortletContext()
- .getRequestDispatcher("/view_generator.jsp");
+ PortletRequestDispatcher dispatcher =
getPortletContext().getRequestDispatcher("/view_generator.jsp");
dispatcher.include(request, response);
}
@Override
- public void processAction(ActionRequest request, ActionResponse response)
- throws PortletException, IOException {
+ public void processAction(ActionRequest request, ActionResponse response) throws
PortletException, IOException
+ {
String username = request.getParameter("username");
response.setEvent(new QName("urn:jboss:gatein:samples:event:object",
"eventObject"), getTestObjectByUserName(username));
}
Modified:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/PortletModesPortlet.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/PortletModesPortlet.java 2010-08-31
14:09:06 UTC (rev 3983)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/PortletModesPortlet.java 2010-08-31
17:23:13 UTC (rev 3984)
@@ -1,3 +1,25 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
package org.gatein.wsrp.portlet;
import java.io.IOException;
@@ -12,41 +34,38 @@
/**
* PortletModes Class
*/
-public class PortletModesPortlet extends GenericPortlet {
+public class PortletModesPortlet extends GenericPortlet
+{
@Override
- public void doView(RenderRequest request, RenderResponse response)
- throws PortletException, IOException {
+ public void doView(RenderRequest request, RenderResponse response) throws
PortletException, IOException
+ {
response.setContentType("text/html");
- PortletRequestDispatcher dispatcher = getPortletContext()
- .getRequestDispatcher("/view.jsp");
+ PortletRequestDispatcher dispatcher =
getPortletContext().getRequestDispatcher("/view.jsp");
dispatcher.include(request, response);
}
@Override
- public void doHelp(RenderRequest request, RenderResponse response)
- throws PortletException, IOException {
+ public void doHelp(RenderRequest request, RenderResponse response) throws
PortletException, IOException
+ {
response.setContentType("text/html");
- PortletRequestDispatcher dispatcher = getPortletContext()
- .getRequestDispatcher("/help.jsp");
+ PortletRequestDispatcher dispatcher =
getPortletContext().getRequestDispatcher("/help.jsp");
dispatcher.include(request, response);
}
@Override
- public void doEdit(RenderRequest request, RenderResponse response)
- throws PortletException, IOException {
+ public void doEdit(RenderRequest request, RenderResponse response) throws
PortletException, IOException
+ {
response.setContentType("text/html");
- PortletRequestDispatcher dispatcher = getPortletContext()
- .getRequestDispatcher("/edit.jsp");
+ PortletRequestDispatcher dispatcher =
getPortletContext().getRequestDispatcher("/edit.jsp");
dispatcher.include(request, response);
}
@RenderMode(name = "TEST_MODE")
- public void doTestMode(RenderRequest request, RenderResponse response)
- throws PortletException, IOException {
+ public void doTestMode(RenderRequest request, RenderResponse response) throws
PortletException, IOException
+ {
response.setContentType("text/html");
- PortletRequestDispatcher dispatcher = getPortletContext()
- .getRequestDispatcher("/test_mode.jsp");
+ PortletRequestDispatcher dispatcher =
getPortletContext().getRequestDispatcher("/test_mode.jsp");
dispatcher.include(request, response);
}
}
Modified:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/utils/TestObject.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/utils/TestObject.java 2010-08-31
14:09:06 UTC (rev 3983)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/portlet/utils/TestObject.java 2010-08-31
17:23:13 UTC (rev 3984)
@@ -1,3 +1,25 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2010, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
package org.gatein.wsrp.portlet.utils;
import java.io.Serializable;
@@ -5,7 +27,8 @@
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
-public class TestObject implements Serializable {
+public class TestObject implements Serializable
+{
private static final long serialVersionUID = 1L;
@@ -15,11 +38,12 @@
private Integer employeeNumber;
private String email;
- public TestObject() {
+ public TestObject()
+ {
}
- public TestObject(String firstName, String lastName, String username,
- Integer employeeNumber, String email) {
+ public TestObject(String firstName, String lastName, String username, Integer
employeeNumber, String email)
+ {
this.firstName = firstName;
this.lastName = lastName;
this.username = username;
@@ -27,7 +51,8 @@
this.email = email;
}
- public TestObject(TestObject object) {
+ public TestObject(TestObject object)
+ {
this.firstName = object.getFirstName();
this.lastName = object.getLastName();
this.username = object.getUsername();
@@ -35,64 +60,77 @@
this.email = object.getEmail();
}
- public String getFirstName() {
+ public String getFirstName()
+ {
return firstName;
}
- public void setFirstName(String firstName) {
+ public void setFirstName(String firstName)
+ {
this.firstName = firstName;
}
- public String getLastName() {
+ public String getLastName()
+ {
return lastName;
}
- public void setLastName(String lastName) {
+ public void setLastName(String lastName)
+ {
this.lastName = lastName;
}
- public String getUsername() {
+ public String getUsername()
+ {
return username;
}
- public void setUsername(String username) {
+ public void setUsername(String username)
+ {
this.username = username;
}
- public Integer getEmployeeNumber() {
+ public Integer getEmployeeNumber()
+ {
return employeeNumber;
}
- public void setEmployeeNumber(Integer employeeNumber) {
+ public void setEmployeeNumber(Integer employeeNumber)
+ {
this.employeeNumber = employeeNumber;
}
- public String getEmail() {
+ public String getEmail()
+ {
return email;
}
- public void setEmail(String email) {
+ public void setEmail(String email)
+ {
this.email = email;
}
@Override
- public boolean equals(Object obj) {
- if (obj instanceof TestObject) {
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof TestObject)
+ {
TestObject object = (TestObject) obj;
- if (this.getUsername().equals(object.getUsername()))
- return true;
+ if (this.getUsername().equals(object.getUsername())) return true;
}
return false;
}
@Override
- public int hashCode() {
+ public int hashCode()
+ {
return super.hashCode() + this.getUsername().hashCode();
}
@Override
- public String toString() {
+ public String toString()
+ {
StringBuilder builder = new StringBuilder();
builder.append("TestObject: ");
builder.append(firstName);