Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
feat: add identifier to all endpoints (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
kayman-mk committed May 12, 2022
1 parent 7752008 commit a844b28
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 21 deletions.
@@ -0,0 +1,26 @@
package com.hlag.tools.commvis.analyzer.model;

public class EndpointFactory {
private static final EndpointFactory singleton = new EndpointFactory();
private Long numberGenerator = 0L;

public static EndpointFactory get() {
return singleton;
}

private synchronized Long getNewIdNumber() {
return ++numberGenerator;
}

public HttpConsumer createHttpConsumer(String className, String methodName, String type, String path) {
return new HttpConsumer(className, methodName, type, path, getNewIdNumber());
}

public HttpProducer createHttpProducer(String className, String methodName, String type, String path, String destinationProjectId) {
return new HttpProducer(className, methodName, type, path, destinationProjectId, getNewIdNumber());
}

public JmsReceiver createJmsReceiver(String className, String destinationType, String destination) {
return new JmsReceiver(className, destinationType, destination, getNewIdNumber());
}
}
Expand Up @@ -7,16 +7,20 @@
* An endpoint which can receive http(s) messages. Typically, a REST API.
*/
@Value
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
public class HttpConsumer implements ISenderReceiverCommunication {
@SerializedName(value="class_name")
private final String className;
String className;
@SerializedName(value="method_name")
private final String methodName;
String methodName;

@SerializedName(value="type")
private final String type;
String type;
@SerializedName(value="path")
private final String path;
String path;

@SerializedName(value="id")
Long id;

@Override
public void visit(AbstractCommunicationModelVisitor visitor) {
Expand Down
@@ -1,42 +1,46 @@
package com.hlag.tools.commvis.analyzer.model;

import com.google.gson.annotations.SerializedName;
import lombok.Value;
import lombok.*;

/**
* Holds the data of one method calling a http(s) endpoint.
*/
@Value
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
public class HttpProducer implements ISenderReceiverCommunication {
/**
* The full qualified classname where the producer lives.
*/
@SerializedName(value="class_name")
private final String className;
String className;

/**
* The method name of the producer.
*/
@SerializedName(value="method_name")
private final String methodName;
String methodName;

/**
* The HTTP method like GET or POST.
*/
@SerializedName(value="type")
private final String type;
String type;

/**
* The full path name called (usually without a domain).
*/
@SerializedName(value="path")
private final String path;
String path;

/**
* The project id of the referenced project.
*/
@SerializedName(value="destination_project_id")
private final String destinationProjectId;
String destinationProjectId;

@SerializedName(value="id")
private Long id;

@Override
public void visit(AbstractCommunicationModelVisitor visitor) {
Expand Down
Expand Up @@ -4,5 +4,10 @@
* The top level interface for all producers and consumers or senders and receivers.
*/
public interface ISenderReceiverCommunication {
/**
* @return an identifier valid within a model
*/
Long getId();

void visit(AbstractCommunicationModelVisitor visitor);
}
@@ -1,29 +1,27 @@
package com.hlag.tools.commvis.analyzer.model;

import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import lombok.*;

/**
* A receiver for JMS messages.
*/
@AllArgsConstructor
@Getter
@ToString
@EqualsAndHashCode
@Value
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
public class JmsReceiver implements ISenderReceiverCommunication {
@SerializedName(value="class_name")
private String className;
String className;

// e.g. "javax.jms.Queue"
@SerializedName(value="destination_type")
private String destinationType;
String destinationType;

// e.g. "jms/catalogs/customer"
@SerializedName(value="destination")
private String destination;
String destination;

@SerializedName(value="id")
Long id;

@Override
public void visit(AbstractCommunicationModelVisitor visitor) {
Expand Down

0 comments on commit a844b28

Please sign in to comment.