You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by John McNally <jm...@collab.net> on 2001/06/28 00:39:34 UTC

Re: cvs commit: jakarta-turbine/src/java/org/apache/turbine/modules/actions/sessionvalidator DefaultSessionValidator.java

A couple years ago, back when Turbine was Dash there were references to
Turbine sprinkled around other classes.  I cannot remember the exact
problem, but it was determined that other classes should not reference
the servlet.   These are just constants, but isn't it better to
reference an interface?

john mcnally

jvanzyl@apache.org wrote:
> 
> jvanzyl     01/06/27 11:44:42
> 
>   Modified:    src/java/org/apache/turbine/modules/actions/sessionvalidator
>                         DefaultSessionValidator.java
>   Log:
>   - use Turbine not TurbineConstants, Turbine implements TurbineConstansts
>     so the values are available through Turbine. Trying to use Turbine
>     as the single point of access.
> 
>   Revision  Changes    Path
>   1.10      +9 -11     jakarta-turbine/src/java/org/apache/turbine/modules/actions/sessionvalidator/DefaultSessionValidator.java
> 
>   Index: DefaultSessionValidator.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/modules/actions/sessionvalidator/DefaultSessionValidator.java,v
>   retrieving revision 1.9
>   retrieving revision 1.10
>   diff -u -r1.9 -r1.10
>   --- DefaultSessionValidator.java      2001/06/19 01:41:15     1.9
>   +++ DefaultSessionValidator.java      2001/06/27 18:44:40     1.10
>   @@ -54,11 +54,7 @@
>     * <http://www.apache.org/>.
>     */
> 
>   -// Turbine Modules
>   -//import org.apache.turbine.modules.*;
>   -
>   -// Turbine Utility Classes
>   -import org.apache.turbine.TurbineConstants;
>   +import org.apache.turbine.Turbine;
>    import org.apache.turbine.util.RunData;
>    import org.apache.turbine.services.resources.TurbineResources;
> 
>   @@ -83,7 +79,7 @@
>     * Turbine servlet.
>     *
>     * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
>   - * @version $Id: DefaultSessionValidator.java,v 1.9 2001/06/19 01:41:15 jon Exp $
>   + * @version $Id: DefaultSessionValidator.java,v 1.10 2001/06/27 18:44:40 jvanzyl Exp $
>     */
>    public class DefaultSessionValidator extends SessionValidator
>    {
>   @@ -110,11 +106,13 @@
>                // only set the message if nothing else has already set it
>                // (e.g. the LogoutUser action)
>                if (data.getMessage() == null)
>   +            {
>                    data.setMessage(TurbineResources.getString(
>   -                    TurbineConstants.LOGIN_MESSAGE));
>   +                    Turbine.LOGIN_MESSAGE));
>   +            }
>                // set the screen to be the login page
>                data.setScreen(TurbineResources.getString(
>   -                TurbineConstants.SCREEN_LOGIN));
>   +                Turbine.SCREEN_LOGIN));
>                // we're not doing any actions buddy! (except action.login which
>                // will have been performed already)
>                data.setAction(null);
>   @@ -122,9 +120,9 @@
>            else if ( ! data.hasScreen() )
>            {
>                data.setMessage(TurbineResources.getString(
>   -                TurbineConstants.LOGIN_MESSAGE_NOSCREEN));
>   +                Turbine.LOGIN_MESSAGE_NOSCREEN));
>                data.setScreen(TurbineResources.getString(
>   -                TurbineConstants.SCREEN_HOMEPAGE));
>   +                Turbine.SCREEN_HOMEPAGE));
>            }
>            else if ( data.getParameters().containsKey("_session_access_counter") )
>            {
>   @@ -136,7 +134,7 @@
>                    data.getUser().setTemp("prev_screen", data.getScreen());
>                    data.getUser().setTemp("prev_parameters", data.getParameters());
>                    data.setScreen( TurbineResources.getString(
>   -                    TurbineConstants.SCREEN_INVALID_STATE) );
>   +                    Turbine.SCREEN_INVALID_STATE) );
>                    data.setAction( "" );
>                }
>            }
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: cvs commit: jakarta-turbine/src/java/org/apache/turbine/modules/actions/sessionvalidato r DefaultSessionValidator.java

Posted by Jason van Zyl <jv...@apache.org>.
On 6/27/01 7:13 PM, "Rafal Krzewski" <Ra...@e-point.pl> wrote:

