public PortletApplicationProxyImpl(PortletApplication app) { this.app = app; this.name = app.getName(); }
/** * @see org.apache.jetspeed.om.portlet.PortletDefinition#getUniqueName() */ public String getUniqueName() { if (app != null && app.getName() != null && portletName != null) { return app.getName() + "::" + portletName; } else { throw new IllegalStateException( "Cannot generate a unique portlet name until the application and portlet name have been set"); } }
public void applicationRemoved(PortletApplication app) { // clear cache element appUserInfoAttrCache.remove(app.getName()); }
public void applicationUpdated(PortletApplication app) { // clear cache element appUserInfoAttrCache.remove(app.getName()); }
public ClassLoader getPortletApplicationClassLoader(PortletApplication pa) { return pa != null ? classLoaderMap.get(pa.getName()) : null; }
public boolean portletDefinitionExists( String portletName, PortletApplication app ) { return getPortletDefinitionByUniqueName(app.getName() + "::" + portletName) != null; }
public void registerPortletApplication(PortletApplication pa, ClassLoader cl) { synchronized (classLoaderMap) { unregisterPortletApplication(pa); classLoaderMap.put(pa.getName(), cl); } }
public boolean equals( Object obj ) { if (obj != null && obj.getClass().equals(getClass())) { PortletDefinitionImpl pd = (PortletDefinitionImpl) obj; boolean sameId = id != null && pd.id != null && id.equals(pd.id); if (sameId) { return true; } String otherAppName = pd.getApplication() != null ? pd.getApplication().getName() : null; boolean sameAppName = (app != null && app.getName() != null && otherAppName != null && app.getName().equals(otherAppName)); return sameAppName && (pd.getPortletName() != null && portletName != null && pd.getPortletName().equals(portletName)); } return false; }
protected int list(PrintWriter writer) { writer.println("Listed Portlet Applications"); Iterator iter = registry.getPortletApplications().iterator(); PortletApplication pa; while (iter.hasNext()) { pa = (PortletApplication) iter.next(); writer.println(pa.getName() + ":" + pa.getContextPath() + ":" + (portletFactory.isPortletApplicationRegistered(pa) ? "ACTIVE" : "INACTIVE")); } return OK; }
public void storePortletPreference(org.apache.jetspeed.om.portlet.PortletDefinition portletdefinition, String windowId, String userName, Map<String, PortletPreference> map) { String appName = portletdefinition.getApplication().getName(); String portletName = portletdefinition.getPortletName(); storePortletPreference(appName, portletName, windowId, userName, map); }
public void updatePortletConfig(PortletDefinition pd) { synchronized (cacheMutex) { if (pd != null) { Map<String, PortletInstance> instanceCache = portletCache.get(pd.getApplication().getName()); PortletInstance instance = instanceCache != null ? instanceCache.get(pd.getPortletName()) : null; if (instance != null) { JetspeedPortletConfigImpl config = (JetspeedPortletConfigImpl) instance.getConfig(); config.setPortletDefinition(pd); } } } }
protected String autoGenerateID(PortletDefinition pd) { String appName = pd.getApplication().getName(); String portletName = pd.getPortletName(); return appName+"::"+portletName+"::"+new UID().toString(); }
/** * For Pluto 2.0 */ public Map<String, String> getUserInfo(PortletRequest request, org.apache.pluto.container.PortletWindow window) { if ( request.getUserPrincipal() == null ) { return null; } PortletWindow portletWindow = (PortletWindow)window; return getUserInfoMap(portletWindow.getPortletDefinition().getApplication().getName(), portletWindow.getRequestContext()); } }
public void removeAllClones(PortletApplication pa) throws RegistryException { Criteria c = new Criteria(); c.addEqualTo("cloneParent", pa.getName()); getPersistenceBrokerTemplate().deleteByQuery(QueryFactory.newQuery(PortletDefinitionImpl.class, c)); pa.getClones().clear(); this.updatePortletApplication(pa); }
protected void unregisterPortletApplication(PortletApplication pa, boolean purgeEntityInfo) throws RegistryException { updateSearchEngine(true,pa); // todo keep (User)Prefs? lockRegistry(RegistryLock.WRITE); try { registry.removeApplication(pa); } finally { unlockRegistry(RegistryLock.WRITE); } revokeDefaultPermissions(pa.getName()); }
/** * Jetspeed: PortletPreferencesProvider */ public void removeDefaults(org.apache.jetspeed.om.portlet.PortletDefinition pd) { Criteria c = new Criteria(); c.addEqualTo(DTYPE, DISCRIMINATOR_PORTLET); c.addEqualTo(APPLICATION_NAME, pd.getApplication().getName()); c.addEqualTo(PORTLET_NAME, pd.getPortletName()); QueryByCriteria query = QueryFactory.newQuery(DatabasePreference.class, c); getPersistenceBrokerTemplate().deleteByQuery(query); String defaultsCacheKey = getPortletPreferenceKey(pd.getApplication().getName(), pd.getPortletName()); preferenceCache.remove(defaultsCacheKey); }
public static void fillInPortletWindow(RequestDiagnostics rd, PortletWindow pw, Throwable e) { if (pw != null) { rd.setPortletWindowId(pw.getWindowId()); PortletDefinition pd = pw.getPortletDefinition(); rd.setPortletApplicationName(pd.getApplication().getName()); rd.setPortletName(pd.getPortletName()); } if (e != null) { fillInException(rd, e); } }
public void removeDefaults(org.apache.jetspeed.om.portlet.PortletDefinition pd, String preferenceName) { Criteria c = new Criteria(); c.addEqualTo(DTYPE, DISCRIMINATOR_PORTLET); c.addEqualTo(APPLICATION_NAME, pd.getApplication().getName()); c.addEqualTo(PORTLET_NAME, pd.getPortletName()); c.addEqualTo("name", preferenceName); QueryByCriteria query = QueryFactory.newQuery(DatabasePreference.class, c); getPersistenceBrokerTemplate().deleteByQuery(query); String defaultsCacheKey = getPortletPreferenceKey(pd.getApplication().getName(), pd.getPortletName()); JetspeedPreferencesMap map = (JetspeedPreferencesMap) preferenceCache.get(defaultsCacheKey).getContent(); map.remove(preferenceName); preferenceCache.put(preferenceCache.createElement(defaultsCacheKey, map)); }
/** * * <p> * getPortletEntities * </p> * * @param portletDefinition * @return */ public Collection getPortletEntities( PortletDefinition portletDefinition ) { Criteria c = new Criteria(); String appName = portletDefinition.getApplication().getName(); String portletName = portletDefinition.getPortletName(); c.addEqualTo("appName", appName); c.addEqualTo("portletName", portletName); return getPersistenceBrokerTemplate().getCollectionByQuery(QueryFactory.newQuery(PortletEntityImpl.class, c)); }
/** * Jetspeed: PortletPreferencesProvider */ public void removeDefaults(PortletApplication app) { Criteria c = new Criteria(); c.addEqualTo(DTYPE, DISCRIMINATOR_PORTLET); c.addEqualTo(APPLICATION_NAME, app.getName()); QueryByCriteria query = QueryFactory.newQuery(DatabasePreference.class, c); getPersistenceBrokerTemplate().deleteByQuery(query); for (PortletDefinition pd : app.getPortlets()) { String defaultsCacheKey = getPortletPreferenceKey(pd.getApplication().getName(), pd.getPortletName()); preferenceCache.remove(defaultsCacheKey); } }