Search in sources :

Example 1 with ViewSet

use of com.structurizr.view.ViewSet in project cia by Hack23.

the class AppPublicSystemDocumentation method main.

/**
 * The main method.
 *
 * @param args
 *            the arguments
 * @throws Exception
 *             the exception
 */
public static void main(final String[] args) throws Exception {
    final Workspace workspace = new Workspace("Citizen Intelligence Agency", "Public System Documentation");
    final Model model = workspace.getModel();
    final ViewSet viewSet = workspace.getViews();
    final Person userPerson = model.addPerson("User", "User of the system");
    final Person adminPerson = model.addPerson("Admin", "Manager of the system");
    final SoftwareSystem ciaSystem = model.addSoftwareSystem("Citizen Intelligence Agency System", "Tracking politicians like bugs!");
    final SoftwareSystem riksdagenApiSystem = model.addSoftwareSystem(Location.External, "data.riksdagen.se", "Public API Swedish Parliament data");
    final SoftwareSystem worldBankApiSystem = model.addSoftwareSystem(Location.External, "data.worldbank.org", "Public API Country indicators");
    final SoftwareSystem valApiSystem = model.addSoftwareSystem(Location.External, "www.val.se", "Public API Swedish Election data");
    final SoftwareSystem esvApiSystem = model.addSoftwareSystem(Location.External, "www.esv.se", "Public Data Swedish public sector spending data");
    final Container loadBalancerContainer = ciaSystem.addContainer("Loadbalancer", "Loadbalancer", "ALB/ELB/Apache/Nginx/HaProxy");
    final Container ciaWebContainer = ciaSystem.addContainer("Web Application", "Web Application", "Jetty/Java");
    // final SpringComponentFinderStrategy springComponentFinderStrategy = new SpringComponentFinderStrategy(new FirstImplementationOfInterfaceSupportingTypesStrategy()
    // ,new ReferencedTypesSupportingTypesStrategy(),new ReferencedTypesInSamePackageSupportingTypesStrategy());
    // springComponentFinderStrategy.setIncludePublicTypesOnly(false);
    // final ComponentFinder componentFinderWeb = new ComponentFinder(ciaWebContainer, "com.hack23.cia",
    // springComponentFinderStrategy);
    // componentFinderWeb.exclude(".*ui.application.web.*");
    // componentFinderWeb.exclude(".*ui.application.views.common.pagelinks.*");
    // componentFinderWeb.exclude(".*ui.application.views.admin.*");
    // componentFinderWeb.exclude(".*ui.application.views.user.*");
    // 
    // componentFinderWeb.exclude(".*service.external.*");
    // componentFinderWeb.exclude(".*service.component.*");
    // componentFinderWeb.exclude(".*package.*");
    // componentFinderWeb.exclude(".*service.impl.action.*");
    // componentFinderWeb.exclude(".*service.impl.email.*");
    // componentFinderWeb.exclude(".*service.impl.rules.*");
    // componentFinderWeb.exclude(".*service.impl.task.*");
    // componentFinderWeb.exclude(".*service.data.impl.*");
    // componentFinderWeb.findComponents();
    final Container relationalDatabase = ciaSystem.addContainer("Database", "Stores information", "Postgresql");
    relationalDatabase.addTags("Database");
    adminPerson.uses(ciaSystem, "Manages");
    userPerson.uses(ciaSystem, "Uses");
    ciaSystem.uses(riksdagenApiSystem, "Loads data");
    ciaSystem.uses(worldBankApiSystem, "Loads data");
    ciaSystem.uses(valApiSystem, "Loads data");
    ciaSystem.uses(esvApiSystem, "Loads data");
    loadBalancerContainer.uses(ciaWebContainer, "HTTPS/H2");
    ciaWebContainer.uses(relationalDatabase, "JDBC");
    final SystemLandscapeView enterpriseContextView = viewSet.createSystemLandscapeView("\"Enterprise\"", "\"Enterprise\"");
    enterpriseContextView.addAllElements();
    final Enterprise enterprise = new Enterprise("Hack23");
    enterpriseContextView.getModel().setEnterprise(enterprise);
    viewSet.createSystemContextView(ciaSystem, "\"System context\"", "\"System context\"").addAllElements();
    viewSet.createContainerView(ciaSystem, "\"Container view\"", "\"Application Overview\"").addAllContainers();
    viewSet.createComponentView(ciaWebContainer, "\"Web\"", "\"Web\"").addAllComponents();
    final DeploymentNode awsAccountNode = model.addDeploymentNode("AppOrg Account", "AWS", "Aws Account");
    final DeploymentNode awsVpcNode = awsAccountNode.addDeploymentNode("Project Network", "AWS", "VPC");
    final DeploymentNode wafNode = awsAccountNode.addDeploymentNode("Web Application Firewall", "AWS", "WAF");
    final Container ciaWafContainer = ciaSystem.addContainer("WebACL Rules", "AWS", "WAF");
    wafNode.add(ciaWafContainer);
    ciaWafContainer.uses(loadBalancerContainer, "Protects/Filter");
    final DeploymentNode awsAuditAccountNode = model.addDeploymentNode("Audit Account", "AWS", "Aws Account");
    final DeploymentNode awsConfigNode = awsAuditAccountNode.addDeploymentNode("Config", "AWS", "Config");
    final Container awsConfigContainer = ciaSystem.addContainer("Rules", "AWS", "Config Rules");
    awsConfigNode.add(awsConfigContainer);
    final DeploymentNode awsInspectorNode = awsAccountNode.addDeploymentNode("System Compliance checks", "AWS", "Inspector");
    final Container awsInspectorContainer = ciaSystem.addContainer("ScanningRules", "AWS", "Scanning Rules");
    awsInspectorNode.add(awsInspectorContainer);
    awsInspectorContainer.uses(ciaWebContainer, "Inspects");
    final DeploymentNode awsSSMNode = awsAccountNode.addDeploymentNode("Patch Compliance", "AWS", "System Mananger");
    final Container awsSSMContainer = ciaSystem.addContainer("InventoryList", "AWS", "InventoryList");
    awsSSMNode.add(awsSSMContainer);
    awsSSMContainer.uses(ciaWebContainer, "Run Commands");
    final DeploymentNode awsQuickSightNode = awsAccountNode.addDeploymentNode("Business analytics", "AWS", "QuickSight");
    final Container awsQuickSightContainer = ciaSystem.addContainer("Dashboards", "AWS", "Dashboards");
    awsQuickSightNode.add(awsQuickSightContainer);
    awsQuickSightContainer.uses(relationalDatabase, "Loads Data");
    final DeploymentNode awsGuardDutyNode = awsAuditAccountNode.addDeploymentNode("Guard Duty", "AWS", "GuardDuty");
    final Container awsGuardDutyContainer = ciaSystem.addContainer("Intelligent threat detection and continuous monitoring", "AWS", "Intelligent threat detection and continuous monitoring");
    awsGuardDutyNode.add(awsGuardDutyContainer);
    final DeploymentNode awsMacieNode = awsAuditAccountNode.addDeploymentNode("A machine learning-powered security", "AWS", "macie");
    final Container awsMacieContainer = ciaSystem.addContainer("discover, classify, and protect sensitive data", "AWS", "discover, classify, and protect sensitive data");
    awsMacieNode.add(awsMacieContainer);
    final DeploymentNode awsLogGroupNode = awsAuditAccountNode.addDeploymentNode("LogGroup", "AWS", "Cloudwatch");
    final Container awsLogstreamContainer = ciaSystem.addContainer("Logstreams", "AWS", "LogStream");
    awsLogGroupNode.add(awsLogstreamContainer);
    ciaWebContainer.uses(awsLogstreamContainer, "Write logs");
    relationalDatabase.uses(awsLogstreamContainer, "Write logs");
    final DeploymentNode awsCloudtrailNode = awsAuditAccountNode.addDeploymentNode("Audit", "AWS", "Cloudtrail");
    final Container awsAuditLogBucketContainer = ciaSystem.addContainer("LogBucket", "AWS", "S3");
    awsCloudtrailNode.add(awsAuditLogBucketContainer);
    final DeploymentNode awsAcessLogsNode = awsAuditAccountNode.addDeploymentNode("Access Logs", "AWS", "S3");
    final Container awsAccessLogBucketContainer = ciaSystem.addContainer("AccessLogBucket", "AWS", "S3");
    awsAcessLogsNode.add(awsAccessLogBucketContainer);
    loadBalancerContainer.uses(awsAccessLogBucketContainer, "Write logs");
    final DeploymentNode applicationLoadbalancerNode = awsAccountNode.addDeploymentNode("Application Loadbalancer", "AWS", "ALB");
    applicationLoadbalancerNode.add(loadBalancerContainer);
    wafNode.uses(applicationLoadbalancerNode, "Protects", "filter rules");
    final DeploymentNode webNode = awsVpcNode.addDeploymentNode("Application", "AWS", "EC2", 2);
    webNode.addDeploymentNode("Jetty", "Jetty", "JVM").add(ciaWebContainer);
    applicationLoadbalancerNode.uses(webNode, "Uses", "https");
    final DeploymentNode databaseNode = awsVpcNode.addDeploymentNode("Database", "AWS", "RDS", 2);
    databaseNode.add(relationalDatabase);
    webNode.uses(databaseNode, "Uses", "jdbc");
    final DeploymentNode githubAccountNode = model.addDeploymentNode("Github Org", "Github", "Github Org");
    final Container sourceCodeContainer = ciaSystem.addContainer("SCM", "Github", "Scm");
    githubAccountNode.add(sourceCodeContainer);
    final Container documentationContainer = ciaSystem.addContainer("Documentation", "Github", "Documentation");
    githubAccountNode.add(documentationContainer);
    final DeploymentNode devNetworkNode = model.addDeploymentNode("Dev Network", "AWS", "Dev Network");
    final Container nexusContainer = ciaSystem.addContainer("Nexus", "Dev", "Nexus");
    devNetworkNode.add(nexusContainer);
    final Container sonarContainer = ciaSystem.addContainer("Sonarqube", "Dev", "Sonarqube");
    devNetworkNode.add(sonarContainer);
    final Container jenkinsContainer = ciaSystem.addContainer("Jenkins", "Dev", "Jenkins");
    jenkinsContainer.uses(sourceCodeContainer, "builds");
    jenkinsContainer.uses(sonarContainer, "Publish QA metrics", "https");
    jenkinsContainer.uses(nexusContainer, "publish artifacts", "https");
    jenkinsContainer.uses(documentationContainer, "publish Documentation", "https");
    devNetworkNode.add(jenkinsContainer);
    final DeploymentNode sumologicSecurityAccountNode = model.addDeploymentNode("Security Account", "Sumologic", "Sumologic Account");
    final DeploymentNode sumologicNetworkSecurityDashboardNode = sumologicSecurityAccountNode.addDeploymentNode("Nework Security Dashboard", "AWS", "Nework Security Dashboard");
    final DeploymentNode sumologicServerSecurityDashboardNode = sumologicSecurityAccountNode.addDeploymentNode("Server Security Dashboard", "AWS", "Server Security Dashboard");
    final DeploymentNode sumologicAwsAccountSecurityDashboardNode = sumologicSecurityAccountNode.addDeploymentNode("AWS Account Security Dashboard", "AWS", "AWS Account Security Dashboard");
    final DeploymentNode sumologicApplicationSecurityDashboardNode = sumologicSecurityAccountNode.addDeploymentNode("Application Security Dashboard", "AWS", "Application Security Dashboard");
    final Container sumologicVpcFlowLogsContainer = ciaSystem.addContainer("VpcFlowLogs", "Sumologic", "VpcFlowLogs");
    sumologicVpcFlowLogsContainer.uses(awsLogstreamContainer, "Recieve logs");
    sumologicNetworkSecurityDashboardNode.add(sumologicVpcFlowLogsContainer);
    final Container sumologicCloudtrailConfigContainer = ciaSystem.addContainer("CloudTrailLogs", "Sumologic", "CloudTrailLogs");
    sumologicCloudtrailConfigContainer.uses(awsAuditLogBucketContainer, "Recieve logs");
    sumologicAwsAccountSecurityDashboardNode.add(sumologicCloudtrailConfigContainer);
    final Container sumologicAwsConfigContainer = ciaSystem.addContainer("AwsConfigLogs", "Sumologic", "AwsConfigLogs");
    sumologicAwsConfigContainer.uses(awsConfigContainer, "Recieve logs");
    sumologicAwsAccountSecurityDashboardNode.add(sumologicAwsConfigContainer);
    final Container sumologicEc2SystemLogsContainer = ciaSystem.addContainer("Ec2SystemLogs", "Sumologic", "Ec2SystemLogs");
    sumologicEc2SystemLogsContainer.uses(awsLogstreamContainer, "Recieve logs");
    sumologicServerSecurityDashboardNode.add(sumologicEc2SystemLogsContainer);
    final Container sumologicEc2ApplicationLogsContainer = ciaSystem.addContainer("Ec2ApplicationLogs", "Sumologic", "Ec2ApplicationLogs");
    sumologicEc2ApplicationLogsContainer.uses(awsLogstreamContainer, "Recieve logs");
    sumologicApplicationSecurityDashboardNode.add(sumologicEc2ApplicationLogsContainer);
    final Container sumologicAwsInspectorResultsContainer = ciaSystem.addContainer("AwsInspectorResults", "Sumologic", "AwsInspectorResults");
    sumologicAwsInspectorResultsContainer.uses(awsInspectorContainer, "Recieve reports");
    sumologicServerSecurityDashboardNode.add(sumologicAwsInspectorResultsContainer);
    final Container sumologicAwsAlbLogsContainer = ciaSystem.addContainer("AwsLoadbalancerAccessLogs", "Sumologic", "AwsLoadbalancerAccessLogs");
    sumologicAwsAlbLogsContainer.uses(awsAccessLogBucketContainer, "Recieve logs");
    sumologicNetworkSecurityDashboardNode.add(sumologicAwsAlbLogsContainer);
    final DeploymentView developmentDeploymentView = viewSet.createDeploymentView(ciaSystem, "\"Deployment\"", "\"Deployment Aws.\"");
    developmentDeploymentView.add(awsAuditAccountNode);
    developmentDeploymentView.add(wafNode);
    developmentDeploymentView.add(awsQuickSightNode);
    developmentDeploymentView.add(awsInspectorNode);
    developmentDeploymentView.add(awsSSMNode);
    developmentDeploymentView.add(sumologicSecurityAccountNode);
    developmentDeploymentView.add(githubAccountNode);
    developmentDeploymentView.add(devNetworkNode);
    developmentDeploymentView.add(applicationLoadbalancerNode);
    developmentDeploymentView.add(webNode);
    developmentDeploymentView.add(databaseNode);
    final Styles styles = viewSet.getConfiguration().getStyles();
    styles.addElementStyle(Tags.COMPONENT).background("#1168bd").color("#ffffff");
    styles.addElementStyle(Tags.CONTAINER).background("#1168bd").color("#ffffff");
    styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#1168bd").color("#ffffff");
    styles.addElementStyle(Tags.PERSON).background("#519823").color("#ffffff").shape(Shape.Person);
    styles.addElementStyle("Database").shape(Shape.Cylinder);
    // StructurizrClient structurizrClient = new StructurizrClient(API_KEY,
    // API_SECRET);
    // structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
    printPlantUml(workspace);
    System.setProperty("PLANTUML_LIMIT_SIZE", "16384");
    Run.main(new String[] { Paths.get(".").toAbsolutePath().normalize().toString() + File.separator + "target" + File.separator + "site" + File.separator + "architecture" + File.separator });
}
Also used : Container(com.structurizr.model.Container) ViewSet(com.structurizr.view.ViewSet) DeploymentNode(com.structurizr.model.DeploymentNode) Model(com.structurizr.model.Model) Enterprise(com.structurizr.model.Enterprise) SoftwareSystem(com.structurizr.model.SoftwareSystem) SystemLandscapeView(com.structurizr.view.SystemLandscapeView) Person(com.structurizr.model.Person) Workspace(com.structurizr.Workspace) DeploymentView(com.structurizr.view.DeploymentView) Styles(com.structurizr.view.Styles)

