From: Olivier Lamy Date: Tue, 23 Aug 2011 12:20:00 +0000 (+0000) Subject: start working on interfaces for module archiva-repository-admin X-Git-Tag: archiva-1.4-M1~496 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0f0a3486c97300183cee73ad223d83c87b4f4e8a;p=archiva.git 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 --- diff --git a/archiva-modules/archiva-base/archiva-repository-admin/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/pom.xml index 481a3df15..b013c8213 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/pom.xml @@ -28,6 +28,22 @@ archiva-repository-admin Archiva Base :: Repository Admin + + javax.inject + javax.inject + 1 + + + org.springframework + spring-context + ${spring.version} + + + commons-logging + commons-logging + + + junit junit diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/RepositoryAdminException.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/RepositoryAdminException.java new file mode 100644 index 000000000..2116fd895 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/RepositoryAdminException.java @@ -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 ); + } +} diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/ManagedRepository.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/ManagedRepository.java new file mode 100644 index 000000000..d55f9ac46 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/ManagedRepository.java @@ -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 + '\'' + '}'; + } +} \ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdmin.java index 64c880cb4..b425574f4 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdmin.java @@ -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 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; + } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/remote/RemoteRepository.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/remote/RemoteRepository.java new file mode 100644 index 000000000..7b060f044 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/remote/RemoteRepository.java @@ -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 + '\'' + '}'; + } +} \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml index c48ec6a2f..b6c7e8ccc 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml @@ -37,6 +37,10 @@ org.apache.archiva archiva-security + + org.apache.archiva + archiva-repository-admin + org.apache.archiva audit