diff options
author | Olivier Lamy <olamy@apache.org> | 2012-10-02 15:12:16 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-10-02 15:12:16 +0000 |
commit | a8c549a9bb88fd2f6abea3435cae7361335811df (patch) | |
tree | dc79c17ce8dbda4918984d313c6895623b82c104 /archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api | |
parent | 163e2753eb3ec596f5b1a911f4240c9d277fadbc (diff) | |
download | archiva-a8c549a9bb88fd2f6abea3435cae7361335811df.tar.gz archiva-a8c549a9bb88fd2f6abea3435cae7361335811df.zip |
[MRM-1681] addProxy Connectors Rules screen
implements backend part.
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1392951 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api')
4 files changed, 255 insertions, 0 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ProxyConnectorRule.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ProxyConnectorRule.java new file mode 100644 index 000000000..f672bee4d --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ProxyConnectorRule.java @@ -0,0 +1,133 @@ +package org.apache.archiva.admin.model.beans; +/* + * 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; +import java.util.ArrayList; +import java.util.List; + +/** + * @author Olivier Lamy + * @since 1.4-M3 + */ +@XmlRootElement ( name = "proxyConnectorRule" ) +public class ProxyConnectorRule + implements Serializable +{ + private String pattern; + + //FIXME: olamy possible tru rest ? or a String + private ProxyConnectorRuleType proxyConnectorRuleType; + + private List<ProxyConnector> proxyConnectors; + + public ProxyConnectorRule() + { + // no op + } + + public ProxyConnectorRule( String pattern, ProxyConnectorRuleType proxyConnectorRuleType, + List<ProxyConnector> proxyConnectors ) + { + this.pattern = pattern; + this.proxyConnectorRuleType = proxyConnectorRuleType; + this.proxyConnectors = proxyConnectors; + } + + public String getPattern() + { + return pattern; + } + + public void setPattern( String pattern ) + { + this.pattern = pattern; + } + + public ProxyConnectorRuleType getProxyConnectorRuleType() + { + return proxyConnectorRuleType; + } + + public void setProxyConnectorRuleType( ProxyConnectorRuleType proxyConnectorRuleType ) + { + this.proxyConnectorRuleType = proxyConnectorRuleType; + } + + public List<ProxyConnector> getProxyConnectors() + { + if ( this.proxyConnectors == null ) + { + this.proxyConnectors = new ArrayList<ProxyConnector>(); + } + return proxyConnectors; + } + + public void setProxyConnectors( List<ProxyConnector> proxyConnectors ) + { + this.proxyConnectors = proxyConnectors; + } + + @Override + public boolean equals( Object o ) + { + if ( this == o ) + { + return true; + } + if ( !( o instanceof ProxyConnectorRule ) ) + { + return false; + } + + ProxyConnectorRule that = (ProxyConnectorRule) o; + + if ( !pattern.equals( that.pattern ) ) + { + return false; + } + if ( proxyConnectorRuleType != that.proxyConnectorRuleType ) + { + return false; + } + + return true; + } + + @Override + public int hashCode() + { + int result = pattern.hashCode(); + result = 31 * result + proxyConnectorRuleType.hashCode(); + return result; + } + + @Override + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append( "ProxyConnectorRule" ); + sb.append( "{pattern='" ).append( pattern ).append( '\'' ); + sb.append( ", proxyConnectorRuleType=" ).append( proxyConnectorRuleType ); + sb.append( ", proxyConnectors=" ).append( proxyConnectors ); + sb.append( '}' ); + return sb.toString(); + } +} diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ProxyConnectorRuleType.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ProxyConnectorRuleType.java new file mode 100644 index 000000000..4eaf6fdba --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ProxyConnectorRuleType.java @@ -0,0 +1,55 @@ +package org.apache.archiva.admin.model.beans; +/* + * 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-M3 + */ +public enum ProxyConnectorRuleType +{ + WHITE_LIST( "whiteList" ), BLACK_LIST( "blackList" ); + + private String ruleType; + + private ProxyConnectorRuleType( String ruleType ) + { + this.ruleType = ruleType; + } + + public void setRuleType( String ruleType ) + { + this.ruleType = ruleType; + } + + public String getRuleType() + { + return ruleType; + } + + @Override + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append( "ProxyConnectorRuleType" ); + sb.append( "{ruleType='" ).append( ruleType ).append( '\'' ); + sb.append( '}' ); + return sb.toString(); + } +} diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnector/ProxyConnectorAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnector/ProxyConnectorAdmin.java index f06a1e6ea..256633d49 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnector/ProxyConnectorAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnector/ProxyConnectorAdmin.java @@ -21,6 +21,7 @@ package org.apache.archiva.admin.model.proxyconnector; import org.apache.archiva.admin.model.AuditInformation; import org.apache.archiva.admin.model.RepositoryAdminException; import org.apache.archiva.admin.model.beans.ProxyConnector; +import org.apache.archiva.admin.model.beans.ProxyConnectorRule; import java.util.List; import java.util.Map; diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnectorrule/ProxyConnectorRuleAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnectorrule/ProxyConnectorRuleAdmin.java new file mode 100644 index 000000000..d7d7cefc4 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnectorrule/ProxyConnectorRuleAdmin.java @@ -0,0 +1,66 @@ +package org.apache.archiva.admin.model.proxyconnectorrule; +/* + * 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 org.apache.archiva.admin.model.AuditInformation; +import org.apache.archiva.admin.model.RepositoryAdminException; +import org.apache.archiva.admin.model.beans.ProxyConnectorRule; + +import java.util.List; + +/** + * @author Olivier Lamy + * @since 1.4-M3 + */ +public interface ProxyConnectorRuleAdmin +{ + /** + * @return + * @throws org.apache.archiva.admin.model.RepositoryAdminException + * + * @since 1.4-M3 + */ + List<ProxyConnectorRule> getProxyConnectorRules() + throws RepositoryAdminException; + + /** + * @param proxyConnectorRule + * @throws RepositoryAdminException + * @since 1.4-M3 + */ + void addProxyConnectorRule( ProxyConnectorRule proxyConnectorRule, AuditInformation auditInformation ) + throws RepositoryAdminException; + + /** + * @param proxyConnectorRule + * @throws RepositoryAdminException + * @since 1.4-M3 + */ + void deleteProxyConnectorRule( ProxyConnectorRule proxyConnectorRule, AuditInformation auditInformation ) + throws RepositoryAdminException; + + /** + * <b>only to update attached proxy connectors to update pattern delete then add</b> + * @param proxyConnectorRule + * @throws RepositoryAdminException + * @since 1.4-M3 + */ + void updateProxyConnectorRule( ProxyConnectorRule proxyConnectorRule, AuditInformation auditInformation ) + throws RepositoryAdminException; +} |