1 package org.apache.archiva.metadata.repository.stats.model;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import org.apache.archiva.metadata.model.MetadataFacet;
23
24 import java.util.Date;
25 import java.util.Map;
26
27 /**
28 *
29 * Provides statistics data of metadata repositories.
30 *
31 * @since 2.3
32 */
33 public interface RepositoryStatistics extends MetadataFacet
34 {
35 String FACET_ID = "org.apache.archiva.metadata.repository.stats";
36
37 String getRepositoryId( );
38
39 Date getScanEndTime( );
40
41 Date getScanStartTime( );
42
43 long getTotalArtifactCount( );
44
45 void setTotalArtifactCount( long totalArtifactCount );
46
47 long getTotalArtifactFileSize( );
48
49 void setTotalArtifactFileSize( long totalArtifactFileSize );
50
51 long getTotalFileCount( );
52
53 void setTotalFileCount( long totalFileCount );
54
55 long getTotalGroupCount( );
56
57 void setTotalGroupCount( long totalGroupCount );
58
59 long getTotalProjectCount( );
60
61 void setTotalProjectCount( long totalProjectCount );
62
63 void setNewFileCount( long newFileCount );
64
65 long getNewFileCount( );
66
67 long getDuration( );
68
69 /**
70 * Statistics data by artifact type.
71 *
72 * @return A list of data keys and values
73 */
74 Map<String, Long> getTotalCountForType( );
75
76 /**
77 * Returns the value for the given artifact type.
78 *
79 * @param type The artifact type
80 * @return The count value.
81 */
82 long getTotalCountForType( String type );
83
84 /**
85 * Sets the value for the given artifact type.
86 * @param type The artifact type.
87 * @param count The count value.
88 */
89 void setTotalCountForType( String type, long count );
90
91 /**
92 * Reads custom statistic values that are store implementation
93 * specific.
94 *
95 * @param fieldName A unique field name.
96 */
97 long getCustomValue(String fieldName);
98
99 /**
100 * Saves custom statistic values that are store implementation
101 * specific. The field name should be unique (e.g. prefixed by the
102 * package name of the data provider).
103 *
104 * @param fieldName A unique field name.
105 * @param count The statistic counter value
106 */
107 void setCustomValue(String fieldName, long count);
108
109 }