1 package org.apache.archiva.indexer.merger;
2 /*
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 */
20
21 import org.apache.archiva.repository.storage.StorageAsset;
22
23 import java.io.Serializable;
24 import java.nio.file.Path;
25 import java.util.Date;
26
27 /**
28 * @author Olivier Lamy
29 */
30 public class TemporaryGroupIndex
31 implements Serializable
32 {
33 private long creationTime = new Date().getTime();
34
35 private StorageAsset directory;
36
37 private String indexId;
38
39 private String groupId;
40
41 private int mergedIndexTtl;
42
43 public TemporaryGroupIndex(StorageAsset directory, String indexId, String groupId, int mergedIndexTtl)
44 {
45 this.directory = directory;
46 this.indexId = indexId;
47 this.groupId = groupId;
48 this.mergedIndexTtl = mergedIndexTtl;
49 }
50
51 public long getCreationTime()
52 {
53 return creationTime;
54 }
55
56 public TemporaryGroupIndex setCreationTime( long creationTime )
57 {
58 this.creationTime = creationTime;
59 return this;
60 }
61
62 public StorageAsset getDirectory()
63 {
64 return directory;
65 }
66
67 public TemporaryGroupIndex setDirectory( StorageAsset directory )
68 {
69 this.directory = directory;
70 return this;
71 }
72
73 public String getIndexId()
74 {
75 return indexId;
76 }
77
78 public TemporaryGroupIndex setIndexId( String indexId )
79 {
80 this.indexId = indexId;
81 return this;
82 }
83
84 public String getGroupId()
85 {
86 return groupId;
87 }
88
89 public void setGroupId( String groupId )
90 {
91 this.groupId = groupId;
92 }
93
94 public int getMergedIndexTtl() {
95 return mergedIndexTtl;
96 }
97
98 public void setMergedIndexTtl(int mergedIndexTtl) {
99 this.mergedIndexTtl = mergedIndexTtl;
100 }
101
102 @Override
103 public int hashCode()
104 {
105 return Long.toString( creationTime ).hashCode();
106 }
107
108 @Override
109 public boolean equals( Object o )
110 {
111 if ( this == o )
112 {
113 return true;
114 }
115 if ( !( o instanceof TemporaryGroupIndex ) )
116 {
117 return false;
118 }
119 return this.creationTime == ( (TemporaryGroupIndex) o ).creationTime;
120 }
121 }