Example 2 with ViewSet

use of com.structurizr.view.ViewSet in project agile-architecture-documentation-system by Riduidel.

the class ViewsGenerator method endVisit.

@Override
public void endVisit(Workspace workspace, OutputBuilder builder) {
    ViewSet views = workspace.getViews();
    SoftwareSystem agileArchitecture = workspace.getModel().getSoftwareSystemWithName(Architecture.AGILE_ARCHITECTURE_DOCUMENTATION);
    SystemContextView contextView = views.createSystemContextView(agileArchitecture, "SystemContext", "Illustration of agile-architecture-documentation usage");
    contextView.addAllSoftwareSystems();
    contextView.addAllPeople();
    ContainerView agileArchitectureContainers = views.createContainerView(agileArchitecture, "agile.architecture.containers", "Agile architecture containers");
    agileArchitectureContainers.addAllContainersAndInfluencers();
    ComponentView agileArchitectureBaseComponents = views.createComponentView(agileArchitecture.getContainerWithName(Architecture.CONTAINERS_BASE), "agile.architecture.base.components", "Agile architecture base components view");
    agileArchitectureBaseComponents.addAllComponents();
// Styles styles = views.getConfiguration().getStyles();
// styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#1168bd").color("#ffffff");
// styles.addElementStyle(Tags.PERSON).background("#08427b").color("#ffffff").shape(Shape.Person);
}
Also used : ComponentView(com.structurizr.view.ComponentView) ViewSet(com.structurizr.view.ViewSet) SystemContextView(com.structurizr.view.SystemContextView) SoftwareSystem(com.structurizr.model.SoftwareSystem) ContainerView(com.structurizr.view.ContainerView)

