View Javadoc

1   /**
2    * This file Copyright (c) 2013 Magnolia International
3    * Ltd.  (http://www.magnolia-cms.com). All rights reserved.
4    *
5    *
6    * This file is dual-licensed under both the Magnolia
7    * Network Agreement and the GNU General Public License.
8    * You may elect to use one or the other of these licenses.
9    *
10   * This file is distributed in the hope that it will be
11   * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
12   * implied warranty of MERCHANTABILITY or FITNESS FOR A
13   * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
14   * Redistribution, except as permitted by whichever of the GPL
15   * or MNA you select, is prohibited.
16   *
17   * 1. For the GPL license (GPL), you can redistribute and/or
18   * modify this file under the terms of the GNU General
19   * Public License, Version 3, as published by the Free Software
20   * Foundation.  You should have received a copy of the GNU
21   * General Public License, Version 3 along with this program;
22   * if not, write to the Free Software Foundation, Inc., 51
23   * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24   *
25   * 2. For the Magnolia Network Agreement (MNA), this file
26   * and the accompanying materials are made available under the
27   * terms of the MNA which accompanies this distribution, and
28   * is available at http://www.magnolia-cms.com/mna.html
29   *
30   * Any modifications to this file must keep this entire header
31   * intact.
32   *
33   */
34  package info.magnolia.module.exchangesimple.monitor;
35  
36  import java.util.Collection;
37  import java.util.Date;
38  import java.util.Map;
39  
40  /**
41   * Interface providing methods to store informations about activation.
42   */
43  public interface ActivationStorage {
44  
45      /**
46       * Logs subscriber response time.
47       * 
48       * @param subscriber name of subscriber
49       * @param time time in miliseconds
50       */
51      public void setSubscriberResponseTime(String subscriber, long time);
52  
53      /**
54       * Logs error that occurred during activation.
55       * 
56       * @param path node path
57       * @param user user's name
58       * @param workspaceName
59       * @param subscriber
60       * @param t exception that occurred during activation
61       * @param deactivation true if deactivation, false if activation
62       */
63      public void logError(String path, String user, String workspaceName, String subscriber, Throwable t, boolean deactivation);
64  
65      /**
66       * Adds size of content that is being activated.
67       * 
68       * @param size
69       */
70      public void addSizeOfActivatedContent(long size);
71  
72      /**
73       * Logs activation request.
74       * 
75       * @param node node which is being activated
76       * @param user user that made activation request
77       * @param deactivation true if is deactivation, false if activation
78       */
79      public void logActivation(String path, String user, String workspaceName, String subscriber, boolean deactivation, boolean success);
80  
81      /**
82       * Adds time needed for activation to complete.
83       * 
84       * @param time time in milliseconds
85       */
86      public void addActivationTime(long time);
87  
88      /**
89       * Increase number of commited transactions by 1.
90       */
91      public void addCommitedTransaction();
92  
93      /**
94       * Increase number of rollbacked transactions by 1.
95       */
96      public void addRollbackedTransaction();
97  
98      /**
99       * Gets time that was spent on activations.
100      * 
101      * @return time in milliseconds
102      */
103     public long getActivationTime();
104 
105     /**
106      * Gets number of activations since last restart.
107      * 
108      * @return number of activations
109      */
110     public int getActivations();
111 
112     /**
113      * Gets number of deactivations since last restart.
114      * 
115      * @return number of deactivations
116      */
117     public int getDeactivations();
118 
119     /**
120      * Gets number of activation errors since last restart.
121      * 
122      * @return number of activation errors
123      */
124     public int getActivationErrors();
125 
126     /**
127      * Gets number of commited transactions since last restart.
128      * 
129      * @return number of commited transactions
130      */
131     public int getCommitedTransactions();
132 
133     /**
134      * Gets number of rollbacked transactions since last restart.
135      * 
136      * @return number of rollbacked transactions
137      */
138     public int getRollbackedTransactions();
139 
140     /**
141      * Gets size of activated content since last restart (in kilobytes).
142      * 
143      * @return size of activated content (in kilobytes)
144      */
145     public long getSizeOfActivatedContent();
146 
147     /**
148      * Gets date from last restart.
149      * 
150      * @return date
151      */
152     public Date getLastRestartDate();
153 
154     /**
155      * Gets activation log.
156      * 
157      * @return map containing activation log
158      */
159     public Collection<ActivationLogEntry> getActivationLog();
160 
161     /**
162      * Gets collection of errors that occurred during activation.
163      * 
164      * @return collection of errors
165      */
166     public Collection<ActivationLogEntry> getActivationErrorLog();
167 
168     /**
169      * Gets activations made by a specified user.
170      * 
171      * @param user name of user
172      * @return map with items that has been activated by specific user
173      */
174     public Collection<ActivationLogEntry> getActivationsMadeByUser(String user);
175 
176     /**
177      * Gets activations per workspace since last restart.
178      * 
179      * @return activations per workspace
180      */
181     public Map<String, Integer> getActivationsPerWorkspace();
182 
183     /**
184      * Gets response times for subscribers.
185      * 
186      * @return response times for subscribers
187      */
188     public Map<String, ResponseTimeEntry> getSubscriberResponseTimes();
189 
190 }