This project has retired. For details please refer to its Attic page.
Source code
001package org.apache.archiva.scheduler.repository.model;
002
003import org.apache.archiva.redback.components.taskqueue.Task;
004
005import java.io.File;
006
007/*
008 * Licensed to the Apache Software Foundation (ASF) under one
009 * or more contributor license agreements.  See the NOTICE file
010 * distributed with this work for additional information
011 * regarding copyright ownership.  The ASF licenses this file
012 * to you under the Apache License, Version 2.0 (the
013 * "License"); you may not use this file except in compliance
014 * with the License.  You may obtain a copy of the License at
015 *
016 *   http://www.apache.org/licenses/LICENSE-2.0
017 *
018 * Unless required by applicable law or agreed to in writing,
019 * software distributed under the License is distributed on an
020 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
021 * KIND, either express or implied.  See the License for the
022 * specific language governing permissions and limitations
023 * under the License.
024 */
025
026/**
027 * DataRefreshTask - task for discovering changes in the repository
028 * and updating all associated data.
029 */
030public class RepositoryTask
031    implements Task
032{
033    private String repositoryId;
034
035    private File resourceFile;
036
037    private boolean updateRelatedArtifacts;
038
039    private boolean scanAll;
040
041    public RepositoryTask()
042    {
043        // no op
044    }
045
046    public RepositoryTask( String repositoryId )
047    {
048        this.repositoryId = repositoryId;
049    }
050
051    public RepositoryTask( String repositoryId, boolean scanAll )
052    {
053        this.repositoryId = repositoryId;
054        this.scanAll = scanAll;
055    }
056
057    public boolean isScanAll()
058    {
059        return scanAll;
060    }
061
062    public void setScanAll( boolean scanAll )
063    {
064        this.scanAll = scanAll;
065    }
066
067    public String getRepositoryId()
068    {
069        return repositoryId;
070    }
071
072    public void setRepositoryId( String repositoryId )
073    {
074        this.repositoryId = repositoryId;
075    }
076
077    @Override
078    public long getMaxExecutionTime()
079    {
080        return 0;
081    }
082
083    public File getResourceFile()
084    {
085        return resourceFile;
086    }
087
088    public void setResourceFile( File resourceFile )
089    {
090        this.resourceFile = resourceFile;
091    }
092
093    public boolean isUpdateRelatedArtifacts()
094    {
095        return updateRelatedArtifacts;
096    }
097
098    public void setUpdateRelatedArtifacts( boolean updateRelatedArtifacts )
099    {
100        this.updateRelatedArtifacts = updateRelatedArtifacts;
101    }
102
103    @Override
104    public String toString()
105    {
106        return "RepositoryTask [repositoryId=" + repositoryId + ", resourceFile=" + resourceFile + ", scanAll="
107            + scanAll + ", updateRelatedArtifacts=" + updateRelatedArtifacts + "]";
108    }
109
110    @Override
111    public int hashCode()
112    {
113        final int prime = 31;
114        int result = 1;
115        result = prime * result + ( ( repositoryId == null ) ? 0 : repositoryId.hashCode() );
116        result = prime * result + ( ( resourceFile == null ) ? 0 : resourceFile.hashCode() );
117        return result;
118    }
119
120    @Override
121    public boolean equals( Object obj )
122    {
123        if ( this == obj )
124        {
125            return true;
126        }
127        if ( obj == null )
128        {
129            return false;
130        }
131        if ( getClass() != obj.getClass() )
132        {
133            return false;
134        }
135        RepositoryTask other = (RepositoryTask) obj;
136        if ( repositoryId == null )
137        {
138            if ( other.repositoryId != null )
139            {
140                return false;
141            }
142        }
143        else if ( !repositoryId.equals( other.repositoryId ) )
144        {
145            return false;
146        }
147        if ( resourceFile == null )
148        {
149            if ( other.resourceFile != null )
150            {
151                return false;
152            }
153        }
154        else if ( !resourceFile.equals( other.resourceFile ) )
155        {
156            return false;
157        }
158        return true;
159    }
160}