Example 3 with ViewSet

use of com.structurizr.view.ViewSet in project tutorials by eugenp.

the class StructurizrSimple method getSoftwareSystem.

private static Workspace getSoftwareSystem() {
    Workspace workspace = new Workspace("Payment Gateway", "Payment Gateway");
    Model model = workspace.getModel();
    Person user = model.addPerson("Merchant", "Merchant");
    SoftwareSystem paymentTerminal = model.addSoftwareSystem(PAYMENT_TERMINAL, "Payment Terminal");
    user.uses(paymentTerminal, "Makes payment");
    SoftwareSystem fraudDetector = model.addSoftwareSystem(FRAUD_DETECTOR, "Fraud Detector");
    paymentTerminal.uses(fraudDetector, "Obtains fraud score");
    ViewSet viewSet = workspace.getViews();
    SystemContextView contextView = viewSet.createSystemContextView(workspace.getModel().getSoftwareSystemWithName(PAYMENT_TERMINAL), SOFTWARE_SYSTEM_VIEW, "Payment Gateway Diagram");
    contextView.addAllElements();
    return workspace;
}
Also used : ViewSet(com.structurizr.view.ViewSet) SystemContextView(com.structurizr.view.SystemContextView) Model(com.structurizr.model.Model) SoftwareSystem(com.structurizr.model.SoftwareSystem) Person(com.structurizr.model.Person) Workspace(com.structurizr.Workspace)

