You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by dl...@apache.org on 2005/07/05 23:55:50 UTC
svn commit: r209328 [8/14] - in /portals/jetspeed-2/trunk/components/portal:
src/ src/java/ src/java/org/ src/java/org/apache/
src/java/org/apache/jetspeed/ src/java/org/apache/jetspeed/aggregator/
src/java/org/apache/jetspeed/aggregator/impl/ src/java...
Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/security/impl/PasswordCredentialValveImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/security/impl/PasswordCredentialValveImpl.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/security/impl/PasswordCredentialValveImpl.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/security/impl/PasswordCredentialValveImpl.java Tue Jul 5 14:55:37 2005
@@ -0,0 +1,145 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.security.impl;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.security.auth.Subject;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.pipeline.PipelineException;
+import org.apache.jetspeed.pipeline.valve.AbstractValve;
+import org.apache.jetspeed.pipeline.valve.PageProfilerValve;
+import org.apache.jetspeed.pipeline.valve.ValveContext;
+import org.apache.jetspeed.profiler.ProfileLocator;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.security.PasswordCredential;
+import org.apache.jetspeed.security.SecurityHelper;
+
+/**
+ * PasswordCredentialValve
+ *
+ * @author <a href="mailto:ate@apache.org">Ate Douma</a>
+ * @version $Id: PasswordCredentialValveImpl.java 188530 2005-04-24 12:37:36Z ate $
+ */
+public class PasswordCredentialValveImpl extends AbstractValve implements org.apache.jetspeed.pipeline.valve.PasswordCredentialValve
+{
+ private static final Log log = LogFactory.getLog(PasswordCredentialValveImpl.class);
+
+ private static final String CHECKED_KEY = PasswordCredentialValveImpl.class.getName() + ".checked";
+ //private PageManager pageManager;
+ private int[] expirationWarningDays;
+
+ public PasswordCredentialValveImpl(List expirationWarningDays)
+ {
+ if ( expirationWarningDays != null )
+ {
+ this.expirationWarningDays = new int[expirationWarningDays.size()];
+ for ( int i = 0; i < this.expirationWarningDays.length; i++ )
+ {
+ this.expirationWarningDays[i] = Integer.parseInt((String)expirationWarningDays.get(i));
+ }
+ Arrays.sort(this.expirationWarningDays);
+ }
+ else
+ {
+ this.expirationWarningDays = new int[0];
+ }
+ }
+
+ /**
+ * @see org.apache.jetspeed.pipeline.valve.Valve#invoke(org.apache.jetspeed.request.RequestContext, org.apache.jetspeed.pipeline.valve.ValveContext)
+ */
+ public void invoke(RequestContext request, ValveContext context) throws PipelineException
+ {
+ try
+ {
+ if ( request.getRequest().getUserPrincipal() != null )
+ {
+ Subject subject = request.getSubject();
+ PasswordCredential pwdCredential = SecurityHelper.getPasswordCredential(subject);
+ Integer passwordDaysValid = null;
+
+ // check for an existing password credential
+ if ( pwdCredential != null )
+ {
+ if ( pwdCredential.isUpdateRequired() )
+ {
+ passwordDaysValid = new Integer(0); // required change
+ }
+ if ( request.getSessionAttribute(CHECKED_KEY) == null )
+ {
+ request.setSessionAttribute(CHECKED_KEY,Boolean.TRUE);
+ if ( pwdCredential.getPreviousAuthenticationDate() != null )
+ {
+ long expirationTime = pwdCredential.getExpirationDate().getTime();
+ long lastAuthTime = pwdCredential.getLastAuthenticationDate().getTime();
+ int lastAuthDaysBeforeExpiration = (int)((expirationTime-lastAuthTime)/(24*60*60*1000));
+ if ( lastAuthDaysBeforeExpiration < 1 )
+ {
+ passwordDaysValid = new Integer(1);
+ }
+ else if (expirationWarningDays.length > 0)
+ {
+ long prevAuthTime = Long.MIN_VALUE;
+ if (pwdCredential.getPreviousAuthenticationDate() != null )
+ {
+ prevAuthTime = pwdCredential.getPreviousAuthenticationDate().getTime();
+ }
+ int prevAuthDaysBeforeExpiration = (int)((expirationTime-prevAuthTime)/(24*60*60*1000));
+ if ( prevAuthDaysBeforeExpiration > lastAuthDaysBeforeExpiration )
+ {
+ for ( int i = 0; i < expirationWarningDays.length; i++ )
+ {
+ int daysBefore = expirationWarningDays[i]-1;
+ if ( lastAuthDaysBeforeExpiration == daysBefore ||
+ (lastAuthDaysBeforeExpiration < daysBefore &&
+ prevAuthDaysBeforeExpiration > daysBefore ) )
+ {
+ passwordDaysValid = new Integer(lastAuthDaysBeforeExpiration+1);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if ( passwordDaysValid != null )
+ {
+ // enforce the SECURITY_LOCATOR to be used to redirect to a change password portlet page
+ request.setAttribute(PageProfilerValve.PROFILE_LOCATOR_REQUEST_ATTR_KEY,ProfileLocator.SECURITY_LOCATOR);
+ // inform the change password portlet why it is invoked
+ request.setAttribute(PasswordCredential.PASSWORD_CREDENTIAL_DAYS_VALID_REQUEST_ATTR_KEY, passwordDaysValid);
+ }
+ }
+ context.invokeNext(request);
+ }
+ catch (Exception e)
+ {
+ log.error("Exception in request pipeline: " + e.getMessage(), e);
+ throw new PipelineException(e.toString(), e);
+ }
+ }
+
+ public String toString()
+ {
+ return "PasswordCredentialValve";
+ }
+
+}
Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/security/impl/SecurityValveImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/security/impl/SecurityValveImpl.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/security/impl/SecurityValveImpl.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/security/impl/SecurityValveImpl.java Tue Jul 5 14:55:37 2005
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.security.impl;
+
+import java.security.Principal;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.security.auth.Subject;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.pipeline.valve.SecurityValve;
+import org.apache.jetspeed.profiler.Profiler;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.security.SecurityException;
+import org.apache.jetspeed.security.SecurityHelper;
+import org.apache.jetspeed.security.User;
+import org.apache.jetspeed.security.UserManager;
+import org.apache.jetspeed.security.UserPrincipal;
+
+/**
+ * SecurityValve
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
+ * @author <a href="mailto:rwatler@finali.com">Randy Walter </a>
+ * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
+ * @version $Id: SecurityValveImpl.java 188241 2005-01-21 16:45:20Z weaver $
+ */
+public class SecurityValveImpl extends AbstractSecurityValve implements SecurityValve
+{
+ private static final Log log = LogFactory.getLog(SecurityValveImpl.class);
+ private Profiler profiler;
+ private UserManager userMgr;
+
+ public SecurityValveImpl( Profiler profiler, UserManager userMgr )
+ {
+ this.profiler = profiler;
+ this.userMgr = userMgr;
+ }
+
+ public String toString()
+ {
+ return "SecurityValve";
+ }
+
+ /**
+ *
+ * <p>
+ * getSubject
+ * </p>
+ * Check for previously established session subject and
+ * invalidate if subject and current user principals do
+ * not match
+ * @param request
+ * @return
+ * @throws Exception
+ */
+ protected final Subject getSubject(RequestContext request) throws Exception
+ {
+ HttpSession session = request.getRequest().getSession();
+ Principal userPrincipal = getUserPrincipal(request);
+
+ Subject subject = getSubjectFromSession(request);
+ if (subject != null)
+ {
+ Principal subjectUserPrincipal = SecurityHelper.getPrincipal(subject, UserPrincipal.class);
+ if ((subjectUserPrincipal == null) || !subjectUserPrincipal.getName().equals(getUserPrincipal(request).getName()))
+ {
+ subject = null;
+ }
+ }
+
+ // create new session subject for user principal if required
+ if (subject == null)
+ {
+ // attempt to get complete subject for user principal
+ // from user manager
+ try
+ {
+ User user = userMgr.getUser(userPrincipal.getName());
+ if ( user != null )
+ {
+ subject = user.getSubject();
+ }
+ }
+ catch (SecurityException sex)
+ {
+ subject = null;
+ }
+
+ // if subject not available, generate default subject using
+ // request or default profiler anonymous user principal
+ if (subject == null)
+ {
+ Set principals = new HashSet();
+ principals.add(userPrincipal);
+ subject = new Subject(true, principals, new HashSet(), new HashSet());
+ }
+ }
+
+ return subject;
+ }
+
+ /**
+ *
+ * <p>
+ * getUserPrincipal
+ * </p>
+ * Aaccess request user principal if defined or default
+ * to profiler anonymous user
+ * @param request
+ * @return
+ */
+ protected final Principal getUserPrincipal(RequestContext request)
+ {
+ Principal userPrincipal = request.getRequest().getUserPrincipal();
+ if (userPrincipal == null)
+ {
+ userPrincipal = new UserPrincipalImpl(userMgr.getAnonymousUser());
+ }
+ return userPrincipal;
+ }
+
+}
Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/DynamicInformationProviderImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/DynamicInformationProviderImpl.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/DynamicInformationProviderImpl.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/DynamicInformationProviderImpl.java Tue Jul 5 14:55:37 2005
@@ -0,0 +1,254 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.services.information;
+
+import java.util.Map;
+import java.util.Iterator;
+import java.util.HashSet;
+import java.util.HashMap;
+import java.util.Enumeration;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.http.HttpServletRequest;
+import javax.portlet.WindowState;
+import javax.portlet.PortletMode;
+
+import org.apache.pluto.services.information.DynamicInformationProvider;
+import org.apache.pluto.services.information.PortletActionProvider;
+import org.apache.pluto.services.information.ResourceURLProvider;
+import org.apache.pluto.factory.NamespaceMapperFactory;
+import org.apache.pluto.om.window.PortletWindow;
+import org.apache.pluto.util.NamespaceMapper;
+import org.apache.pluto.services.information.PortletURLProvider;
+import org.apache.jetspeed.container.state.MutableNavigationalState;
+import org.apache.jetspeed.container.state.NavigationalState;
+import org.apache.jetspeed.container.url.PortalURL;
+import org.apache.jetspeed.engine.core.PortletActionProviderImpl;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.request.RequestContextComponent;
+import org.apache.jetspeed.Jetspeed;
+
+/**
+ * Provides dynamic information to Pluto Container:
+ *
+ * 1. getPortletURL
+ * 2. getRequestMimetype
+ * 3. getResponseMimetype
+ * 4. getResponseMimetypes
+ * 5. getPortletMode
+ * 6. getPreviousPortletMode
+ * 7. getWindowState
+ * 8. getPreviousWindowState
+ * 9. isPortletModeAllowed
+ * 10. isWindowStateAllowed
+ * 11. getSupportedPortletModes
+ * 12. getSupportedWindowStates
+ * 13. getAllParameters
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: DynamicInformationProviderImpl.java 188577 2005-05-17 15:57:13Z ate $
+ */
+public class DynamicInformationProviderImpl implements DynamicInformationProvider
+{
+ HttpServletRequest request = null;
+ ServletConfig config = null;
+
+ RequestContext context;
+
+ public DynamicInformationProviderImpl(HttpServletRequest request,
+ ServletConfig config)
+ {
+ this.request = request;
+ this.config = config;
+
+ // TODO: assemble this dependency when this provider is converted to a component
+ RequestContextComponent rcc = (RequestContextComponent)Jetspeed.getComponentManager().getComponent(RequestContextComponent.class);
+ this.context = rcc.getRequestContext(request);
+ }
+
+ public PortletURLProvider getPortletURLProvider(PortletWindow portletWindow)
+ {
+ return new PortletURLProviderImpl(this.context, portletWindow);
+ }
+
+ public String getRequestContentType()
+ {
+ return context.getMimeType().toString();
+ }
+
+ public String getResponseContentType()
+ {
+ return context.getMimeType().toString();
+ }
+
+ public Iterator getResponseContentTypes()
+ {
+ HashSet responseMimeTypes = new HashSet(NumberOfKnownMimetypes);
+ // TODO: need to integrate with capability code
+ responseMimeTypes.add("text/html");
+
+ return responseMimeTypes.iterator();
+ }
+
+ public PortletMode getPortletMode(PortletWindow portletWindow)
+ {
+ NavigationalState navState = context.getPortalURL().getNavigationalState();
+ return navState.getMode(portletWindow);
+ }
+
+ public WindowState getWindowState(PortletWindow portletWindow)
+ {
+ NavigationalState navState = context.getPortalURL().getNavigationalState();
+ return navState.getState(portletWindow);
+ }
+
+ public boolean isPortletModeAllowed(PortletMode mode)
+ {
+ //checks whether PortletMode is supported as example
+ String[] supportedModes = Jetspeed.getContext().getConfiguration().getStringArray("supported.portletmode");
+ for (int i=0; i<supportedModes.length; i++)
+ {
+ if (supportedModes[i].equalsIgnoreCase(mode.toString()))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean isWindowStateAllowed(WindowState state)
+ {
+ //checks whether WindowState is supported as example
+ String[] supportedStates = Jetspeed.getContext().getConfiguration().getStringArray("supported.windowstate");
+ for (int i=0; i<supportedStates.length; i++)
+ {
+ if (supportedStates[i].equalsIgnoreCase(state.toString()))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public java.util.Iterator getSupportedPortletModes()
+ {
+ HashSet set = new HashSet();
+
+ String[] supportedStates = Jetspeed.getContext().getConfiguration().getStringArray("supported.portletmode");
+
+ for (int i=0; i<supportedStates.length; i++)
+ {
+ set.add(supportedStates[i].toString());
+ }
+ return set.iterator();
+
+ }
+
+ public java.util.Iterator getSupportedWindowStates()
+ {
+ HashSet set = new HashSet();
+
+ String[] supportedStates = Jetspeed.getContext().getConfiguration().getStringArray("supported.windowstate");
+
+ for (int i=0; i<supportedStates.length; i++)
+ {
+ set.add(supportedStates[i].toString());
+ }
+ return set.iterator();
+
+ }
+
+ public String getBasePortalURL()
+ {
+ return context.getPortalURL().getBaseURL();
+ }
+
+ /**
+ * this method is deprecated but Im going to keep it around for reference
+ *
+ * @param portletWindow
+ * @deprecated
+ * @return
+ */
+ private Map getAllParameters(PortletWindow portletWindow)
+ {
+ Enumeration parameters = request.getParameterNames();
+
+ Map portletParameters = new HashMap();
+
+ NamespaceMapper namespaceMapper = ((NamespaceMapperFactory) Jetspeed.getComponentManager().getComponent(
+ org.apache.pluto.util.NamespaceMapper.class)).getNamespaceMapper();
+ while (parameters.hasMoreElements())
+ {
+ String name = (String)parameters.nextElement();
+
+ String portletParameter = namespaceMapper.decode(portletWindow.getId(),name);
+
+ if (portletParameter!=null) // it is in the portlet's namespace
+ {
+ portletParameters.put(portletParameter, request.getParameterValues(name) );
+ }
+ }
+
+ PortalURL url = context.getPortalURL();
+
+ Iterator iterator = url.getNavigationalState().getParameterNames(portletWindow);
+ while (iterator.hasNext())
+ {
+ String name = (String)iterator.next();
+
+ String[] values = url.getNavigationalState().getParameterValues(portletWindow, name);
+
+ portletParameters.put(name, values );
+
+ }
+
+ return portletParameters;
+ }
+
+ private final static int NumberOfKnownMimetypes = 15;
+
+
+ /**
+ * <p>
+ * getPortletActionProvider
+ * </p>
+ *
+ * @see org.apache.pluto.services.information.DynamicInformationProvider#getPortletActionProvider(org.apache.pluto.om.window.PortletWindow)
+ * @param arg0
+ * @return
+ */
+ public PortletActionProvider getPortletActionProvider(PortletWindow window)
+ {
+ return new PortletActionProviderImpl((MutableNavigationalState)context.getPortalURL().getNavigationalState(), window);
+ }
+
+ /**
+ * <p>
+ * getResourceURLProvider
+ * </p>
+ *
+ * @see org.apache.pluto.services.information.DynamicInformationProvider#getResourceURLProvider(org.apache.pluto.om.window.PortletWindow)
+ * @param arg0
+ * @return
+ */
+ public ResourceURLProvider getResourceURLProvider(PortletWindow window)
+ {
+
+ return new ResourceURLProviderImpl(this.context, window);
+ }
+
+}
Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/InformationProviderServiceImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/InformationProviderServiceImpl.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/InformationProviderServiceImpl.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/InformationProviderServiceImpl.java Tue Jul 5 14:55:37 2005
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.services.information;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.pluto.factory.Factory;
+import org.apache.pluto.services.information.DynamicInformationProvider;
+import org.apache.pluto.services.information.InformationProviderService;
+import org.apache.pluto.services.information.StaticInformationProvider;
+
+/**
+ * Factory class for getting Information Provider access
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: InformationProviderServiceImpl.java 187159 2004-08-01 15:48:56Z weaver $
+ */
+public class InformationProviderServiceImpl implements Factory, InformationProviderService
+{
+ private javax.servlet.ServletConfig servletConfig;
+ private static final Log log = LogFactory.getLog(InformationProviderServiceImpl.class);
+
+ public void init(javax.servlet.ServletConfig config, java.util.Map properties) throws Exception
+ {
+ servletConfig = config;
+ }
+
+ public StaticInformationProvider getStaticProvider()
+ {
+ javax.servlet.ServletContext context = servletConfig.getServletContext();
+
+ StaticInformationProvider provider =
+ (StaticInformationProvider) context.getAttribute("org.apache.jetspeed.engine.core.StaticInformationProvider");
+
+ if (provider == null)
+ {
+ provider = new StaticInformationProviderImpl(servletConfig);
+ context.setAttribute("org.apache.engine.core.StaticInformationProvider", provider);
+ }
+
+ if (provider != null)
+ {
+ // log.info("Static information provider " + provider.getClass().getName());
+ }
+ else
+ {
+ log.warn("A static information provider has not been defined");
+ }
+
+ return provider;
+ }
+
+ public DynamicInformationProvider getDynamicProvider(javax.servlet.http.HttpServletRequest request)
+ {
+ DynamicInformationProvider provider =
+ (DynamicInformationProvider) request.getAttribute("org.apache.jetspeed.engine.core.DynamicInformationProvider");
+
+ if (provider == null)
+ {
+ provider = new DynamicInformationProviderImpl(request, servletConfig);
+ request.setAttribute("org.apache.jetspeed.engine.core.DynamicInformationProvider", provider);
+ }
+
+ return provider;
+ }
+
+ /**
+ * <p>
+ * destroy
+ * </p>
+ *
+ * @see org.apache.pluto.factory.Factory#destroy()
+ * @throws java.lang.Exception
+ */
+ public void destroy() throws Exception
+ {
+
+ }
+}
Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/PortletURLProviderImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/PortletURLProviderImpl.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/PortletURLProviderImpl.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/PortletURLProviderImpl.java Tue Jul 5 14:55:37 2005
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.services.information;
+
+import java.util.Map;
+
+import javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+
+import org.apache.jetspeed.container.url.PortalURL;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.pluto.om.window.PortletWindow;
+import org.apache.pluto.services.information.PortletURLProvider;
+
+/**
+ * Provides access to the Portal URL manipulation
+ *
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: PortletURLProviderImpl.java 188509 2005-04-21 09:03:32Z ate $
+ */
+public class PortletURLProviderImpl implements PortletURLProvider
+{
+ private PortletWindow portletWindow = null;
+ private PortletMode mode = null;
+ private WindowState state = null;
+ private boolean action = false;
+ private boolean secure = false;
+ private Map parameters = null;
+
+ private PortalURL url;
+
+ public PortletURLProviderImpl(RequestContext context, PortletWindow portletWindow)
+ {
+ this.portletWindow = portletWindow;
+
+ url = context.getPortalURL();
+ }
+
+ public void setPortletMode(PortletMode mode)
+ {
+ this.mode = mode;
+ }
+
+ public void setWindowState(WindowState state)
+ {
+ this.state = state;
+ }
+
+ public void setAction()
+ {
+ action = true;
+ }
+
+ public void setSecure()
+ {
+ secure = true;
+ }
+
+ public void clearParameters()
+ {
+ // not used, handled by JetspeedNavigationalStateCodec itself
+ }
+
+ public void setParameters(Map parameters)
+ {
+ this.parameters = parameters;
+ }
+
+ public String toString()
+ {
+ return url.createPortletURL(portletWindow,parameters,mode,state,action,secure);
+ }
+}
Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/ResourceURLProviderImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/ResourceURLProviderImpl.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/ResourceURLProviderImpl.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/ResourceURLProviderImpl.java Tue Jul 5 14:55:37 2005
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.services.information;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.pluto.om.window.PortletWindow;
+import org.apache.pluto.services.information.ResourceURLProvider;
+
+/**
+ * <p>
+ * ResourceURLProviderImpl
+ * </p>
+ *
+ *
+ * @
+ * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
+ * @version $ $
+ *
+ */
+public class ResourceURLProviderImpl implements ResourceURLProvider
+{
+ private PortletWindow portletWindow = null;
+ private String stringUrl = "";
+ private String base = "";
+ private RequestContext context;
+
+ public ResourceURLProviderImpl(RequestContext context, PortletWindow portletWindow)
+ {
+ this.portletWindow = portletWindow;
+ this.context = context;
+ this.base = context.getPortalURL().getBaseURL();
+ }
+
+ // ResourceURLProvider implementation.
+
+ public void setAbsoluteURL(String path)
+ {
+ stringUrl = path;
+ }
+
+ public void setFullPath(String path)
+ {
+ stringUrl = base + path;
+ }
+
+ public String toString()
+ {
+ URL url = null;
+
+ if (!"".equals(stringUrl))
+ {
+ try
+ {
+ url = new URL(stringUrl);
+ }
+ catch (MalformedURLException e)
+ {
+ throw new java.lang.IllegalArgumentException("A malformed URL has occured");
+ }
+ }
+
+ return ((url == null) ? "" : url.toString());
+
+ }
+
+}
Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/StaticInformationProviderImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/StaticInformationProviderImpl.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/StaticInformationProviderImpl.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/StaticInformationProviderImpl.java Tue Jul 5 14:55:37 2005
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.services.information;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+
+import org.apache.jetspeed.Jetspeed;
+import org.apache.jetspeed.components.portletregistry.PortletRegistry;
+import org.apache.jetspeed.engine.core.PortalContextProviderImpl;
+import org.apache.pluto.om.common.ObjectID;
+import org.apache.pluto.om.portlet.PortletDefinition;
+import org.apache.pluto.services.information.PortalContextProvider;
+import org.apache.pluto.services.information.StaticInformationProvider;
+
+/**
+ * Provides static information to Pluto Container:
+ *
+ * 1. PortletDefinition - given a unique registry id,
+ * retrieve the portlet definition from the portlet registry
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: StaticInformationProviderImpl.java 187887 2004-11-04 18:06:25Z taylor $
+ */
+public class StaticInformationProviderImpl implements StaticInformationProvider
+{
+ private ServletConfig config = null;
+
+ public StaticInformationProviderImpl(ServletConfig config)
+ {
+ this.config = config;
+ }
+
+ /**
+ * Given a unique registry id,
+ * retrieve the portlet definition from the portlet registry
+ *
+ * @param uniqueId The uniquely identifying portlet id in the registry
+ */
+ public PortletDefinition getPortletDefinition(String uniqueId)
+ {
+ PortletRegistry registry =
+ (PortletRegistry) Jetspeed.getComponentManager().getComponent(PortletRegistry.class);
+ return registry.getPortletDefinitionByIdentifier(uniqueId);
+ }
+
+ /**
+ * <p>
+ * getPortalContextProvider
+ * </p>
+ *
+ * @see org.apache.pluto.services.information.StaticInformationProvider#getPortalContextProvider()
+ * @return
+ */
+ public PortalContextProvider getPortalContextProvider()
+ {
+ ServletContext context = config.getServletContext();
+
+ PortalContextProvider provider =
+ (PortalContextProvider) context.getAttribute("org.apache.jetspeed.engine.core.PortalContextProvider");
+
+ if (provider == null)
+ {
+ provider = new PortalContextProviderImpl();
+ context.setAttribute("org.apache.jetspeed.engine.core.PortalContextProvider", provider);
+ }
+
+ return provider;
+ }
+
+ /**
+ * <p>
+ * getPortletDefinition
+ * </p>
+ *
+ * @see org.apache.pluto.services.information.StaticInformationProvider#getPortletDefinition(org.apache.pluto.om.common.ObjectID)
+ * @param arg0
+ * @return
+ */
+ public PortletDefinition getPortletDefinition(ObjectID arg0)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/title/DynamicTitleServiceImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/title/DynamicTitleServiceImpl.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/title/DynamicTitleServiceImpl.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/title/DynamicTitleServiceImpl.java Tue Jul 5 14:55:37 2005
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.services.title;
+
+import java.util.Iterator;
+import java.util.Locale;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.jetspeed.PortalReservedParameters;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.pluto.om.common.ObjectID;
+import org.apache.pluto.om.common.Preference;
+import org.apache.pluto.om.entity.PortletEntity;
+import org.apache.pluto.om.window.PortletWindow;
+import org.apache.pluto.services.title.DynamicTitleService;
+
+
+public class DynamicTitleServiceImpl implements DynamicTitleService
+{
+
+ public void setDynamicTitle(PortletWindow window,
+ HttpServletRequest request, String titleArg)
+ {
+ ObjectID id = window.getPortletEntity().getId();
+ request.setAttribute(
+ PortalReservedParameters.OVERRIDE_PORTLET_TITLE_ATTR
+ + "::entity.id::" + id.toString(), titleArg);
+ }
+
+ protected final String getTitleFromPortletDefinition(PortletWindow window,
+ HttpServletRequest request)
+ {
+ String title = null;
+ RequestContext requestContext = (RequestContext) request
+ .getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
+
+ PortletEntity entity = window.getPortletEntity();
+ if (entity != null && entity.getPortletDefinition() != null)
+ {
+ title = requestContext.getPreferedLanguage(
+ entity.getPortletDefinition()).getTitle();
+ }
+
+ if (title == null && entity.getPortletDefinition() != null)
+ {
+ title = entity.getPortletDefinition().getName();
+ }
+ else if (title == null)
+ {
+ title = "Invalid portlet entity " + entity.getId();
+ }
+
+ return title;
+ }
+
+ protected final String getTitleFromPreference(PortletWindow window,
+ HttpServletRequest request)
+ {
+ Locale locale = request.getLocale();
+ String titleKey = createTitleKey(locale, false);
+
+ Preference titlePref = window.getPortletEntity().getPreferenceSet()
+ .get(titleKey);
+ if (titlePref == null)
+ {
+ titleKey = createTitleKey(locale, true);
+ titlePref = window.getPortletEntity().getPreferenceSet().get(
+ titleKey);
+ }
+
+ if (titlePref != null)
+ {
+ Iterator values = titlePref.getValues();
+ if (values.hasNext())
+ {
+ return (String) titlePref.getValues().next();
+ }
+ }
+
+ return null;
+ }
+
+ public static String createTitleKey(Locale locale, boolean languageOnly)
+ {
+ if(languageOnly)
+ {
+ return "jetspeed.title."+locale.getLanguage();
+ }
+ else
+ {
+ return "jetspeed.title."+locale.toString();
+ }
+ }
+
+}
Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/PortletApplicationException.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/PortletApplicationException.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/PortletApplicationException.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/PortletApplicationException.java Tue Jul 5 14:55:37 2005
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.tools.pamanager;
+
+import org.apache.jetspeed.exception.JetspeedException;
+
+/**
+ * Occurs when anything unexpected happens within the Portlet Application Manager.
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @author <a href="mailto:roger.ruttimann@earthlink.net">Roger Ruttimann</a>
+ * @version $Id: PortletApplicationException.java 185962 2004-03-08 01:03:33Z jford $
+ **/
+
+public class PortletApplicationException extends JetspeedException
+{
+
+ public PortletApplicationException()
+ {
+ super();
+ }
+
+ public PortletApplicationException(String message)
+ {
+ super(message);
+ }
+
+ public PortletApplicationException(Throwable nested)
+ {
+ super(nested);
+ }
+
+ public PortletApplicationException(String msg, Throwable nested)
+ {
+ super(msg, nested);
+ }
+
+
+
+}
+
Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/PortletApplicationManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/PortletApplicationManager.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/PortletApplicationManager.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/PortletApplicationManager.java Tue Jul 5 14:55:37 2005
@@ -0,0 +1,441 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.tools.pamanager;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.jetspeed.components.portletentity.PortletEntityAccessComponent;
+import org.apache.jetspeed.components.portletentity.PortletEntityNotDeletedException;
+import org.apache.jetspeed.components.portletregistry.PortletRegistry;
+import org.apache.jetspeed.components.portletregistry.RegistryException;
+import org.apache.jetspeed.container.window.PortletWindowAccessor;
+import org.apache.jetspeed.factory.PortletFactory;
+import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
+import org.apache.jetspeed.om.common.servlet.MutableWebApplication;
+import org.apache.jetspeed.search.SearchEngine;
+import org.apache.jetspeed.security.RoleManager;
+import org.apache.jetspeed.util.FileSystemHelper;
+import org.apache.jetspeed.util.descriptor.PortletApplicationWar;
+
+import org.apache.pluto.om.common.SecurityRole;
+import org.apache.pluto.om.entity.PortletEntity;
+import org.apache.pluto.om.entity.PortletEntityCtrl;
+import org.apache.pluto.om.portlet.PortletDefinition;
+
+import java.io.IOException;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * PortletApplicationManager
+ *
+ * @author <a href="mailto:ate@douma.nu">Ate Douma</a>
+ * @version $Id: PortletApplicationManager.java,v 1.21 2005/04/09 00:24:44 shinsuke Exp $
+ */
+public class PortletApplicationManager implements PortletApplicationManagement
+{
+ private static final Log log = LogFactory.getLog("deployment");
+ private static final String PORTLET_XML = "WEB-INF/portlet.xml";
+
+ protected PortletEntityAccessComponent entityAccess;
+ protected PortletFactory portletFactory;
+ protected PortletRegistry registry;
+ protected PortletWindowAccessor windowAccess;
+ protected SearchEngine searchEngine;
+ protected RoleManager roleManager;
+ protected boolean autoCreateRoles;
+
+ /**
+ * Creates a new PortletApplicationManager object.
+ */
+ public PortletApplicationManager(PortletFactory portletFactory, PortletRegistry registry,
+ PortletEntityAccessComponent entityAccess, PortletWindowAccessor windowAccess)
+ {
+ this.portletFactory = portletFactory;
+ this.registry = registry;
+ this.entityAccess = entityAccess;
+ this.windowAccess = windowAccess;
+ }
+
+ public void setRoleManager(RoleManager roleManager)
+ {
+ this.roleManager = roleManager;
+ }
+
+ public void setAutoCreateRoles(boolean autoCreateRoles)
+ {
+ this.autoCreateRoles = autoCreateRoles;
+ }
+
+ public void setSearchEngine(SearchEngine searchEngine)
+ {
+ this.searchEngine = searchEngine;
+ }
+
+ public void startLocalPortletApplication(String contextName, FileSystemHelper warStruct,
+ ClassLoader paClassLoader)
+ throws RegistryException
+ {
+ checkValidContextName(contextName, true);
+ startPA(contextName, warStruct, paClassLoader, true);
+ }
+
+ public void startPortletApplication(String contextName, FileSystemHelper warStruct,
+ ClassLoader paClassLoader)
+ throws RegistryException
+ {
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+ try
+ {
+ checkValidContextName(contextName, false);
+ startPA(contextName, warStruct, paClassLoader, false);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(contextClassLoader);
+ }
+ }
+
+ public void stopLocalPortletApplication(String contextName)
+ throws RegistryException
+ {
+ checkValidContextName(contextName, true);
+ stopPA(contextName);
+ }
+
+ public void stopPortletApplication(String contextName)
+ throws RegistryException
+ {
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+ try
+ {
+ checkValidContextName(contextName, false);
+ stopPA(contextName);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(contextClassLoader);
+ }
+ }
+
+ public void unregisterPortletApplication(String paName)
+ throws RegistryException
+ {
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+ try
+ {
+ MutablePortletApplication pa = null;
+
+ try
+ {
+ pa = (MutablePortletApplication) registry.getPortletApplication(paName);
+ }
+ catch (Exception e)
+ {
+ // ignore errors during portal shutdown
+ }
+
+ if (pa != null)
+ {
+ if (portletFactory.getPortletApplicationClassLoader(pa) != null)
+ {
+ throw new RegistryException("Portlet Application " + paName + " still running");
+ }
+
+ unregisterPortletApplication(pa, true);
+ }
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(contextClassLoader);
+ }
+ }
+
+ protected void checkValidContextName(String contextName, boolean local)
+ throws RegistryException
+ {
+ int prefixLength = LOCAL_PA_PREFIX.length();
+
+ if ((contextName.length() >= prefixLength)
+ && contextName.substring(0, prefixLength).equalsIgnoreCase(LOCAL_PA_PREFIX))
+ {
+ if (!local)
+ {
+ throw new RegistryException("Prefix \"" + LOCAL_PA_PREFIX
+ + "\" is reserved for Local Portlet Applications only.");
+ }
+ }
+ else if (local)
+ {
+ throw new RegistryException("Prefix \"" + LOCAL_PA_PREFIX
+ + "\" is required for Local Portlet Applications.");
+ }
+ }
+
+ protected MutablePortletApplication registerPortletApplication(PortletApplicationWar paWar,
+ MutablePortletApplication oldPA, boolean local, ClassLoader paClassLoader)
+ throws RegistryException
+ {
+ if (oldPA != null)
+ {
+ unregisterPortletApplication(oldPA, false);
+ oldPA = null;
+ }
+
+ MutablePortletApplication pa = null;
+ boolean registered = false;
+ String paName = paWar.getPortletApplicationName();
+
+ try
+ {
+ log.info("Loading portlet.xml...." + paName);
+ pa = paWar.createPortletApp(paClassLoader);
+
+ if (local)
+ {
+ pa.setApplicationType(MutablePortletApplication.LOCAL);
+ }
+ else
+ {
+ pa.setApplicationType(MutablePortletApplication.WEBAPP);
+ }
+
+ // load the web.xml
+ log.info("Loading web.xml...." + paName);
+ MutableWebApplication wa = paWar.createWebApp();
+ paWar.validate();
+
+ if (local)
+ {
+ wa.setContextRoot("<portal>");
+ }
+
+ pa.setWebApplicationDefinition(wa);
+
+ // Make sure existing entities are refreshed with the most
+ // recent PortletDefintion.
+ Collection portletDefs = pa.getPortletDefinitions();
+ if(portletDefs != null && portletDefs.size() > 0)
+ {
+ Iterator pdItr = portletDefs.iterator();
+ while(pdItr.hasNext())
+ {
+ PortletDefinition pd = (PortletDefinition) pdItr.next();
+ Collection portletEntites = entityAccess.getPortletEntities(pd);
+ if(portletEntites != null && portletEntites.size() > 0)
+ {
+ Iterator peItr = portletEntites.iterator();
+ while(peItr.hasNext())
+ {
+ PortletEntityCtrl portletEntity = (PortletEntityCtrl) peItr.next();
+ portletEntity.setPortletDefinition(pd);
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ String msg = "Failed to load portlet application for "
+ + paWar.getPortletApplicationName();
+ log.error(msg);
+ throw new RegistryException(msg);
+ }
+
+ // register the portlet application
+ try
+ {
+ registry.registerPortletApplication(pa);
+ registered = true;
+ log.info("Registered the portlet application " + paName);
+
+ // add to search engine result
+ if (searchEngine != null)
+ {
+ searchEngine.add(pa);
+ searchEngine.add(pa.getPortletDefinitions());
+ log.info("Registered the portlet application in the search engine... " + paName);
+ }
+
+ if ( autoCreateRoles && roleManager != null && pa.getWebApplicationDefinition().getSecurityRoles() != null )
+ {
+ try
+ {
+ Iterator rolesIter = pa.getWebApplicationDefinition().getSecurityRoles().iterator();
+ SecurityRole sr;
+ while ( rolesIter.hasNext() )
+ {
+ sr = (SecurityRole)rolesIter.next();
+ if ( !roleManager.roleExists(sr.getRoleName()) )
+ {
+ roleManager.addRole(sr.getRoleName());
+ log.info("AutoCreated role: "+sr.getRoleName()+" from portlet application "+paName+" its web definition");
+ }
+ }
+ }
+ catch (SecurityException sex)
+ {
+ log.warn("Failed to autoCreate roles for portlet application " + paName+": "+sex.getMessage(), sex);
+ }
+ }
+
+ return pa;
+ }
+ catch (Exception e)
+ {
+ String msg = "Failed to register portlet application, " + paName;
+ log.error(msg, e);
+
+ if (registered)
+ {
+ try
+ {
+ unregisterPortletApplication(pa, local);
+ }
+ catch (Exception re)
+ {
+ log.error("Failed to rollback registration of portlet application" + paName, re);
+ }
+ }
+
+ throw new RegistryException(msg, e);
+ }
+ }
+
+ protected void startPA(String contextName, FileSystemHelper warStruct,
+ ClassLoader paClassLoader, boolean local)
+ throws RegistryException
+ {
+ PortletApplicationWar paWar = null;
+
+ try
+ {
+ try
+ {
+ paWar = new PortletApplicationWar(warStruct, contextName, "/" + contextName);
+
+ if (paClassLoader == null)
+ {
+ paClassLoader = paWar.createClassloader(getClass().getClassLoader());
+ }
+ }
+ catch (IOException e)
+ {
+ String msg = "Failed to create PA WAR for " + contextName;
+ log.error(msg, e);
+ throw new RegistryException(msg, e);
+ }
+
+ MutablePortletApplication pa = (MutablePortletApplication) registry
+ .getPortletApplication(contextName);
+
+ if ((pa != null) && (paWar.getPortletApplicationChecksum() == pa.getChecksum()))
+ {
+ portletFactory.unregisterPortletApplication(pa);
+ }
+ else
+ {
+ pa = registerPortletApplication(paWar, pa, local, paClassLoader);
+ }
+ portletFactory.registerPortletApplication(pa, paClassLoader);
+ }
+ finally
+ {
+ if (paWar != null)
+ {
+ try
+ {
+ paWar.close();
+ }
+ catch (IOException e)
+ {
+ log.error("Failed to close PA WAR for " + contextName, e);
+ }
+ }
+ }
+ }
+
+ protected void stopPA(String contextName)
+ throws RegistryException
+ {
+ MutablePortletApplication pa = null;
+
+ try
+ {
+ pa = (MutablePortletApplication) registry.getPortletApplication(contextName);
+ }
+ catch (Exception e)
+ {
+ // ignore errors during portal shutdown
+ }
+ if (pa != null)
+ {
+ portletFactory.unregisterPortletApplication(pa);
+ }
+ }
+
+ protected void unregisterPortletApplication(MutablePortletApplication pa,
+ boolean purgeEntityInfo)
+ throws RegistryException
+ {
+ if (searchEngine != null)
+ {
+ searchEngine.remove(pa);
+ searchEngine.remove(pa.getPortletDefinitions());
+ }
+
+ log.info("Remove all registry entries defined for portlet application " + pa.getName());
+
+ Iterator portlets = pa.getPortletDefinitions().iterator();
+
+ while (portlets.hasNext())
+ {
+ PortletDefinition portletDefinition = (PortletDefinition) portlets.next();
+ Iterator entities = entityAccess.getPortletEntities(portletDefinition)
+ .iterator();
+
+ while (entities.hasNext())
+ {
+ PortletEntity entity = (PortletEntity) entities.next();
+
+ if (purgeEntityInfo)
+ {
+ try
+ {
+ entityAccess.removePortletEntity(entity);
+ }
+ catch (PortletEntityNotDeletedException e)
+ {
+ String msg = "Failed to delete Portlet Entity " + entity.getId();
+ log.error(msg, e);
+ throw new RegistryException(msg, e);
+ }
+ }
+
+ entityAccess.removeFromCache(entity);
+ windowAccess.removeWindows(entity);
+ }
+ }
+
+ // todo keep (User)Prefs?
+ registry.removeApplication(pa);
+ }
+}
Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/JetspeedServiceRule.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/JetspeedServiceRule.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/JetspeedServiceRule.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/JetspeedServiceRule.java Tue Jul 5 14:55:37 2005
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.tools.pamanager.rules;
+
+import org.apache.commons.digester.Rule;
+import org.apache.jetspeed.om.common.JetspeedServiceReference;
+import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
+
+
+/**
+ * This class helps load the jetspeed portlet extension service declarations.
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ */
+public class JetspeedServiceRule extends Rule
+{
+ private MutablePortletApplication app;
+
+ public JetspeedServiceRule(MutablePortletApplication app)
+ {
+ this.app = app;
+
+ }
+
+ public void end(String namespace, String name) throws Exception
+ {
+ Object o = digester.peek(0);
+ System.out.println("namespace = " + namespace);
+ System.out.println("name = " + name);
+ System.out.println("object = " + o);
+
+ JetspeedServiceReference service = (JetspeedServiceReference) digester.peek(0);
+ System.out.println("service = " + service);
+
+ app.addJetspeedService(service);
+ }
+
+}
Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/JetspeedServicesRuleSet.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/JetspeedServicesRuleSet.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/JetspeedServicesRuleSet.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/JetspeedServicesRuleSet.java Tue Jul 5 14:55:37 2005
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.jetspeed.tools.pamanager.rules;
+
+import org.apache.commons.digester.Digester;
+import org.apache.commons.digester.RuleSetBase;
+import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
+import org.apache.jetspeed.om.impl.JetspeedServiceReferenceImpl;
+
+/**
+ * This class helps load the jetspeed portlet extension service declarations.
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ */
+public class JetspeedServicesRuleSet extends RuleSetBase
+{
+ private MutablePortletApplication app;
+
+ public JetspeedServicesRuleSet(MutablePortletApplication app)
+ {
+ this.app = app;
+ }
+
+ /**
+ * @see org.apache.commons.digester.RuleSet#addRuleInstances(org.apache.commons.digester.Digester)
+ */
+ public void addRuleInstances(Digester digester)
+ {
+ digester.addObjectCreate("portlet-app/services/service", JetspeedServiceReferenceImpl.class);
+ digester.addSetProperties("portlet-app/services/service", "name", "name");
+
+ digester.addRule("portlet-app/services/service", new JetspeedServiceRule(app));
+
+ }
+
+}
Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/LocalizedFieldRule.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/LocalizedFieldRule.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/LocalizedFieldRule.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/LocalizedFieldRule.java Tue Jul 5 14:55:37 2005
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.tools.pamanager.rules;
+
+import java.util.Locale;
+
+import org.apache.commons.digester.Rule;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.jetspeed.om.common.GenericMetadata;
+import org.apache.jetspeed.om.common.LocalizedField;
+import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
+import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
+
+import org.xml.sax.Attributes;
+
+/**
+ * This class helps load internationalized fields
+ *
+ * @author <a href="mailto:jford@apache.org">Jeremy Ford </a>
+ * @version $Id: LocalizedFieldRule.java 186744 2004-06-08 01:36:30Z dlestrat $
+ */
+public class LocalizedFieldRule extends Rule
+{
+ protected final static Log log = LogFactory.getLog(LocalizedFieldRule.class);
+
+ /**
+ * Handle the beginning of an XML element.
+ *
+ * @param attributes
+ * The attributes of this element
+ * @exception Exception
+ * if a processing error occurs
+ */
+ public void begin(String namespace, String name, Attributes attributes) throws Exception
+ {
+
+ if (digester.getLogger().isDebugEnabled())
+ digester.getLogger().debug("Setting localized field " + name);
+
+ Object obj = digester.peek();
+ if (null == obj)
+ {
+ digester.push(null);
+ return;
+ }
+ GenericMetadata metadata = null;
+ if (obj instanceof MutablePortletApplication)
+ {
+ metadata = ((MutablePortletApplication) obj).getMetadata();
+ }
+ if (obj instanceof PortletDefinitionComposite)
+ {
+ metadata = ((PortletDefinitionComposite) obj).getMetadata();
+ }
+ if (metadata != null)
+ {
+ LocalizedField child = metadata.createLocalizedField();
+
+ if (name.equals("metadata"))
+ {
+ String nameAttr = attributes.getValue("name");
+ child.setName(nameAttr);
+ }
+ else
+ {
+ child.setName(name);
+ }
+ String language = attributes.getValue("xml:lang");
+ Locale locale = null;
+ if (language == null)
+ {
+ locale = new Locale("en");
+ }
+ else
+ {
+ locale = new Locale(language);
+ }
+
+ child.setLocale(locale);
+ digester.push(child);
+ }
+ else
+ {
+ digester.push(null);
+ }
+ }
+
+ public void body(String namespace, String name, String text) throws Exception
+ {
+ LocalizedField child = (LocalizedField) digester.peek(0);
+ if (child != null)
+ {
+ child.setValue(text);
+ }
+ }
+
+ public void end(String namespace, String name) throws Exception
+ {
+ LocalizedField child = (LocalizedField) digester.pop();
+ if (child != null)
+ {
+ Object obj = digester.peek();
+ if (null == obj)
+ {
+ digester.push(null);
+ return;
+ }
+ GenericMetadata metadata = null;
+ if (obj instanceof MutablePortletApplication)
+ {
+ metadata = ((MutablePortletApplication) obj).getMetadata();
+ }
+ if (obj instanceof PortletDefinitionComposite)
+ {
+ metadata = ((PortletDefinitionComposite) obj).getMetadata();
+ }
+ if (null != metadata)
+ {
+ metadata.addField(child);
+ }
+ }
+ }
+}
\ No newline at end of file
Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/MetadataRuleSet.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/MetadataRuleSet.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/MetadataRuleSet.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/MetadataRuleSet.java Tue Jul 5 14:55:37 2005
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.tools.pamanager.rules;
+
+import org.apache.commons.digester.Digester;
+import org.apache.commons.digester.RuleSetBase;
+
+/**
+ * RuleSet for adding metadata
+ *
+ * @author <a href="mailto:jford@apache.org">Jeremy Ford</a>
+ * @version $Id: MetadataRuleSet.java 186727 2004-06-05 16:19:19Z dlestrat $
+ */
+public class MetadataRuleSet extends RuleSetBase
+{
+ private String prefix;
+
+ /**
+ * @param string
+ */
+ public MetadataRuleSet(String prefix)
+ {
+ this.prefix = prefix;
+ }
+
+ /**
+ * @see org.apache.commons.digester.RuleSet#addRuleInstances(org.apache.commons.digester.Digester)
+ */
+ public void addRuleInstances(Digester digester)
+ {
+ LocalizedFieldRule fieldRule = new LocalizedFieldRule();
+
+ digester.addRule(prefix + "title", fieldRule);
+ digester.addRule(prefix + "contributor", fieldRule);
+ digester.addRule(prefix + "creator", fieldRule);
+ digester.addRule(prefix + "coverage", fieldRule);
+ digester.addRule(prefix + "description", fieldRule);
+ digester.addRule(prefix + "format", fieldRule);
+ digester.addRule(prefix + "identifier", fieldRule);
+ digester.addRule(prefix + "language", fieldRule);
+ digester.addRule(prefix + "publisher", fieldRule);
+ digester.addRule(prefix + "relation", fieldRule);
+ digester.addRule(prefix + "right", fieldRule);
+ digester.addRule(prefix + "source", fieldRule);
+ digester.addRule(prefix + "subject", fieldRule);
+ digester.addRule(prefix + "type", fieldRule);
+ digester.addRule(prefix + "metadata", fieldRule);
+ }
+
+}
Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/PortletRule.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/PortletRule.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/PortletRule.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/PortletRule.java Tue Jul 5 14:55:37 2005
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.tools.pamanager.rules;
+
+import org.apache.commons.digester.Rule;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
+import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
+
+/**
+ * This class helps load the portlet's metadata onto the digester stack
+ *
+ * @author <a href="mailto:jford@apache.org">Jeremy Ford </a>
+ * @version $Id: PortletRule.java 186744 2004-06-08 01:36:30Z dlestrat $
+ */
+public class PortletRule extends Rule
+{
+ protected final static Log log = LogFactory.getLog(PortletRule.class);
+
+ private MutablePortletApplication app;
+
+ public PortletRule(MutablePortletApplication app)
+ {
+ this.app = app;
+ }
+
+ public void body(String namespace, String name, String text) throws Exception
+ {
+ log.debug("Found portlet name " + name);
+ PortletDefinitionComposite def = (PortletDefinitionComposite) app.getPortletDefinitionByName(text);
+ digester.push(def);
+ }
+}
\ No newline at end of file
Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/UserAttributeRefRule.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/UserAttributeRefRule.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/UserAttributeRefRule.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/UserAttributeRefRule.java Tue Jul 5 14:55:37 2005
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.tools.pamanager.rules;
+
+import org.apache.commons.digester.Rule;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.jetspeed.om.common.UserAttributeRef;
+import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
+
+/**
+ * This class helps load the jetspeed portlet extension user attributes.
+ *
+ * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
+ */
+public class UserAttributeRefRule extends Rule
+{
+ protected final static Log log = LogFactory.getLog(UserAttributeRefRule.class);
+
+ private MutablePortletApplication app;
+
+ public UserAttributeRefRule(MutablePortletApplication app)
+ {
+ this.app = app;
+ }
+
+ public void end(String namespace, String name) throws Exception
+ {
+ UserAttributeRef userAttributeRef = (UserAttributeRef) digester.peek(0);
+ app.addUserAttributeRef(userAttributeRef);
+ }
+}
\ No newline at end of file
Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/UserAttributeRefRuleSet.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/UserAttributeRefRuleSet.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/UserAttributeRefRuleSet.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/rules/UserAttributeRefRuleSet.java Tue Jul 5 14:55:37 2005
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.tools.pamanager.rules;
+
+import org.apache.commons.digester.Digester;
+import org.apache.commons.digester.RuleSetBase;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
+import org.apache.jetspeed.om.impl.UserAttributeRefImpl;
+
+/**
+ * This class helps load the jetspeed portlet extension user attributes.
+ *
+ * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
+ */
+public class UserAttributeRefRuleSet extends RuleSetBase
+{
+ protected final static Log log = LogFactory.getLog(UserAttributeRefRuleSet.class);
+
+ private MutablePortletApplication app;
+
+ public UserAttributeRefRuleSet(MutablePortletApplication app)
+ {
+ this.app = app;
+ }
+
+ /**
+ * @see org.apache.commons.digester.RuleSet#addRuleInstances(org.apache.commons.digester.Digester)
+ */
+ public void addRuleInstances(Digester digester)
+ {
+ digester.addObjectCreate("portlet-app/user-attribute-ref", UserAttributeRefImpl.class);
+ digester.addBeanPropertySetter("portlet-app/user-attribute-ref/name", "name");
+ digester.addBeanPropertySetter("portlet-app/user-attribute-ref/name-link", "nameLink");
+ digester.addRule("portlet-app/user-attribute-ref", new UserAttributeRefRule(app));
+ }
+
+}
\ No newline at end of file
Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/servletcontainer/JBossManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/servletcontainer/JBossManager.java?rev=209328&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/servletcontainer/JBossManager.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/tools/pamanager/servletcontainer/JBossManager.java Tue Jul 5 14:55:37 2005
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.jetspeed.tools.pamanager.servletcontainer;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * JBoss application server management
+ *
+ * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
+ * @version $Id: JBossManager.java 188436 2005-03-23 22:54:30Z ate $
+ */
+public class JBossManager implements ApplicationServerManager
+{
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#start(java.lang.String)
+ */
+ public ApplicationServerManagerResult start(String appPath) throws IOException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#stop(java.lang.String)
+ */
+ public ApplicationServerManagerResult stop(String appPath) throws IOException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#reload(java.lang.String)
+ */
+ public ApplicationServerManagerResult reload(String appPath) throws IOException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#undeploy(java.lang.String)
+ */
+ public ApplicationServerManagerResult undeploy(String appPath) throws IOException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#deploy(java.lang.String, java.io.InputStream, int)
+ */
+ public ApplicationServerManagerResult deploy(String appPath, InputStream is, int size)
+ throws IOException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#getHostPort()
+ */
+ public int getHostPort()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#getHostUrl()
+ */
+ public String getHostUrl()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.tools.pamanager.servletcontainer.ApplicationServerManager#isConnected()
+ */
+ public boolean isConnected()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see groovy.swing.impl.Startable#start()
+ */
+ public void start()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public String getAppServerTarget(String appName)
+ {
+ return appName + ".war";
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org