paulsp 02/04/14 09:49:09
Modified: src/java/org/apache/jetspeed/modules/actions
JLogoutUser.java
src/java/org/apache/jetspeed/modules/actions/controllers
MultiColumnControllerAction.java
RowColumnControllerAction.java
src/java/org/apache/jetspeed/portal/controllers
VelocityPanedPortletController.java
VelocityPortletController.java
src/java/org/apache/jetspeed/portal/controls
VelocityPortletControl.java
src/java/org/apache/jetspeed/portal/portlets
VelocityPortlet.java
src/java/org/apache/jetspeed/util/template
BaseJetspeedLink.java JetspeedLink.java
JetspeedLinkFactory.java JetspeedTemplateLink.java
TestJetspeedLink.java TestJetspeedLinkFactory.java
Log:
Part of PEID implementation
(Big commit part 1 of 2)
o JetspeedLinkFactory now uses Turbine's Factory Services to instanciate
objects
o TestJetspeedLinkFactory now verify class name created by
JetspeedLinkFactory is the same as one for the tool jlink
o Non default pages, including pages that are not in the user's
PSML tree, can be customize
o Converted some template from $jlink to $jslink
o JLogout now redirect to the home page.
o Removed deprecated stuff from BaseVelocityLink.java and
JetspeedLink.java
o JetspeedTemplateLink.java no longer implements JetspeedLink
o Various test cleanups
o Various import cleanups
Revision Changes Path
1.5 +17 -0
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/JLogoutUser.java
Index: JLogoutUser.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/JLogoutUser.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- JLogoutUser.java 25 Feb 2002 04:38:12 -0000 1.4
+++ JLogoutUser.java 14 Apr 2002 16:49:09 -0000 1.5
@@ -68,8 +68,12 @@
import org.apache.turbine.TurbineConstants;
import org.apache.turbine.om.security.User;
+// Jetspeed Stuff
import org.apache.jetspeed.services.resources.JetspeedResources;
import org.apache.jetspeed.services.JetspeedSecurity;
+import org.apache.jetspeed.util.template.JetspeedLink;
+import org.apache.jetspeed.util.template.JetspeedLinkFactory;
+
/**
@@ -137,6 +141,7 @@
*/
protected void LogoutUser(RunData data) throws Exception
{
+ JetspeedLink jsLink = null;
User user = data.getUser();
if ( user != null )
@@ -174,8 +179,20 @@
if (!JetspeedResources.getString(TurbineConstants.ACTION_LOGOUT, "")
.equals("LogoutUser"))
{
+ // FIXME: Do we need this setScreen() ?
data.setScreen(JetspeedResources.getString(
TurbineConstants.SCREEN_HOMEPAGE));
+
+ try
+ {
+ jsLink = JetspeedLinkFactory.getInstance(data);
+ } catch (Exception e)
+ {
+ Log.error(e);
+ }
+ data.setRedirectURI(jsLink.getHomePage().toString());
+ JetspeedLinkFactory.putInstance(jsLink);
+ jsLink = null;
}
}
1.11 +24 -12
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controllers/MultiColumnControllerAction.java
Index: MultiColumnControllerAction.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controllers/MultiColumnControllerAction.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- MultiColumnControllerAction.java 1 Apr 2002 18:05:57 -0000 1.10
+++ MultiColumnControllerAction.java 14 Apr 2002 16:49:09 -0000 1.11
@@ -54,14 +54,7 @@
package org.apache.jetspeed.modules.actions.controllers;
-import org.apache.jetspeed.portal.Portlet;
-import org.apache.jetspeed.portal.PortletSet;
-import org.apache.jetspeed.portal.PortletController;
-import org.apache.jetspeed.portal.PortletControllerConfig;
-import org.apache.jetspeed.portal.PanedPortletController;
-import org.apache.jetspeed.services.rundata.JetspeedRunData;
-import org.apache.jetspeed.services.Registry;
-import org.apache.jetspeed.services.resources.JetspeedResources;
+// Jetspeed stuff
import org.apache.jetspeed.om.profile.Profile;
import org.apache.jetspeed.om.registry.PortletEntry;
import org.apache.jetspeed.om.profile.Portlets;
@@ -71,17 +64,26 @@
import org.apache.jetspeed.om.profile.Parameter;
import org.apache.jetspeed.om.profile.psml.PsmlParameter;
import org.apache.jetspeed.om.profile.psml.PsmlLayout;
+import org.apache.jetspeed.portal.Portlet;
+import org.apache.jetspeed.portal.PortletSet;
+import org.apache.jetspeed.portal.PortletController;
+import org.apache.jetspeed.portal.PortletControllerConfig;
+import org.apache.jetspeed.portal.PanedPortletController;
+import org.apache.jetspeed.services.rundata.JetspeedRunData;
+import org.apache.jetspeed.services.Registry;
+import org.apache.jetspeed.services.resources.JetspeedResources;
+import org.apache.jetspeed.util.template.JetspeedLink;
+import org.apache.jetspeed.util.template.JetspeedLinkFactory;
// Turbine stuff
-import org.apache.turbine.util.DynamicURI;
import org.apache.turbine.util.Log;
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.StringUtils;
-import org.apache.turbine.services.template.TurbineTemplate;
// Velocity Stuff
import org.apache.velocity.context.Context;
+// Java stuff
import java.util.ArrayList;
import java.util.Collections;
import java.util.Vector;
@@ -92,7 +94,7 @@
import java.util.HashMap;
import java.util.StringTokenizer;
-/**
+/**9
* This action builds a context suitable for controllers handling
* grid positioned layout using PortletSet.Constraints
*
@@ -342,6 +344,7 @@
*/
public void doCancel(RunData data, Context context)
{
+ JetspeedLink jsLink = null;
data.getUser().removeTemp("columns");
((JetspeedRunData)data).setCustomized(null);
@@ -350,7 +353,16 @@
((JetspeedRunData)data).setMode("default");
// bring logged on user to homepage via HTTP redirect
- data.setRedirectURI(new DynamicURI(data).toString());
+ try
+ {
+ jsLink = JetspeedLinkFactory.getInstance(data);
+ } catch (Exception e)
+ {
+ Log.error(e);
+ }
+ data.setRedirectURI(jsLink.toString());
+ JetspeedLinkFactory.putInstance(jsLink);
+ jsLink = null;
}
}
1.12 +24 -9
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controllers/RowColumnControllerAction.java
Index: RowColumnControllerAction.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controllers/RowColumnControllerAction.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- RowColumnControllerAction.java 1 Apr 2002 18:05:57 -0000 1.11
+++ RowColumnControllerAction.java 14 Apr 2002 16:49:09 -0000 1.12
@@ -54,6 +54,14 @@
package org.apache.jetspeed.modules.actions.controllers;
+//Jetspeed Stuff
+import org.apache.jetspeed.om.profile.Profile;
+import org.apache.jetspeed.om.registry.RegistryEntry;
+import org.apache.jetspeed.om.profile.Portlets;
+import org.apache.jetspeed.om.profile.Entry;
+import org.apache.jetspeed.om.profile.MetaInfo;
+import org.apache.jetspeed.om.profile.Layout;
+import org.apache.jetspeed.om.profile.psml.PsmlLayout;
import org.apache.jetspeed.portal.PortletSet;
import org.apache.jetspeed.portal.Portlet;
import org.apache.jetspeed.portal.PortletController;
@@ -62,17 +70,12 @@
import org.apache.jetspeed.services.Registry;
import org.apache.jetspeed.services.resources.JetspeedResources;
import org.apache.jetspeed.services.rundata.JetspeedRunData;
-import org.apache.jetspeed.om.profile.Profile;
-import org.apache.jetspeed.om.registry.RegistryEntry;
-import org.apache.jetspeed.om.profile.Portlets;
-import org.apache.jetspeed.om.profile.Entry;
-import org.apache.jetspeed.om.profile.MetaInfo;
-import org.apache.jetspeed.om.profile.Layout;
-import org.apache.jetspeed.om.profile.psml.PsmlLayout;
import org.apache.jetspeed.util.AutoProfile;
+import org.apache.jetspeed.util.template.JetspeedLink;
+import org.apache.jetspeed.util.template.JetspeedLinkFactory;
// Turbine stuff
-import org.apache.turbine.util.DynamicURI;
+//import org.apache.turbine.util.DynamicURI;
import org.apache.turbine.util.Log;
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.StringUtils;
@@ -81,6 +84,7 @@
// Velocity Stuff
import org.apache.velocity.context.Context;
+// Java stuff
import java.util.Vector;
import java.util.List;
import java.util.StringTokenizer;
@@ -95,6 +99,7 @@
* sorted lists of portlets
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Paul Spencer</a>
*/
public class RowColumnControllerAction extends VelocityControllerAction
{
@@ -286,6 +291,7 @@
*/
public void doCancel(RunData data, Context context)
{
+ JetspeedLink jsLink = null;
((JetspeedRunData)data).setCustomized(null);
if (((JetspeedRunData)data).getCustomized() == null)
@@ -293,7 +299,16 @@
((JetspeedRunData)data).setMode("default");
// bring logged on user to homepage via HTTP redirect
- data.setRedirectURI(new DynamicURI(data).toString());
+ try
+ {
+ jsLink = JetspeedLinkFactory.getInstance(data);
+ } catch (Exception e)
+ {
+ Log.error(e);
+ }
+ data.setRedirectURI(jsLink.toString());
+ JetspeedLinkFactory.putInstance(jsLink);
+ jsLink = null;
}
}
1.5 +17 -8
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controllers/VelocityPanedPortletController.java
Index: VelocityPanedPortletController.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controllers/VelocityPanedPortletController.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- VelocityPanedPortletController.java 9 Mar 2002 06:29:17 -0000 1.4
+++ VelocityPanedPortletController.java 14 Apr 2002 16:49:09 -0000 1.5
@@ -55,13 +55,16 @@
package org.apache.jetspeed.portal.controllers;
// Turbine stuff
-import org.apache.turbine.util.RunData;
import org.apache.turbine.util.DynamicURI;
+import org.apache.turbine.util.Log;
+import org.apache.turbine.util.RunData;
// Jetspeed stuff
import org.apache.jetspeed.portal.Portlet;
import org.apache.jetspeed.portal.PanedPortletController;
import org.apache.jetspeed.util.MetaData;
+import org.apache.jetspeed.util.template.JetspeedLink;
+import org.apache.jetspeed.util.template.JetspeedLinkFactory;
/**
* A Velocity based portlet controller implementation that can be used
@@ -71,7 +74,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
*
- * @version $Id: VelocityPanedPortletController.java,v 1.4 2002/03/09 06:29:17
taylor Exp $
+ * @version $Id: VelocityPanedPortletController.java,v 1.5 2002/04/14 16:49:09
paulsp Exp $
*/
public class VelocityPanedPortletController extends VelocityPortletController
@@ -142,12 +145,18 @@
*/
public DynamicURI getPortletURI( Portlet portlet, RunData rundata )
{
- DynamicURI uri = new DynamicURI( rundata );
-
- // is this necessary?
- uri.removeQueryData( getPaneParameter() );
-
- uri.addQueryData( getPaneParameter(), portlet.getID() );
+ JetspeedLink jsLink = null;
+ try
+ {
+ jsLink = JetspeedLinkFactory.getInstance(rundata);
+ }
+ catch( Exception e)
+ {
+ Log.error( e );
+ }
+ DynamicURI uri = jsLink.setPaneById(portlet.getID());
+ JetspeedLinkFactory.putInstance(jsLink);
+
return uri;
}
1.8 +4 -4
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controllers/VelocityPortletController.java
Index: VelocityPortletController.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controllers/VelocityPortletController.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- VelocityPortletController.java 11 Mar 2002 07:22:11 -0000 1.7
+++ VelocityPortletController.java 14 Apr 2002 16:49:09 -0000 1.8
@@ -55,10 +55,11 @@
package org.apache.jetspeed.portal.controllers;
// Turbine stuff
-import org.apache.turbine.util.RunData;
+import org.apache.turbine.modules.ActionLoader;
import org.apache.turbine.services.velocity.TurbineVelocity;
import org.apache.turbine.services.pull.TurbinePull;
-import org.apache.turbine.modules.ActionLoader;
+import org.apache.turbine.util.Log;
+import org.apache.turbine.util.RunData;
// Jetspeed stuff
import org.apache.jetspeed.portal.Portlet;
@@ -71,7 +72,6 @@
// Velocity Stuff
import org.apache.velocity.context.Context;
-import org.apache.turbine.util.Log;
/**
* A Velocity based portlet controller implementation
@@ -79,7 +79,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Roberto Carrasco</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
*
- * @version $Id: VelocityPortletController.java,v 1.7 2002/03/11 07:22:11 taylor
Exp $
+ * @version $Id: VelocityPortletController.java,v 1.8 2002/04/14 16:49:09 paulsp
Exp $
*/
public class VelocityPortletController extends AbstractPortletController
{
1.15 +17 -7
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/VelocityPortletControl.java
Index: VelocityPortletControl.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/VelocityPortletControl.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- VelocityPortletControl.java 29 Mar 2002 20:12:32 -0000 1.14
+++ VelocityPortletControl.java 14 Apr 2002 16:49:09 -0000 1.15
@@ -59,7 +59,6 @@
import org.apache.turbine.services.pull.TurbinePull;
import org.apache.turbine.util.Log;
import org.apache.turbine.util.RunData;
-import org.apache.turbine.util.RelativeDynamicURI;
// Jetspeed stuff
import org.apache.jetspeed.portal.Portlet;
@@ -72,6 +71,8 @@
import org.apache.jetspeed.services.rundata.JetspeedRunData;
import org.apache.jetspeed.util.MimeType;
import org.apache.jetspeed.util.template.JetspeedTool;
+import org.apache.jetspeed.util.template.JetspeedLink;
+import org.apache.jetspeed.util.template.JetspeedLinkFactory;
// Ecs stuff
import org.apache.ecs.ConcreteElement;
@@ -105,7 +106,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Roberto Carrasco</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
*
- * @version $Id: VelocityPortletControl.java,v 1.14 2002/03/29 20:12:32 taylor Exp $
+ * @version $Id: VelocityPortletControl.java,v 1.15 2002/04/14 16:49:09 paulsp Exp $
*
*/
public class VelocityPortletControl extends AbstractPortletControl
@@ -193,6 +194,7 @@
protected List buildActionList( RunData rundata, Portlet portlet )
{
List actions = new Vector();
+ JetspeedLink jsLink = null;
JetspeedRunData jdata = (JetspeedRunData)rundata;
// list the available actiosn for this portlet
@@ -262,11 +264,19 @@
{
PortletAction action = (PortletAction)i.next();
- // FIXME: RelativeDynamicURI should be replaced by JetspeedTemplateLink
- action.setLink( new RelativeDynamicURI( rundata )
- .addQueryData("action", getAction( action.getName()
) )
- .addQueryData("js_peid", portlet.getID() )
- .toString() );
+ try
+ {
+ jsLink = JetspeedLinkFactory.getInstance(rundata);
+ }
+ catch( Exception e)
+ {
+ Log.error( e );
+ }
+ action.setLink( jsLink.setPortletById(portlet.getID())
+ .addQueryData("action", getAction(
action.getName()))
+ .toString());
+ JetspeedLinkFactory.putInstance(jsLink);
+ jsLink=null;
}
return actions;
1.16 +5 -6
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/VelocityPortlet.java
Index: VelocityPortlet.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/VelocityPortlet.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- VelocityPortlet.java 9 Apr 2002 04:36:35 -0000 1.15
+++ VelocityPortlet.java 14 Apr 2002 16:49:09 -0000 1.16
@@ -168,15 +168,14 @@
//We need to initialize the jlink tool with ourselves to
// enable links between portlets.
+ // FIXME: the tool jlink is deprecated.
Object jlink = context.get( "jlink" );
+ if (jlink instanceof JetspeedTemplateLink )
+ ((JetspeedTemplateLink)jlink).setPortlet( this );
+
+ Object jslink = context.get( "jslink" );
if (jlink instanceof JetspeedLink )
((JetspeedLink)jlink).setPortlet( this );
- else
- {
- // FIXME: This is to be deprecated
- if (jlink instanceof JetspeedTemplateLink )
- ((JetspeedTemplateLink)jlink).setPortlet( this );
- }
String actionName = getPortletConfig().getInitParameter("action");
1.4 +142 -195
jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/BaseJetspeedLink.java
Index: BaseJetspeedLink.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/BaseJetspeedLink.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BaseJetspeedLink.java 13 Apr 2002 22:05:18 -0000 1.3
+++ BaseJetspeedLink.java 14 Apr 2002 16:49:09 -0000 1.4
@@ -87,7 +87,7 @@
* rendering code. This is done currently in VelocityPortlet.</p>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Paul Spencer</a>
- * @version $Id: BaseJetspeedLink.java,v 1.3 2002/04/13 22:05:18 paulsp Exp $
+ * @version $Id: BaseJetspeedLink.java,v 1.4 2002/04/14 16:49:09 paulsp Exp $
*/
public class BaseJetspeedLink implements ApplicationTool, JetspeedLink
{
@@ -108,21 +108,15 @@
* for performance reasons.
*/
private Profile profile = null;
+
/**
- * @deprecated Use JetspeedResources.PATH_PANEL_KEY. This is a from
JetspeedTemplateLink
- */
- public static final String PANEL_KEY = "select-panel";
- /**
- * @deprecated Use JetspeedResources.PATH_ACTION_KEY. This is a from
JetspeedTemplateLink
- */
- public static final String ACTION_KEY = "action";
- /**
- * @deprecated JetspeedResources.PATH_PORTLET_KEY. This is a from
JetspeedTemplateLink
+ * Has the initialization for the current rundata been performed?. This is
+ * here for performance reasons.
*/
- public static final String PORTLET_KEY = "portlet";
+ private boolean initDone = false;
+
/**
*<p>The portlet that will be used to build the reference.</p>
- * @deprecated This is a from JetspeedTemplateLink
*/
protected Portlet activePortlet = null;
@@ -168,6 +162,8 @@
*/
public DynamicURI setPortalElement(String peid)
{
+ if (initDone == false)
+ initLink();
if (profile.getDocument().getEntryById( peid) != null)
return setPortletById( peid);
else
@@ -178,7 +174,6 @@
* Return an link to a specific portlet using the portet's id
*
* @param peid of the portlet
- * @throws ProfileException if the profile detects an error
* @return DynamicURI to specific portlet
*/
public DynamicURI setPortletById(String peid)
@@ -191,17 +186,108 @@
return uri;
} catch (ProfileException e)
{
- e.printStackTrace();
+ Log.error(e);
return null;
}
}
/**
+ * Return link to the home page without user,
+ * page, group, or role refrenances
+ *
+ * @return DynamicURI to the home page
+ */
+ public DynamicURI getHomePage()
+ {
+ return new DynamicURI( rundata);
+ }
+
+ /**
+ * Return a link that includes the template
+ * from rundata
+ *
+ * @return DynamicURI to template
+ */
+ public DynamicURI getTemplate()
+ {
+ try
+ {
+ DynamicURI uri = getRoot();
+ // Add current template to URI, if their is one
+ String template = rundata.getRequestedTemplate();
+ if (template != null)
+ uri.addPathInfo( JetspeedResources.PATH_TEMPLATE_KEY, template);
+ return uri;
+ } catch (ProfileException e)
+ {
+ Log.error(e);
+ return null;
+ }
+ }
+
+ /**
+ * Return a link to the template.
+ *
+ * @param template to add to link
+ * @return DynamicURI to specific portlet
+ */
+ public DynamicURI setTemplate(String template)
+ {
+ try
+ {
+ DynamicURI uri = getRoot();
+ // Add current template to URI, if their is one
+ if (template != null)
+ uri.addPathInfo( JetspeedResources.PATH_TEMPLATE_KEY, template);
+ return uri;
+ } catch (ProfileException e)
+ {
+ Log.error(e);
+ return null;
+ }
+ }
+
+ /**
+ * Return a link that includes an action
+ *
+ * @param action Desired action
+ * @return DynamicURI that includes the desire action
+ */
+ public DynamicURI setAction(String action)
+ {
+ try
+ {
+ DynamicURI uri = getRoot();
+ // Add current template to URI, if their is one
+ if (action != null)
+ uri.addPathInfo( JetspeedResources.PATH_ACTION_KEY, action);
+ return uri;
+ } catch (ProfileException e)
+ {
+ Log.error(e);
+ return null;
+ }
+ }
+
+ /**
+ * Return a link to a desired page in for the
+ * current user, group, or role.
+ * @param page Desired page
+ * @return DynamicURI that to the desired page
+ */
+ public DynamicURI setPage(String page)
+ {
+ DynamicURI uri = new DynamicURI( rundata);
+ if (page != null)
+ uri.addPathInfo( JetspeedResources.PATH_TEMPLATE_KEY, page);
+ return uri;
+ }
+
+ /**
* Return a link to a specific pane using the pane's id
*
* @param paneId of the Pane
- * @throws ProfileException if the profile detects an error
- * @return URI to specific portlet
+ * @return URI to specific portlet
*/
public DynamicURI setPaneById(String paneId)
{
@@ -213,12 +299,33 @@
return uri;
} catch (ProfileException e)
{
- e.printStackTrace();
+ Log.error(e);
return null;
}
}
- /**
+ private void initLink()
+ {
+ if (initDone == true)
+ return;
+
+ try
+ {
+ profile = Profiler.getProfile(rundata);
+ } catch (ProfileException e)
+ {
+ Log.error(e);
+ }
+ if (profile != null)
+ {
+ // Get ProfileLocator for path info.
+ if ((profile instanceof ProfileLocator) == true)
+ locator = (ProfileLocator) profile;
+ }
+ initDone = true;
+ }
+
+ /**
* Return a link to the root portlet or pane
*
* @throws ProfileException if the profile detects an error
@@ -227,25 +334,14 @@
private DynamicURI getRoot() throws ProfileException
{
DynamicURI uri = null;
- if (profile == null)
- profile = Profiler.getProfile(rundata);
- if ((locator == null) && (profile != null))
- {
- // Get ProfileLocator for path info.
- if ((profile instanceof ProfileLocator) == true)
- locator = (ProfileLocator) profile;
- }
+ if (initDone == false)
+ initLink();
if (locator != null)
uri = Profiler.makeDynamicURI(rundata, locator);
if (uri == null)
uri = new DynamicURI( rundata);
-
- // Add current template to URI, if their is one
- String template = rundata.getRequestedTemplate();
- if (template != null)
- uri.addPathInfo( JetspeedResources.PATH_TEMPLATE_KEY, template);
-
+
return uri;
}
@@ -261,7 +357,7 @@
return getRoot().toString();
} catch (ProfileException e)
{
- e.printStackTrace();
+ Log.error(e);
return null;
}
}
@@ -300,178 +396,28 @@
/**
* Add a portlet reference in the link.
*
- * This method is from JetspeedTemplateLink and is only here
- * for backward compatibility. This it should not be used for
- * any new development. Also any problems with this method will
- * not be fixed
- *
- * @param portlet the name of the portlet to link to
- * @deprecated the name is confusing. Use @see(#forPortletById()) instead.
- * @return a DynamicURI referencing the named portlet for easy link
construction in template
- */
- public DynamicURI setPortlet(String portlet)
- {
- return this.forPortlet( portlet );
- }
-
- /**
- * Add a portlet reference in the link.
- *
- * This method is from JetspeedTemplateLink and is only here
- * for backward compatibility. This it should not be used for
- * any new development. Also any problems with this method will
- * not be fixed
+ * Note: This must be used with caution, since a portlet may exist may times
+ * in a PSML. setPortletById() is the perfered method.
*
- * @param portlet the name of the portlet to link to
- * @deprecated Use @see(#forPortletById()) instead.
+ * @param portletName the name of the portlet to link to
* @return a DynamicURI referencing the named portlet for easy link
construction in template
*/
- public DynamicURI forPortlet(String portlet)
- {
- try
- {
- DynamicURI uri = getRoot();
- if ((portlet != null) && (portlet.length() > 0))
- uri.addPathInfo(JetspeedResources.PATH_PORTLET_KEY, portlet);
- return uri;
- } catch ( ProfileException e)
- {
- return null;
- }
- }
-
- /**
- * Add a select-panel reference in the link
- *
- * This method is from JetspeedTemplateLink and is only here
- * for backward compatibility. This it should not be used for
- * any new development. Also any problems with this method will
- * not be fixed
- *
- * @param portlet the name of the portlet to link to
- * @deprecated Use @see(#forPaneById()) instead.
- * @return a self reference for easy link construction in template
- */
- public DynamicURI setPanel(String panel)
- {
- PortletController controller =
activePortlet.getPortletConfig().getPortletSet().getController();
-
- String id = null;
-
- if (controller instanceof PanedPortletController)
- {
- PortletSet set = controller.getPortlets();
- Portlet portlet = null;
- if (null != set)
- {
- portlet = set.getPortletByName(panel);
- }
- if (portlet != null)
- id = portlet.getID();
- }
-
- try
- {
- DynamicURI uri = getRoot();
- if ((id != null) && (id.length() > 0))
- uri.addPathInfo(JetspeedResources.PATH_PANEID_KEY, id);
- return uri;
- } catch ( ProfileException e)
- {
- return null;
- }
- }
-
- /**
- * <p>Use the activePortlet to get the current Panel name (key).</p>
- *
- * This method is from JetspeedTemplateLink and is only here
- * for backward compatibility. This it should not be used for
- * any new development. Also any problems with this method will
- * not be fixed
- *
- * @deprecated Use @see(#forPaneById()) instead.
- * @return the panel parameter name
- */
- public String getPanelKey()
+ public DynamicURI setPortletName(String portletName)
{
- String panelName = PANEL_KEY;
+ DynamicURI uri=null;
try
{
- PortletController controller = activePortlet.getPortletConfig()
- .getPortletSet()
- .getController();
-
- if (controller instanceof PanedPortletController)
- {
- panelName=((PanedPortletController)controller).getParameterName();
- }
-
- }
- catch (Exception e)
- {
- panelName = PANEL_KEY;
- }
-
- return panelName;
- }
-
- /**
- * Return a link to the root portlet or pane with additional
- * item on the path.
- *
- * This method is from JetspeedTemplateLink and is only here
- * for backward compatibility. This it should not be used for
- * any new development. Also any problems with this method will
- * not be fixed.
- *
- * @param name of item to add to the path
- * @param value of item to add to the path
- * @deprecated
- * @throws ProfileException if the profile detects an error
- * @return DynamicURI to specific portlet
- */
- public DynamicURI addPathInfo(String name, Object value)
- {
- try
- {
- DynamicURI uri = getRoot();
- return uri.addPathInfo( name, value);
- } catch (ProfileException e)
+ uri = getRoot();
+ } catch (Exception e)
{
- e.printStackTrace();
- return null;
- }
- }
-
- /**
- * Return a link to the root portlet or pane with an additional
- * query item on the path
- *
- * This method is from JetspeedTemplateLink and is only here
- * for backward compatibility. This it should not be used for
- * any new development. Also any problems with this method will
- * not be fixed.
- *
- * @param name of item to add to the path
- * @param value of item to add to the path
- * @throws ProfileException if the profile detects an error
- * @deprecated
- * @return DynamicURI to specific portlet
- */
- public DynamicURI addQueryData( String name, Object value )
- {
- try
- {
- DynamicURI uri = getRoot();
- return uri.addQueryData( name, value);
- } catch (ProfileException e)
- {
- e.printStackTrace();
+ Log.error(e);
return null;
}
+ if ((portletName != null) && (portletName.length() > 0))
+ uri.addPathInfo(JetspeedResources.PATH_PORTLET_KEY, portletName);
+ return uri;
}
-
+
/**
* Methods required by ApplictionTool interface
*
@@ -494,6 +440,7 @@
this.rundata = null;
profile = null;
locator = null;
+ initDone = false;
return;
}
/**
1.4 +44 -80
jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/JetspeedLink.java
Index: JetspeedLink.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/JetspeedLink.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JetspeedLink.java 13 Apr 2002 08:24:44 -0000 1.3
+++ JetspeedLink.java 14 Apr 2002 16:49:09 -0000 1.4
@@ -71,7 +71,7 @@
* rendering code. This is done currently in VelocityPortlet.</p>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Paul Spencer</a>
- * @version $Id: JetspeedLink.java,v 1.3 2002/04/13 08:24:44 paulsp Exp $
+ * @version $Id: JetspeedLink.java,v 1.4 2002/04/14 16:49:09 paulsp Exp $
*/
public interface JetspeedLink
{
@@ -84,6 +84,45 @@
public void init(RunData rundata);
/**
+ * Return link to the home page without user,
+ * page, group, or role refrenances
+ *
+ * @return DynamicURI to the home page
+ */
+ public DynamicURI getHomePage();
+
+ /**
+ * Return a link that includes the template
+ * from rundata
+ *
+ * @return DynamicURI to template
+ */
+ public DynamicURI getTemplate();
+
+ /**
+ * Return a link that includes an action
+ *
+ * @param action Desired action
+ * @return DynamicURI that includes the desire action
+ */
+ public DynamicURI setAction(String action);
+
+ /**
+ * Return a link to a desired page in for the
+ * current user, group, or role.
+ * @param page Desired page
+ * @return DynamicURI that to the desired page
+ */
+ public DynamicURI setPage(String page);
+ /**
+ * Return a link to the template.
+ *
+ * @param template to add to link
+ * @return DynamicURI to specific portlet
+ */
+ public DynamicURI setTemplate(String template);
+
+ /**
* Return an link to a specific portal element
*
* @param peid of the portal element
@@ -134,7 +173,6 @@
* not be fixed
*
* @param portlet the name of the active portlet
- * @deprecated the name is confusing. Use @see(#forPaneById()) instead.
*/
public void setPortlet(Portlet portlet);
@@ -142,87 +180,13 @@
/**
* Add a portlet reference in the link.
*
- * This method is from JetspeedTemplateLink and is only here
- * for backward compatibility. This it should not be used for
- * any new development. Also any problems with this method will
- * not be fixed
+ * Note: This must be used with caution, since a portlet may exist may times
+ * in a PSML. setPortletById() is the perfered method.
*
- * @param portlet the name of the portlet to link to
- * @deprecated the name is confusing. Use @see(#forPortletById()) instead.
+ * @param portletName the name of the portlet to link to
* @return a DynamicURI referencing the named portlet for easy link
construction in template
*/
- public DynamicURI setPortlet(String portlet);
-
- /**
- * Add a portlet reference in the link.
- *
- * This method is from JetspeedTemplateLink and is only here
- * for backward compatibility. This it should not be used for
- * any new development. Also any problems with this method will
- * not be fixed
- *
- * @param portlet the name of the portlet to link to
- * @deprecated Use @see(#forPortletById()) instead.
- * @return a DynamicURI referencing the named portlet for easy link
construction in template
- */
- public DynamicURI forPortlet(String portlet);
-
- /**
- * Add a select-panel reference in the link
- *
- * This method is from JetspeedTemplateLink and is only here
- * for backward compatibility. This it should not be used for
- * any new development. Also any problems with this method will
- * not be fixed
- *
- * @param portlet the name of the portlet to link to
- * @deprecated Use @see(#forPaneById()) instead.
- * @return a self reference for easy link construction in template
- */
- public DynamicURI setPanel(String panel);
-
- /**
- * <p>Use the activePortlet to get the current Panel name (key).</p>
- *
- * This method is from JetspeedTemplateLink and is only here
- * for backward compatibility. This it should not be used for
- * any new development. Also any problems with this method will
- * not be fixed
- *
- * @deprecated Use @see(#forPaneById()) instead.
- * @return the panel parameter name
- */
- public String getPanelKey();
- /**
- * Return a link to the root portlet or pane with additional
- * item on the path
- *
- * This method is from JetspeedTemplateLink and is only here
- * for backward compatibility. This it should not be used for
- * any new development. Also any problems with this method will
- * not be fixed.
- *
- * @param name of item to add to the path
- * @param value of item to add to the path
- * @return DynamicURI to specific portlet
- */
- public DynamicURI addPathInfo ( String name, Object value );
-
- /**
- * Return a link to the root portlet or pane with additional
- * item on the path
- *
- * This method is from JetspeedTemplateLink and is only here
- * for backward compatibility. This it should not be used for
- * any new development. Also any problems with this method will
- * not be fixed.
- *
- * @param name of item to add to the path
- * @param value of item to add to the path
- * @return DynamicURI to specific portlet
- */
- public DynamicURI addQueryData ( String name, Object value );
-
+ public DynamicURI setPortletName(String portletName);
}
1.2 +20 -15
jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/JetspeedLinkFactory.java
Index: JetspeedLinkFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/JetspeedLinkFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JetspeedLinkFactory.java 13 Apr 2002 08:24:44 -0000 1.1
+++ JetspeedLinkFactory.java 14 Apr 2002 16:49:09 -0000 1.2
@@ -55,12 +55,14 @@
package org.apache.jetspeed.util.template;
// Jetspeed
-import org.apache.jetspeed.util.template.BaseJetspeedLink;
+import org.apache.jetspeed.util.template.JetspeedLink;
import org.apache.jetspeed.services.resources.JetspeedResources;
// Turbine
import org.apache.turbine.util.TurbineException;
+import org.apache.turbine.services.factory.FactoryService;
import org.apache.turbine.services.pool.TurbinePool;
+import org.apache.turbine.services.TurbineServices;
import org.apache.turbine.util.RunData;
/**
@@ -73,11 +75,14 @@
{
/**
* Name of class for JetspeedLink. The class is the same one used
- * by the tool <code>jlink</code>, so the class name is retrieved from
+ * by the tool <code>jslink</code>, so the class name is retrieved from
* the tool's configuration.
*/
- private static String JETSPEEDLINK_CLASSNAME =
JetspeedResources.getString("tool.request.jlink","org.apache.jetspeed.util.template.BaseJetspeedLink");
+ private static String JETSPEEDLINK_CLASSNAME =
JetspeedResources.getString("tool.request.jslink","org.apache.jetspeed.util.template.BaseJetspeedLink");
+ private static FactoryService factoryService = (FactoryService) TurbineServices.
+ getInstance().getService(FactoryService.SERVICE_NAME);
+
/**
* Get an JetspeedLink object. The object may be retreived
* from a pool. If no object is available in the pool, then one will
@@ -86,15 +91,15 @@
* The JetspeedLink's init() should be called to return a valid link.
*
* @throws TurbineException by Turbine's pool service
- * @return JetspeedLink
- */
+ * @return JetspeedLink
+ */
public static JetspeedLink getInstance()
throws TurbineException
{
- JetspeedLink jlink = (JetspeedLink) TurbinePool.getInstance(
JETSPEEDLINK_CLASSNAME);
- if (jlink == null)
- jlink = new BaseJetspeedLink();
- return jlink;
+ JetspeedLink jsLink = (JetspeedLink) TurbinePool.getInstance(
JETSPEEDLINK_CLASSNAME);
+ if (jsLink == null)
+ jsLink = (JetspeedLink)
factoryService.getInstance(JETSPEEDLINK_CLASSNAME);
+ return jsLink;
}
/**
@@ -105,21 +110,21 @@
* @param rundata The request data.
* @throws TurbineException by Turbine's pool service
* @return JetspeedLink
- */
+ */
public static JetspeedLink getInstance( RunData rundata)
throws TurbineException
{
- JetspeedLink jlink = getInstance();
- if (jlink != null)
- jlink.init(rundata);
- return jlink;
+ JetspeedLink jsLink = getInstance();
+ if (jsLink != null)
+ jsLink.init(rundata);
+ return jsLink;
}
/**
* Return an object to the pool
*
* @param jetspeedLink object to return to pool
- */
+ */
public static void putInstance(JetspeedLink jetspeedLink)
{
if (jetspeedLink != null)
1.9 +2 -39
jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/JetspeedTemplateLink.java
Index: JetspeedTemplateLink.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/JetspeedTemplateLink.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- JetspeedTemplateLink.java 13 Apr 2002 08:24:44 -0000 1.8
+++ JetspeedTemplateLink.java 14 Apr 2002 16:49:09 -0000 1.9
@@ -79,12 +79,12 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Santiago Gala</a>
- * @version $Id: JetspeedTemplateLink.java,v 1.8 2002/04/13 08:24:44 paulsp Exp $
+ * @version $Id: JetspeedTemplateLink.java,v 1.9 2002/04/14 16:49:09 paulsp Exp $
*
* @deprecated Use JetspeedBaseLink
*/
public class JetspeedTemplateLink
- extends TemplateLink implements ApplicationTool, JetspeedLink
+ extends TemplateLink implements ApplicationTool
{
// parameter names for the Jetspeed framework elements
@@ -319,43 +319,6 @@
String buf = super.toString();
return buf;
- }
-
-
- /*
- * Part of JetspeedLink interface
- */
- /**
- * Return an link to a specific portal element
- *
- * @param peid of the portal element
- * @return DynamicURI to specific portal element
- */
- public DynamicURI setPortalElement(String peid)
- {
- return addPathInfo("js_peid", peid);
- }
-
- /**
- * Return a link to a specific pane using the pane's id
- *
- * @param paneId of the Pane
- * @return URI to specific portlet
- */
- public DynamicURI setPaneById(String paneId)
- {
- return addPathInfo("js_pane", paneId);
- }
-
- /**
- * Return an link to a specific portlet using the portet's id
- *
- * @param peid of the portlet
- * @return DynamicURI to specific portlet
- */
- public DynamicURI setPortletById(String peid)
- {
- return addPathInfo("js_peid", peid);
}
}
1.4 +19 -19
jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/TestJetspeedLink.java
Index: TestJetspeedLink.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/TestJetspeedLink.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TestJetspeedLink.java 13 Apr 2002 22:05:18 -0000 1.3
+++ TestJetspeedLink.java 14 Apr 2002 16:49:09 -0000 1.4
@@ -93,7 +93,7 @@
* TestJespeedLink
*
* @author <a href="[EMAIL PROTECTED]">Paul Spencer</a>
- * @version $Id: TestJetspeedLink.java,v 1.3 2002/04/13 22:05:18 paulsp Exp $
+ * @version $Id: TestJetspeedLink.java,v 1.4 2002/04/14 16:49:09 paulsp Exp $
*/
public class TestJetspeedLink extends ServletTestCase
{
@@ -160,11 +160,11 @@
TurbinePull.populateContext( context, rundata);
// Verify tool are in the context
- JetspeedLink jlink = (JetspeedLink) context.get("jlink");
- assertNotNull( "Got jlink from context", jlink);
+ JetspeedLink jsLink = (JetspeedLink) context.get("jslink");
+ assertNotNull( "Got jslink from context", jsLink);
// Generate the link
- String link = jlink.toString();
+ String link = jsLink.toString();
System.out.println("Base link = " + link);
assertTrue( "Verifing base Link",
link.startsWith("http://" + TEST_HOST + TEST_CONTEXT + TEST_SERVLET));
@@ -206,11 +206,11 @@
TurbinePull.populateContext( context, rundata);
// Verify tool are in the context
- JetspeedLink jlink = (JetspeedLink) context.get("jlink");
- assertNotNull( "Got jlink from context", jlink);
+ JetspeedLink jsLink = (JetspeedLink) context.get("jslink");
+ assertNotNull( "Got jslink from context", jsLink);
// Generate the link
- String link = jlink.toString();
+ String link = jsLink.toString();
System.out.println("Group link = " + link);
assertTrue( "Verifing group Link",
link.startsWith("http://" + TEST_HOST + TEST_CONTEXT + TEST_SERVLET
+"/group/apache"));
@@ -253,11 +253,11 @@
TurbinePull.populateContext( context, rundata);
// Verify tool are in the context
- JetspeedLink jlink = (JetspeedLink) context.get("jlink");
- assertNotNull( "Got jlink from context", jlink);
+ JetspeedLink jsLink = (JetspeedLink) context.get("jslink");
+ assertNotNull( "Got jslink from context", jsLink);
// Generate the link
- String link = jlink.toString();
+ String link = jsLink.toString();
System.out.println("Page Link = " + link);
assertTrue( "Verifing page Link",
link.startsWith("http://" + TEST_HOST + TEST_CONTEXT + TEST_SERVLET
+"/page/news"));
@@ -298,11 +298,11 @@
TurbinePull.populateContext( context, rundata);
// Verify tool are in the context
- JetspeedLink jlink = (JetspeedLink) context.get("jlink");
- assertNotNull( "Got jlink from context", jlink);
+ JetspeedLink jsLink = (JetspeedLink) context.get("jslink");
+ assertNotNull( "Got jslink from context", jsLink);
// Generate the link
- String link = jlink.toString();
+ String link = jsLink.toString();
System.out.println("Group/Page Link = " + link);
assertTrue( "Verifing group/page Link",
link.startsWith("http://" + TEST_HOST + TEST_CONTEXT + TEST_SERVLET
+"/group/apache/page/news"));
@@ -345,22 +345,22 @@
TurbinePull.populateContext( context, rundata);
// Verify tool are in the context
- JetspeedLink jlink = (JetspeedLink) context.get("jlink");
- assertNotNull( "Got jlink from context", jlink);
+ JetspeedLink jsLink = (JetspeedLink) context.get("jslink");
+ assertNotNull( "Got jslink from context", jsLink);
// Generate the link
- String link = jlink.toString();
+ String link = jsLink.toString();
System.out.println("Group/Page Link = " + link);
// Generate the link from JetspeedLink
jetspeedLink = JetspeedLinkFactory.getInstance(rundata);
System.out.println("Group/Page jetspeedLink = " + jetspeedLink.toString());
- assertEquals( "jlink = jetspeedLink", link, jetspeedLink.toString());
- JetspeedLinkFactory.putInstance(jlink);
+ assertEquals( "jsLink = jetspeedLink", link, jetspeedLink.toString());
+ JetspeedLinkFactory.putInstance(jsLink);
// Make sure 2 calls to toString() return the same value
jetspeedLink = JetspeedLinkFactory.getInstance(rundata);
- assertEquals( "jlink = jetspeedLink", jetspeedLink.toString(),
jetspeedLink.toString());
+ assertEquals( "jsLink = jetspeedLink", jetspeedLink.toString(),
jetspeedLink.toString());
// Generatate and output thre page
TurbineTestUtilities.generatePage(rundata);
1.2 +33 -29
jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/TestJetspeedLinkFactory.java
Index: TestJetspeedLinkFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/TestJetspeedLinkFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestJetspeedLinkFactory.java 13 Apr 2002 22:05:18 -0000 1.1
+++ TestJetspeedLinkFactory.java 14 Apr 2002 16:49:09 -0000 1.2
@@ -65,6 +65,7 @@
import junit.awtui.TestRunner;
// Jetspeed imports
+import org.apache.jetspeed.services.resources.JetspeedResources;
import org.apache.jetspeed.util.template.JetspeedLink;
// Turbine imports
@@ -78,7 +79,7 @@
* TestTurbineCache
*
* @author <a href="[EMAIL PROTECTED]">Paul Spencer</a>
- * @version $Id: TestJetspeedLinkFactory.java,v 1.1 2002/04/13 22:05:18 paulsp Exp $
+ * @version $Id: TestJetspeedLinkFactory.java,v 1.2 2002/04/14 16:49:09 paulsp Exp $
*/
public class TestJetspeedLinkFactory extends TestCase
{
@@ -147,10 +148,13 @@
*/
public void testSimpleGet() throws Exception
{
- JetspeedLink jlink = JetspeedLinkFactory.getInstance();
- System.out.println("Class return by JetspeedLinkFactory: " +
jlink.getClass().getName());
- assertNotNull( "Got JetspeedLink", jlink);
- assertTrue( "jlink instance of JetspeedLink", (jlink instanceof
JetspeedLink));
+ JetspeedLink jsLink = JetspeedLinkFactory.getInstance();
+ System.out.println("Class return by JetspeedLinkFactory: " +
jsLink.getClass().getName());
+ assertNotNull( "Got JetspeedLink", jsLink);
+ assertEquals( "Created class defined by tools.request.jslink"
+ , JetspeedResources.getString("tool.request.jslink"
+ , "org.apache.jetspeed.util.template.BaseJetspeedLink"),
jsLink.getClass().getName());
+ assertTrue( "Class instance of JetspeedLink", (jsLink instanceof
JetspeedLink));
}
/**
@@ -162,40 +166,40 @@
{
PoolService poolService = (PoolService) TurbineServices.
getInstance().getService(PoolService.SERVICE_NAME);
- JetspeedLink jlink = null;
+ JetspeedLink jsLink = null;
int beforeSize;
for (int counter = 0; counter < 10; counter++)
{
- jlink = JetspeedLinkFactory.getInstance();
- assertNotNull( "Get loop - Got JetspeedLink", jlink);
- assertTrue( "Get loop - jlink instance of JetspeedLink", (jlink
instanceof JetspeedLink));
+ jsLink = JetspeedLinkFactory.getInstance();
+ assertNotNull( "Get loop - Got JetspeedLink", jsLink);
+ assertTrue( "Get loop - jsLink instance of JetspeedLink", (jsLink
instanceof JetspeedLink));
}
- String linkClassName = jlink.getClass().getName();
- jlink = null;
+ String linkClassName = jsLink.getClass().getName();
+ jsLink = null;
for (int counter = 0; counter < 10; counter++)
{
- jlink = JetspeedLinkFactory.getInstance();
- assertNotNull( "Get/put loop - Got JetspeedLink", jlink);
- assertTrue( "Get/put loop - jlink instance of JetspeedLink", (jlink
instanceof JetspeedLink));
+ jsLink = JetspeedLinkFactory.getInstance();
+ assertNotNull( "Get/put loop - Got JetspeedLink", jsLink);
+ assertTrue( "Get/put loop - jsLink instance of JetspeedLink", (jsLink
instanceof JetspeedLink));
beforeSize = poolService.getSize( linkClassName);
- JetspeedLinkFactory.putInstance(jlink);
+ JetspeedLinkFactory.putInstance(jsLink);
assertTrue( "Class saved in pool", (beforeSize < poolService.getSize(
linkClassName)));
- jlink = null;
+ jsLink = null;
}
}
public void testFillPool() throws Exception
{
- Stack jlinkStack = new Stack();
- JetspeedLink jlink = null;
+ Stack jsLinkStack = new Stack();
+ JetspeedLink jsLink = null;
PoolService poolService = (PoolService) TurbineServices.
getInstance().getService(PoolService.SERVICE_NAME);
int poolCapacity;
- jlink = JetspeedLinkFactory.getInstance();
- String linkClassName = jlink.getClass().getName();
+ jsLink = JetspeedLinkFactory.getInstance();
+ String linkClassName = jsLink.getClass().getName();
poolCapacity = poolService.getCapacity( linkClassName);
System.out.println("Class Name " + linkClassName);
@@ -204,23 +208,23 @@
// Fill stack with objects
for (int counter = 0; counter < poolCapacity; counter++)
{
- jlink = JetspeedLinkFactory.getInstance();
- assertNotNull( "Get loop - Got JetspeedLink", jlink);
- assertTrue( "Get loop - jlink instance of JetspeedLink", (jlink
instanceof JetspeedLink));
- jlinkStack.push(jlink);
+ jsLink = JetspeedLinkFactory.getInstance();
+ assertNotNull( "Get loop - Got JetspeedLink", jsLink);
+ assertTrue( "Get loop - jsLink instance of JetspeedLink", (jsLink
instanceof JetspeedLink));
+ jsLinkStack.push(jsLink);
}
// Fill up the pool
- while (jlinkStack.empty() == false)
- JetspeedLinkFactory.putInstance( (JetspeedLink) jlinkStack.pop());
+ while (jsLinkStack.empty() == false)
+ JetspeedLinkFactory.putInstance( (JetspeedLink) jsLinkStack.pop());
assertEquals( "Pool is full", poolCapacity,
poolService.getSize(linkClassName));
// Empty pool
for (int counter = 0; counter < poolCapacity; counter++)
{
- jlink = JetspeedLinkFactory.getInstance();
- assertNotNull( "Get loop - Got JetspeedLink", jlink);
- assertTrue( "Get loop - jlink instance of JetspeedLink", (jlink
instanceof JetspeedLink));
+ jsLink = JetspeedLinkFactory.getInstance();
+ assertNotNull( "Get loop - Got JetspeedLink", jsLink);
+ assertTrue( "Get loop - jsLink instance of JetspeedLink", (jsLink
instanceof JetspeedLink));
}
assertEquals( "Pool is empty", 0, poolService.getSize(linkClassName));
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>