View Javadoc

1   package net.sourceforge.blogentis.storage.impl;
2   
3   //-----------------------------------------------------------------------
4   //Blogentis - a blog publishing platform.
5   //Copyright (C) 2004 Tassos Bassoukos <abassouk@gmail.com>
6   //
7   //This library is free software; you can redistribute it and/or
8   //modify it under the terms of the GNU Lesser General Public
9   //License as published by the Free Software Foundation; either
10  //version 2.1 of the License, or (at your option) any later version.
11  //
12  //This library is distributed in the hope that it will be useful,
13  //but WITHOUT ANY WARRANTY; without even the implied warranty of
14  //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  //Lesser General Public License for more details.
16  //
17  //You should have received a copy of the GNU Lesser General Public
18  //License along with this library; if not, write to the Free Software
19  //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  //-----------------------------------------------------------------------
21  //
22  //$Id: StorageExtensionPointImpl.java,v 1.1 2004/10/22 17:34:13 tassos Exp $
23  //
24  
25  import java.util.Iterator;
26  
27  import net.sourceforge.blogentis.om.Blog;
28  import net.sourceforge.blogentis.plugins.AbstractBlogExtensionPoint;
29  import net.sourceforge.blogentis.plugins.IPlugin;
30  import net.sourceforge.blogentis.storage.IStorageExtension;
31  import net.sourceforge.blogentis.storage.IStorageExtensionPoint;
32  
33  import org.apache.slide.content.NodeRevisionContent;
34  import org.apache.slide.content.NodeRevisionDescriptor;
35  import org.apache.slide.content.NodeRevisionDescriptors;
36  import org.apache.slide.content.NodeRevisionNumber;
37  
38  /***
39   * @author abas
40   *  
41   */
42  public class StorageExtensionPointImpl
43          extends AbstractBlogExtensionPoint
44          implements IStorageExtensionPoint {
45  
46      public StorageExtensionPointImpl(IPlugin plugin, Blog blog) {
47          super(plugin, blog);
48      }
49  
50      public String getName() {
51          return "Storage Operations Extension Point";
52      }
53  
54      public Class getExtensionClass() {
55          return IStorageExtension.class;
56      }
57  
58      public void preStoreContent(String originalPath,
59                                  NodeRevisionDescriptors revisionDescriptors,
60                                  NodeRevisionDescriptor revisionDescriptor,
61                                  NodeRevisionContent revisionContent) {
62          for(Iterator i = extensions.iterator(); i.hasNext();) {
63              IStorageExtension ise = (IStorageExtension)i.next();
64              ise.preStoreContent(originalPath, revisionDescriptors,
65                                  revisionDescriptor, revisionContent);
66          }
67      }
68  
69      public void postStoreContent(String originalPath,
70                                   NodeRevisionDescriptors revisionDescriptors,
71                                   NodeRevisionDescriptor revisionDescriptor,
72                                   NodeRevisionContent revisionContent) {
73          for(Iterator i = extensions.iterator(); i.hasNext();) {
74              IStorageExtension ise = (IStorageExtension)i.next();
75              ise.postStoreContent(originalPath, revisionDescriptors,
76                                   revisionDescriptor, revisionContent);
77          }
78      }
79  
80      public void preRetrieveContent(String originalPath,
81                                     NodeRevisionDescriptors revisionDescriptors,
82                                     NodeRevisionNumber revisionNumber,
83                                     NodeRevisionDescriptor revisionDescriptor) {
84          for(Iterator i = extensions.iterator(); i.hasNext();) {
85              IStorageExtension ise = (IStorageExtension)i.next();
86              ise.preRetrieveContent(originalPath, revisionDescriptors,
87                                     revisionNumber, revisionDescriptor);
88          }
89      }
90  
91      public void postRetrieveContent(
92                                      String originalPath,
93                                      NodeRevisionDescriptors revisionDescriptors,
94                                      NodeRevisionDescriptor revisionDescriptor,
95                                      NodeRevisionContent revisionContent) {
96          for(Iterator i = extensions.iterator(); i.hasNext();) {
97              IStorageExtension ise = (IStorageExtension)i.next();
98              ise.postRetrieveContent(originalPath, revisionDescriptors,
99                                      revisionDescriptor, revisionContent);
100         }
101     }
102 
103     public void preRemoveContent(String originalPath,
104                                  NodeRevisionDescriptors revisionDescriptors,
105                                  NodeRevisionDescriptor revisionDescriptor) {
106         for(Iterator i = extensions.iterator(); i.hasNext();) {
107             IStorageExtension ise = (IStorageExtension)i.next();
108             ise.preRemoveContent(originalPath, revisionDescriptors,
109                                  revisionDescriptor);
110         }
111     }
112 }