> Jason van Zyl wrote:
>> 
>> On 6/27/01 6:39 PM, "John McNally" <jm...@collab.net> wrote:
>> 
>>> A couple years ago, back when Turbine was Dash there were references to
>>> Turbine sprinkled around other classes.  I cannot remember the exact
>>> problem, but it was determined that other classes should not reference
>>> the servlet.   These are just constants, but isn't it better to
>>> reference an interface?
>> 
>> I don't immediately see any sort of problem. If you found out exactly what
>> the problem was, I'm always willing to listen :-) Was it possibly a
>> problem with previous servlet implementations?
>> 
>> I did because I think Turbine.java should eventually be the single
>> point of access/information for the system. I can think of a couple
>> example why I'd like to keep using Turbine.java as the access point.
> 
> +1 Jason. I also believe that this is a good approach. We could even
> go as far as making Turbine implement ServiceBroker.

Yup, that¹s a possibility. I think we are in agreement that whatever
the eventual form, all things should be accessible via Turbine.java.
It will be like this in a fairly short period of time.

> I'd also 
> recommend moving the doGet() stuff into a HttpService so these two
> aren't clogged together in a single file.

I don't know about a service per se. But the file could definitely
be split up a bit. It will be shrinking in size pretty shortly ;-)
 
> Servlet container --HttpServlet--> Turbine <--ServiceBroker--
> Application
> 
> Rafal
> 
> --
> mgr inz. Rafal Krzewski
> Senior Internet Developer
> mailto:Rafal.Krzewski@e-point.pl
> +48 22 8534830 http://e-point.pl
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org

-- 

jvz.

Jason van Zyl

http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: cvs commit: jakarta-turbine/src/java/org/apache/turbine/modules/actions/sessionvalidator DefaultSessionValidator.java

Posted by Rafal Krzewski <Ra...@e-point.pl>.
Jason van Zyl wrote:
> 
> On 6/27/01 6:39 PM, "John McNally" <jm...@collab.net> wrote:
> 
> > A couple years ago, back when Turbine was Dash there were references to
> > Turbine sprinkled around other classes.  I cannot remember the exact
> > problem, but it was determined that other classes should not reference
> > the servlet.   These are just constants, but isn't it better to
> > reference an interface?
> 
> I don't immediately see any sort of problem. If you found out exactly what
> the problem was, I'm always willing to listen :-) Was it possibly a
> problem with previous servlet implementations?
> 
> I did because I think Turbine.java should eventually be the single
> point of access/information for the system. I can think of a couple
> example why I'd like to keep using Turbine.java as the access point.

+1 Jason. I also believe that this is a good approach. We could even
go as far as making Turbine implement ServiceBroker. I'd also 
recommend moving the doGet() stuff into a HttpService so these two
aren't clogged together in a single file.

Servlet container --HttpServlet--> Turbine <--ServiceBroker--
Application

Rafal

--
mgr inz. Rafal Krzewski
Senior Internet Developer
mailto:Rafal.Krzewski@e-point.pl
+48 22 8534830 http://e-point.pl

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: cvs commit: jakarta-turbine/src/java/org/apache/turbine/modules/actions/sessionvalidato r DefaultSessionValidator.java

Posted by Jason van Zyl <jv...@apache.org>.
On 6/27/01 6:39 PM, "John McNally" <jm...@collab.net> wrote:

> A couple years ago, back when Turbine was Dash there were references to
> Turbine sprinkled around other classes.  I cannot remember the exact
> problem, but it was determined that other classes should not reference
> the servlet.   These are just constants, but isn't it better to
> reference an interface?

I don't immediately see any sort of problem. If you found out exactly what
the problem was, I'm always willing to listen :-) Was it possibly a
problem with previous servlet implementations?

I did because I think Turbine.java should eventually be the single
point of access/information for the system. I can think of a couple
example why I'd like to keep using Turbine.java as the access point.

If we eventually have a great number of constants, we can split them
up into several constants files, and Turbine.java simply has to
implement them and they will still be available to the client code
without change.

Another reason I had in mind was the scriptability of modules:
it would be nice if you could just pop a reference to Turbine.java
into the scripting language context so that people writing scripts
have access to everything they need to write modules from the single
access point of Turbine.java.

If it really is a problem, than we can change things. I think
it is a good plan to use Turbine.java as the façade for everything
available in Turbine though.