Example 4 with ViewSet

use of com.structurizr.view.ViewSet in project cia by Hack23.

the class AwsPublicSystemDocumentation method main.

/**
 * The main method.
 *
 * @param args
 *            the arguments
 * @throws Exception
 *             the exception
 */
public static void main(final String[] args) throws Exception {
    final Workspace workspace = new Workspace("Citizen Intelligence Agency", "Public Aws System Documentation");
    final Model model = workspace.getModel();
    final ViewSet viewSet = workspace.getViews();
    final SoftwareSystem ciaSystem = model.addSoftwareSystem("Citizen Intelligence Agency", "Tracking politicians like bugs!");
    final DeploymentNode masterAccountNode = model.addDeploymentNode("Master Account", "AWS", "Aws Account");
    final Container awsAccountContainer = ciaSystem.addContainer("Master Account", "AWS", "Aws Account");
    final DeploymentNode iamAccountNode = model.addDeploymentNode("IAM Account", "AWS", "Aws Account");
    final Container iamAccountContainer = ciaSystem.addContainer("IAM Account", "AWS", "Aws Account");
    final DeploymentNode devAccountNode = model.addDeploymentNode("Development Account", "AWS", "Aws Account");
    final Container devAccountContainer = ciaSystem.addContainer("Development Account", "AWS", "Aws Account");
    final DeploymentNode opCenterAccountNode = model.addDeploymentNode("Operation Center Account", "AWS", "Aws Account");
    final Container opCenterAccountContainer = ciaSystem.addContainer("Operation Center Account", "AWS", "Aws Account");
    final DeploymentNode auditAccountNode = model.addDeploymentNode("Audit Account", "AWS", "Aws Account");
    final Container auditAccountContainer = ciaSystem.addContainer("Audit Account", "AWS", "Aws Account");
    final DeploymentNode appAccountNode = model.addDeploymentNode("Application Account", "AWS", "Aws Account");
    final Container appAccountContainer = ciaSystem.addContainer("Application Account", "AWS", "Aws Account");
    awsAccountContainer.uses(iamAccountContainer, "create/restrict");
    awsAccountContainer.uses(devAccountContainer, "create/restrict");
    awsAccountContainer.uses(opCenterAccountContainer, "create/restrict");
    awsAccountContainer.uses(auditAccountContainer, "create/restrict");
    awsAccountContainer.uses(appAccountContainer, "create/restrict");
    awsAccountContainer.uses(auditAccountContainer, "publish event/audit");
    iamAccountContainer.uses(auditAccountContainer, "publish event/audit");
    devAccountContainer.uses(auditAccountContainer, "publish event/audit");
    opCenterAccountContainer.uses(auditAccountContainer, "publish event/audit");
    appAccountContainer.uses(auditAccountContainer, "publish event/audit");
    opCenterAccountContainer.uses(auditAccountContainer, "Monitor event/audit");
    iamAccountContainer.uses(devAccountContainer, "manage access");
    iamAccountContainer.uses(appAccountContainer, "manage access");
    iamAccountContainer.uses(opCenterAccountContainer, "manage access");
    opCenterAccountNode.add(opCenterAccountContainer);
    devAccountNode.add(devAccountContainer);
    auditAccountNode.add(auditAccountContainer);
    appAccountNode.add(appAccountContainer);
    iamAccountNode.add(iamAccountContainer);
    masterAccountNode.add(awsAccountContainer);
    final DeploymentView developmentDeploymentView = viewSet.createDeploymentView(ciaSystem, "\"Production Aws Account structure\"", "\"Production Aws Account structure\"");
    developmentDeploymentView.add(masterAccountNode);
    developmentDeploymentView.add(iamAccountNode);
    developmentDeploymentView.add(devAccountNode);
    developmentDeploymentView.add(opCenterAccountNode);
    developmentDeploymentView.add(auditAccountNode);
    developmentDeploymentView.add(appAccountNode);
    final Styles styles = viewSet.getConfiguration().getStyles();
    styles.addElementStyle(Tags.COMPONENT).background("#1168bd").color("#ffffff");
    styles.addElementStyle(Tags.CONTAINER).background("#1168bd").color("#ffffff");
    styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#1168bd").color("#ffffff");
    styles.addElementStyle(Tags.PERSON).background("#519823").color("#ffffff").shape(Shape.Person);
    styles.addElementStyle("Database").shape(Shape.Cylinder);
    printPlantUml(workspace);
    System.setProperty("PLANTUML_LIMIT_SIZE", "8192");
    Run.main(new String[] { Paths.get(".").toAbsolutePath().normalize().toString() + File.separator + "target" + File.separator + "site" + File.separator + "architecture" + File.separator });
}
Also used : Container(com.structurizr.model.Container) ViewSet(com.structurizr.view.ViewSet) DeploymentNode(com.structurizr.model.DeploymentNode) Model(com.structurizr.model.Model) SoftwareSystem(com.structurizr.model.SoftwareSystem) Workspace(com.structurizr.Workspace) DeploymentView(com.structurizr.view.DeploymentView) Styles(com.structurizr.view.Styles)

