1 package org.apache.archiva.scheduler.indexing;
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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
22 import org.apache.archiva.indexer.ArchivaIndexingContext;
23 import org.apache.archiva.redback.components.taskqueue.Task;
24 import org.apache.archiva.repository.ManagedRepository;
26 import java.nio.file.Path;
29 public class ArtifactIndexingTask
39 private final ManagedRepository repository;
41 private final Path resourceFile;
43 private final Action action;
45 private final ArchivaIndexingContext context;
47 private boolean executeOnEntireRepo = true;
52 private boolean onlyUpdate = false;
54 public ArtifactIndexingTask( ManagedRepository repository, Path resourceFile, Action action,
55 ArchivaIndexingContext context )
57 this.repository = repository;
58 this.resourceFile = resourceFile;
60 this.context = context;
63 public ArtifactIndexingTask( ManagedRepository repository, Path resourceFile, Action action,
64 ArchivaIndexingContext context, boolean executeOnEntireRepo )
66 this( repository, resourceFile, action, context );
67 this.executeOnEntireRepo = executeOnEntireRepo;
70 public ArtifactIndexingTask( ManagedRepository repository, Path resourceFile, Action action,
71 ArchivaIndexingContext context, boolean executeOnEntireRepo, boolean onlyUpdate )
73 this( repository, resourceFile, action, context, executeOnEntireRepo );
74 this.onlyUpdate = onlyUpdate;
77 public boolean isExecuteOnEntireRepo()
79 return executeOnEntireRepo;
82 public void setExecuteOnEntireRepo( boolean executeOnEntireRepo )
84 this.executeOnEntireRepo( executeOnEntireRepo );
87 public ArtifactIndexingTask executeOnEntireRepo( boolean executeOnEntireRepo )
89 this.executeOnEntireRepo = executeOnEntireRepo;
94 public long getMaxExecutionTime()
99 public Path getResourceFile()
104 public Action getAction()
109 public ManagedRepository getRepository()
114 public ArchivaIndexingContext getContext()
119 public boolean isOnlyUpdate()
124 public void setOnlyUpdate( boolean onlyUpdate )
126 this.onlyUpdate = onlyUpdate;
130 public int hashCode()
132 final int prime = 31;
134 result = prime * result + action.hashCode();
135 result = prime * result + repository.getId().hashCode();
136 result = prime * result + ( ( resourceFile == null ) ? 0 : resourceFile.hashCode() );
141 public boolean equals( Object obj )
151 if ( getClass() != obj.getClass() )
155 ArtifactIndexingTask other = (ArtifactIndexingTask) obj;
156 if ( !action.equals( other.action ) )
160 if ( !repository.getId().equals( other.repository.getId() ) )
164 if ( resourceFile == null )
166 if ( other.resourceFile != null )
171 else if ( !resourceFile.equals( other.resourceFile ) )
180 public String toString()
182 return "ArtifactIndexingTask [action=" + action + ", repositoryId=" + repository.getId() + ", resourceFile="
183 + resourceFile + "]";