com.structurizr.model.Container Java Examples
The following examples show how to use
com.structurizr.model.Container.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StructurizrSimple.java From tutorials with MIT License | 6 votes |
private static void addContainers(Workspace workspace) { Model model = workspace.getModel(); SoftwareSystem paymentTerminal = model.getSoftwareSystemWithName(PAYMENT_TERMINAL); Container f5 = paymentTerminal.addContainer("Payment Load Balancer", "Payment Load Balancer", "F5"); Container jvm1 = paymentTerminal.addContainer("JVM-1", "JVM-1", "Java Virtual Machine"); Container jvm2 = paymentTerminal.addContainer("JVM-2", "JVM-2", "Java Virtual Machine"); Container jvm3 = paymentTerminal.addContainer("JVM-3", "JVM-3", "Java Virtual Machine"); Container oracle = paymentTerminal.addContainer("oracleDB", "Oracle Database", "RDBMS"); f5.uses(jvm1, "route"); f5.uses(jvm2, "route"); f5.uses(jvm3, "route"); jvm1.uses(oracle, "storage"); jvm2.uses(oracle, "storage"); jvm3.uses(oracle, "storage"); ContainerView view = workspace.getViews().createContainerView(paymentTerminal, CONTAINER_VIEW, "Container View"); view.addAllContainers(); }
Example #2
Source File: StructurizrSimple.java From tutorials with MIT License | 6 votes |
private static void addComponents(Workspace workspace) { Model model = workspace.getModel(); SoftwareSystem paymentTerminal = model.getSoftwareSystemWithName(PAYMENT_TERMINAL); Container jvm1 = paymentTerminal.getContainerWithName("JVM-1"); Component jaxrs = jvm1.addComponent("jaxrs-jersey", "restful webservice implementation", "rest"); Component gemfire = jvm1.addComponent("gemfire", "Clustered Cache Gemfire", "cache"); Component hibernate = jvm1.addComponent("hibernate", "Data Access Layer", "jpa"); jaxrs.uses(gemfire, ""); gemfire.uses(hibernate, ""); ComponentView componentView = workspace.getViews().createComponentView(jvm1, COMPONENT_VIEW, "JVM Components"); componentView.addAllComponents(); }
Example #3
Source File: WorkspaceTests.java From java with Apache License 2.0 | 6 votes |
@Test public void test_countAndLogWarnings() { Workspace workspace = new Workspace("Name", "Description"); SoftwareSystem softwareSystem1 = workspace.getModel().addSoftwareSystem("Software System 1", null); SoftwareSystem softwareSystem2 = workspace.getModel().addSoftwareSystem("Software System 2", " "); Container container1 = softwareSystem1.addContainer("Name", "Description", null); Container container2 = softwareSystem2.addContainer("Name", "Description", " "); container1.uses(container2, null, null); container2.uses(container1, " ", " "); Component component1A = container1.addComponent("A", null, null); Component component1B = container1.addComponent("B", "", ""); component1A.uses(component1B, null); component1B.uses(component1A, ""); assertEquals(10, workspace.countAndLogWarnings()); }
Example #4
Source File: ContainerView.java From java with Apache License 2.0 | 5 votes |
/** * Adds the default set of elements to this view. */ @Override public void addDefaultElements() { for (Container container : getSoftwareSystem().getContainers()) { add(container); addNearestNeighbours(container, Person.class); addNearestNeighbours(container, SoftwareSystem.class); } }
Example #5
Source File: StructurizrSimple.java From tutorials with MIT License | 5 votes |
private static void findComponents(Container jvm) throws Exception { ComponentFinder componentFinder = new ComponentFinder( jvm, "com.baeldung.structurizr", new SpringComponentFinderStrategy( new ReferencedTypesSupportingTypesStrategy() ), new SourceCodeComponentFinderStrategy(new File("."), 150)); componentFinder.findComponents(); }
Example #6
Source File: StructurizrSimple.java From tutorials with MIT License | 5 votes |
private static void addSpringComponents(Workspace workspace) throws Exception { Container jvm2 = workspace.getModel().getSoftwareSystemWithName(PAYMENT_TERMINAL).getContainerWithName("JVM-2"); findComponents(jvm2); ComponentView view = workspace.getViews().createComponentView(jvm2, JVM2_COMPONENT_VIEW, "JVM2ComponentView"); view.addAllComponents(); }
Example #7
Source File: ContainerView.java From java with Apache License 2.0 | 5 votes |
/** * Adds all people, software systems and containers that are directly connected to the specified element. * * @param element an Element */ @Override public void addNearestNeighbours(@Nonnull Element element) { super.addNearestNeighbours(element, Person.class); super.addNearestNeighbours(element, SoftwareSystem.class); super.addNearestNeighbours(element, Container.class); }
Example #8
Source File: CarShareComponents.java From architecture-guild with Apache License 2.0 | 5 votes |
private static void setupComponentView(Workspace workspace, Container oldBackend) { Function<ViewSet, StaticView> componentViewCreator = views -> views.createComponentView(oldBackend, "Car sharing monolith components", "Car sharing monolith components"); setupView(workspace, componentViewCreator, PaperSize.A2_Landscape); }
Example #9
Source File: StylingRelationships.java From java with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws Exception { Workspace workspace = new Workspace("Styling Relationships", "This is a model of my software system."); Model model = workspace.getModel(); Person user = model.addPerson("User", "A user of my software system."); SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system."); Container webApplication = softwareSystem.addContainer("Web Application", "My web application.", "Java and Spring MVC"); Container database = softwareSystem.addContainer("Database", "My database.", "Relational database schema"); user.uses(webApplication, "Uses", "HTTPS"); webApplication.uses(database, "Reads from and writes to", "JDBC"); ViewSet views = workspace.getViews(); ContainerView containerView = views.createContainerView(softwareSystem, "containers", "An example of a container diagram."); containerView.addAllElements(); Styles styles = workspace.getViews().getConfiguration().getStyles(); // example 1 // styles.addRelationshipStyle(Tags.RELATIONSHIP).color("#ff0000"); // example 2 // model.getRelationships().stream().filter(r -> "HTTPS".equals(r.getTechnology())).forEach(r -> r.addTags("HTTPS")); // model.getRelationships().stream().filter(r -> "JDBC".equals(r.getTechnology())).forEach(r -> r.addTags("JDBC")); // styles.addRelationshipStyle("HTTPS").color("#ff0000"); // styles.addRelationshipStyle("JDBC").color("#0000ff"); StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET); structurizrClient.putWorkspace(WORKSPACE_ID, workspace); }
Example #10
Source File: StylingElements.java From java with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws Exception { Workspace workspace = new Workspace("Styling Elements", "This is a model of my software system."); Model model = workspace.getModel(); Person user = model.addPerson("User", "A user of my software system."); SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system."); Container webApplication = softwareSystem.addContainer("Web Application", "My web application.", "Java and Spring MVC"); Container database = softwareSystem.addContainer("Database", "My database.", "Relational database schema"); user.uses(webApplication, "Uses", "HTTPS"); webApplication.uses(database, "Reads from and writes to", "JDBC"); ViewSet views = workspace.getViews(); ContainerView containerView = views.createContainerView(softwareSystem, "containers", "An example of a container diagram."); containerView.addAllElements(); Styles styles = workspace.getViews().getConfiguration().getStyles(); // example 1 // styles.addElementStyle(Tags.ELEMENT).background("#438dd5").color("#ffffff"); // example 2 // styles.addElementStyle(Tags.ELEMENT).color("#ffffff"); // styles.addElementStyle(Tags.PERSON).background("#08427b"); // styles.addElementStyle(Tags.CONTAINER).background("#438dd5"); // example 3 // styles.addElementStyle(Tags.ELEMENT).color("#ffffff"); // styles.addElementStyle(Tags.PERSON).background("#08427b").shape(Shape.Person); // styles.addElementStyle(Tags.CONTAINER).background("#438dd5"); // database.addTags("Database"); // styles.addElementStyle("Database").shape(Shape.Cylinder); StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET); structurizrClient.putWorkspace(WORKSPACE_ID, workspace); }
Example #11
Source File: WebShop.java From structurizr-extensions with Apache License 2.0 | 5 votes |
@Autowired public WebShop(Model model, Personas personas, Sap sap) { webShop = model.addSoftwareSystem(Location.Internal, "WebShop", "Web-based application to buy our products"); final Container webServer = webShop.addContainer("WebShop", "The web application of the web shop", "Tomcat"); personas.getCustomer().uses(webServer, "Buys products", "Browser"); personas.getAdmin().uses(webServer, "enters new products", "Browser"); webServer.uses(sap.getSap(), "places orders", "WebService"); }
Example #12
Source File: AwsPublicSystemDocumentation.java From cia with Apache License 2.0 | 4 votes |
/** * 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 }); }
Example #13
Source File: CarShareComponents.java From architecture-guild with Apache License 2.0 | 4 votes |
private void createCallsFromInternalModules(Container bigApp) { sampleComponent1.uses(sampleComponent2, "a direct rest call", Protocols.REST, InteractionStyle.Synchronous); }
Example #14
Source File: CarShareComponents.java From architecture-guild with Apache License 2.0 | 4 votes |
SampleCarShareModules(Container carSharing) { sampleComponent1 = carSharing.addComponent("Sample component 1", "Sample component 1"); sampleComponent2 = carSharing.addComponent("Sample component 2", "Sample component 2"); }
Example #15
Source File: ContainerView.java From java with Apache License 2.0 | 2 votes |
/** * Adds an individual container (belonging to any software system) to this view. * * @param container the Container to add * @param addRelationships whether to add relationships to/from the container */ public void add(Container container, boolean addRelationships) { addElement(container, addRelationships); }
Example #16
Source File: ContainerView.java From java with Apache License 2.0 | 2 votes |
/** * Removes an individual container from this view. * * @param container the Container to remove */ public void remove(Container container) { removeElement(container); }
Example #17
Source File: ContainerView.java From java with Apache License 2.0 | 2 votes |
/** * Adds an individual container (belonging to any software system) to this view, including relationships to/from that container. * * @param container the Container to add */ public void add(Container container) { add(container, true); }
Example #18
Source File: DocumentationTemplate.java From java with Apache License 2.0 | 2 votes |
/** * Adds a section relating to a {@link Container} from one or more files. * * @param container the {@link Container} the documentation content relates to * @param title the section title * @param files one or more File objects that point to the documentation content * @return a documentation {@link Section} * @throws IOException if there is an error reading the files */ public Section addSection(Container container, String title, File... files) throws IOException { return add(container, title, files); }
Example #19
Source File: DocumentationTemplate.java From java with Apache License 2.0 | 2 votes |
/** * Adds a section relating to a {@link Container}. * * @param container the {@link Container} the documentation content relates to * @param title the section title * @param format the {@link Format} of the documentation content * @param content a String containing the documentation content * @return a documentation {@link Section} */ public Section addSection(Container container, String title, Format format, String content) { return add(container, title, format, content); }
Example #20
Source File: StructurizrDocumentationTemplate.java From java with Apache License 2.0 | 2 votes |
/** * Adds a "Components" section relating to a {@link Container} from one or more files. * * @param container the {@link Container} the documentation content relates to * @param files one or more File objects that point to the documentation content * @return a documentation {@link Section} * @throws IOException if there is an error reading the files */ @Nonnull public Section addComponentsSection(@Nullable Container container, File... files) throws IOException { return addSection(container, "Components", files); }
Example #21
Source File: StructurizrDocumentationTemplate.java From java with Apache License 2.0 | 2 votes |
/** * Adds a "Components" section relating to a {@link Container}. * * @param container the {@link Container} the documentation content relates to * @param format the {@link Format} of the documentation content * @param content a String containing the documentation content * @return a documentation {@link Section} */ @Nonnull public Section addComponentsSection(@Nullable Container container, @Nonnull Format format, @Nonnull String content) { return addSection(container, "Components", format, content); }