> 
> john mcnally
> 
> jvanzyl@apache.org wrote:
>> 
>> jvanzyl     01/06/27 11:44:42
>> 
>>   Modified:    src/java/org/apache/turbine/modules/actions/sessionvalidator
>>                         DefaultSessionValidator.java
>>   Log:
>>   - use Turbine not TurbineConstants, Turbine implements TurbineConstansts
>>     so the values are available through Turbine. Trying to use Turbine
>>     as the single point of access.
>> 
>>   Revision  Changes    Path
>>   1.10      +9 -11
>> jakarta-turbine/src/java/org/apache/turbine/modules/actions/sessionvalidator/
>> DefaultSessionValidator.java
>> 
>>   Index: DefaultSessionValidator.java
>>   ===================================================================
>>   RCS file: 
>> /home/cvs/jakarta-turbine/src/java/org/apache/turbine/modules/actions/session
>> validator/DefaultSessionValidator.java,v
>>   retrieving revision 1.9
>>   retrieving revision 1.10
>>   diff -u -r1.9 -r1.10
>>   --- DefaultSessionValidator.java      2001/06/19 01:41:15     1.9
>>   +++ DefaultSessionValidator.java      2001/06/27 18:44:40     1.10
>>   @@ -54,11 +54,7 @@
>>     * <http://www.apache.org/>.
>>     */
>> 
>>   -// Turbine Modules
>>   -//import org.apache.turbine.modules.*;
>>   -
>>   -// Turbine Utility Classes
>>   -import org.apache.turbine.TurbineConstants;
>>   +import org.apache.turbine.Turbine;
>>    import org.apache.turbine.util.RunData;
>>    import org.apache.turbine.services.resources.TurbineResources;
>> 
>>   @@ -83,7 +79,7 @@
>>     * Turbine servlet.
>>     *
>>     * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
>>   - * @version $Id: DefaultSessionValidator.java,v 1.9 2001/06/19 01:41:15
>> jon Exp $
>>   + * @version $Id: DefaultSessionValidator.java,v 1.10 2001/06/27 18:44:40
>> jvanzyl Exp $
>>     */
>>    public class DefaultSessionValidator extends SessionValidator
>>    {
>>   @@ -110,11 +106,13 @@
>>                // only set the message if nothing else has already set it
>>                // (e.g. the LogoutUser action)
>>                if (data.getMessage() == null)
>>   +            {
>>                    data.setMessage(TurbineResources.getString(
>>   -                    TurbineConstants.LOGIN_MESSAGE));
>>   +                    Turbine.LOGIN_MESSAGE));
>>   +            }
>>                // set the screen to be the login page
>>                data.setScreen(TurbineResources.getString(
>>   -                TurbineConstants.SCREEN_LOGIN));
>>   +                Turbine.SCREEN_LOGIN));
>>                // we're not doing any actions buddy! (except action.login
>> which
>>                // will have been performed already)
>>                data.setAction(null);
>>   @@ -122,9 +120,9 @@
>>            else if ( ! data.hasScreen() )
>>            {
>>                data.setMessage(TurbineResources.getString(
>>   -                TurbineConstants.LOGIN_MESSAGE_NOSCREEN));
>>   +                Turbine.LOGIN_MESSAGE_NOSCREEN));
>>                data.setScreen(TurbineResources.getString(
>>   -                TurbineConstants.SCREEN_HOMEPAGE));
>>   +                Turbine.SCREEN_HOMEPAGE));
>>            }
>>            else if (
>> data.getParameters().containsKey("_session_access_counter") )
>>            {
>>   @@ -136,7 +134,7 @@
>>                    data.getUser().setTemp("prev_screen", data.getScreen());
>>                    data.getUser().setTemp("prev_parameters",
>> data.getParameters());
>>                    data.setScreen( TurbineResources.getString(
>>   -                    TurbineConstants.SCREEN_INVALID_STATE) );
>>   +                    Turbine.SCREEN_INVALID_STATE) );
>>                    data.setAction( "" );
>>                }
>>            }
>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org

-- 

jvz.

Jason van Zyl

http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: cvs commit: jakarta-turbine/src/java/org/apache/turbine/modules/actions/sessionvalidato r DefaultSessionValidator.java

Posted by Jon Stevens <jo...@latchkey.com>.
on 6/27/01 3:39 PM, "John McNally" <jm...@collab.net> wrote:

> A couple years ago, back when Turbine was Dash there were references to
> Turbine sprinkled around other classes.  I cannot remember the exact
> problem, but it was determined that other classes should not reference
> the servlet.   These are just constants, but isn't it better to
> reference an interface?
> 
> john mcnally

Yup...I remember this as well...people always flamed me for making these
types of references so I had to remove them...i forget why I was flamed for
it though...

-jon


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org