8000 Refactored Maven Artifact Download Script by jharper-sec · Pull Request #8 · jharper-sec/c6t · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Refactored Maven Artifact Download Script #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 25, 2024

Conversation

jharper-sec
Copy link
Owner

Refactored Maven Artifact Download Script

Overview:
This PR refactors the existing Python script used for downloading Maven artifacts to enhance its maintainability, flexibility, and adherence to SOLID design principles. The primary changes include organizing the code into classes and introducing a constant for the Maven package namespace.

Key Changes:

  1. Class Structure:

    • Introduced ChecksumVerifier for handling file checksum verification.
    • Created FileDownloader for managing file download operations.
    • Developed MavenMetadataHandler for managing Maven metadata-related operations.
    • Implemented JavaAgentDownloader for orchestrating the download and verification of Java agents.
  2. Constant for Maven Package Namespace:

    • Added MAVEN_PACKAGE_NAMESPACE to store the hardcoded Maven package namespace, enhancing flexibility and maintainability.
  3. Dependency Injection:

    • Refactored code to use dependency injection, allowing classes to depend on abstractions rather than concrete implementations.

Benefits:

  • Single Responsibility Principle (SRP): Each class now has a single responsibility, making the code easier to understand and maintain.
  • Open/Closed Principle (OCP): The structure allows for easy extension without modifying existing code.
  • Maintainability: Centralizing the Maven package namespace into a constant simplifies updates and reuse across different namespaces.
  • Flexibility: Dependency injection makes the codebase more modular and easier to test.

Usage:

  • The refactored code can be used to download the Java agent from a Maven repository with enhanced readability and maintainability.

@jharper-sec jharper-sec self-assigned this May 25, 2024
@jharper-sec jharper-sec merged commit cd2c43e into main May 25, 2024
2 checks passed
@jharper-sec jharper-sec deleted the download-agent-refactor branch May 25, 2024 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0