Examples of PoolService


Examples of org.apache.turbine.services.pool.PoolService

     */
    private void populateWithSessionTools(List tools, Context context,
                                          User user, boolean usePerm)
    {
        // Get the PoolService to fetch object instances from
        PoolService pool = (PoolService)
            TurbineServices.getInstance().getService(PoolService.SERVICE_NAME);

        // Iterate the tools
        Iterator it = tools.iterator();
        while (it.hasNext())
        {
            ToolData toolData = (ToolData)it.next();
            try
            {
                // ensure that tool is created only once for a user
                // by synchronizing against the user object
                synchronized (user)
                {
                    // first try and fetch the tool from the user's
                    // hashtable
                    Object tool = usePerm
                        ? user.getPerm(toolData.toolClassName)
                        : user.getTemp(toolData.toolClassName);

                    if (tool == null)
                    {
                        // if not there, an instance must be fetched from
                        // the pool
                        tool = pool.getInstance(toolData.toolClass);
                        if (tool instanceof ApplicationTool)
                        {
                            // session tools are init'd with the User object
                            ((ApplicationTool)tool).init(user);
                        }
View Full Code Here

Examples of org.apache.turbine.services.pool.PoolService

     * @param context the Velocity Context to release tools from
     */
    public void releaseTools(Context context)
    {
        // Get the PoolService to release object instances to
        PoolService pool = (PoolService)
            TurbineServices.getInstance().getService(PoolService.SERVICE_NAME);

        // only the request tools can be released - other scoped
        // tools will have continuing references to them
        releaseTools(context, pool, requestTools);
View Full Code Here

Examples of org.apache.turbine.services.pool.PoolService

                tryRunDataService = false;
            }
        }

        // Failed, create a default implementation using the Pool Service.
        PoolService pool = (PoolService)
            TurbineServices.getInstance().getService(PoolService.SERVICE_NAME);
        TurbineRunData data = (TurbineRunData)
            pool.getInstance(DefaultTurbineRunData.class);

        // Cache some information that will be used elsewhere.
        data.setRequest(req);
        data.setResponse(res);
       
View Full Code Here

Examples of org.apache.turbine.services.pool.PoolService

            {
            }
        }

        // Failed, use the Pool Service instead.
        PoolService pool = (PoolService)
            TurbineServices.getInstance().getService(PoolService.SERVICE_NAME);
        pool.putInstance(data);
    }
View Full Code Here

Examples of org.apache.turbine.services.pool.PoolService

     * @param data a RunData instance
     */
    private void populateWithRequestTools(Context context, RunData data)
    {
        // Get the PoolService to fetch object instances from
        PoolService pool = (PoolService)
            TurbineServices.getInstance().getService(PoolService.SERVICE_NAME);

        // Iterate the tools
        Iterator it = requestTools.iterator();
        while (it.hasNext())
        {
            ToolData toolData = (ToolData)it.next();
            try
            {
                Object tool = pool.getInstance(toolData.toolClass);
                if (tool instanceof ApplicationTool)
                {
                    // request tools are init'd with a RunData object
                    ((ApplicationTool)tool).init(data);
                }
View Full Code Here

Examples of org.apache.turbine.services.pool.PoolService

     */
    private void populateWithSessionTools(List tools, Context context,
            RunData data, boolean usePerm)
    {
        // Get the PoolService to fetch object instances from
        PoolService pool = (PoolService)
            TurbineServices.getInstance().getService(PoolService.SERVICE_NAME);

        // Get the current user
        User user = data.getUser();
       
        // Iterate the tools
        Iterator it = tools.iterator();
        while (it.hasNext())
        {
            ToolData toolData = (ToolData)it.next();
            try
            {
                // ensure that tool is created only once for a user
                // by synchronizing against the user object
                synchronized (user)
                {
                    // first try and fetch the tool from the user's
                    // hashtable
                    Object tool = usePerm
                        ? user.getPerm(toolData.toolClassName)
                        : user.getTemp(toolData.toolClassName);
                   
                    if (tool == null)
                    {
                        // if not there, an instance must be fetched from
                        // the pool
                        tool = pool.getInstance(toolData.toolClass);
                        if (tool instanceof ApplicationTool)
                        {
                            // session tools are init'd with the User object
                            ((ApplicationTool)tool).init(user);
                        }
View Full Code Here

Examples of org.apache.turbine.services.pool.PoolService

     * @param context the Velocity Context to release tools from
     */
    public void releaseTools(Context context)
    {
        // Get the PoolService to release object instances to
        PoolService pool = (PoolService)
            TurbineServices.getInstance().getService(PoolService.SERVICE_NAME);
      
        // only the request tools can be released - other scoped
        // tools will have continuing references to them
        releaseTools(context, pool, requestTools);
View Full Code Here

Examples of org.apache.turbine.services.pool.PoolService

        {
            throw new TurbineException("RunTime configuration '" + key + "' is undefined");
        }
       
        // Use the Pool Service for recycling the implementing objects.
        PoolService pool = (PoolService)
            TurbineServices.getInstance().getService(PoolService.SERVICE_NAME);

        TurbineRunData data;
        try
        {
            data = (TurbineRunData) pool.getInstance(cfg[0]);
            data.setParameterParser((ParameterParser) pool.getInstance(cfg[1]));
            data.setCookieParser((CookieParser) pool.getInstance(cfg[2]));
        }
        catch (ClassCastException x)
        {
            throw new TurbineException("RunData configuration '" + key + "' is illegal",x);
        }
View Full Code Here

Examples of org.apache.turbine.services.pool.PoolService

     */
    public boolean putRunData(RunData data)
    {
        if (data instanceof TurbineRunData)
        {
            PoolService pool = (PoolService)
                TurbineServices.getInstance().getService(PoolService.SERVICE_NAME);
            pool.putInstance(((TurbineRunData) data).getParameterParser());
            pool.putInstance(((TurbineRunData) data).getCookieParser());
            return pool.putInstance(data);
        }
        else
        {
            return false;
        }
View Full Code Here

Examples of org.apache.turbine.services.pool.PoolService

     * @param data a RunData instance
     */
    private void populateWithRequestTools(Context context, RunData data)
    {
        // Get the PoolService to fetch object instances from
        PoolService pool = (PoolService)
            TurbineServices.getInstance().getService(PoolService.SERVICE_NAME);

        // Iterate the tools
        Iterator it = requestTools.iterator();
        while (it.hasNext())
        {
            ToolData toolData = (ToolData)it.next();
            try
            {
                Object tool = pool.getInstance(toolData.toolClass);
                if (tool instanceof ApplicationTool)
                {
                    // request tools are init'd with a RunData object
                    ((ApplicationTool)tool).init(data);
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.