]> source.dussan.org Git - archiva.git/commitdiff
start working on interfaces for module archiva-repository-admin
authorOlivier Lamy <olamy@apache.org>
Tue, 23 Aug 2011 12:20:00 +0000 (12:20 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 23 Aug 2011 12:20:00 +0000 (12:20 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1160654 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-repository-admin/pom.xml
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/RepositoryAdminException.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/ManagedRepository.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/ManagedRepositoryAdmin.java
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/remote/RemoteRepository.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml

index 481a3df15f695fb42b528d7256d32712849176ad..b013c821330e532c91e94cf282672f842def439b 100644 (file)
   <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>
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 (file)
index 0000000..2116fd8
--- /dev/null
@@ -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 (file)
index 0000000..d55f9ac
--- /dev/null
@@ -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
index 64c880cb468c9fd8c39a36ae234faed9ebaf9465..b425574f4fc3441e4ce922d4247bf3e4324e9b33 100644 (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;
+
 
 }
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 (file)
index 0000000..7b060f0
--- /dev/null
@@ -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
index c48ec6a2faee0e7d87781a065614acb1704853bc..b6c7e8cccd0607a12d5b0d4d3fe4c02bded3b5e6 100644 (file)
       <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>