cziegeler 2004/06/29 05:12:45
Modified: src/blocks/portal/java/org/apache/cocoon/portal/pluto/om
WebApplicationDefinitionImpl.java
PortletDefinitionRegistryImpl.java
PortletApplicationDefinitionImpl.java
Log:
Partly apply patch #29556: support for IBM WebSphere
Revision Changes Path
1.7 +8 -3
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/pluto/om/WebApplicationDefinitionImpl.java
Index: WebApplicationDefinitionImpl.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/pluto/om/WebApplicationDefinitionImpl.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- WebApplicationDefinitionImpl.java 7 Jun 2004 13:10:41 -0000 1.6
+++ WebApplicationDefinitionImpl.java 29 Jun 2004 12:12:44 -0000 1.7
@@ -236,8 +236,13 @@
return servletMappings;
}
- protected void setContextRoot(String contextPath) {
- this.contextPath = contextPath;
+ protected void setContextRoot(String contextRoot) {
+ // PATCH for IBM WebSphere
+ if (contextRoot != null && contextRoot.endsWith(".war") ) {
+ this.contextPath = contextRoot.substring(0,
contextRoot.length()-4);
+ } else {
+ this.contextPath = contextRoot;
+ }
}
public void setDescriptions(DescriptionSet descriptions) {
1.5 +21 -3
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/pluto/om/PortletDefinitionRegistryImpl.java
Index: PortletDefinitionRegistryImpl.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/pluto/om/PortletDefinitionRegistryImpl.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PortletDefinitionRegistryImpl.java 5 Mar 2004 13:02:15 -0000
1.4
+++ PortletDefinitionRegistryImpl.java 29 Jun 2004 12:12:45 -0000
1.5
@@ -145,9 +145,18 @@
}
String baseWMDir = servletContext.getRealPath("");
+ // BEGIN PATCH for IBM WebSphere
+ if (baseWMDir.endsWith(File.separator)) {
+ baseWMDir = baseWMDir.substring(0, baseWMDir.length()-1);
+ }
+ // END PATCH for IBM WebSphere
int lastIndex = baseWMDir.lastIndexOf(File.separatorChar);
this.contextName = baseWMDir.substring(lastIndex+1);
baseWMDir = baseWMDir.substring(0, lastIndex+1);
+ if ( this.getLogger().isDebugEnabled() ) {
+ this.getLogger().debug("servletContext.getRealPath('') ="+
servletContext.getRealPath(""));
+ this.getLogger().debug("baseWMDir = " + baseWMDir);
+ }
this.load(baseWMDir,mappingPortletXml, mappingWebXml);
} catch (Exception e) {
e.printStackTrace();
@@ -170,9 +179,11 @@
throws Exception {
File f = new File(baseWMDir);
String[] entries = f.list();
- for (int i=0; i<entries.length; i++)
- {
+ for (int i=0; i<entries.length; i++) {
File entry = new File(baseWMDir+entries[i]);
+ if ( this.getLogger().isDebugEnabled() ) {
+ this.getLogger().debug("Searching file: " + entry);
+ }
if (entry.isDirectory()) {
load(baseWMDir, entries[i], portletXMLMapping,
webXMLMapping);
}
@@ -185,6 +196,9 @@
Mapping webXMLMapping)
throws Exception {
String directory =
baseDir+webModule+File.separatorChar+"WEB-INF"+File.separatorChar;
+ if ( this.getLogger().isDebugEnabled() ) {
+ this.getLogger().debug("Searching in directory: " + directory);
+ }
File portletXml = new File(directory+"portlet.xml");
File webXml = new File(directory+"web.xml");
@@ -243,9 +257,13 @@
portletApp.preBuild(structure);
portletApp.postBuild(structure);
+
+ this.getLogger().debug("portlet.xml loaded");
}
this.registry.add( portletApp );
+
+ this.getLogger().debug("Portlet added to registry");
// fill portletsKeyObjectId
final Iterator portlets =
portletApp.getPortletDefinitionList().iterator();
1.3 +66 -54
cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/pluto/om/PortletApplicationDefinitionImpl.java
Index: PortletApplicationDefinitionImpl.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/pluto/om/PortletApplicationDefinitionImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PortletApplicationDefinitionImpl.java 5 Mar 2004 13:02:14 -0000
1.2
+++ PortletApplicationDefinitionImpl.java 29 Jun 2004 12:12:45 -0000
1.3
@@ -34,14 +34,20 @@
*
* @version CVS $Id$
*/
+/**
+ * @author CZiegeler
+ *
+ * To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
public class PortletApplicationDefinitionImpl
extends AbstractSupportSet
implements PortletApplicationDefinition {
protected String GUID;
- protected String appId = null;
- protected String version = null;
+ protected String appId;
+ protected String version;
private ArrayList customPortletMode = new ArrayList();
@@ -51,15 +57,15 @@
private PortletDefinitionListImpl portlets = new
PortletDefinitionListImpl();
- private WebApplicationDefinition webApplication = null;
+ private WebApplicationDefinition webApplication;
- private ObjectID objectId = null;
+ private ObjectID objectId;
- private String contextPath = null;
+ private String contextPath;
- // PortletApplicationDefinition implementation.
-
- /** PUBLIC*/
+ /* (non-Javadoc)
+ * @see org.apache.pluto.om.portlet.PortletApplicationDefinition#getId()
+ */
public ObjectID getId() {
if ( this.objectId == null ) {
this.objectId =
org.apache.cocoon.portal.pluto.om.common.ObjectIDImpl.createFromString(getGUID());
@@ -67,36 +73,45 @@
return this.objectId;
}
- /** PUBLIC*/
+ /* (non-Javadoc)
+ * @see
org.apache.pluto.om.portlet.PortletApplicationDefinition#getVersion()
+ */
public String getVersion() {
return this.version;
}
- /** TODO PUBLIC*/
+ /* (non-Javadoc)
+ * @see
org.apache.pluto.om.portlet.PortletApplicationDefinition#getPortletDefinitionList()
+ */
public PortletDefinitionList getPortletDefinitionList() {
return this.portlets;
}
- /** PUBLIC*/
+ /* (non-Javadoc)
+ * @see
org.apache.pluto.om.portlet.PortletApplicationDefinition#getWebApplicationDefinition()
+ */
public WebApplicationDefinition getWebApplicationDefinition() {
return this.webApplication;
}
- // Support implementation.
-
- public void postLoad(Object parameter) throws Exception
- {
+ /* (non-Javadoc)
+ * @see
org.apache.cocoon.portal.pluto.om.common.Support#postLoad(java.lang.Object)
+ */
+ public void postLoad(Object parameter) throws Exception {
((Support)portlets).postLoad(parameter);
}
- public void preBuild(Object parameter) throws Exception
- {
+ /* (non-Javadoc)
+ * @see
org.apache.cocoon.portal.pluto.om.common.Support#preBuild(java.lang.Object)
+ */
+ public void preBuild(Object parameter)
+ throws Exception {
Vector structure = (Vector)parameter;
String contextRoot = (String)structure.get(0);
WebApplicationDefinition webApplication =
(WebApplicationDefinition)structure.get(1);
Map servletMap = (Map)structure.get(2);
- setContextRoot(contextRoot);
+ this.setContextRoot(contextRoot);
setWebApplicationDefinition(webApplication);
@@ -108,17 +123,23 @@
}
- public void postBuild(Object parameter) throws Exception
- {
+ /* (non-Javadoc)
+ * @see
org.apache.cocoon.portal.pluto.om.common.Support#postBuild(java.lang.Object)
+ */
+ public void postBuild(Object parameter) throws Exception {
}
- public void preStore(Object parameter) throws Exception
- {
+ /* (non-Javadoc)
+ * @see
org.apache.cocoon.portal.pluto.om.common.Support#preStore(java.lang.Object)
+ */
+ public void preStore(Object parameter) throws Exception {
((Support)portlets).preStore(parameter);
}
- public void postStore(Object parameter) throws Exception
- {
+ /* (non-Javadoc)
+ * @see
org.apache.cocoon.portal.pluto.om.common.Support#postStore(java.lang.Object)
+ */
+ public void postStore(Object parameter) throws Exception {
((Support)portlets).postStore(parameter);
}
@@ -147,79 +168,70 @@
return GUID;
}
- private void setContextRoot(String contextRoot)
- {
- this.contextPath = contextRoot;
+ private void setContextRoot(String contextRoot) {
+ // PATCH for IBM WebSphere
+ if (contextRoot != null && contextRoot.endsWith(".war") ) {
+ this.contextPath = contextRoot.substring(0,
contextRoot.length()-4);
+ } else {
+ this.contextPath = contextRoot;
+ }
}
// additional methods.
- public String getAppId()
- {
+ public String getAppId() {
return appId;
}
- public void setAppId(String appId)
- {
+ public void setAppId(String appId) {
this.appId = appId;
}
- public void setVersion(String version)
- {
+ public void setVersion(String version) {
this.version = version;
}
// not yet fully supported:
- public Collection getCustomPortletMode()
- {
+ public Collection getCustomPortletMode() {
return customPortletMode;
}
- public void setCustomPortletMode(Collection customPortletMode)
- {
+ public void setCustomPortletMode(Collection customPortletMode) {
this.customPortletMode = (ArrayList)customPortletMode;
}
- public Collection getCustomPortletState()
- {
+ public Collection getCustomPortletState() {
return customPortletState;
}
- public void setCustomPortletState(Collection customPortletState)
- {
+ public void setCustomPortletState(Collection customPortletState) {
this.customPortletState = (ArrayList)customPortletState;
}
- public Collection getUserAttribute()
- {
+ public Collection getUserAttribute() {
return userAttribute;
}
- public void setUserAttribute(Collection userAttribute)
- {
+ public void setUserAttribute(Collection userAttribute) {
this.userAttribute = (ArrayList)userAttribute;
}
- public Collection getSecurityConstraint()
- {
+ public Collection getSecurityConstraint() {
return securityConstraint;
}
- public void setSecurityConstraint(Collection securityConstraint)
- {
+ public void setSecurityConstraint(Collection securityConstraint) {
this.securityConstraint = (ArrayList)securityConstraint;
}
// additional internal methods
- public Collection getCastorPortlets()
- {
+ public Collection getCastorPortlets() {
return portlets;
}
- protected void setWebApplicationDefinition(WebApplicationDefinition
webApplication)
- {
+ protected void setWebApplicationDefinition(WebApplicationDefinition
webApplication) {
this.webApplication = webApplication;
}