001package org.apache.archiva.indexer.merger; 002/* 003 * Licensed to the Apache Software Foundation (ASF) under one 004 * or more contributor license agreements. See the NOTICE file 005 * distributed with this work for additional information 006 * regarding copyright ownership. The ASF licenses this file 007 * to you under the Apache License, Version 2.0 (the 008 * "License"); you may not use this file except in compliance 009 * with the License. You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, 014 * software distributed under the License is distributed on an 015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 016 * KIND, either express or implied. See the License for the 017 * specific language governing permissions and limitations 018 * under the License. 019 */ 020 021import java.io.File; 022import java.io.Serializable; 023import java.util.Date; 024 025/** 026 * @author Olivier Lamy 027 */ 028public class TemporaryGroupIndex 029 implements Serializable 030{ 031 private long creationTime = new Date().getTime(); 032 033 private File directory; 034 035 private String indexId; 036 037 private String groupId; 038 039 private int mergedIndexTtl; 040 041 public TemporaryGroupIndex(File directory, String indexId, String groupId, int mergedIndexTtl) 042 { 043 this.directory = directory; 044 this.indexId = indexId; 045 this.groupId = groupId; 046 this.mergedIndexTtl = mergedIndexTtl; 047 } 048 049 public long getCreationTime() 050 { 051 return creationTime; 052 } 053 054 public TemporaryGroupIndex setCreationTime( long creationTime ) 055 { 056 this.creationTime = creationTime; 057 return this; 058 } 059 060 public File getDirectory() 061 { 062 return directory; 063 } 064 065 public TemporaryGroupIndex setDirectory( File directory ) 066 { 067 this.directory = directory; 068 return this; 069 } 070 071 public String getIndexId() 072 { 073 return indexId; 074 } 075 076 public TemporaryGroupIndex setIndexId( String indexId ) 077 { 078 this.indexId = indexId; 079 return this; 080 } 081 082 public String getGroupId() 083 { 084 return groupId; 085 } 086 087 public void setGroupId( String groupId ) 088 { 089 this.groupId = groupId; 090 } 091 092 public int getMergedIndexTtl() { 093 return mergedIndexTtl; 094 } 095 096 public void setMergedIndexTtl(int mergedIndexTtl) { 097 this.mergedIndexTtl = mergedIndexTtl; 098 } 099 100 @Override 101 public int hashCode() 102 { 103 return Long.toString( creationTime ).hashCode(); 104 } 105 106 @Override 107 public boolean equals( Object o ) 108 { 109 if ( this == o ) 110 { 111 return true; 112 } 113 if ( !( o instanceof TemporaryGroupIndex ) ) 114 { 115 return false; 116 } 117 return this.creationTime == ( (TemporaryGroupIndex) o ).creationTime; 118 } 119}