Example 5 with ViewSet

use of com.structurizr.view.ViewSet in project agile-architecture-documentation-system by Riduidel.

the class Architecture method describeArchitecture.

/**
 * Creates the workspace object and add in it both the architecture components
 * AND the views used to display it
 *
 * @return
 */
public Workspace describeArchitecture() {
    // tag::structurizr-example-context[]
    String name = "agile-architecture-documentation-system";
    Workspace workspace = new Workspace(name, "This is the model of the agile architecture documentation system.");
    Model model = workspace.getModel();
    Person architect = model.addPerson("Architect", "The architect as team scribe is the writer of this kind of documentation.");
    Person stakeholder = model.addPerson("Stakeholder", "All project stakeholders are readers of this kind of documentation.");
    SoftwareSystem agileArchitecture = model.addSoftwareSystem(AGILE_ARCHITECTURE_DOCUMENTATION, "This software system generates the documentation.");
    agileArchitecture.addProperty(ModelElementKeys.ISSUE_MANAGER, "https://github.com/Riduidel/agile-architecture-documentation-system");
    agileArchitecture.addProperty(ADRExtractor.AGILE_ARCHITECTURE_TICKETS_PROJECT, name);
    agileArchitecture.addProperty(ADRExtractor.AGILE_ARCHITECTURE_TICKETS_ADR_LABEL, "decision");
    architect.uses(agileArchitecture, "Writes");
    stakeholder.uses(agileArchitecture, "Read");
    // end::structurizr-example-context[]
    // ///////////////////////////////////////////////////////////////////////////////////////
    // tag::structurizr-example-containers[]
    Container archetype = agileArchitecture.addContainer(CONTAINERS_ARCHETYPE, "Archetype generating a valid build", "maven archetype");
    archetype.addProperty(MavenEnhancer.AGILE_ARCHITECTURE_MAVEN_POM, locate("archetype/pom.xml"));
    architect.uses(archetype, "Bootstrap a valid project");
    Container maven = agileArchitecture.addContainer(CONTAINERS_MAVEN, "Maven build tool", "Maven build tool");
    architect.uses(maven, "Generates documentation");
    Container base = agileArchitecture.addContainer(CONTAINERS_BASE, "Architecture base", "Java executable");
    base.addProperty(MavenEnhancer.AGILE_ARCHITECTURE_MAVEN_POM, locate("base/pom.xml"));
    base.addProperty(ModelElementKeys.SCM_PATH, base.getName());
    // end::structurizr-example-containers[]
    // tag::structurizr-example-components[]
    ComponentFinder componentFinder = new ComponentFinder(base, // new SourceCodeComponentFinderStrategy(new File("../base/src/main/java")),
    ArchitectureModelProvider.class.getPackageName(), new StructurizrAnnotationsComponentFinderStrategy());
    // end::structurizr-example-components[]
    if (getClass().getClassLoader() instanceof URLClassLoader) {
        componentFinder.setUrlClassLoader((URLClassLoader) getClass().getClassLoader());
    }
    try {
        componentFinder.findComponents();
    } catch (Exception e) {
        throw new RuntimeException("Unable to locate components in ", e);
    }
    // model.addImplicitRelationships();
    // Damn, structurizr-annotations doesn't understand CDI. Let's supplement it!
    base.getComponentWithName("ArchitectureEnhancer").uses(base.getComponentWithName("DocumentsCollector"), "Collects documents in source folder");
    base.getComponentWithName("ArchitectureEnhancer").uses(base.getComponentWithName("SCMLinkGenerator"), "Generates links to SCM sources");
    base.getComponentWithName("ArchitectureEnhancer").uses(base.getComponentWithName("SCMReadmeReader"), "Includes elements readme when they exist");
    base.getComponentWithName("ArchitectureEnhancer").uses(base.getComponentWithName("ImplicitIncludeManager"), "Generates includes for all enhancers");
    base.getComponentWithName("ArchitectureEnhancer").uses(base.getComponentWithName("GraphEmitter"), "Generates diagrams in PlantUML format");
    maven.uses(base.getComponentWithName("ArchitectureDocumentationBuilder"), "Invokes that Java executable during maven build");
    Component gitHub = base.addComponent("github-scm-handler", "GitHub SCM Handler", "java");
    gitHub.addProperty(MavenEnhancer.AGILE_ARCHITECTURE_MAVEN_POM, locate("github-scm-handler/pom.xml"));
    gitHub.addProperty(ModelElementKeys.SCM_PATH, gitHub.getName());
    base.getComponentWithName("SCMLinkGenerator").uses(gitHub, "Get project source link");
    base.getComponentWithName("SCMReadmeReader").uses(gitHub, "Get project readme");
    Component gitLab = base.addComponent("gitlab-scm-handler", "GitLab SCM Handler", "java");
    gitLab.addProperty(MavenEnhancer.AGILE_ARCHITECTURE_MAVEN_POM, locate("gitlab-scm-handler/pom.xml"));
    gitLab.addProperty(ModelElementKeys.SCM_PATH, gitLab.getName());
    base.getComponentWithName("SCMLinkGenerator").uses(gitLab, "Get project source link");
    base.getComponentWithName("SCMReadmeReader").uses(gitLab, "Get project readme");
    Component adrTicketsExtractor = base.addComponent("adr-tickets-extractor", "enhanced by maven");
    adrTicketsExtractor.addProperty(MavenEnhancer.AGILE_ARCHITECTURE_MAVEN_POM, locate("adr-tickets-extractor/pom.xml"));
    adrTicketsExtractor.addProperty(ModelElementKeys.SCM_PATH, adrTicketsExtractor.getName());
    adrTicketsExtractor.uses(gitLab, "Read tickets from Gitlab if configured so");
    adrTicketsExtractor.uses(gitHub, "Read tickets from GitHub if configured so");
    base.getComponentWithName("ArchitectureEnhancer").uses(adrTicketsExtractor, "Produces ADR reporting");
    Component cdiConfigExtension = base.addComponent("cdi-config-extension", "CDI Config extensions", "java");
    cdiConfigExtension.addProperty(MavenEnhancer.AGILE_ARCHITECTURE_MAVEN_POM, locate("cdi-config-extension/pom.xml"));
    cdiConfigExtension.addProperty(ModelElementKeys.SCM_PATH, cdiConfigExtension.getName());
    base.getComponentWithName("ArchitectureDocumentationBuilder").uses(cdiConfigExtension, "Eases out some CDI code");
    Component mavenEnhancer = base.addComponent("maven-metadata-inferer", "Enhanced by Maven");
    cdiConfigExtension.addProperty(MavenEnhancer.AGILE_ARCHITECTURE_MAVEN_POM, locate("maven-metadata-inferer/pom.xml"));
    cdiConfigExtension.addProperty(ModelElementKeys.SCM_PATH, mavenEnhancer.getName());
    base.getComponentWithName("ArchitectureDocumentationBuilder").uses(mavenEnhancer, "Infer most of element details from Maven infos");
    Container asciidoc = agileArchitecture.addContainer("asciidoc", "Asciidoc tooling", "Maven plugin");
    maven.uses(base, "Generates diagrams and asciidoc includes");
    maven.uses(asciidoc, "Generates documentation as usable text in HTML/PDF/...");
    // ///////////////////////////////////////////////////////////////////////////////////////
    // tag::structurizr-example-views[]
    ViewSet views = workspace.getViews();
    SystemContextView contextView = views.createSystemContextView(agileArchitecture, "SystemContext", "Illustration of agile-architecture-documentation usage");
    contextView.addAllSoftwareSystems();
    contextView.addAllPeople();
    ContainerView agileArchitectureContainers = views.createContainerView(agileArchitecture, "agile.architecture.containers", "Agile architecture containers");
    agileArchitectureContainers.addAllContainersAndInfluencers();
    ComponentView agileArchitectureBaseComponents = views.createComponentView(base, "agile.architecture.base.components", "Agile architecture base components view");
    agileArchitectureBaseComponents.addAllComponents();
    // styles.addElementStyle(Tags.PERSON).background("#08427b").color("#ffffff").shape(Shape.Person);
    return workspace;
}
Also used : ArchitectureModelProvider(org.ndx.agile.architecture.base.ArchitectureModelProvider) ComponentFinder(com.structurizr.analysis.ComponentFinder) StructurizrAnnotationsComponentFinderStrategy(com.structurizr.analysis.StructurizrAnnotationsComponentFinderStrategy) Container(com.structurizr.model.Container) ComponentView(com.structurizr.view.ComponentView) ViewSet(com.structurizr.view.ViewSet) SystemContextView(com.structurizr.view.SystemContextView) URLClassLoader(java.net.URLClassLoader) Model(com.structurizr.model.Model) SoftwareSystem(com.structurizr.model.SoftwareSystem) ContainerView(com.structurizr.view.ContainerView) Component(com.structurizr.model.Component) Person(com.structurizr.model.Person) Workspace(com.structurizr.Workspace)

Aggregations

ViewSet (com.structurizr.view.ViewSet)6 SoftwareSystem (com.structurizr.model.SoftwareSystem)5 Workspace (com.structurizr.Workspace)4 Model (com.structurizr.model.Model)4 Container (com.structurizr.model.Container)3 Person (com.structurizr.model.Person)3 SystemContextView (com.structurizr.view.SystemContextView)3 DeploymentNode (com.structurizr.model.DeploymentNode)2 ComponentView (com.structurizr.view.ComponentView)2 ContainerView (com.structurizr.view.ContainerView)2 DeploymentView (com.structurizr.view.DeploymentView)2 Styles (com.structurizr.view.Styles)2 ComponentFinder (com.structurizr.analysis.ComponentFinder)1 StructurizrAnnotationsComponentFinderStrategy (com.structurizr.analysis.StructurizrAnnotationsComponentFinderStrategy)1 Component (com.structurizr.model.Component)1 Enterprise (com.structurizr.model.Enterprise)1 SystemLandscapeView (com.structurizr.view.SystemLandscapeView)1 Constructor (java.lang.reflect.Constructor)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 URLClassLoader (java.net.URLClassLoader)1