You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IndexingTask.java 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. package org.apache.archiva.admin.model.beans;
  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. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. import java.io.Serializable;
  20. /**
  21. * Information about index update tasks running on a repository.
  22. *
  23. * @author Martin Stockhammer <martin_s@apache.org>
  24. */
  25. public class IndexingTask extends RepositoryTaskInfo implements Serializable
  26. {
  27. private static final long serialVersionUID = -1947200162602613310L;
  28. /**
  29. * <code>true</code>, if this task is just updating the existing index.
  30. */
  31. private boolean updateOnly;
  32. public boolean isUpdateOnly( )
  33. {
  34. return updateOnly;
  35. }
  36. public void setUpdateOnly( boolean updateOnly )
  37. {
  38. this.updateOnly = updateOnly;
  39. }
  40. @Override
  41. public boolean equals( Object o )
  42. {
  43. if ( this == o ) return true;
  44. if ( o == null || getClass( ) != o.getClass( ) ) return false;
  45. IndexingTask that = (IndexingTask) o;
  46. if ( isFullScan( ) != that.fullScan ) return false;
  47. if ( updateOnly != that.updateOnly ) return false;
  48. if ( isRunning( ) != that.isRunning( ) ) return false;
  49. if ( getMaxExecutionTimeMs( ) != that.getMaxExecutionTimeMs( ) ) return false;
  50. if ( !getRepositoryId( ).equals( that.getRepositoryId( ) ) ) return false;
  51. return getResource( ).equals( that.getResource( ) );
  52. }
  53. @Override
  54. public int hashCode( )
  55. {
  56. int result = getRepositoryId( ).hashCode( );
  57. result = 31 * result + ( isFullScan( ) ? 1 : 0 );
  58. result = 31 * result + ( updateOnly ? 1 : 0 );
  59. result = 31 * result + getResource( ).hashCode( );
  60. result = 31 * result + ( isRunning( ) ? 1 : 0 );
  61. result = 31 * result + (int) ( getMaxExecutionTimeMs( ) ^ ( getMaxExecutionTimeMs( ) >>> 32 ) );
  62. return result;
  63. }
  64. @Override
  65. public String toString( )
  66. {
  67. final StringBuilder sb = new StringBuilder( "IndexingTask{" );
  68. sb.append( "repositoryId='" ).append( getRepositoryId( ) ).append( '\'' );
  69. sb.append( ", fullRepository=" ).append( isFullScan( ) );
  70. sb.append( ", updateOnly=" ).append( updateOnly );
  71. sb.append( ", resource='" ).append( getResource( ) ).append( '\'' );
  72. sb.append( ", running=" ).append( isRunning( ) );
  73. sb.append( ", maxExecutionTimeMs=" ).append( getMaxExecutionTimeMs( ) );
  74. sb.append( '}' );
  75. return sb.toString( );
  76. }
  77. }