[jboss-cvs] jboss-portal/forums/src/main/org/jboss/portlet/forums/command/result ...

Julien Viet julien at jboss.com
Sun Aug 20 19:17:38 EDT 2006


  User: julien  
  Date: 06/08/20 19:17:38

  Added:       forums/src/main/org/jboss/portlet/forums/command/result     
                        CompositeResult.java ImmutableResult.java
                        Result.java ResultType.java SimpleResult.java
  Log:
  move command framework for forums into the forums module
  
  Revision  Changes    Path
  1.1      date: 2006/08/20 23:17:38;  author: julien;  state: Exp;jboss-portal/forums/src/main/org/jboss/portlet/forums/command/result/CompositeResult.java
  
  Index: CompositeResult.java
  ===================================================================
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2005, JBoss Inc., 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.jboss.portlet.forums.command.result;
  
  import java.util.Iterator;
  import java.util.LinkedList;
  import java.util.List;
  
  import org.jboss.portlet.forums.command.CommandConstants;
  
  /**
   * @version <tt>$Revision: 1.1 $</tt>
   * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
   */
  public class CompositeResult
     implements Result
  {
  
     private final List results = new LinkedList();
  
     public void addResult(Result result)
     {
        results.add(result);
     }
  
     public Iterator iterator()
     {
        return results.iterator();
     }
  
     public ResultType getType()
     {
        return CommandConstants.TYPE_COMPOSITE;
     }
  }
  
  
  
  1.1      date: 2006/08/20 23:17:38;  author: julien;  state: Exp;jboss-portal/forums/src/main/org/jboss/portlet/forums/command/result/ImmutableResult.java
  
  Index: ImmutableResult.java
  ===================================================================
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2005, JBoss Inc., 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.jboss.portlet.forums.command.result;
  
  
  /**
   * @author <a href="theute at users.sourceforge.net">Thomas Heute</a>
   * $Revision: 1.1 $
   */
  public class ImmutableResult
     extends ResultType
     implements Result
  {
  
     public ImmutableResult(String name)
     {
        super(name);
     }
  
     public ResultType getType()
     {
        return this;
     }
  }
  
  
  
  1.1      date: 2006/08/20 23:17:38;  author: julien;  state: Exp;jboss-portal/forums/src/main/org/jboss/portlet/forums/command/result/Result.java
  
  Index: Result.java
  ===================================================================
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2005, JBoss Inc., 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.jboss.portlet.forums.command.result;
  
  /**
   * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
   * @version $Revision: 1.1 $
   */
  public interface Result
  {
     ResultType getType();
  }
  
  
  
  1.1      date: 2006/08/20 23:17:38;  author: julien;  state: Exp;jboss-portal/forums/src/main/org/jboss/portlet/forums/command/result/ResultType.java
  
  Index: ResultType.java
  ===================================================================
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2005, JBoss Inc., 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.jboss.portlet.forums.command.result;
  
  /**
   * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
   * @version $Revision: 1.1 $
   */
  public class ResultType
  {
  
     private String name;
  
     protected ResultType(String name)
     {
        if (name == null)
        {
           throw new IllegalArgumentException("Name cannot be null");
        }
        this.name = name;
     }
  
     public String getName()
     {
        return name;
     }
  }
  
  
  
  1.1      date: 2006/08/20 23:17:38;  author: julien;  state: Exp;jboss-portal/forums/src/main/org/jboss/portlet/forums/command/result/SimpleResult.java
  
  Index: SimpleResult.java
  ===================================================================
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2005, JBoss Inc., 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.jboss.portlet.forums.command.result;
  
  import java.util.HashMap;
  import java.util.Map;
  
  /**
   * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
   * @version $Revision: 1.1 $
   */
  public class SimpleResult
     implements Result
  {
  
     private ResultType type;
     private Map values;
  
     public SimpleResult(ResultType type)
     {
        this.type = type;
        this.values = null;
     }
  
     public void put(String key, Object value)
     {
        if (values == null)
        {
           values = new HashMap();
        }
        values.put(key, value);
     }
  
     public Object get(String key)
     {
        return values != null ? values.get(key) : null;
     }
  
     public ResultType getType()
     {
        return type;
     }
  }
  
  
  



More information about the jboss-cvs-commits mailing list