You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DisableProxyConnectorAction.java 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. package org.apache.maven.archiva.web.action.admin.connectors.proxy;
  2. import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
  3. /*
  4. * Licensed to the Apache Software Foundation (ASF) under one
  5. * or more contributor license agreements. See the NOTICE file
  6. * distributed with this work for additional information
  7. * regarding copyright ownership. The ASF licenses this file
  8. * to you under the Apache License, Version 2.0 (the
  9. * "License"); you may not use this file except in compliance
  10. * with the License. You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing,
  15. * software distributed under the License is distributed on an
  16. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  17. * KIND, either express or implied. See the License for the
  18. * specific language governing permissions and limitations
  19. * under the License.
  20. */
  21. /**
  22. * DisableProxyConnectorAction
  23. *
  24. * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="disableProxyConnectorAction"
  25. */
  26. public class DisableProxyConnectorAction extends AbstractProxyConnectorAction
  27. {
  28. private String source;
  29. private String target;
  30. private ProxyConnectorConfiguration proxyConfig;
  31. public String confirmDisable()
  32. {
  33. this.proxyConfig = findProxyConnector( source, target );
  34. // Not set? Then there is nothing to delete.
  35. if ( this.proxyConfig == null )
  36. {
  37. addActionError( "Unable to disable proxy configuration, configuration with source [" + source
  38. + "], and target [" + target + "] does not exist." );
  39. return ERROR;
  40. }
  41. return INPUT;
  42. }
  43. public String disable()
  44. {
  45. this.proxyConfig = findProxyConnector( source, target );
  46. // Not set? Then there is nothing to delete.
  47. if ( this.proxyConfig == null )
  48. {
  49. addActionError( "Unable to disable proxy configuration, configuration with source [" + source
  50. + "], and target [" + target + "] does not exist." );
  51. return ERROR;
  52. }
  53. if ( hasActionErrors() )
  54. {
  55. return ERROR;
  56. }
  57. proxyConfig.setDisabled(true);
  58. addActionMessage( "Successfully disabled proxy connector [" + source + " , " + target + " ]" );
  59. setSource( null );
  60. setTarget( null );
  61. return saveConfiguration();
  62. }
  63. public String getSource()
  64. {
  65. return source;
  66. }
  67. public void setSource(String source)
  68. {
  69. this.source = source;
  70. }
  71. public String getTarget()
  72. {
  73. return target;
  74. }
  75. public void setTarget(String target)
  76. {
  77. this.target = target;
  78. }
  79. }