You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by hu...@apache.org on 2006/11/06 16:02:22 UTC
svn commit: r471756 [3/31] - in /struts/struts2/trunk: apps/blank/
apps/blank/src/main/java/example/ apps/blank/src/test/java/example/
apps/mailreader/src/main/java/mailreader2/
apps/portlet/src/main/java/org/apache/struts2/portlet/example/ apps/portle...
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain3.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain3.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain3.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/actionchaining/ActionChain3.java Mon Nov 6 07:01:43 2006
@@ -1,65 +1,68 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.actionchaining;
import com.opensymphony.xwork2.ActionSupport;
/**
- *
+ *
*/
public class ActionChain3 extends ActionSupport {
- private static final long serialVersionUID = -1456568865075250621L;
-
- private String actionChain1Property1;
- private String actionChain2Property1;
- private String actionChain3Property1 = "Property set in Action Chain 3";
-
-
- public String getActionChain1Property1() {
- return actionChain1Property1;
- }
- public void setActionChain1Property1(String actionChain1Property1) {
- this.actionChain1Property1 = actionChain1Property1;
- }
-
-
-
- public String getActionChain2Property1() {
- return actionChain2Property1;
- }
- public void setActionChain2Property1(String actionChain2Property1) {
- this.actionChain2Property1 = actionChain2Property1;
- }
-
-
-
- public String getActionChain3Property1() {
- return actionChain3Property1;
- }
- public void setActionChain3Property1(String actionChain3Property1) {
- this.actionChain3Property1 = actionChain3Property1;
- }
-
-
-
-
- public String execute() throws Exception {
- return SUCCESS;
- }
+ private static final long serialVersionUID = -1456568865075250621L;
+
+ private String actionChain1Property1;
+ private String actionChain2Property1;
+ private String actionChain3Property1 = "Property set in Action Chain 3";
+
+
+ public String getActionChain1Property1() {
+ return actionChain1Property1;
+ }
+ public void setActionChain1Property1(String actionChain1Property1) {
+ this.actionChain1Property1 = actionChain1Property1;
+ }
+
+
+
+ public String getActionChain2Property1() {
+ return actionChain2Property1;
+ }
+ public void setActionChain2Property1(String actionChain2Property1) {
+ this.actionChain2Property1 = actionChain2Property1;
+ }
+
+
+
+ public String getActionChain3Property1() {
+ return actionChain3Property1;
+ }
+ public void setActionChain3Property1(String actionChain3Property1) {
+ this.actionChain3Property1 = actionChain3Property1;
+ }
+
+
+
+
+ public String execute() throws Exception {
+ return SUCCESS;
+ }
}
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/AjaxTestAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/AjaxTestAction.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/AjaxTestAction.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/AjaxTestAction.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.ajax;
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example4ShowPanelAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example4ShowPanelAction.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example4ShowPanelAction.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example4ShowPanelAction.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.ajax;
@@ -27,46 +30,46 @@
*/
public class Example4ShowPanelAction extends ActionSupport {
- private String name;
- private String gender;
-
- private static final long serialVersionUID = 7751976335066456596L;
-
- public String panel1() throws Exception {
- return SUCCESS;
- }
-
- public String panel2() throws Exception {
- return SUCCESS;
- }
-
- public String panel3() throws Exception {
- return SUCCESS;
- }
-
- public String getGender() {
- return gender;
- }
-
- public void setGender(String gender) {
- this.gender = gender;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getTodayDate() {
- SimpleDateFormat sdf = new SimpleDateFormat("dd-MMMM-yyyy");
- return sdf.format(new Date());
- }
-
- public String getTodayTime() {
- SimpleDateFormat sdf = new SimpleDateFormat("kk:mm:ss");
- return sdf.format(new Date());
- }
+ private String name;
+ private String gender;
+
+ private static final long serialVersionUID = 7751976335066456596L;
+
+ public String panel1() throws Exception {
+ return SUCCESS;
+ }
+
+ public String panel2() throws Exception {
+ return SUCCESS;
+ }
+
+ public String panel3() throws Exception {
+ return SUCCESS;
+ }
+
+ public String getGender() {
+ return gender;
+ }
+
+ public void setGender(String gender) {
+ this.gender = gender;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getTodayDate() {
+ SimpleDateFormat sdf = new SimpleDateFormat("dd-MMMM-yyyy");
+ return sdf.format(new Date());
+ }
+
+ public String getTodayTime() {
+ SimpleDateFormat sdf = new SimpleDateFormat("kk:mm:ss");
+ return sdf.format(new Date());
+ }
}
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example5Action.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example5Action.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example5Action.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/Example5Action.java Mon Nov 6 07:01:43 2006
@@ -1,23 +1,43 @@
+/*
+ * $Id: $
+ *
+ * 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.struts2.showcase.ajax;
import com.opensymphony.xwork2.ActionSupport;
public class Example5Action extends ActionSupport {
- private static final long serialVersionUID = 2111967621952300611L;
-
- private String name;
- private Integer age;
-
-
- public String getName() { return name; }
- public void setName(String name) { this.name = name; }
-
- public Integer getAge() { return age; }
- public void setAge(Integer age) { this.age = age; }
-
- @Override
- public String execute() throws Exception {
- return SUCCESS;
- }
+ private static final long serialVersionUID = 2111967621952300611L;
+
+ private String name;
+ private Integer age;
+
+
+ public String getName() { return name; }
+ public void setName(String name) { this.name = name; }
+
+ public Integer getAge() { return age; }
+ public void setAge(Integer age) { this.age = age; }
+
+ @Override
+ public String execute() throws Exception {
+ return SUCCESS;
+ }
}
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Category.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Category.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Category.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Category.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.ajax.tree;
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/GetCategory.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/GetCategory.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/GetCategory.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/GetCategory.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.ajax.tree;
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Toggle.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Toggle.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Toggle.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/ajax/tree/Toggle.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.ajax.tree;
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/MemoryStorage.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/MemoryStorage.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/MemoryStorage.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/MemoryStorage.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.application;
@@ -38,7 +41,7 @@
public class MemoryStorage implements Storage {
- private static final long serialVersionUID = 8611213748834904125L;
+ private static final long serialVersionUID = 8611213748834904125L;
private Map memory = new HashMap();
@@ -127,7 +130,7 @@
public Collection findAll( Class entityClass ) {
if (entityClass != null) {
- return getEntityMap(entityClass).values();
+ return getEntityMap(entityClass).values();
} else {
return new ArrayList();
}
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/Storage.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/Storage.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/Storage.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/Storage.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.application;
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/TestDataProvider.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/TestDataProvider.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/TestDataProvider.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/application/TestDataProvider.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.application;
@@ -36,9 +39,9 @@
public class TestDataProvider implements Serializable, InitializingBean {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- private static final Logger log = Logger.getLogger(TestDataProvider.class);
+ private static final Logger log = Logger.getLogger(TestDataProvider.class);
public static final String[] POSITIONS = {
"Developer",
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatAuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatAuthenticationInterceptor.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatAuthenticationInterceptor.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatAuthenticationInterceptor.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.chat;
@@ -29,29 +32,29 @@
public class ChatAuthenticationInterceptor implements Interceptor {
- private static final long serialVersionUID = 1L;
-
- private static final Log _log = LogFactory.getLog(ChatAuthenticationInterceptor.class);
-
- public static final String USER_SESSION_KEY = "chatUserSessionKey";
-
- public void destroy() {
- }
-
- public void init() {
- }
-
- public String intercept(ActionInvocation invocation) throws Exception {
-
- _log.debug("Authenticating chat user");
-
- SessionMap session = (SessionMap) ActionContext.getContext().get(ActionContext.SESSION);
- User user = (User) session.get(USER_SESSION_KEY);
-
- if (user == null) {
- return Action.LOGIN;
- }
- return invocation.invoke();
- }
+ private static final long serialVersionUID = 1L;
+
+ private static final Log _log = LogFactory.getLog(ChatAuthenticationInterceptor.class);
+
+ public static final String USER_SESSION_KEY = "chatUserSessionKey";
+
+ public void destroy() {
+ }
+
+ public void init() {
+ }
+
+ public String intercept(ActionInvocation invocation) throws Exception {
+
+ _log.debug("Authenticating chat user");
+
+ SessionMap session = (SessionMap) ActionContext.getContext().get(ActionContext.SESSION);
+ User user = (User) session.get(USER_SESSION_KEY);
+
+ if (user == null) {
+ return Action.LOGIN;
+ }
+ return invocation.invoke();
+ }
}
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatException.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatException.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatException.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatException.java Mon Nov 6 07:01:43 2006
@@ -1,33 +1,36 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.chat;
public class ChatException extends RuntimeException {
-
- private static final long serialVersionUID = 1L;
- public enum ErrorType {
- ROOM_ALREADY_EXISTS,
- USER_ALREADY_EXISTS,
- NO_SUCH_ROOM_EXISTS
- }
-
- public ChatException(String description, ErrorType type) {
- super(description);
- }
+ private static final long serialVersionUID = 1L;
+
+ public enum ErrorType {
+ ROOM_ALREADY_EXISTS,
+ USER_ALREADY_EXISTS,
+ NO_SUCH_ROOM_EXISTS
+ }
+
+ public ChatException(String description, ErrorType type) {
+ super(description);
+ }
}
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatInterceptor.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatInterceptor.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatInterceptor.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatInterceptor.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.chat;
@@ -31,28 +34,28 @@
* Authenticate showcase chat example, make sure everyone have a username.
*/
public class ChatInterceptor implements Interceptor {
-
- private static final Log _log = LogFactory.getLog(ChatInterceptor.class);
- private static final long serialVersionUID = 1L;
-
- public static final String CHAT_USER_SESSION_KEY = "ChatUserSessionKey";
-
- public void destroy() {
- }
-
- public void init() {
- }
-
- public String intercept(ActionInvocation invocation) throws Exception {
- HttpSession session = (HttpSession) ActionContext.getContext().get(ActionContext.SESSION);
- User chatUser = (User) session.getAttribute(CHAT_USER_SESSION_KEY);
- if (chatUser == null) {
- _log.debug("Chat user not logged in");
- return Action.LOGIN;
- }
- return invocation.invoke();
- }
+ private static final Log _log = LogFactory.getLog(ChatInterceptor.class);
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String CHAT_USER_SESSION_KEY = "ChatUserSessionKey";
+
+ public void destroy() {
+ }
+
+ public void init() {
+ }
+
+ public String intercept(ActionInvocation invocation) throws Exception {
+ HttpSession session = (HttpSession) ActionContext.getContext().get(ActionContext.SESSION);
+ User chatUser = (User) session.getAttribute(CHAT_USER_SESSION_KEY);
+ if (chatUser == null) {
+ _log.debug("Chat user not logged in");
+ return Action.LOGIN;
+ }
+ return invocation.invoke();
+ }
}
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLoginAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLoginAction.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLoginAction.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLoginAction.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.chat;
@@ -25,41 +28,41 @@
public class ChatLoginAction extends ActionSupport implements SessionAware {
- private static final long serialVersionUID = 1L;
-
- private ChatService chatService;
- private Map session;
-
- private String name;
-
- public ChatLoginAction(ChatService chatService) {
- this.chatService = chatService;
- }
-
- public String getName() {
- return this.name;
- }
- public void setName(String name) {
- this.name = name;
- }
-
-
- public String execute() throws Exception {
- try {
- chatService.login(new User(name));
- session.put(ChatAuthenticationInterceptor.USER_SESSION_KEY, new User(name));
- }
- catch(ChatException e) {
- e.printStackTrace();
- addActionError(e.getMessage());
- return INPUT;
- }
- return SUCCESS;
- }
-
-
- // === SessionAware ===
- public void setSession(Map session) {
- this.session = session;
- }
+ private static final long serialVersionUID = 1L;
+
+ private ChatService chatService;
+ private Map session;
+
+ private String name;
+
+ public ChatLoginAction(ChatService chatService) {
+ this.chatService = chatService;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
+
+ public String execute() throws Exception {
+ try {
+ chatService.login(new User(name));
+ session.put(ChatAuthenticationInterceptor.USER_SESSION_KEY, new User(name));
+ }
+ catch(ChatException e) {
+ e.printStackTrace();
+ addActionError(e.getMessage());
+ return INPUT;
+ }
+ return SUCCESS;
+ }
+
+
+ // === SessionAware ===
+ public void setSession(Map session) {
+ this.session = session;
+ }
}
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLogoutAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLogoutAction.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLogoutAction.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatLogoutAction.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.chat;
@@ -25,31 +28,31 @@
public class ChatLogoutAction extends ActionSupport implements SessionAware {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
+
+ private ChatService chatService;
+
+ private Map session;
+
+
+ public ChatLogoutAction(ChatService chatService) {
+ this.chatService = chatService;
+ }
+
+ public String execute() throws Exception {
+
+ User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY);
+ if (user != null) {
+ chatService.logout(user.getName());
+ session.remove(ChatAuthenticationInterceptor.USER_SESSION_KEY);
+ }
+
+ return SUCCESS;
+ }
+
- private ChatService chatService;
-
- private Map session;
-
-
- public ChatLogoutAction(ChatService chatService) {
- this.chatService = chatService;
- }
-
- public String execute() throws Exception {
-
- User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY);
- if (user != null) {
- chatService.logout(user.getName());
- session.remove(ChatAuthenticationInterceptor.USER_SESSION_KEY);
- }
-
- return SUCCESS;
- }
-
-
- // === SessionAware ===
- public void setSession(Map session) {
- this.session = session;
- }
+ // === SessionAware ===
+ public void setSession(Map session) {
+ this.session = session;
+ }
}
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatMessage.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatMessage.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatMessage.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatMessage.java Mon Nov 6 07:01:43 2006
@@ -1,46 +1,49 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.chat;
import java.util.Date;
public class ChatMessage {
-
- private Date creationDate;
- private String message;
- private User creator;
-
- public ChatMessage(String message, User creator) {
- assert(message != null);
- assert(creator != null);
-
- this.creationDate = new Date(System.currentTimeMillis());
- this.message = message;
- this.creator = creator;
- }
-
- public Date getCreationDate() {
- return creationDate;
- }
- public User getCreator() {
- return creator;
- }
- public String getMessage() {
- return message;
- }
+
+ private Date creationDate;
+ private String message;
+ private User creator;
+
+ public ChatMessage(String message, User creator) {
+ assert(message != null);
+ assert(creator != null);
+
+ this.creationDate = new Date(System.currentTimeMillis());
+ this.message = message;
+ this.creator = creator;
+ }
+
+ public Date getCreationDate() {
+ return creationDate;
+ }
+ public User getCreator() {
+ return creator;
+ }
+ public String getMessage() {
+ return message;
+ }
}
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatService.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatService.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatService.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatService.java Mon Nov 6 07:01:43 2006
@@ -1,34 +1,37 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.chat;
import java.util.List;
public interface ChatService {
- List<User> getAvailableUsers();
- void login(User user);
- void logout(String name);
-
- List<Room> getAvailableRooms();
- void addRoom(Room room);
- void enterRoom(User user, String roomName);
- void exitRoom(String userName, String roomName);
- List<ChatMessage> getMessagesInRoom(String roomName);
- void sendMessageToRoom(String roomName, User user, String message);
- List<User> getUsersAvailableInRoom(String roomName);
+ List<User> getAvailableUsers();
+ void login(User user);
+ void logout(String name);
+
+ List<Room> getAvailableRooms();
+ void addRoom(Room room);
+ void enterRoom(User user, String roomName);
+ void exitRoom(String userName, String roomName);
+ List<ChatMessage> getMessagesInRoom(String roomName);
+ void sendMessageToRoom(String roomName, User user, String message);
+ List<User> getUsersAvailableInRoom(String roomName);
}
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatServiceImpl.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatServiceImpl.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatServiceImpl.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatServiceImpl.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.chat;
@@ -23,90 +26,90 @@
import java.util.Map;
public class ChatServiceImpl implements ChatService {
-
- private Map<String, User> availableUsers = new LinkedHashMap<String, User>();
- private Map<String, Room> availableRooms = new LinkedHashMap<String, Room>();
-
-
- public List<User> getAvailableUsers() {
- return new ArrayList<User>(availableUsers.values());
- }
-
- public List<Room> getAvailableRooms() {
- return new ArrayList<Room>(availableRooms.values());
- }
-
- public void addRoom(Room room) {
- if (availableRooms.containsKey(room.getName())) {
- throw new ChatException("room ["+room.getName()+"] is already available", ChatException.ErrorType.valueOf("ROOM_ALREADY_EXISTS"));
- }
- availableRooms.put(room.getName(), room);
- }
-
- public void login(User user) {
- assert(user != null);
- if (availableUsers.containsKey(user.getName())) {
- throw new ChatException("User ["+user.getName()+"] already exists", ChatException.ErrorType.valueOf("USER_ALREADY_EXISTS"));
- }
- availableUsers.put(user.getName(), user);
- }
-
- public void logout(String name) {
- assert(name != null);
- assert(name.trim().length() > 0);
- availableUsers.remove(name);
- for (Room room : availableRooms.values()) {
- if (room.hasMember(name)) {
- room.memberExit(name);
- }
- }
- }
-
- public void exitRoom(String userName, String roomName) {
- assert(roomName != null);
- assert(roomName.trim().length()> 0);
-
- if (availableRooms.containsKey(roomName)) {
- Room room = availableRooms.get(roomName);
- room.memberExit(userName);
- }
- }
-
- public void enterRoom(User user, String roomName) {
- assert(roomName != null);
- assert(roomName.trim().length() > 0);
- if (! availableRooms.containsKey(roomName)) {
- throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS);
- }
- Room room = availableRooms.get(roomName);
- room.memberEnter(user);
- }
-
- public List<ChatMessage> getMessagesInRoom(String roomName) {
- assert(roomName != null);
- assert(roomName.trim().length() > 0);
- if (! availableRooms.containsKey(roomName)) {
- throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS);
- }
- Room room = availableRooms.get(roomName);
- return room.getChatMessages();
- }
-
- public void sendMessageToRoom(String roomName, User user, String message) {
- assert(roomName != null);
- if (! availableRooms.containsKey(roomName)) {
- throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS);
- }
- Room room = availableRooms.get(roomName);
- room.addMessage(new ChatMessage(message, user));
- }
-
- public List<User> getUsersAvailableInRoom(String roomName) {
- assert(roomName != null);
- if (! availableRooms.containsKey(roomName)) {
- throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS);
- }
- Room room = availableRooms.get(roomName);
- return room.getMembers();
- }
+
+ private Map<String, User> availableUsers = new LinkedHashMap<String, User>();
+ private Map<String, Room> availableRooms = new LinkedHashMap<String, Room>();
+
+
+ public List<User> getAvailableUsers() {
+ return new ArrayList<User>(availableUsers.values());
+ }
+
+ public List<Room> getAvailableRooms() {
+ return new ArrayList<Room>(availableRooms.values());
+ }
+
+ public void addRoom(Room room) {
+ if (availableRooms.containsKey(room.getName())) {
+ throw new ChatException("room ["+room.getName()+"] is already available", ChatException.ErrorType.valueOf("ROOM_ALREADY_EXISTS"));
+ }
+ availableRooms.put(room.getName(), room);
+ }
+
+ public void login(User user) {
+ assert(user != null);
+ if (availableUsers.containsKey(user.getName())) {
+ throw new ChatException("User ["+user.getName()+"] already exists", ChatException.ErrorType.valueOf("USER_ALREADY_EXISTS"));
+ }
+ availableUsers.put(user.getName(), user);
+ }
+
+ public void logout(String name) {
+ assert(name != null);
+ assert(name.trim().length() > 0);
+ availableUsers.remove(name);
+ for (Room room : availableRooms.values()) {
+ if (room.hasMember(name)) {
+ room.memberExit(name);
+ }
+ }
+ }
+
+ public void exitRoom(String userName, String roomName) {
+ assert(roomName != null);
+ assert(roomName.trim().length()> 0);
+
+ if (availableRooms.containsKey(roomName)) {
+ Room room = availableRooms.get(roomName);
+ room.memberExit(userName);
+ }
+ }
+
+ public void enterRoom(User user, String roomName) {
+ assert(roomName != null);
+ assert(roomName.trim().length() > 0);
+ if (! availableRooms.containsKey(roomName)) {
+ throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS);
+ }
+ Room room = availableRooms.get(roomName);
+ room.memberEnter(user);
+ }
+
+ public List<ChatMessage> getMessagesInRoom(String roomName) {
+ assert(roomName != null);
+ assert(roomName.trim().length() > 0);
+ if (! availableRooms.containsKey(roomName)) {
+ throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS);
+ }
+ Room room = availableRooms.get(roomName);
+ return room.getChatMessages();
+ }
+
+ public void sendMessageToRoom(String roomName, User user, String message) {
+ assert(roomName != null);
+ if (! availableRooms.containsKey(roomName)) {
+ throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS);
+ }
+ Room room = availableRooms.get(roomName);
+ room.addMessage(new ChatMessage(message, user));
+ }
+
+ public List<User> getUsersAvailableInRoom(String roomName) {
+ assert(roomName != null);
+ if (! availableRooms.containsKey(roomName)) {
+ throw new ChatException("No such room exists ["+roomName+"]", ChatException.ErrorType.NO_SUCH_ROOM_EXISTS);
+ }
+ Room room = availableRooms.get(roomName);
+ return room.getMembers();
+ }
}
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatSessionListener.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatSessionListener.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatSessionListener.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ChatSessionListener.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.chat;
@@ -28,23 +31,23 @@
public class ChatSessionListener implements HttpSessionListener {
- private static final Log _log = LogFactory.getLog(ChatSessionListener.class);
-
- public void sessionCreated(HttpSessionEvent event) {
- }
-
- public void sessionDestroyed(HttpSessionEvent event) {
- HttpSession session = event.getSession();
- WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(session.getServletContext());
- if (context != null) {
- User user = (User) session.getAttribute(ChatInterceptor.CHAT_USER_SESSION_KEY);
- if (user != null) {
- ChatService service = (ChatService) context.getBean("chatService");
- service.logout(user.getName());
-
- _log.info("session expired, logged user ["+user.getName()+"] out");
- }
- }
- }
+ private static final Log _log = LogFactory.getLog(ChatSessionListener.class);
+
+ public void sessionCreated(HttpSessionEvent event) {
+ }
+
+ public void sessionDestroyed(HttpSessionEvent event) {
+ HttpSession session = event.getSession();
+ WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(session.getServletContext());
+ if (context != null) {
+ User user = (User) session.getAttribute(ChatInterceptor.CHAT_USER_SESSION_KEY);
+ if (user != null) {
+ ChatService service = (ChatService) context.getBean("chatService");
+ service.logout(user.getName());
+
+ _log.info("session expired, logged user ["+user.getName()+"] out");
+ }
+ }
+ }
}
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Constants.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Constants.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Constants.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Constants.java Mon Nov 6 07:01:43 2006
@@ -1,22 +1,25 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.chat;
public class Constants {
- public static String UPDATE_FREQ = "30000";
+ public static String UPDATE_FREQ = "30000";
}
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/CrudRoomAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/CrudRoomAction.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/CrudRoomAction.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/CrudRoomAction.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.chat;
@@ -21,41 +24,41 @@
public class CrudRoomAction extends ActionSupport {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
+
+ private ChatService chatService;
+
+ private String name;
+ private String description;
+
- private ChatService chatService;
-
- private String name;
- private String description;
-
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public CrudRoomAction(ChatService chatService) {
- this.chatService = chatService;
- }
-
- public String create() throws Exception {
- try {
- chatService.addRoom(new Room(name, description));
- }
- catch(ChatException e) {
- addActionError(e.getMessage());
- }
- return SUCCESS;
- }
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public CrudRoomAction(ChatService chatService) {
+ this.chatService = chatService;
+ }
+
+ public String create() throws Exception {
+ try {
+ chatService.addRoom(new Room(name, description));
+ }
+ catch(ChatException e) {
+ addActionError(e.getMessage());
+ }
+ return SUCCESS;
+ }
}
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/DateConverter.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/DateConverter.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/DateConverter.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/DateConverter.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.chat;
@@ -27,30 +30,30 @@
import org.apache.struts2.util.StrutsTypeConverter;
public class DateConverter extends StrutsTypeConverter {
-
- private static final Log _log = LogFactory.getLog(DateConverter.class);
- public Object convertFromString(Map context, String[] values, Class toClass) {
-
- if (values.length > 0 && values[0] != null && values[0].trim().length() > 0) {
- SimpleDateFormat sdf = new SimpleDateFormat();
- try {
- return sdf.parse(values[0]);
- }
- catch(ParseException e) {
- _log.error("error converting value ["+values[0]+"] to Date ", e);
- }
- }
- return null;
- }
-
- public String convertToString(Map context, Object o) {
-
- if (o instanceof Date) {
- SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
- return sdf.format((Date) o);
- }
- return "";
- }
+ private static final Log _log = LogFactory.getLog(DateConverter.class);
+
+ public Object convertFromString(Map context, String[] values, Class toClass) {
+
+ if (values.length > 0 && values[0] != null && values[0].trim().length() > 0) {
+ SimpleDateFormat sdf = new SimpleDateFormat();
+ try {
+ return sdf.parse(values[0]);
+ }
+ catch(ParseException e) {
+ _log.error("error converting value ["+values[0]+"] to Date ", e);
+ }
+ }
+ return null;
+ }
+
+ public String convertToString(Map context, Object o) {
+
+ if (o instanceof Date) {
+ SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
+ return sdf.format((Date) o);
+ }
+ return "";
+ }
}
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/EnterRoomAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/EnterRoomAction.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/EnterRoomAction.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/EnterRoomAction.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.chat;
@@ -25,35 +28,35 @@
public class EnterRoomAction extends ActionSupport implements SessionAware {
- private static final long serialVersionUID = 1L;
-
- private ChatService chatService;
- private Map session;
- private String roomName;
-
- public String getRoomName() { return this.roomName; }
- public void setRoomName(String roomName) { this.roomName = roomName; }
-
- public EnterRoomAction(ChatService chatService) {
- this.chatService = chatService;
- }
-
- public String execute() throws Exception {
-
- User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY);
- try {
- chatService.enterRoom(user, roomName);
- }
- catch(Exception e) {
- addActionError(e.getMessage());
- }
- return SUCCESS;
- }
-
-
- // === SessionAware ===
- public void setSession(Map session) {
- this.session = session;
- }
-
+ private static final long serialVersionUID = 1L;
+
+ private ChatService chatService;
+ private Map session;
+ private String roomName;
+
+ public String getRoomName() { return this.roomName; }
+ public void setRoomName(String roomName) { this.roomName = roomName; }
+
+ public EnterRoomAction(ChatService chatService) {
+ this.chatService = chatService;
+ }
+
+ public String execute() throws Exception {
+
+ User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY);
+ try {
+ chatService.enterRoom(user, roomName);
+ }
+ catch(Exception e) {
+ addActionError(e.getMessage());
+ }
+ return SUCCESS;
+ }
+
+
+ // === SessionAware ===
+ public void setSession(Map session) {
+ this.session = session;
+ }
+
}
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ExitRoomAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ExitRoomAction.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ExitRoomAction.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/ExitRoomAction.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.chat;
@@ -25,31 +28,31 @@
public class ExitRoomAction extends ActionSupport implements SessionAware {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
+
+ private String roomName;
+
+ private Map session;
+
+ public String getRoomName() { return roomName; }
+ public void setRoomName(String roomName) { this.roomName = roomName; }
+
+ private ChatService chatService;
+
+ public ExitRoomAction(ChatService chatService) {
+ this.chatService = chatService;
+ }
+
+ public String execute() throws Exception {
+ User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY);
+ chatService.exitRoom(user.getName(), roomName);
+
+ return SUCCESS;
+ }
+
+ // === SessionAware ===
+ public void setSession(Map session) {
+ this.session = session;
+ }
- private String roomName;
-
- private Map session;
-
- public String getRoomName() { return roomName; }
- public void setRoomName(String roomName) { this.roomName = roomName; }
-
- private ChatService chatService;
-
- public ExitRoomAction(ChatService chatService) {
- this.chatService = chatService;
- }
-
- public String execute() throws Exception {
- User user = (User) session.get(ChatAuthenticationInterceptor.USER_SESSION_KEY);
- chatService.exitRoom(user.getName(), roomName);
-
- return SUCCESS;
- }
-
- // === SessionAware ===
- public void setSession(Map session) {
- this.session = session;
- }
-
}
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/MessagesAvailableInRoomAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/MessagesAvailableInRoomAction.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/MessagesAvailableInRoomAction.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/MessagesAvailableInRoomAction.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.chat;
@@ -24,33 +27,33 @@
public class MessagesAvailableInRoomAction extends ActionSupport {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
+
+ private String roomName;
+ private ChatService chatService;
+ private List<ChatMessage> messagesAvailableInRoom = new ArrayList<ChatMessage>();
+
+ public String getRoomName() { return this.roomName; }
+ public void setRoomName(String roomName) {
+ this.roomName = roomName;
+ }
+
+ public List<ChatMessage> getMessagesAvailableInRoom() {
+ return messagesAvailableInRoom;
+ }
+
+ public MessagesAvailableInRoomAction(ChatService chatService) {
+ this.chatService = chatService;
+ }
+
+ public String execute() throws Exception {
+ try {
+ messagesAvailableInRoom = chatService.getMessagesInRoom(roomName);
+ }
+ catch(ChatException e) {
+ addActionError(e.getMessage());
+ }
+ return SUCCESS;
+ }
- private String roomName;
- private ChatService chatService;
- private List<ChatMessage> messagesAvailableInRoom = new ArrayList<ChatMessage>();
-
- public String getRoomName() { return this.roomName; }
- public void setRoomName(String roomName) {
- this.roomName = roomName;
- }
-
- public List<ChatMessage> getMessagesAvailableInRoom() {
- return messagesAvailableInRoom;
- }
-
- public MessagesAvailableInRoomAction(ChatService chatService) {
- this.chatService = chatService;
- }
-
- public String execute() throws Exception {
- try {
- messagesAvailableInRoom = chatService.getMessagesInRoom(roomName);
- }
- catch(ChatException e) {
- addActionError(e.getMessage());
- }
- return SUCCESS;
- }
-
}
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Room.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Room.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Room.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/chat/Room.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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.struts2.showcase.chat;
@@ -24,75 +27,75 @@
import java.util.Map;
public class Room {
-
- private static final int MAX_CHAT_MESSAGES = 10;
-
- private String name;
- private String description;
- private Date creationDate;
-
- private List<ChatMessage> messages = new ArrayList<ChatMessage>();
-
- private Map<String, User> members = new LinkedHashMap<String, User>();
-
- public Room(String name, String description) {
- this.name = name;
- this.description = description;
- this.creationDate = new Date(System.currentTimeMillis());
- }
-
-
- // properties
- public Date getCreationDate() {
- return creationDate;
- }
-
- public String getDescription() {
- return description;
- }
-
- public String getName() {
- return name;
- }
-
-
- // (behaviour) members
- public List<User> getMembers() {
- return new ArrayList<User>(members.values());
- }
- public User findMember(String name) {
- assert(name != null);
- return members.get(name);
- }
- public boolean hasMember(String name) {
- assert(name != null);
- return members.containsKey(name);
- }
- public void memberEnter(User member) {
- assert(member != null);
- if (! hasMember(member.getName())) {
- members.put(member.getName(), member);
- }
- }
-
- public void memberExit(String memberName) {
- assert(memberName != null);
- assert(memberName.trim().length() > 0);
- members.remove(memberName);
- }
-
-
- // (behaviour) chat messags
- public void addMessage(ChatMessage chatMessage) {
- if (messages.size() > MAX_CHAT_MESSAGES) {
- // messages.remove(messages.size() - 1);
- messages.remove(0);
- }
- messages.add(chatMessage);
- }
-
- public List<ChatMessage> getChatMessages() {
- return new ArrayList<ChatMessage>(messages);
- }
-
+
+ private static final int MAX_CHAT_MESSAGES = 10;
+
+ private String name;
+ private String description;
+ private Date creationDate;
+
+ private List<ChatMessage> messages = new ArrayList<ChatMessage>();
+
+ private Map<String, User> members = new LinkedHashMap<String, User>();
+
+ public Room(String name, String description) {
+ this.name = name;
+ this.description = description;
+ this.creationDate = new Date(System.currentTimeMillis());
+ }
+
+
+ // properties
+ public Date getCreationDate() {
+ return creationDate;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+
+ // (behaviour) members
+ public List<User> getMembers() {
+ return new ArrayList<User>(members.values());
+ }
+ public User findMember(String name) {
+ assert(name != null);
+ return members.get(name);
+ }
+ public boolean hasMember(String name) {
+ assert(name != null);
+ return members.containsKey(name);
+ }
+ public void memberEnter(User member) {
+ assert(member != null);
+ if (! hasMember(member.getName())) {
+ members.put(member.getName(), member);
+ }
+ }
+
+ public void memberExit(String memberName) {
+ assert(memberName != null);
+ assert(memberName.trim().length() > 0);
+ members.remove(memberName);
+ }
+
+
+ // (behaviour) chat messags
+ public void addMessage(ChatMessage chatMessage) {
+ if (messages.size() > MAX_CHAT_MESSAGES) {
+ // messages.remove(messages.size() - 1);
+ messages.remove(0);
+ }
+ messages.add(chatMessage);
+ }
+
+ public List<ChatMessage> getChatMessages() {
+ return new ArrayList<ChatMessage>(messages);
+ }
+
}