001package org.apache.archiva.metadata.repository.stats.model; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import org.apache.archiva.metadata.model.MetadataFacet; 023 024import java.util.Date; 025import java.util.Map; 026 027/** 028 * 029 * Provides statistics data of metadata repositories. 030 * 031 * @since 2.3 032 */ 033public interface RepositoryStatistics extends MetadataFacet 034{ 035 String FACET_ID = "org.apache.archiva.metadata.repository.stats"; 036 037 String getRepositoryId( ); 038 039 Date getScanEndTime( ); 040 041 Date getScanStartTime( ); 042 043 long getTotalArtifactCount( ); 044 045 void setTotalArtifactCount( long totalArtifactCount ); 046 047 long getTotalArtifactFileSize( ); 048 049 void setTotalArtifactFileSize( long totalArtifactFileSize ); 050 051 long getTotalFileCount( ); 052 053 void setTotalFileCount( long totalFileCount ); 054 055 long getTotalGroupCount( ); 056 057 void setTotalGroupCount( long totalGroupCount ); 058 059 long getTotalProjectCount( ); 060 061 void setTotalProjectCount( long totalProjectCount ); 062 063 void setNewFileCount( long newFileCount ); 064 065 long getNewFileCount( ); 066 067 long getDuration( ); 068 069 /** 070 * Statistics data by artifact type. 071 * 072 * @return A list of data keys and values 073 */ 074 Map<String, Long> getTotalCountForType( ); 075 076 /** 077 * Returns the value for the given artifact type. 078 * 079 * @param type The artifact type 080 * @return The count value. 081 */ 082 long getTotalCountForType( String type ); 083 084 /** 085 * Sets the value for the given artifact type. 086 * @param type The artifact type. 087 * @param count The count value. 088 */ 089 void setTotalCountForType( String type, long count ); 090 091 /** 092 * Reads custom statistic values that are store implementation 093 * specific. 094 * 095 * @param fieldName A unique field name. 096 */ 097 long getCustomValue(String fieldName); 098 099 /** 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}