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.admin.model.beans.ManagedRepository;
23 import org.apache.archiva.redback.components.taskqueue.Task;
24 import org.apache.maven.index.context.IndexingContext;
28 public class ArtifactIndexingTask
38 private final ManagedRepository repository;
40 private final File resourceFile;
42 private final Action action;
44 private final IndexingContext context;
46 private boolean executeOnEntireRepo = true;
51 private boolean onlyUpdate = false;
53 public ArtifactIndexingTask( ManagedRepository repository, File resourceFile, Action action,
54 IndexingContext context )
56 this.repository = repository;
57 this.resourceFile = resourceFile;
59 this.context = context;
62 public ArtifactIndexingTask( ManagedRepository repository, File resourceFile, Action action,
63 IndexingContext context, boolean executeOnEntireRepo )
65 this( repository, resourceFile, action, context );
66 this.executeOnEntireRepo = executeOnEntireRepo;
69 public ArtifactIndexingTask( ManagedRepository repository, File resourceFile, Action action,
70 IndexingContext context, boolean executeOnEntireRepo, boolean onlyUpdate )
72 this( repository, resourceFile, action, context, executeOnEntireRepo );
73 this.onlyUpdate = onlyUpdate;
76 public boolean isExecuteOnEntireRepo()
78 return executeOnEntireRepo;
81 public void setExecuteOnEntireRepo( boolean executeOnEntireRepo )
83 this.executeOnEntireRepo( executeOnEntireRepo );
86 public ArtifactIndexingTask executeOnEntireRepo( boolean executeOnEntireRepo )
88 this.executeOnEntireRepo = executeOnEntireRepo;
93 public long getMaxExecutionTime()
98 public File getResourceFile()
103 public Action getAction()
108 public ManagedRepository getRepository()
113 public IndexingContext getContext()
118 public boolean isOnlyUpdate()
123 public void setOnlyUpdate( boolean onlyUpdate )
125 this.onlyUpdate = onlyUpdate;
129 public int hashCode()
131 final int prime = 31;
133 result = prime * result + action.hashCode();
134 result = prime * result + repository.getId().hashCode();
135 result = prime * result + ( ( resourceFile == null ) ? 0 : resourceFile.hashCode() );
140 public boolean equals( Object obj )
150 if ( getClass() != obj.getClass() )
154 ArtifactIndexingTask other = (ArtifactIndexingTask) obj;
155 if ( !action.equals( other.action ) )
159 if ( !repository.getId().equals( other.repository.getId() ) )
163 if ( resourceFile == null )
165 if ( other.resourceFile != null )
170 else if ( !resourceFile.equals( other.resourceFile ) )
179 public String toString()
181 return "ArtifactIndexingTask [action=" + action + ", repositoryId=" + repository.getId() + ", resourceFile="
182 + resourceFile + "]";