Author: dam...@jb... Date: 2005-12-05 11:13:56 -0500 (Mon, 05 Dec 2005) New Revision: 1692 Added: qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/ qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsLast31DaysStatusPlugin.java qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsLast7DaysStatusPlugin.java qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsTodayStatusPlugin.java qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsTotalStatusPlugin.java qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/RevisionStatusPlugin.java qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/TotalRepoSizeStatusPlugin.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/CounterPlugin.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/ImagePlugin.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/AdminSimpleCredentials.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiTypeLoader.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/GetRefsFromPagePlugin.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/UpdateRefs.java Removed: qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/CommitsTotalStatusPlugin.java qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/SvnStatusPlugin.java qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsLast31DaysStatusPlugin.java qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsLast7DaysStatusPlugin.java qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsTodayStatusPlugin.java qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsTotalStatusPlugin.java qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/RevisionStatusPlugin.java qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/TotalRepoSizeStatusPlugin.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiTypeHandler.java Modified: qa/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DomToXmlTransformer.java qa/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCounterTools.java qa/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersDescriptor.java qa/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/FileAccessFilter.java qa/forge/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/ForgeConfWatcher.java qa/forge/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java qa/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/Podcast.java qa/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/PodcastDescriptor.java qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java qa/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/PortletWikiSession.java qa/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/ServletWikiSession.java qa/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/etc/WikiInsidePlugins.xml qa/forge/portal-extensions/jbosswiki/wiki-common/src/etc/WikiTypes.xml qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/CurrentTimePlugin.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/UndefinedPagesPlugin.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/UnusedPagesPlugin.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/Credentials.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/FileDataSource.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/InsidePluginExcecutor.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/JBossPortalCredentials.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/MediaDataSource.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/ShotokuDataSource.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/SimpleCredentials.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiEngine.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiInsidePlugin.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiPage.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiSession.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiType.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/exceptions/DataSourceException.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/exceptions/WikiException.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AdminConsolePlugin.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachementInfoPlugin.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/HTMLTranslatorParts.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/RefsManipulatingInsidePlugin.java qa/forge/portal-extensions/jbosswiki/wiki-common/src/test/java/org/jboss/wiki/test/WikiTest.java qa/forge/portal-extensions/maven.xml Log: MERGED: -r 1665:1691 https://svn.labs.jboss.com/trunk/forge into qa. Another installment for the 1.0.7 release. Modified: qa/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DomToXmlTransformer.java =================================================================== --- qa/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DomToXmlTransformer.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DomToXmlTransformer.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -34,6 +34,7 @@ /** * @author adamw + * @author Ryszard Kozmik * A helper class to transform DOM nodes to their string representations * in XML. */ @@ -47,7 +48,8 @@ public String transformNode(Node root) throws TransformerException { TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer();; - + transformer.setOutputProperty(OutputKeys.INDENT,"yes"); + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); ByteArrayOutputStream bos = new ByteArrayOutputStream(); Modified: qa/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCounterTools.java =================================================================== --- qa/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCounterTools.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCounterTools.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -90,7 +90,7 @@ DelegateContext ctx = new DelegateContext(); // Getting the DownloadCountersDescriptor object containing counters. - DownloadCountersDescriptor desc = getDesc(portalName); + DownloadCountersDescriptor desc = getDesc(portalName,contentManager); // If there isn't a descriptor in cache, return empty context. if (desc==null) { @@ -102,22 +102,17 @@ return ctx; } - // Getting the counters. - Map<String,Counter> values = desc.getCountersMap(); + // Getting the counters values. + Map<String,String> values = desc.getValuesForPortlet(projectId); // Filling the context for portlet. DelegateContext counters = ctx.next("counters"); for (String keyLink:values.keySet()) { - // Getting project ID from the counter - String counterProjectId = values.get(keyLink).getProjectId(); - - if (counterProjectId!=null && counterProjectId.compareTo(projectId)==0) { - DelegateContext counter = counters.next("counter"); - // Resolving the file name. - String fileName = keyLink.split(File.separator)[keyLink.split(File.separator).length-1]; - counter.put("link",fileName); - counter.put("value",Long.toString(values.get(keyLink).getValue())); - } + DelegateContext counter = counters.next("counter"); + // Resolving the file name. + String fileName = keyLink.split(File.separator)[keyLink.split(File.separator).length-1]; + counter.put("link",fileName); + counter.put("value",values.get(keyLink)); } return ctx; } @@ -127,7 +122,7 @@ * @param portalName * @return DownloadCountersDescriptor object. */ - public static DownloadCountersDescriptor getDesc(final String portalName) { + public static DownloadCountersDescriptor getDesc(final String portalName,final ContentManager contentManager) { DownloadCountersDescriptor desc = (DownloadCountersDescriptor) ForgeHelper .getForgeManagement().getFromCache(portalName, DownloadCountersDescriptor.class.getName()); Modified: qa/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersDescriptor.java =================================================================== --- qa/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersDescriptor.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersDescriptor.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -128,6 +128,7 @@ synchronizeCounters(descriptors); } catch (Exception e) { + System.out.println ("[DOWNLOADCOUNTERS] Failed to initialize downloadCounters."); e.printStackTrace(); } } @@ -288,6 +289,8 @@ private synchronized Set<String> getTrackedProjects () { Set<String> projects = new HashSet<String>(); + if (downloadCounters==null) + return projects; for (String link:downloadCounters.keySet()) { projects.add(downloadCounters.get(link).getProjectId()); } @@ -312,6 +315,15 @@ return links; } + public synchronized Map<String,String> getValuesForPortlet (String projectId) { + List<String> links = getProjectLinks(projectId); + Map<String,String> values = new Hashtable<String,String>(links.size()); + for (String link : links) { + values.put(link,Long.toString(downloadCounters.get(link).getValue())); + } + return values; + } + /** * Method synchronizes the downloadCounters Map with a main download counters descriptor file. * @@ -337,7 +349,7 @@ createDocument(doc); DomToXmlTransformer xht = new DomToXmlTransformer(); - + // Getting string containing whole xml. String xmlString = xht.transformNode(doc.getDocumentElement()); @@ -364,7 +376,7 @@ for (String link:keys) { temporary = downloadCounters.get(link); Node newCounter = doc.createElement(COUNTER); - + Node newLink = doc.createElement(LINK); Node newLinkText = doc.createTextNode(link); newLink.appendChild(newLinkText); @@ -376,7 +388,7 @@ Node newValue = doc.createElement(VALUE); Node newValueText = doc.createTextNode(Long.toString(temporary.getValue())); newValue.appendChild(newValueText); - + newCounter.appendChild(newLink); newCounter.appendChild(newProjectId); newCounter.appendChild(newValue); @@ -393,7 +405,7 @@ * Counter value for this <code>link</code> will be incremented. */ synchronized public void increment (final String link) { - if (downloadCounters.get(link)!=null) { + if (downloadCounters!=null && downloadCounters.get(link)!=null) { // Status change to inform about counters modification. changeStatus=true; downloadCounters.get(link).increment(); Modified: qa/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/FileAccessFilter.java =================================================================== --- qa/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/FileAccessFilter.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/FileAccessFilter.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -145,7 +145,8 @@ // Sending the request link to the DownloadCounter to increment // counter for this link if it's one of the tracked links. - downloadCounters.increment(File.separator+requestedRes); + if (downloadCounters!=null) + downloadCounters.increment(File.separator+requestedRes); } Modified: qa/forge/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/ForgeConfWatcher.java =================================================================== --- qa/forge/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/ForgeConfWatcher.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/ForgeConfWatcher.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -7,8 +7,12 @@ import org.jboss.forge.common.service.NodeWatcher; import org.jboss.logging.Logger; +import org.jboss.shotoku.ContentManager; import org.jboss.shotoku.Node; +import org.jboss.shotoku.aop.Inject; import org.jboss.shotoku.aop.NodeInject; +import org.jboss.shotoku.exceptions.RepositoryException; +import org.jboss.shotoku.exceptions.ResourceDoesNotExist; import org.w3c.dom.Document; import org.w3c.dom.NodeList; @@ -22,17 +26,26 @@ private Logger log = Logger.getLogger(this.getClass()); - @NodeInject("/default/freezone/forcelogin.xml") + @Inject + private ContentManager contentManager; + private Node configuration; public Object init(String arg0) { - lastNodeModification = configuration.getLastModification(); + try { + configuration = contentManager.getRootDirectory().getNode("/default/freezone/forcelogin.xml"); + lastNodeModification = configuration.getLastModification(); + } catch (RepositoryException e) { + configuration = null; + } catch (ResourceDoesNotExist e) { + configuration = null; + } return parseConfiguration(); } public Object nodeUpdate(String arg0, Object arg1) { - if (lastNodeModification < configuration.getLastModification()) { + if (configuration != null && lastNodeModification < configuration.getLastModification()) { lastNodeModification = configuration.getLastModification(); return parseConfiguration(); } @@ -40,6 +53,9 @@ } private List<String> parseConfiguration() { + if (configuration == null) + return null; + try { List<String> loggedInOnly = new ArrayList<String>(); Modified: qa/forge/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java =================================================================== --- qa/forge/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -212,7 +212,7 @@ loggedInOnly = (List<String>) ForgeHelper.getForgeManagement() .getFromCache("", ForgeConfWatcher.class.getName()); - return (request.getUser() != null) || (!loggedInOnly.contains(cmsPath)); + return (request.getUser() != null) || (loggedInOnly != null && !loggedInOnly.contains(cmsPath)); } @SuppressWarnings("unchecked") Modified: qa/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/Podcast.java =================================================================== --- qa/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/Podcast.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/Podcast.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -161,14 +161,16 @@ // filling the context with enclosure information ItemEnclosureIF enclosure = item.getEnclosure(); - if (enclosure != null) { - nodeContext.put("enclosure-type", enclosure.getType()); - nodeContext.put("enclosure-size", Math.round(enclosure.getLength() / BYTES_IN_MB)); - - URL enclosureLocation = enclosure.getLocation(); - if (enclosureLocation != null) { + URL enclosureLocation = null; + + if (enclosure != null) { + enclosureLocation = enclosure.getLocation(); + } + + if (enclosureLocation != null) { nodeContext.put("enclosure-link", enclosureLocation.toString()); - } + nodeContext.put("enclosure-type", enclosure.getType()); + nodeContext.put("enclosure-size", Math.round(enclosure.getLength() / BYTES_IN_MB)); } // filling the context with channel information Modified: qa/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/PodcastDescriptor.java =================================================================== --- qa/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/PodcastDescriptor.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/PodcastDescriptor.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -52,7 +52,7 @@ if ((root.getNodeType() == Node.ELEMENT_NODE) && (root.getNodeName().equals(Podcast.PODCAST_ELEMENT))) { - podcast = new Podcast(portalName, root); + podcast = new Podcast(serverAdress, root); } fillContext(); Modified: qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java =================================================================== --- qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -43,8 +43,6 @@ import org.w3c.dom.NodeList; import org.jboss.forge.status.plugins.StatusPlugin; -import org.jboss.forge.status.plugins.CommitsTotalStatusPlugin; - import org.jboss.logging.Logger; /** @@ -208,7 +206,7 @@ * but only those with names included in <code>nodeNames</code> Set */ private Set<Node> getChildNodesSet(Node root, Set<String> nodesNames) { - HashSet ret = new HashSet<Node>(); + HashSet<Node> ret = new HashSet<Node>(); NodeList list = root.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { @@ -227,7 +225,7 @@ * Map binds child Nodes names with appropriate Nodes. */ private Map<String,Node> getChildNodesMap(Node root, Set<String> nodesNames) { - HashMap ret = new HashMap<String,Node>(); + HashMap<String,Node> ret = new HashMap<String,Node>(); NodeList list = root.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { Deleted: qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/CommitsTotalStatusPlugin.java =================================================================== --- qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/CommitsTotalStatusPlugin.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/CommitsTotalStatusPlugin.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -1,53 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.jboss.forge.status.plugins; - -import java.util.Map; - -/** -* @author Pawel Wrzeszcz -*/ - -public class CommitsTotalStatusPlugin extends SvnStatusPlugin { - - protected static String PLUGIN_NAME = "Commits total"; - protected static String PLUGIN_ID = "commitstotal"; - - public String getId() { return PLUGIN_ID; } - public String getName() { return PLUGIN_NAME; } - - public CommitsTotalStatusPlugin() { - super(); - } - @Override - protected int getPluginSpecyficValue(Map projectMap) { - Integer commitsTotal = (Integer) projectMap.get("commitsTotal"); - return commitsTotal.intValue(); - } - - @Override - protected int getPluginSpecyficDefaultValue() { - return 0; - } - -} \ No newline at end of file Deleted: qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/SvnStatusPlugin.java =================================================================== --- qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/SvnStatusPlugin.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/SvnStatusPlugin.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -1,129 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.jboss.forge.status.plugins; - -import java.net.MalformedURLException; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.jboss.logging.Logger; - -import com.caucho.hessian.client.HessianProxyFactory; - -import hu.midori.kosmos.protocol.SvnService; -//import hu.midori.kosmos.model.SvnRepository; - -/** -* @author Pawel Wrzeszcz -*/ - -public abstract class SvnStatusPlugin extends StatusPlugin { - - private Map<String,Map> projectsMaps; - - private Logger log; - - private final static String KOSMOS_SVN_SERVICE_URL = - "http://localhost:8080/kosmos-server/kosmos-services/svn-service"; - //TODO shoud be parameter in xml config file - - public SvnStatusPlugin() { - super(); - - projectsMaps = new HashMap<String,Map>(); - log = Logger.getLogger(this.getClass()); - } - - protected abstract int getPluginSpecyficValue(Map projectMap); - protected abstract int getPluginSpecyficDefaultValue(); - - protected Map getSvnRepository(String projectId) { - - // Get project repository URL - String repoURL = getRepoURL(projectId); - //System.out.println("repo for project " + projectId + " " + repoURL); - - if (repoURL == null) { - return null; - } - - Map repositoryMap = null; - - // Connect to kosmos service - HessianProxyFactory factory = new HessianProxyFactory(); - SvnService service; - - try { - service = (SvnService) factory.create(SvnService.class, - KOSMOS_SVN_SERVICE_URL); - } catch (MalformedURLException e) { - log.error("Can not connect to kosmos svn service: " + KOSMOS_SVN_SERVICE_URL); - return null; - } - - // Get repository map - List repositories = service.getRepositories(repoURL); - - repositoryMap = (Map) repositories.get(0); - //printRepo(repositoryMap); - - return repositoryMap; - } - - private void printRepo(Map repositoryMap) { //debug - if (repositoryMap != null) { - - for (Iterator iter = repositoryMap.keySet().iterator(); iter.hasNext();) { - Object obj = (Object) iter.next(); - System.out.println("object: " + obj + " binding: " + repositoryMap.get(obj)); - } - } - } - - public int getValue(String projectId) { - - if (!projectsMaps.containsKey(projectId)) { - projectsMaps.put(projectId, getProjectMap(projectId)); - } - - Map projectMap = projectsMaps.get(projectId); - - if (projectMap == null) { - return getPluginSpecyficDefaultValue(); - } - - return getPluginSpecyficValue(projectMap); - } - - private String getRepoURL(String projectId) { - String repoURL = projects.getProjectProperty(projectId, "svn-repo"); - return (repoURL == "" ? null : repoURL); - } - - private Map getProjectMap(String projectId) { - return getSvnRepository(projectId); - } - -} Copied: qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn (from rev 1691, trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn) Deleted: qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsLast31DaysStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsLast31DaysStatusPlugin.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsLast31DaysStatusPlugin.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -1,53 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.jboss.forge.status.plugins.svn; - -import java.util.Map; - -/** -* @author Pawel Wrzeszcz -*/ - -public class CommitsLast31DaysStatusPlugin extends SvnStatusPlugin { - - protected static String PLUGIN_NAME = "Commits Last 31 Days"; - protected static String PLUGIN_ID = "commits31"; - - public String getId() { return PLUGIN_ID; } - public String getName() { return PLUGIN_NAME; } - - public CommitsLast31DaysStatusPlugin() { - super(); - } - @Override - protected int getPluginSpecyficValue(Map projectMap) { - Integer commitsTotal = (Integer) projectMap.get("commitsLast31Days"); - return commitsTotal.intValue(); - } - - @Override - protected int getPluginSpecyficDefaultValue() { - return 0; - } - -} \ No newline at end of file Copied: qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsLast31DaysStatusPlugin.java (from rev 1691, trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsLast31DaysStatusPlugin.java) Deleted: qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsLast7DaysStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsLast7DaysStatusPlugin.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsLast7DaysStatusPlugin.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -1,53 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.jboss.forge.status.plugins.svn; - -import java.util.Map; - -/** -* @author Pawel Wrzeszcz -*/ - -public class CommitsLast7DaysStatusPlugin extends SvnStatusPlugin { - - protected static String PLUGIN_NAME = "Commits Last 7 Days"; - protected static String PLUGIN_ID = "commits7"; - - public String getId() { return PLUGIN_ID; } - public String getName() { return PLUGIN_NAME; } - - public CommitsLast7DaysStatusPlugin() { - super(); - } - @Override - protected int getPluginSpecyficValue(Map projectMap) { - Integer commitsTotal = (Integer) projectMap.get("commitsLast7Days"); - return commitsTotal.intValue(); - } - - @Override - protected int getPluginSpecyficDefaultValue() { - return 0; - } - -} \ No newline at end of file Copied: qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsLast7DaysStatusPlugin.java (from rev 1691, trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsLast7DaysStatusPlugin.java) Deleted: qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsTodayStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsTodayStatusPlugin.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsTodayStatusPlugin.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -1,53 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.jboss.forge.status.plugins.svn; - -import java.util.Map; - -/** -* @author Pawel Wrzeszcz -*/ - -public class CommitsTodayStatusPlugin extends SvnStatusPlugin { - - protected static String PLUGIN_NAME = "Commits Today"; - protected static String PLUGIN_ID = "commitstoday"; - - public String getId() { return PLUGIN_ID; } - public String getName() { return PLUGIN_NAME; } - - public CommitsTodayStatusPlugin() { - super(); - } - @Override - protected int getPluginSpecyficValue(Map projectMap) { - Integer commitsTotal = (Integer) projectMap.get("commitsToday"); - return commitsTotal.intValue(); - } - - @Override - protected int getPluginSpecyficDefaultValue() { - return 0; - } - -} \ No newline at end of file Copied: qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsTodayStatusPlugin.java (from rev 1691, trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsTodayStatusPlugin.java) Deleted: qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsTotalStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsTotalStatusPlugin.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsTotalStatusPlugin.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -1,53 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.jboss.forge.status.plugins.svn; - -import java.util.Map; - -/** -* @author Pawel Wrzeszcz -*/ - -public class CommitsTotalStatusPlugin extends SvnStatusPlugin { - - protected static String PLUGIN_NAME = "Commits total"; - protected static String PLUGIN_ID = "commitstotal"; - - public String getId() { return PLUGIN_ID; } - public String getName() { return PLUGIN_NAME; } - - public CommitsTotalStatusPlugin() { - super(); - } - @Override - protected int getPluginSpecyficValue(Map projectMap) { - Integer commitsTotal = (Integer) projectMap.get("commitsTotal"); - return commitsTotal.intValue(); - } - - @Override - protected int getPluginSpecyficDefaultValue() { - return 0; - } - -} \ No newline at end of file Copied: qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsTotalStatusPlugin.java (from rev 1691, trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/CommitsTotalStatusPlugin.java) Deleted: qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/RevisionStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/RevisionStatusPlugin.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/RevisionStatusPlugin.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -1,53 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.jboss.forge.status.plugins.svn; - -import java.util.Map; - -/** -* @author Pawel Wrzeszcz -*/ - -public class RevisionStatusPlugin extends SvnStatusPlugin { - - protected static String PLUGIN_NAME = "Revision no"; - protected static String PLUGIN_ID = "revision"; - - public String getId() { return PLUGIN_ID; } - public String getName() { return PLUGIN_NAME; } - - public RevisionStatusPlugin() { - super(); - } - @Override - protected int getPluginSpecyficValue(Map projectMap) { - Long commitsTotal = (Long) projectMap.get("revision"); - return commitsTotal.intValue(); - } - - @Override - protected int getPluginSpecyficDefaultValue() { - return 0; - } - -} \ No newline at end of file Copied: qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/RevisionStatusPlugin.java (from rev 1691, trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/RevisionStatusPlugin.java) Deleted: qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -1,131 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.jboss.forge.status.plugins.svn; - -import org.jboss.forge.status.plugins.StatusPlugin; - -import java.net.MalformedURLException; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.jboss.logging.Logger; - -import com.caucho.hessian.client.HessianProxyFactory; - -import hu.midori.kosmos.protocol.SvnService; -//import hu.midori.kosmos.model.SvnRepository; - -/** -* @author Pawel Wrzeszcz -*/ - -public abstract class SvnStatusPlugin extends StatusPlugin { - - private Map<String,Map> projectsMaps; - - private Logger log; - - private final static String KOSMOS_SVN_SERVICE_URL = - "http://localhost:8080/kosmos-server/kosmos-services/svn-service"; - //TODO shoud be parameter in xml config file - - public SvnStatusPlugin() { - super(); - - projectsMaps = new HashMap<String,Map>(); - log = Logger.getLogger(this.getClass()); - } - - protected abstract int getPluginSpecyficValue(Map projectMap); - protected abstract int getPluginSpecyficDefaultValue(); - - protected Map getSvnRepository(String projectId) { - - // Get project repository URL - String repoURL = getRepoURL(projectId); - //System.out.println("repo for project " + projectId + " " + repoURL); - - if (repoURL == null) { - return null; - } - - Map repositoryMap = null; - - // Connect to kosmos service - HessianProxyFactory factory = new HessianProxyFactory(); - SvnService service; - - try { - service = (SvnService) factory.create(SvnService.class, - KOSMOS_SVN_SERVICE_URL); - } catch (MalformedURLException e) { - log.error("Can not connect to kosmos svn service: " + KOSMOS_SVN_SERVICE_URL); - return null; - } - - // Get repository map - List repositories = service.getRepositories(repoURL); - - repositoryMap = (Map) repositories.get(0); - //printRepo(repositoryMap); - - return repositoryMap; - } - - private void printRepo(Map repositoryMap) { //debug - if (repositoryMap != null) { - - for (Iterator iter = repositoryMap.keySet().iterator(); iter.hasNext();) { - Object obj = (Object) iter.next(); - System.out.println("object: " + obj + " binding: " + repositoryMap.get(obj)); - } - } - } - - public int getValue(String projectId) { - - if (!projectsMaps.containsKey(projectId)) { - projectsMaps.put(projectId, getProjectMap(projectId)); - } - - Map projectMap = projectsMaps.get(projectId); - - if (projectMap == null) { - return getPluginSpecyficDefaultValue(); - } - - return getPluginSpecyficValue(projectMap); - } - - private String getRepoURL(String projectId) { - String repoURL = projects.getProjectProperty(projectId, "svn-repo"); - return (repoURL == "" ? null : repoURL); - } - - private Map getProjectMap(String projectId) { - return getSvnRepository(projectId); - } - -} Copied: qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java (from rev 1691, trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java) Deleted: qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/TotalRepoSizeStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/TotalRepoSizeStatusPlugin.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/TotalRepoSizeStatusPlugin.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -1,53 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.jboss.forge.status.plugins.svn; - -import java.util.Map; - -/** -* @author Pawel Wrzeszcz -*/ - -public class TotalRepoSizeStatusPlugin extends SvnStatusPlugin { - - protected static String PLUGIN_NAME = "Total File Size"; - protected static String PLUGIN_ID = "total_file_size"; - - public String getId() { return PLUGIN_ID; } - public String getName() { return PLUGIN_NAME; } - - public TotalRepoSizeStatusPlugin() { - super(); - } - @Override - protected int getPluginSpecyficValue(Map projectMap) { - Integer commitsTotal = (Integer) projectMap.get("totalFileSize"); - return commitsTotal.intValue(); - } - - @Override - protected int getPluginSpecyficDefaultValue() { - return 0; - } - -} \ No newline at end of file Copied: qa/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/TotalRepoSizeStatusPlugin.java (from rev 1691, trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/TotalRepoSizeStatusPlugin.java) Modified: qa/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/PortletWikiSession.java =================================================================== --- qa/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/PortletWikiSession.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/PortletWikiSession.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -44,4 +44,8 @@ this.portletSession = portletSession; } + public String getId() { + return portletSession.getId(); + } + } Modified: qa/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/ServletWikiSession.java =================================================================== --- qa/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/ServletWikiSession.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/ServletWikiSession.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -43,5 +43,9 @@ public ServletWikiSession(HttpSession httpSession) { this.httpSession = httpSession; } + + public String getId() { + return httpSession.getId(); + } } Modified: qa/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java =================================================================== --- qa/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -202,7 +202,7 @@ } if (rReq.getParameter("editAction") != null) { - log.info("EDITING PAGE"); + log.debug("EDITING PAGE"); // unlock page WikiPage edPage = wikiEngine.getByName((String) rReq @@ -320,7 +320,7 @@ pageToShow = wikiEngine.getByName(wikiPage, editWikiContext); - if ((pageToShow != null) && (!pageToShow.isEditable())) { + if ((pageToShow != null) && (!pageToShow.isEditable(credentials))) { if (!credentials.isAdmin()) { showPage = true; } @@ -457,9 +457,9 @@ rReq.setAttribute("defaultPage", defaultPage); - rReq.setAttribute("isEditable", pageToShow.isEditable()); + rReq.setAttribute("isEditable", pageToShow.isEditable(credentials)); - rReq.setAttribute("isViewable", pageToShow.isViewable()); + rReq.setAttribute("isViewable", pageToShow.isViewable(credentials)); rReq.setAttribute("isAdmin", credentials.isAdmin()); Modified: qa/forge/portal-extensions/jbosswiki/wiki-common/src/etc/WikiInsidePlugins.xml =================================================================== --- qa/forge/portal-extensions/jbosswiki/wiki-common/src/etc/WikiInsidePlugins.xml 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/jbosswiki/wiki-common/src/etc/WikiInsidePlugins.xml 2005-12-05 16:13:56 UTC (rev 1692) @@ -6,4 +6,6 @@ <entry key="InsertPage">org.jboss.wiki.plugins.InsertPageInsidePlugin</entry> <entry key="IndexPlugin">org.jboss.wiki.plugins.IndexInsidePlugin</entry> <entry key="CurrentTimePlugin">com.ecyrd.jspwiki.plugin.CurrentTimePlugin</entry> +<entry key="Counter">com.ecyrd.jspwiki.plugin.CounterPlugin</entry> +<entry key="Image">com.ecyrd.jspwiki.plugin.ImagePlugin</entry> </properties> \ No newline at end of file Modified: qa/forge/portal-extensions/jbosswiki/wiki-common/src/etc/WikiTypes.xml =================================================================== --- qa/forge/portal-extensions/jbosswiki/wiki-common/src/etc/WikiTypes.xml 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/jbosswiki/wiki-common/src/etc/WikiTypes.xml 2005-12-05 16:13:56 UTC (rev 1692) @@ -94,6 +94,14 @@ </plugin> </wikiType> <wikiType> + <name>refs</name> + <class>org.jboss.wiki.plugins.DirectReferenceWikiType</class> + <plugin> + <name>getRefsForPage</name> + <class>org.jboss.wiki.plugins.GetRefsFromPagePlugin</class> + </plugin> + </wikiType> + <wikiType> <name>recentChanges</name> <class>org.jboss.wiki.plugins.DefaultWikiType</class> <plugin> @@ -124,6 +132,10 @@ <name>reTranslateUids</name> <class>org.jboss.wiki.plugins.ReTranslateUids</class> </plugin> + <plugin> + <name>updateRefs</name> + <class>org.jboss.wiki.plugins.UpdateRefs</class> + </plugin> </wikiType> <wikiType> <name>admin</name> Copied: qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/CounterPlugin.java (from rev 1691, trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/CounterPlugin.java) Modified: qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/CurrentTimePlugin.java =================================================================== --- qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/CurrentTimePlugin.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/CurrentTimePlugin.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -1,7 +1,6 @@ package com.ecyrd.jspwiki.plugin; import java.text.SimpleDateFormat; -import java.util.Calendar; import java.util.Date; import java.util.HashMap; Copied: qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/ImagePlugin.java (from rev 1691, trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/ImagePlugin.java) Modified: qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java =================================================================== --- qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -10,10 +10,6 @@ public class ReferringPagesPlugin extends RefsManipulatingInsidePlugin { - - //FIXME : FAQJBossIIOP - - @Override public String process(WikiPage wikiPage, WikiSession wikiSession, HashMap<String, String> attributes) { @@ -31,7 +27,7 @@ String uid = wikiEngine.getUid(wikiPage.getName()); - Set<String> refsFor = getRefsFor(uid, max); + Set<String> refsFor = getRefsFor(uid, max, wikiSession); for (String ref : refsFor) { stringBuffer.append(getLink(ref, maxwidth)); Modified: qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/UndefinedPagesPlugin.java =================================================================== --- qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/UndefinedPagesPlugin.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/UndefinedPagesPlugin.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -20,12 +20,12 @@ StringBuffer stringBuffer = new StringBuffer(); - Set<String> allRefs = getAllRefs(); + Set<String> allRefs = getAllRefs(wikiSession); for (String pageName : allRefs) { if (!wikiEngine.pageExists(pageName)) { - stringBuffer.append(getLink(pageName, maxwidth)); + stringBuffer.append(getLink(wikiEngine.getUid(pageName), maxwidth)); } } Modified: qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/UnusedPagesPlugin.java =================================================================== --- qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/UnusedPagesPlugin.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/com/ecyrd/jspwiki/plugin/UnusedPagesPlugin.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -22,12 +22,12 @@ Set<String> pageNames = wikiEngine.getAllPageNames(); - Set<String> allRefs = getAllRefs(); + Set<String> allRefs = getAllRefs(wikiSession); for (String pageName : pageNames) { - if (!allRefs.contains(pageName)) { - stringBuffer.append(getLink(pageName, maxwidth)); + if (!allRefs.contains(wikiEngine.getUid(pageName))) { + stringBuffer.append(getLink(wikiEngine.getUid(pageName), maxwidth)); } } Copied: qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/AdminSimpleCredentials.java (from rev 1691, trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/AdminSimpleCredentials.java) Modified: qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/Credentials.java =================================================================== --- qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/Credentials.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/Credentials.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -21,6 +21,8 @@ */ package org.jboss.wiki; +import java.util.Set; + import javax.portlet.ActionRequest; import javax.portlet.RenderRequest; @@ -61,4 +63,15 @@ * @param rReq ActionRequest to set. */ public abstract void setActionRequest(ActionRequest rReq); + + /**Checks if user is in given role. + * @param role to check + * @return True if is in role, false otherwise. + */ + public abstract boolean isUserInRole(String role); + + /**Get Set of ALL role names. + * @return Set of role names or empty Set if there are no roles + */ + public abstract Set<String> getAllRoles(); } Modified: qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/FileDataSource.java =================================================================== --- qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/FileDataSource.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/FileDataSource.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -34,6 +34,7 @@ import java.util.TreeSet; import org.jboss.logging.Logger; +import org.jboss.wiki.exceptions.DataSourceException; import org.jboss.wiki.exceptions.PageRenamingException; /** @@ -447,6 +448,87 @@ } } + + public void saveRolesSet(String uid, Set<String> roles, int action) throws DataSourceException { + File rolesFile; + try { + rolesFile = getRolesFile(uid, action); + + if (rolesFile == null) + throw new DataSourceException("Wrong action number"); + + } catch (IOException e) { + throw new DataSourceException(e); + } + + FileOutputStream fos = null; + try { + fos = new FileOutputStream(rolesFile); + + Properties roleProps = new Properties(); + + int i = 1; + + for (String roleName : roles) { + roleProps.setProperty("Role."+i++, roleName); + } + + roleProps.store(fos, SAVE_COMMENT); + + fos.close(); + } catch (FileNotFoundException e) { + throw new DataSourceException(e); + } catch (IOException e) { + try { + fos.close(); + } catch (IOException e1) { + throw new DataSourceException(e); + } + throw new DataSourceException(e); + } + + } + + private File getRolesFile(String uid, int action) throws IOException { + String fileName = (action == MediaDataSource.EDITABLE) ? "editRoles" : (action == MediaDataSource.VIEWABLE) ? "viewRoles" : null; + + if (fileName == null) + return null; + + File rolesFile = new File(pathToMedia + "/OLD/" + uid + "/" + fileName + ".properties"); + + if (!rolesFile.exists()) { + rolesFile.createNewFile(); + } + + return rolesFile; + } + + private Set<String> getRoles(String uid, int action) throws IOException { + Set<String> set = new TreeSet<String>(); + + File rolesFile = getRolesFile(uid, action); + + if (rolesFile == null) + return null; + + FileInputStream rolesFileIs = new FileInputStream(rolesFile); + + Properties roleProps = new Properties(); + + roleProps.load(rolesFileIs); + + int i = 1; + + while (roleProps.getProperty("Role."+i) != null) { + set.add(roleProps.getProperty("Role."+i)); + i++; + } + + rolesFileIs.close(); + + return set; + } public WikiPage getPage(String pageName) { // log.info("[WIKI:FileDataSource]: Getting new page: " + @@ -495,6 +577,17 @@ (pageMods & EDITABLE) == EDITABLE); page.setLength(pageFile.length()); + + try { + page.setEditRoles(getRoles(pageName, EDITABLE)); + } catch (IOException e) { + log.error("Couldn't read edit roles for page: "+pageName, e); + } + try { + page.setViewRoles(getRoles(pageName, VIEWABLE)); + } catch (IOException e) { + log.error("Couldn't read view roles for page: "+pageName, e); + } } } Modified: qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/InsidePluginExcecutor.java =================================================================== --- qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/InsidePluginExcecutor.java 2005-12-05 14:17:28 UTC (rev 1691) +++ qa/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/InsidePluginExcecutor.java 2005-12-05 16:13:56 UTC (rev 1692) @@ -9,6 +9,7 @@ import java.util.regex.Pattern; import org.jboss.logging.Logger; +import org.jboss.wiki.plugins.HTMLTranslatorParts; public class InsidePluginExcecutor { @@ -40,7 +41,7 @@ Properties props = new Properties(); try { - props.loadFromXML(WikiTypeHandler.class + props.loadFromXML(WikiTypeLoader.class .getResourceAsStream("/WikiInsidePlugins.xml")); } catch (InvalidPropertiesFormatException e) { log.error("WikiInsidePlugins.xml... [truncated message content] |