From: <jbo...@li...> - 2005-11-13 23:41:33
|
Author: unibrew Date: 2005-11-13 18:41:22 -0500 (Sun, 13 Nov 2005) New Revision: 1565 Added: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Counter.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCounterTools.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersDescriptor.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersWatcher.java Removed: trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/DownloadCounter.java trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/portlet/DownloadCounterTools.java Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCounterDescriptor.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectDescriptor.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsHelper.java trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/FileAccessFilter.java trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/portlet/DownloadCounterPortlet.java trunk/forge/portal-extensions/portal-default/src/web/WEB-INF/default-portal.xml Log: [JBLAB-263] DownloadCounter new version. Added: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Counter.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Counter.java 2005-11-12 21:22:11 UTC (rev 1564) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/Counter.java 2005-11-13 23:41:22 UTC (rev 1565) @@ -0,0 +1,66 @@ +package org.jboss.forge.common.projects; + + +/** + * Each Counter class object represents simply one counter for a download link. + * Object contains the current counter value and projectId for this link. + * + * @author Ryszard Kozmik + */ + +public class Counter { + + /** + * Current value of a download counter. + */ + private long value; + + /** + * Project id for which this instance of Counter works. + */ + private String projectId; + + /** + * Main constructor simply initiates values. + * + * @param value + * Starting value for counter. + * @param projectId + * Name of project for this counter. + */ + Counter (long value,String projectId) { + this.value=value; + this.projectId=projectId; + } + + /** + * This method increments the value of the counter. + */ + void increment () { + value++; + } + + /** + * Method returns project id name for this counter. + * + * @return Project id name for this counter. + */ + String getProjectId() { + return projectId; + } + + /** + * Method returns current value of the counter. + * @return Current value of the counter. + */ + long getValue() { + return value; + } + + /** + * Overrided method returns String containing value of the counter. + */ + public String toString () { + return Long.toString(value); + } +} Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCounterDescriptor.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCounterDescriptor.java 2005-11-12 21:22:11 UTC (rev 1564) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCounterDescriptor.java 2005-11-13 23:41:22 UTC (rev 1565) @@ -23,8 +23,8 @@ package org.jboss.forge.common.projects; -import java.io.File; import java.io.IOException; +import java.io.InputStream; import java.util.LinkedList; import java.util.List; @@ -33,44 +33,71 @@ import org.apache.xerces.parsers.DOMParser; import org.jboss.forge.common.XmlTools; import org.jboss.forge.common.projects.XmlInputFactory.XmlNotFoundException; -import org.jboss.shotoku.ContentManager; -import org.jboss.shotoku.aop.Inject; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import org.xml.sax.SAXException; +/** + * DownloadCounterDescriptor is an object representing a project download counter descriptor. + * It parses the xml descriptor and then is used for collecting data achieved from parsing. + * + * @author Ryszard Kozmik + */ + public class DownloadCounterDescriptor extends AbstractDescriptor { - @Inject - private ContentManager contentManager; + /** + * This variable contains all links, which need to be tracked, collected from xml descriptor. + */ + private List<String> links; - public DownloadCounterDescriptor (XmlInputFactory isf, DomToXmlTransformer xht, - String portalName, String projectId) throws SAXException, IOException, - XmlNotFoundException, TransformerException { - - // The isf is already suffixed with the members directory, so we just - // need to add project id and descriptor name. - String isfPathToXml = File.separator+projectId + File.separator + ProjectsHelper.DOWNLOADCOUNTER_DESC; - // Getting the categories and files descriptors + /** + * Name of tag in counter.xml containing counter link. + */ + public static final String LINK = "link"; + + /** + * Name of tag in counter.xml containing counter. + */ + public static final String COUNTER = "counter"; + + /** + * Main DownloadCounterDescriptor constructor which parses the xml descriptor for a project + * and collects data from it. + * + * @param counterDesc + * This Node points to the download counter project descriptor. + * @throws SAXException + * XML parser exception. + * @throws IOException + * File reading exception. + * @throws XmlNotFoundException + * File not found exception. + */ + public DownloadCounterDescriptor (org.jboss.shotoku.Node counterDesc) + throws SAXException, IOException,XmlNotFoundException { + + // Opening the download counter descriptor. DOMParser parser = new DOMParser(); - InputSource is = isf.getInputSource(isfPathToXml); - parser.parse(is); - org.w3c.dom.Document doc = parser.getDocument(); + InputStream is = counterDesc.getContentInputStream(); + parser.parse(new InputSource(is)); + Document doc = parser.getDocument(); Node n=null,property=null; NodeList nodes = doc.getDocumentElement().getChildNodes(); - List<String> links = new LinkedList<String>(); + // Parsing and gettting download links which are requested to be tracked by download counter. + links = new LinkedList<String>(); for (int i = 0; i < nodes.getLength(); i++) { n = nodes.item(i); if (n.getNodeType() == Node.ELEMENT_NODE) { - if (n.getNodeName().equals("counter")) { + if (n.getNodeName().equals(COUNTER)) { NodeList counterProps = n.getChildNodes(); for (int j=0;j< counterProps.getLength() ; j++) { property = counterProps.item(j); if (property.getNodeType()== Node.ELEMENT_NODE){ - if (property.getNodeName().equals("link") && XmlTools.unmarshallText(property) != null + if (property.getNodeName().equals(LINK) && XmlTools.unmarshallText(property) != null && !XmlTools.unmarshallText(property).trim().equals("")) { links.add(XmlTools.unmarshallText(property).trim()); } @@ -80,95 +107,15 @@ } } - if (!links.isEmpty()) { - addLinksToCounter(projectId,portalName,links,isf,xht); - } } /** - * Mathod adds new links to the main download counter xml file. - * @param projectId - * @param portalName - * @param links - * @param isf - * @param xht - * @throws SAXException - * @throws IOException - * @throws XmlNotFoundException - * @throws TransformerException + * Method simply returns links from the xml descriptor which are requested to be tracked. + * @return + * List<String> of download links. */ - private synchronized void addLinksToCounter (String projectId,String portalName, - List<String> links, XmlInputFactory isf, DomToXmlTransformer xht) - throws SAXException, IOException, XmlNotFoundException, TransformerException { - - // Opening the main download counter xml descriptor for parsing. - DOMParser parser = new DOMParser(); - parser.parse(isf.getInputSource(ProjectsHelper.DOWNLOADCOUNTERMAIN_DESC)); - Document doc = parser.getDocument(); - NodeList nodes = doc.getDocumentElement().getChildNodes(); - Node n=null,property=null; - - - // This loop will remove all links from the "List<String> link" - // which are already in the main download counter descriptor. - for (int i=0;i <nodes.getLength(); i++) { - n = nodes.item(i); - if (n.getNodeType() == Node.ELEMENT_NODE) { - if (n.getNodeName().equals("counter")) { - NodeList counterSettings = n.getChildNodes(); - for (int j=0; j <counterSettings.getLength() ; j++) { - property = counterSettings.item(j); - if (property.getNodeType() == Node.ELEMENT_NODE) { - String nodeName = property.getNodeName(); - String nodeNodeValue = XmlTools.unmarshallText(property).trim(); - if (nodeName.equals("link") && nodeNodeValue!=null && links.contains(nodeNodeValue)) { - links.remove(nodeNodeValue); - } - } - } - } - } - } - - - // Here the new links from the "List<String> links" will be added. - if (!links.isEmpty()) { - - for (String link:links) { - Node newCounter = doc.createElement("counter"); - - Node newLink = doc.createElement("link"); - Node newLinkText = doc.createTextNode(link); - newLink.appendChild(newLinkText); - - Node newProjectId = doc.createElement("id"); - Node newProjectIdText = doc.createTextNode(projectId); - newProjectId.appendChild(newProjectIdText); - - Node newValue = doc.createElement("value"); - Node newValueText = doc.createTextNode("0"); - newValue.appendChild(newValueText); - - newCounter.appendChild(newLink); - newCounter.appendChild(newProjectId); - newCounter.appendChild(newValue); - - doc.getDocumentElement().appendChild(newCounter); - } - } - - // Making path to main counter xml located in members directory. - String pathToCountersXml = File.separator + portalName + File.separator - + ProjectsHelper.MEMBERS_DIR + File.separator + ProjectsHelper.DOWNLOADCOUNTERMAIN_DESC; - - // Getting string containing whole xml. - String xmlString = xht.transformNode(doc.getDocumentElement()); - - // Saving the main download counter xml descriptor with a new content. - org.jboss.shotoku.Node xmlFile = contentManager.getNode(pathToCountersXml); - xmlFile.setContent(xmlString); - xmlFile.save ("[DownlaodCounter] Main xml descriptor file update."); - + public List<String> getLinks () { + return links; } } Added: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCounterTools.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCounterTools.java 2005-11-12 21:22:11 UTC (rev 1564) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCounterTools.java 2005-11-13 23:41:22 UTC (rev 1565) @@ -0,0 +1,170 @@ + + /* + * 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.common.projects; + +import java.io.File; +import java.util.Map; + +import org.jboss.forge.common.ForgeHelper; +import org.jboss.portal.common.context.DelegateContext; +import org.jboss.shotoku.ContentManager; + +/** + * DownloadCounterTools class is just a tool class with static methods + * helpiing download counters to work. + * + * @author Ryszard Kozmik + */ + +public class DownloadCounterTools { + + /** + * Dir in portal where the JSP view file is. + */ + public static final String FORGE_FILE_ACCESS_DIR="file-access"; + + /** + * Name of JSP view file. + */ + public static final String DOWNLOADCOUNTER_JSP="normal.jsp"; + + /** + * Child of a counter node where value of a counter. + */ + public static final String VALUE = "value"; + + /** + * Child of a counter node containing download counter's tracked link. + */ + public static final String LINK = "link"; + + /** + * Child nodes of counters head context. + */ + public static final String COUNTER = "counter"; + + /** + * Head context name. + */ + public static final String COUNTERS = "counters"; + + /** + * Method prepares DelegateContext object for DownloadCountersPortlet view JSP file. + * + * @param portalName + * @param projectId + * Project id name for which tracked links should be added to the context. + * @param contentManager + * @return DelegateContext object containing content for JSP file. + * @throws Exception + */ + public static DelegateContext getContext (final String portalName,final String projectId,ContentManager contentManager) throws Exception { + + // If the projectId is null method returns empty DelegateContext object. + if (projectId==null) { + return new DelegateContext(); + } + + // Creating new empty context. + DelegateContext ctx = new DelegateContext(); + + // Getting the DownloadCountersDescriptor object containing counters. + DownloadCountersDescriptor desc = getDesc(portalName); + + // If there isn't a descriptor in cache, return empty context. + if (desc==null) { + return ctx; + } + + // If there is no tracked link for projectId return empty context. + if (!desc.checkForProjectCounters(projectId)) { + return ctx; + } + + // Getting the counters. + Map<String,Counter> values = desc.getCountersMap(); + + // 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())); + } + } + return ctx; + } + + /** + * Method gets DownloadCountersDescriptor object from the forge cache. + * @param portalName + * @return DownloadCountersDescriptor object. + */ + public static synchronized DownloadCountersDescriptor getDesc(final String portalName) { + DownloadCountersDescriptor desc = (DownloadCountersDescriptor) ForgeHelper + .getForgeManagement().getFromCache(portalName, + DownloadCountersDescriptor.class.getName()); + return desc; + } + + /** + * Method constructs path to main download counters descriptor. + * + * @param portalName + * @return Path to main download counters descriptor. + */ + public static String getMainXmlPath (String portalName) { + return portalName + File.separator + ProjectsHelper.MEMBERS_DIR + File.separator + ProjectsHelper.DOWNLOADCOUNTERMAIN_DESC; + } + + /** + * Method constructs path to project's download counters descriptor. + * + * @param portalName + * @param projectId + * Project id name for which the download counter descriptor path will be constructed + * @return Path to project's download counters descriptor. + */ + public static String getProjectXmlPath(String portalName,String projectId) { + return portalName+File.separator+ProjectsHelper.MEMBERS_DIR+File.separator+projectId+ + File.separator+ProjectsHelper.DOWNLOADCOUNTER_DESC; + } + + /** + * Method constructs path to the DownloadCounterPortlet JSP view file. + * + * @param portalName + * @return Path to the JSP DownloadCounterPortlet view file. + */ + public static String getJspCmPath() { + return FORGE_FILE_ACCESS_DIR + File.separator + DOWNLOADCOUNTER_JSP; + } + +} \ No newline at end of file Added: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersDescriptor.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersDescriptor.java 2005-11-12 21:22:11 UTC (rev 1564) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersDescriptor.java 2005-11-13 23:41:22 UTC (rev 1565) @@ -0,0 +1,415 @@ + + /* + * 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.common.projects; + +import java.io.File; +import java.io.InputStream; +import java.util.Hashtable; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.xml.transform.TransformerException; + +import org.apache.xerces.parsers.DOMParser; +import org.jboss.forge.common.XmlTools; +import org.jboss.shotoku.ContentManager; +import org.jboss.shotoku.Directory; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +/** + * DownloadCountersDescriptor is a main class used for counting downloads. + * It contains code for synchronizing counters with main download counters xml + * as well as synchronizing the tracked links with projects dowload counter descriptors. + * + * @author Ryszard Kozmik + */ + +public class DownloadCountersDescriptor extends AbstractDescriptor{ + + /** + * Name of tag in counters.xml containing counter value. + */ + public static final String VALUE = "value"; + + /** + * Name of tag in counters.xml containing counter link. + */ + public static final String LINK = "link"; + + /** + * Name of tag in counters.xml containing counter. + */ + public static final String COUNTER = "counter"; + + /** + * Name of tag in counters.xml containing project id. + */ + public static final String ID = "id"; + + /** + * This Map contains all counters for the portal. + */ + private Map<String,Counter> downloadCounters; + + /** + * ContentManager is used for getting to file resources. + */ + private ContentManager contentManager; + + /** + * This boolean variable turns to true if one of the counters + * has been incremented. If value is true the downloadCounters Map + * will be synchronized with a main xml descriptor + */ + private boolean changeStatus; + + /** + * Constructor for DownloadCountersDescriptor. + * While constructing object all information from projects descriptors + * is being collected and the downloadCounters Map is filled with values + * from main xml download counters descriptor. + * + * @param portalName + * @param contentManager + */ + public DownloadCountersDescriptor (final String portalName, ContentManager contentManager) { + + // Just initializing the changeStatus variable + changeStatus=false; + + // Getting the path to main dowload counters descriptor. + String pathToCountersXml = File.separator + DownloadCounterTools.getMainXmlPath(portalName); + + // Saving the ContentManager. + this.contentManager = contentManager; + + try { + + // Parsing main download counters descriptor. + DOMParser parser = new DOMParser(); + InputStream is = contentManager.getNode(pathToCountersXml).getContentInputStream(); + parser.parse(new InputSource(is)); + Document doc = parser.getDocument(); + NodeList nodes = doc.getDocumentElement().getChildNodes(); + downloadCounters=getValuesFromNodes(nodes); + + // Getting Map containing pairs of ProjectId and shotoku Node + // which refers to project download counterdescriptor. + Map <String,org.jboss.shotoku.Node> descriptors = getDownloadDescriptors(portalName); + + // Synchronizing tracked links in downloadConters with links from + // projects download counter descriptors. + synchronizeCounters(descriptors); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Method only returns all download counters. + * @return Returns a Map containing tracked download counters. + */ + public Map<String,Counter> getCountersMap () { + return downloadCounters; + } + + + /** + * This method searches through projects direcories in order to find all download counter descriptors. + * Method returns Map containging pairs of String projectId and + * org.jboss.shotoku.Node download counter descriptor file node. + * @param portalName + * @return A Map<String,org.jboss.shotoku.Node> containing project ids with their download + * counter's Node. + */ + public Map<String,org.jboss.shotoku.Node> getDownloadDescriptors (String portalName) { + Map<String,org.jboss.shotoku.Node> nodes = new Hashtable<String,org.jboss.shotoku.Node>(); + + // Getting the members dir. + Directory membersDir = contentManager.getDirectory(portalName+File.separator+ProjectsHelper.MEMBERS_DIR); + + // Getting all projects dirs in members directory. + List<Directory> membersProjectDirs = membersDir.getDirectories(); + + for (Directory projectDir:membersProjectDirs) { + for (org.jboss.shotoku.Node n:projectDir.getNodes().toList()) { + // Checking if node is a node containing download counter descriptor. + if (n.getName().compareTo(ProjectsHelper.DOWNLOADCOUNTER_DESC)==0) { + org.jboss.shotoku.Node counter = projectDir.getNode(ProjectsHelper.DOWNLOADCOUNTER_DESC); + String projectId = projectDir.getName(); + nodes.put(projectId,counter); + break; + } + } + + } + return nodes; + } + + /** + * Method removes links which was disabled from counting + * and adds those which was added in their project download counter descriptor. + * + * @param counters + * This Map<Strin,org.jboss.shotoku.Node> contains project ids with their download + * counter descriptor's Node. + */ + private synchronized void synchronizeCounters (Map<String,org.jboss.shotoku.Node> counters) { + + // Iterating through projects nodes containing download counter descriptors. + for (String projectId:counters.keySet()){ + try { + // Parsing project download counter descriptor. + DownloadCounterDescriptor counterDesc = + new DownloadCounterDescriptor(counters.get(projectId)); + + // Getting list of links which are now tracked by downloadCounters. + List<String> xmlProjectLinks = getProjectLinks(projectId); + + // Getting the list of links from download counter descriptor. + List<String> links = counterDesc.getLinks(); + + // This list will be used for collecting links which must be + // removed from downloadCounters. + List<String> linksToDelete = new LinkedList<String>(); + + // Searching for links to remove and links which are already tracked. + for (String link:xmlProjectLinks) { + if (links.contains(link)) { + links.remove(link); + } else { + linksToDelete.add(link); + } + } + + // Removing links which shouldn't be tracked any more. + for (String link:linksToDelete) { + downloadCounters.remove(link); + } + + // Adding new download links for tracking. + for (String link:links) { + downloadCounters.put(link,new Counter(0,projectId)); + } + + } catch (Exception e) { + System.out.println ("[DOWNLOADCOUNTER] Problem with opening project "+ + projectId+" download counter descriptor."); + e.printStackTrace(); + } + + } + + // Changing status to false becouse downloadCounters Map + // is now synchronized with download counters descriptors. + changeStatus=false; + } + + /** + * This method returns a List<String> of links which + * are now tracked for project given by <projectId> parameter. + * + * @param projectId + * Id of a project for which the links will be searched. + * @return List<String> Containing tracked links. + */ + private List<String> getProjectLinks (String projectId) { + List<String> links = new LinkedList<String>(); + for (String link:downloadCounters.keySet()) { + if (link.indexOf(File.separator+projectId+File.separator)!=-1) { + links.add(new String(link)); + } + } + return links; + } + + /** + * Method synchronizes the downloadCounters Map with a main download counters descriptor file. + * + * @param portalName + */ + public void synchronizeWithFile(String portalName) { + + String pathToCountersXml = File.separator + DownloadCounterTools.getMainXmlPath(portalName); + + try { + DOMParser parser = new DOMParser(); + + // Opening main download counters descriptor file. + InputStream is = contentManager.getNode(pathToCountersXml).getContentInputStream(); + parser.parse(new InputSource(is)); + Document doc = parser.getDocument(); + Node mainTag = doc.createElement("counters"); + + // Replacing old main descriptor tag with new, empty. + doc.replaceChild(mainTag,doc.getDocumentElement()); + + // Filling the descriptor with new counter. + createDocument(doc); + + DomToXmlTransformer xht = new DomToXmlTransformer(); + + // Getting string containing whole xml. + String xmlString = xht.transformNode(doc.getDocumentElement()); + + // Saving the main download counter xml descriptor with a new content. + org.jboss.shotoku.Node xmlFile = contentManager.getNode(pathToCountersXml); + xmlFile.setContent(xmlString); + xmlFile.save ("[DownlaodCounter] Main xml descriptor file update."); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Method creates content of download counters main descriptor by + * copying values from downloadCounters Map. + * + * @param doc + * This Document object points to download counters main descriptor xml. + */ + private void createDocument (Document doc) { + Set<String> keys = downloadCounters.keySet(); + Counter temporary=null; + 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); + + Node newProjectId = doc.createElement(ID); + Node newProjectIdText = doc.createTextNode(temporary.getProjectId()); + newProjectId.appendChild(newProjectIdText); + + 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); + + doc.getDocumentElement().appendChild(newCounter); + } + } + + /** + * Method simply just increments the counter value for + * given in parameter <link>. + * + * @param link + * Counter value for this <code>link</code> will be incremented. + */ + synchronized public void increment (String link) { + if (downloadCounters.get(link)!=null) { + // Status change to inform about counters modification. + changeStatus=true; + downloadCounters.get(link).increment(); + } + } + + /** + * This method returns true if there is at least one link, + * connected with given in parameter <projectId>, tracked. + * If there is no link for this <projectId> tracked method returns false. + * + * @param projectId + * The id of a project for which occurence of the links will checked. + * @return Bool value whether there is a link to this project tracked or not. + */ + public boolean checkForProjectCounters(String projectId) { + for (String link:downloadCounters.keySet()) { + if (link.indexOf(File.separator+projectId+File.separator)!=-1) { + return true; + } + } + return false; + } + + /** + * Method returns true if there was change in downloadCounters Map. + * Othervise it returns false. + * + * @return Returns true if the status of downloadCounters has changed. + */ + public boolean hasChanged () { + return changeStatus; + } + + + /** + * Method used for pulling the links,counter values and projectIds out from the + * xml file nodes to the <String,Counter> Map. + * @param nodes + * NodeList containing conent of xml descriptor + * @return + * Map<String,Couner> containing counters for links which will be tracked. + */ + private static Map<String,Counter> getValuesFromNodes (NodeList nodes) { + Map<String,Counter> values = new Hashtable<String,Counter>(); + + // Temporary variables used for parsing. + Node n=null,property=null; + + // Parsing main download counters descriptor. + for (int i = 0; i < nodes.getLength(); i++) { + n = nodes.item(i); + if (n.getNodeType() == Node.ELEMENT_NODE) { + if (n.getNodeName().equals(DownloadCountersDescriptor.COUNTER)) { + NodeList counterProps = n.getChildNodes(); + String tempLink = null; + String tempValue = null; + String tempId = null; + for (int j=0;j< counterProps.getLength() ; j++) { + property = counterProps.item(j); + if (property.getNodeType()== Node.ELEMENT_NODE){ + String nodeTextCnt = XmlTools.unmarshallText(property); + if (property.getNodeName().equals(LINK) && nodeTextCnt != null && !nodeTextCnt.trim().equals("")) { + tempLink = nodeTextCnt.trim(); + } else if (property.getNodeName().equals(VALUE) && nodeTextCnt !=null && !nodeTextCnt.trim().equals("")) { + tempValue = nodeTextCnt.trim(); + } else if (property.getNodeName().equals(ID) && nodeTextCnt !=null && !nodeTextCnt.trim().equals("")) { + tempId = nodeTextCnt.trim(); + } + } + } + if (tempLink!=null && tempValue!=null && tempId!=null) { + values.put(tempLink,new Counter(Long.valueOf(tempValue),tempId)); + } + } + } + } + return values; + } + +} Added: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersWatcher.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersWatcher.java 2005-11-12 21:22:11 UTC (rev 1564) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/DownloadCountersWatcher.java 2005-11-13 23:41:22 UTC (rev 1565) @@ -0,0 +1,79 @@ +package org.jboss.forge.common.projects; + +import java.util.Collection; + +import org.jboss.forge.common.service.NodeWatcher; +import org.jboss.forge.common.service.ResourceWatcher; +import org.jboss.shotoku.ContentManager; + +/** + * DownloadCounterWatcher class which implements NodeWatcher interface + * is used for invoking updates of the main download counter xml descriptor + * and watching for changes in projects download counter descriptors. + * + * @author Ryszard Kozmik + * + */ +public class DownloadCountersWatcher implements NodeWatcher{ + + ContentManager contentManager; + ResourceWatcher rw; + + /** + * Simple constructor saving ContentManager given in parameter + * <code>conentManager</code> + * @param contentManager + */ + public DownloadCountersWatcher (ContentManager contentManager) { + this.contentManager = contentManager; + } + + + public Object init(String portalName) { + return getDescriptor(portalName); + } + + /** + * Method constructs the DownloadCountersDescriptor object registers it + * with the ResourceWatcher as well as all found DownloadCounterDescriptor's. + * + * @param portalName + * @return DownloadCountersDescriptor object. + */ + private Object getDescriptor (String portalName) { + DownloadCountersDescriptor descriptor = + new DownloadCountersDescriptor(portalName, contentManager); + rw = new ResourceWatcher(contentManager); + // Registering ResourceWatcher to watch for main download counters xml file change. + rw.watchResource(DownloadCounterTools.getMainXmlPath(portalName)); + + // Getting the project ids names where are project download counter descriptors. + Collection<String> projects = descriptor.getDownloadDescriptors(portalName).keySet(); + + // Adding found project download counter descriptors to the ResourceWatcher to watch + // for their changes. + for (String id:projects) { + rw.watchResource(DownloadCounterTools.getProjectXmlPath(portalName,id)); + } + return descriptor; + } + + /** + * Method updates main downlaod counters descriptor if there is such a need. + * If the object is changed the method returns new object if not returns null. + */ + public Object nodeUpdate(String portalName, Object currentValue) { + if (currentValue==null || rw.checkResources()) { + return getDescriptor(portalName); + } else if (((DownloadCountersDescriptor)currentValue).hasChanged()){ + DownloadCountersDescriptor descriptor = + (DownloadCountersDescriptor)currentValue; + descriptor.synchronizeWithFile(portalName); + return null; + } + return null; + } + + + +} Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectDescriptor.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectDescriptor.java 2005-11-12 21:22:11 UTC (rev 1564) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectDescriptor.java 2005-11-13 23:41:22 UTC (rev 1565) @@ -119,18 +119,6 @@ downloads = null; } - // Trying to create a downloads counter descriptor. - /* IMPLEMENTATION OF DOWNLOAD COUNTER TEMPORARY COMMENTED - try { - downloadCounter = new DownloadCounterDescriptor(isf, xht, portalName, getId()); - } catch (XmlNotFoundException e1) { - // It means that this project doesn't have downlaod counter descriptor. - } - catch (Exception e) { - log.warn("Project "+getId()+", unable te parse download counter" + - " descriptor: "+e); - downloadCounter = null; - }*/ } /** Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsHelper.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsHelper.java 2005-11-12 21:22:11 UTC (rev 1564) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsHelper.java 2005-11-13 23:41:22 UTC (rev 1565) @@ -32,6 +32,7 @@ * Various helper methods for project-specific portlets. * * @author adamw + * @author Ryszard Kozmik */ public class ProjectsHelper { /** Deleted: trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/DownloadCounter.java =================================================================== --- trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/DownloadCounter.java 2005-11-12 21:22:11 UTC (rev 1564) +++ trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/DownloadCounter.java 2005-11-13 23:41:22 UTC (rev 1565) @@ -1,163 +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.fileaccess; - -import java.io.File; -import java.io.InputStream; - -import org.apache.xerces.parsers.DOMParser; -import org.jboss.forge.common.XmlTools; -import org.jboss.forge.common.projects.DomToXmlTransformer; -import org.jboss.forge.common.projects.ProjectsHelper; -import org.jboss.shotoku.ContentManager; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; - -public class DownloadCounter { - - // Name the main xml file containing download counter data. - public static final String DOWNLOADCOUNTER_FILE="counters.xml"; - - // Name of tag in counters.xml containing counter value. - public static final String VALUE = "value"; - - // Name of tag in counters.xml containing counter link. - public static final String LINK = "link"; - - // Name of tag in counters.xml containing counter. - public static final String COUNTER = "counter"; - - synchronized public static void increment (String link,ContentManager contentManager) { - if (link==null) { - return; - } - String portalName = resolvePortalName(link); - - link = File.separator + link; - - String pathToCountersXml = File.separator + portalName + File.separator - + ProjectsHelper.MEMBERS_DIR + File.separator + DOWNLOADCOUNTER_FILE; - - try { - DOMParser parser = new DOMParser(); - - // Getting stream of counters.xml file. - InputStream is = contentManager.getNode(pathToCountersXml).getContentInputStream(); - parser.parse(new InputSource(is)); - Document doc = parser.getDocument(); - NodeList nodes = doc.getDocumentElement().getChildNodes(); - - // This variable will reference Node containing counter for searched link. - Node linkNode = findLinkNode (nodes, link); - - // If the linkNode variable isn't NULL it means that we count this link and should increment it. - if (linkNode!=null) { - NodeList linkNodeChildren=linkNode.getChildNodes(); - Node tempNode = null; - for (int i=0;i<linkNodeChildren.getLength();i++) { - tempNode = linkNodeChildren.item(i); - if (tempNode.getNodeType()== Node.ELEMENT_NODE){ - - // Searching for VALUE node to change its value. - - if (tempNode.getNodeName().equals(VALUE)) { - String nodeTextCnt = XmlTools.unmarshallText(tempNode); - if (nodeTextCnt!=null && !nodeTextCnt.equals("")) { - long value = 1; - try { - // Trying to get the old value from the node. - value = Long.valueOf(nodeTextCnt) + 1; - } catch (NumberFormatException e) { - System.out.println ("[DownloadCounter] Incorrect "+DOWNLOADCOUNTER_FILE+" syntax."); - e.printStackTrace(); - } - NodeList content = tempNode.getChildNodes(); - for (int j=0;j<content.getLength();j++) { - if (content.item(j).getNodeType() == Node.TEXT_NODE){ - // Setting the new node value. - content.item(j).setNodeValue(Long.toString(value)); - break; - } else { - // Removing some inapropriate content of this node. - tempNode.removeChild(content.item(j)); - } - } - } else { - // Situation when the VALUE node is empty - Node newValueText = doc.createTextNode("1"); - tempNode.appendChild(newValueText); - } - break; - } - } - } - DomToXmlTransformer xht = new DomToXmlTransformer(); - String xmlString = xht.transformNode(doc.getDocumentElement()); - // Saving the updated xml. - org.jboss.shotoku.Node xmlFile = contentManager.getNode(pathToCountersXml); - xmlFile.setContent(xmlString); - xmlFile.save ("[DownlaodCounter] Main xml descriptor file update."); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * Method used to resolve portal name to which the download link aims. - * @param link - * @return - */ - private static String resolvePortalName (String link) { - return link.split(File.separator)[0]; - } - - private static Node findLinkNode (NodeList nodes, String link) { - - // Temporary variables used for parsing. - Node n=null,property=null; - - for (int i = 0; i < nodes.getLength(); i++) { - n = nodes.item(i); - if (n.getNodeType() == Node.ELEMENT_NODE) { - if (n.getNodeName().equals(COUNTER)) { - NodeList counterProps = n.getChildNodes(); - for (int j=0;j< counterProps.getLength() ; j++) { - property = counterProps.item(j); - if (property.getNodeType()== Node.ELEMENT_NODE){ - String nodeTextCnt = XmlTools.unmarshallText(property); - if (property.getNodeName().equals(LINK) && nodeTextCnt != null && nodeTextCnt.trim().equals(link)) { - return n; - } - } - } - } - } - } - return null; - } - -} Modified: trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/FileAccessFilter.java =================================================================== --- trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/FileAccessFilter.java 2005-11-12 21:22:11 UTC (rev 1564) +++ trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/FileAccessFilter.java 2005-11-13 23:41:22 UTC (rev 1565) @@ -39,9 +39,8 @@ import org.jboss.shotoku.aop.Inject; import org.jboss.forge.common.ForgeHelper; -/* TEMPORARY COMMENTED DOWNLOAD COUNTER PROJECT */ -//import org.jboss.forge.common.projects.DownloadCountersDescriptor; -//import org.jboss.forge.common.projects.DownloadCountersWatcher; +import org.jboss.forge.common.projects.DownloadCountersDescriptor; +import org.jboss.forge.common.projects.DownloadCountersWatcher; /** @@ -49,6 +48,7 @@ * a content repository. * * @author adamw + * @author Ryszard Kozmik */ public class FileAccessFilter implements Filter { /** @@ -81,6 +81,7 @@ @Inject private ContentManager contentManager; + public void init(FilterConfig conf) { } @@ -127,26 +128,32 @@ // Checking if we can allow access to this resource. checkResource(requestedRes); - /* IMPLEMENTATION OF DOWNLOAD COUNTER TEMPORARY COMMENTED + // DownloadCounter + // checking if it is file access to downloads if (requestedRes.indexOf(DOWNLOADS_ACCESS)!=-1) { + + // resolving portal name String portalName = resolvePortalName(requestedRes); + + // Trying to get DownloadCountersDescriptor object from the cache DownloadCountersDescriptor downloadCounters = (DownloadCountersDescriptor) ForgeHelper .getForgeManagement().getFromCache(portalName, DownloadCountersDescriptor.class.getName()); - + + // Checking if there was DownloadCountersDescriptor object in cache. + // If not creating new one. if (downloadCounters == null) downloadCounters = (DownloadCountersDescriptor) ForgeHelper.getForgeManagement() - .addNodeWatcher(portalName, + .addNodeWatcher(portalName, DownloadCountersDescriptor.class.getName(), new DownloadCountersWatcher(contentManager)); // Sending the request link to the DownloadCounter to increment // counter for this link if it's one of the tracked links. - - downloadCounters.increment(requestedRes); + downloadCounters.increment(File.separator+requestedRes); - } */ + } Node requestedNode = contentManager.getNode(requestedRes); String mimeType = requestedNode.getMimeType(); Modified: trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/portlet/DownloadCounterPortlet.java =================================================================== --- trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/portlet/DownloadCounterPortlet.java 2005-11-12 21:22:11 UTC (rev 1564) +++ trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/portlet/DownloadCounterPortlet.java 2005-11-13 23:41:22 UTC (rev 1565) @@ -30,6 +30,7 @@ import javax.portlet.PortletRequestDispatcher; import org.jboss.forge.common.ForgeHelper; +import org.jboss.forge.common.projects.DownloadCounterTools; import org.jboss.forge.common.projects.ProjectsHelper; import org.jboss.portal.common.context.DelegateContext; import org.jboss.portal.core.servlet.jsp.PortalJsp; @@ -43,24 +44,29 @@ * @author Ryszard Kozmik * Downlaod Counter portlet. */ + public class DownloadCounterPortlet extends JBossPortlet { @Inject private ContentManager contentManager; + public void doView(JBossRenderRequest request, JBossRenderResponse response) throws IOException, PortletException { // Getting name of the project on which the download counter is used. - //String projectId = (String)request.getAttribute("project"); String projectId = ProjectsHelper.getSelectedProjectId(request); + // Preparing request & response ProjectsHelper.prepareRequest(request); response.setContentType("text/html"); + + // Resolving portal name. String portalName = ForgeHelper.getPortalName(request); DelegateContext context = null; try { + // Getting context for view of download counters tracked for project. context = DownloadCounterTools.getContext(portalName,projectId,contentManager); // Adding content context to request for JSP file. request.setAttribute(PortalJsp.CTX_REQUEST, context); @@ -69,6 +75,7 @@ throw new PortletException(e); } + // Dispaching request to the JSP file. PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher( ForgeHelper.createRepoAccessPath(portalName,DownloadCounterTools.getJspCmPath())); rd.include(request, response); Deleted: trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/portlet/DownloadCounterTools.java =================================================================== --- trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/portlet/DownloadCounterTools.java 2005-11-12 21:22:11 UTC (rev 1564) +++ trunk/forge/portal-extensions/forge-file-access/src/java/org/jboss/forge/fileaccess/portlet/DownloadCounterTools.java 2005-11-13 23:41:22 UTC (rev 1565) @@ -1,130 +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.fileaccess.portlet; - -import java.io.File; -import java.io.InputStream; -import java.util.Hashtable; -import java.util.Map; - -import org.apache.xerces.parsers.DOMParser; -import org.jboss.forge.common.XmlTools; -import org.jboss.forge.common.projects.ProjectsHelper; -import org.jboss.forge.fileaccess.DownloadCounter; -import org.jboss.portal.common.context.DelegateContext; -import org.jboss.shotoku.ContentManager; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; - -public class DownloadCounterTools { - - public static final String FORGE_FILE_ACCESS_DIR="file-access"; - public static final String DOWNLOADCOUNTER_JSP="normal.jsp"; - - public static DelegateContext getContext (String portalName,String projectId,ContentManager contentManager) throws Exception { - - // If the projectId is null method returns empty DelegateContext object. - if (projectId==null) { - return new DelegateContext(); - } - - String pathToCountersXml = File.separator + portalName + File.separator - + ProjectsHelper.MEMBERS_DIR + File.separator + DownloadCounter.DOWNLOADCOUNTER_FILE; - - DOMParser parser = new DOMParser(); - - // Getting stream of counters.xml file. - InputStream is = contentManager.getNode(pathToCountersXml).getContentInputStream(); - parser.parse(new InputSource(is)); - Document doc = parser.getDocument(); - NodeList nodes = doc.getDocumentElement().getChildNodes(); - - // This Map will contain links as map keys and, counter values as map values. - Map<String,String> values = getValuesFromNodes (nodes); - - // Filling the context for portlet. - DelegateContext ctx = new DelegateContext(); - for (String keyLink:values.keySet()) { - // Getting project ID from the counter - String counterProjectId = null; - if (keyLink.split(File.separator).length>=4) - counterProjectId = keyLink.split(File.separator)[3]; - if (counterProjectId!=null && counterProjectId.compareTo(projectId)==0) { - DelegateContext counter = ctx.next("counter"); - String fileName = keyLink.split(File.separator)[keyLink.split(File.separator).length-1]; - counter.put("link",fileName); - counter.put("value",values.get(keyLink)); - } - } - return ctx; - } - - /** - * Method used for pulling the links and counter values out from the - * xml file nodes to the <String,String> Map. - * @param nodes - * @return - */ - private static Map<String,String> getValuesFromNodes (NodeList nodes) { - Map<String,String> values = new Hashtable<String,String>(); - - // Temporary variables used for parsing. - Node n=null,property=null; - - // Parsing main Download Counter descriptor. - for (int i = 0; i < nodes.getLength(); i++) { - n = nodes.item(i); - if (n.getNodeType() == Node.ELEMENT_NODE) { - if (n.getNodeName().equals(DownloadCounter.COUNTER)) { - NodeList counterProps = n.getChildNodes(); - String tempLink = null; - String tempValue = null; - for (int j=0;j< counterProps.getLength() ; j++) { - property = counterProps.item(j); - if (property.getNodeType()== Node.ELEMENT_NODE){ - String nodeTextCnt = XmlTools.unmarshallText(property); - if (property.getNodeName().equals("link") && nodeTextCnt != null && !nodeTextCnt.trim().equals("")) { - tempLink = nodeTextCnt.trim(); - } else if (property.getNodeName().equals("value") && nodeTextCnt !=null && !nodeTextCnt.trim().equals("")) { - tempValue = nodeTextCnt.trim(); - } - } - } - if (tempLink!=null && tempValue!=null) { - values.put(tempLink,tempValue); - } - } - } - } - return values; - } - - - public static String getJspCmPath() { - return FORGE_FILE_ACCESS_DIR + File.separator + DOWNLOADCOUNTER_JSP; - } - -} \ No newline at end of file Modified: trunk/forge/portal-extensions/portal-default/src/web/WEB-INF/default-portal.xml =================================================================== --- trunk/forge/portal-extensions/portal-default/src/web/WEB-INF/default-portal.xml 2005-11-12 21:22:11 UTC (rev 1564) +++ trunk/forge/portal-extensions/portal-default/src/web/WEB-INF/default-portal.xml 2005-11-13 23:41:22 UTC (rev 1565) @@ -274,6 +274,13 @@ <region>center</region> <height>0</height> </window> + <window> + <window-name>DownloadCounterPortletWindowDefaultDownloads</window-name> + <instance-ref>counter.DownloadCounterPortlet.DownloadCounterPortletInstance</instance-ref> + <region>center</region> + <height>0</height> + <window-state>normal</window-state> + </window> </page> <page> |