View Javadoc
1   /*
2    * Copyright (C) 2003-2007 eXo Platform SAS.
3    *
4    * This program is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Affero General Public License
6    * as published by the Free Software Foundation; either version 3
7    * of the License, or (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program; if not, see<http://www.gnu.org/licenses/>.
16   */
17  package org.exoplatform.services.cms.scripts;
18  
19  import java.util.List;
20  import java.util.Set;
21  
22  import javax.jcr.Node;
23  import org.exoplatform.services.jcr.ext.common.SessionProvider;
24  
25  public interface ScriptService {
26    
27    /**
28     * This method will get node for ECM Explorer Scripts by giving the following params: provider
29     * @param provider      SessionProvider
30     * @see                 Node
31     * @see                 org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator
32     * @see                 SessionProvider
33     * @return              Node
34     * @throws Exception
35     */
36    public Node getECMScriptHome(SessionProvider provider) throws Exception;
37    
38    /**
39     * This method will get all node for ECM Action Scripts by giving the following params: provider
40     * @param provider
41     * @see                 Node
42     * @see                 org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator
43     * @see                 SessionProvider
44     * @return              Node
45     * @throws Exception
46     */
47    public List<Node> getECMActionScripts(SessionProvider provider) throws Exception;  
48    
49    /**
50     * This method will get all node for ECM Interceptor Scripts by giving the following params: provider
51     * @param provider
52     * @see                 Node
53     * @see                 org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator
54     * @see                 SessionProvider
55     * @return              nodes list
56     * @throws Exception
57     */
58    public List<Node> getECMInterceptorScripts(SessionProvider provider) throws Exception;  
59    
60    /**
61     * This method will get all node for ECM Widget Scripts by giving the following params: provider
62     * @param provider
63     * @see                 Node
64     * @see                 org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator
65     * @see                 SessionProvider
66     * @return              nodes list
67     * @throws Exception
68     */
69    public List<Node> getECMWidgetScripts(SessionProvider provider) throws Exception;  
70    
71    /**
72     * This method will get script by giving the following params: scriptPath
73     * @param scriptPath    String
74     *                      The path of script
75     * @see                 CmsScript
76     * @return              CmsScript
77     * @throws Exception
78     */
79    public CmsScript getScript(String scriptPath) throws Exception;  
80  
81    /**
82     * This method will get base path of script
83     * @see                 org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator
84     * @return              String
85     * @throws Exception
86     */
87    public String getBaseScriptPath() throws Exception ;
88  
89    /**
90     * This method will return the script as Text based on the script node.
91     * @param script        Node
92     *                      The script node
93     * @see                 Node
94     * @return              String
95     * @throws Exception
96     */
97    public String getScriptAsText(Node script) throws Exception;
98    
99    /**
100    * This method will add script by giving the following params: name, text, provider
101    * @param name          String
102    *                      The name of script
103    * @param text          String
104    * @param provider      SessionProvider
105    * @see                 SessionProvider
106    * @throws Exception
107    */
108   public void addScript(String name, String text, SessionProvider provider) throws Exception;
109   
110   /**
111    * This method will add script by giving the following params: name, text, description, provider
112    * @param name          String
113    *                      The name of script
114    * @param text          String
115    * @param description   String
116    * @param provider      SessionProvider
117    * @see                 SessionProvider
118    * @throws Exception
119    */
120   public void addScript(String name, String description, String text, SessionProvider provider) throws Exception;  
121   
122   /**
123    * This method will remove script by giving the following params: name, text, provider
124    * @param scriptPath    String
125    *                      The path of script
126    * @param provider      SessionProvider
127    * @see                 Node
128    * @see                 SessionProvider
129    * @throws Exception
130    */
131   public void removeScript(String scriptPath, SessionProvider provider) throws Exception;  
132   
133   /**
134    * This method will get script node by giving the following params: scriptName,  provider
135    * @param scriptName    String
136    *                      The name of script
137    * @param provider      SessionProvider
138    * @see                 Node
139    * @see                 SessionProvider
140    * @return              Node
141    * @throws Exception
142    */
143   public Node getScriptNode(String scriptName, SessionProvider provider) throws Exception;  
144   
145   /**
146    * This method will init the current repository
147    * @see                 org.exoplatform.services.jcr.core.ManageableRepository
148    * @see                 javax.jcr.observation.ObservationManager
149    * @see                 javax.jcr.Session
150    * @throws Exception
151    */
152   public void initRepo() throws Exception;
153   
154   /**
155    * gets all configured scripts
156    * @return
157    */
158   public Set<String> getAllConfiguredScripts();
159 }