start working on interfaces for module archiva-repository-admin

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1160654 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-08-23 12:20:00 +00:00
parent d27077404a
commit 0f0a3486c9
6 changed files with 393 additions and 0 deletions

View File

@ -28,6 +28,22 @@
<artifactId>archiva-repository-admin</artifactId>
<name>Archiva Base :: Repository Admin</name>
<dependencies>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>

View File

@ -0,0 +1,33 @@
package org.apache.archiva.admin.repository;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* @author Olivier Lamy
* @since 1.4
*/
public class RepositoryAdminException
extends Exception
{
public RepositoryAdminException( String message, Throwable cause )
{
super( message, cause );
}
}

View File

@ -0,0 +1,196 @@
package org.apache.archiva.admin.repository.managed;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.io.Serializable;
/**
* @since 1.4
*/
public class ManagedRepository
implements Serializable
{
private String id;
private String name;
private String url;
private String layout;
private boolean snapshots = false;
private boolean releases = false;
private boolean blockRedeployments;
private String cronExpression;
/**
* not need when creating the repo : only available when reading
*/
private ManagedRepository stagingRepository;
public ManagedRepository()
{
// no op
}
public ManagedRepository( String id, String name, String url, String layout, boolean snapshots, boolean releases,
boolean blockRedeployments, String cronExpression )
{
this.id = id;
this.name = name;
this.url = url;
this.layout = layout;
this.snapshots = snapshots;
this.releases = releases;
this.blockRedeployments = blockRedeployments;
this.cronExpression = cronExpression;
}
public String getId()
{
return this.id;
}
public String getLayout()
{
return this.layout;
}
public String getName()
{
return this.name;
}
public String getUrl()
{
return this.url;
}
public boolean isReleases()
{
return this.releases;
}
/**
* Get null
*/
public boolean isSnapshots()
{
return this.snapshots;
}
public void setId( String id )
{
this.id = id;
}
public void setLayout( String layout )
{
this.layout = layout;
}
public void setName( String name )
{
this.name = name;
}
public void setReleases( boolean releases )
{
this.releases = releases;
}
public void setSnapshots( boolean snapshots )
{
this.snapshots = snapshots;
}
public void setUrl( String url )
{
this.url = url;
}
public boolean isBlockRedeployments()
{
return blockRedeployments;
}
public void setBlockRedeployments( boolean blockRedeployments )
{
this.blockRedeployments = blockRedeployments;
}
public String getCronExpression()
{
return cronExpression;
}
public void setCronExpression( String cronExpression )
{
this.cronExpression = cronExpression;
}
public ManagedRepository getStagingRepository()
{
return stagingRepository;
}
public void setStagingRepository( ManagedRepository stagingRepository )
{
this.stagingRepository = stagingRepository;
}
public int hashCode()
{
int result = 17;
result = 37 * result + ( id != null ? id.hashCode() : 0 );
return result;
}
public boolean equals( Object other )
{
if ( this == other )
{
return true;
}
if ( !( other instanceof ManagedRepository ) )
{
return false;
}
ManagedRepository that = (ManagedRepository) other;
boolean result = true;
result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) );
return result;
}
@Override
public String toString()
{
return "ManagedRepository{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", url='" + url + '\''
+ ", layout='" + layout + '\'' + ", snapshots=" + snapshots + ", releases=" + releases
+ ", blockRedeployments=" + blockRedeployments + ", cronExpression='" + cronExpression + '\'' + '}';
}
}

View File

@ -19,11 +19,31 @@ package org.apache.archiva.admin.repository.managed;
*/
import org.apache.archiva.admin.repository.RepositoryAdminException;
import java.util.List;
/**
* @author Olivier Lamy
* @since 1.4
*/
public interface ManagedRepositoryAdmin
{
List<ManagedRepository> getManagedRepositories()
throws RepositoryAdminException;
ManagedRepository getManagedRepository( String repositoryId )
throws RepositoryAdminException;
Boolean deleteManagedRepository( String repositoryId )
throws RepositoryAdminException;
Boolean addManagedRepository( ManagedRepository managedRepository, boolean needStageRepo )
throws RepositoryAdminException;
Boolean updateManagedRepository( ManagedRepository managedRepository, boolean needStageRepo )
throws RepositoryAdminException;
}

View File

@ -0,0 +1,124 @@
package org.apache.archiva.admin.repository.remote;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
public class RemoteRepository
implements Serializable
{
private String id;
private String name;
private String url;
private String layout;
public RemoteRepository()
{
// no op
}
public RemoteRepository( String id, String name, String url, String layout )
{
this.id = id;
this.name = name;
this.url = url;
this.layout = layout;
}
public String getId()
{
return this.id;
}
public String getLayout()
{
return this.layout;
}
public String getName()
{
return this.name;
}
public String getUrl()
{
return this.url;
}
public void setId( String id )
{
this.id = id;
}
public void setLayout( String layout )
{
this.layout = layout;
}
public void setName( String name )
{
this.name = name;
}
public void setUrl( String url )
{
this.url = url;
}
public int hashCode()
{
int result = 17;
result = 37 * result + ( id != null ? id.hashCode() : 0 );
return result;
}
public boolean equals( Object other )
{
if ( this == other )
{
return true;
}
if ( !( other instanceof RemoteRepository ) )
{
return false;
}
RemoteRepository that = (RemoteRepository) other;
boolean result = true;
result = result && ( getId() == null ? that.getId() == null : getId().equals( that.getId() ) );
return result;
}
@Override
public String toString()
{
return "RemoteRepository{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", url='" + url + '\''
+ ", layout='" + layout + '\'' + '}';
}
}

View File

@ -37,6 +37,10 @@
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-security</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-repository-admin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>audit</artifactId>