1 package org.apache.archiva.admin.model.beans;
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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
21 import javax.xml.bind.annotation.XmlRootElement;
22 import java.io.Serializable;
23 import java.util.ArrayList;
24 import java.util.List;
27 * @author Olivier Lamy
30 @XmlRootElement(name = "repositoryGroup")
31 public class RepositoryGroup
32 implements Serializable
42 private List<String> repositories;
45 * The path of the merged index.
47 private String mergedIndexPath = "/.indexer";
50 * The TTL (time to live) of the repo group's merged index.
52 private int mergedIndexTtl = 30;
54 public RepositoryGroup()
59 public RepositoryGroup( String id, List<String> repositories )
62 this.repositories = repositories;
66 * Method addRepository.
70 public void addRepository( String string )
72 getRepositories().add( string );
76 * Get the id of the repository group.
86 * Method getRepositories.
90 public List<String> getRepositories()
92 if ( this.repositories == null )
94 this.repositories = new ArrayList<String>( 0 );
97 return this.repositories;
101 * Method removeRepository.
105 public void removeRepository( String string )
107 getRepositories().remove( string );
111 * Set the id of the repository group.
115 public void setId( String id )
121 * Set the list of repository ids under the group.
123 * @param repositories
125 public void setRepositories( List<String> repositories )
127 this.repositories = repositories;
130 public String getMergedIndexPath()
132 return mergedIndexPath;
135 public void setMergedIndexPath( String mergedIndexPath )
137 this.mergedIndexPath = mergedIndexPath;
140 public int getMergedIndexTtl() {
141 return mergedIndexTtl;
145 * Set the TTL of the repo group's merged index.
147 * @param mergedIndexTtl
149 public void setMergedIndexTtl(int mergedIndexTtl) {
150 this.mergedIndexTtl = mergedIndexTtl;
153 public RepositoryGroup mergedIndexPath( String mergedIndexPath ) {
154 this.mergedIndexPath = mergedIndexPath;
158 public RepositoryGroup mergedIndexTtl( int mergedIndexTtl ) {
159 this.mergedIndexTtl = mergedIndexTtl;
163 public boolean equals( Object other )
170 if ( !( other instanceof RepositoryGroup ) )
175 RepositoryGroup that = (RepositoryGroup) other;
176 boolean result = true;
177 result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) );
181 public int hashCode()
184 result = 37 * result + ( id != null ? id.hashCode() : 0 );
189 public String toString()
191 final StringBuilder sb = new StringBuilder();
192 sb.append( "RepositoryGroup" );
193 sb.append( "{id='" ).append( id ).append( '\'' );
194 sb.append( ", repositories=" ).append( repositories );
196 return sb.toString();