Skip to content

Commit

Permalink
docs(fix): fix javadoc for the entire project
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaGiulianelli committed Feb 12, 2025
1 parent e6c83b7 commit 97281d1
Show file tree
Hide file tree
Showing 15 changed files with 178 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,16 @@ public interface DTDManager extends DTDManagerReader {
*/
boolean removeAction(String rawActionName);

/*
/**
* Add an event to the DTD.
* @param rawEventName the raw name of the event to add
*/
void addEvent(String rawEventName);

/*
/**
* Remove an event from the DTD.
* @param rawEventName the raw name of the event to remove
* @return true is correctly removed, false if not present
*/
boolean removeEvent(String rawEventName);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,40 @@

import io.github.webbasedwodt.common.ThingModelElement;

/*
/**
* Get the available properties, relationships, actions, and events of the digital twin.
*
* These data are obtained combining the information from the ThingModel and the Ontology mapping,
* prioritizing the Ontology mapping.
*/
public interface OntologyManager {

/*
/**
* Get the available context extensions of the digital twin.
* @return the available context extensions.
*/
List<ThingModelElement> getAvailableContextExtensions();

/*
* Get the type of the digital twin.
/**
* Get the available properties.
* @return the available properties
*/
List<ThingModelElement> getAvailableProperties();

/*
* Get the available properties of the digital twin.
/**
* Get the available relationships of the digital twin.
* @return the available relationships
*/
List<ThingModelElement> getAvailableRelationships();

/*
* Get the available relationships of the digital twin.
/**
* Get the available actions of the digital twin.
* @return the available actions
*/
List<ThingModelElement> getAvailableActions();

/*
* Get the available actions of the digital twin.
/**
* Get the available events of the digital twin.
* @return the available events
*/
List<ThingModelElement> getAvailableEvents();
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,19 @@
import io.github.webbasedwodt.ontology.Node;
import io.github.webbasedwodt.ontology.RdfProperty;

/**
* This class handles ontological information from the two possible configurations: thing model and config file.
*/
public final class OntologyManagerImpl implements DTOntology, OntologyManager {

private final ThingModelUtils thingModelUtils;
private Optional<YamlOntologyProvider> yamlOntologyHandler = Optional.empty();

/**
* Default constructor.
* @param dittoThing the ditto thing to expose
* @param yamlOntologyPath the yaml config file path
*/
public OntologyManagerImpl(
Thing dittoThing,
String yamlOntologyPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ public class WoTDTDManager implements DTDManager {
private final Map<String, Action> actions;
private final Map<String, Event> events;

/**
* Default constructor.
* @param configuration the adapter configuration
* @param platformManagementInterfaceReader the platform management interface reader instance
*/
public WoTDTDManager(
final WoDTDigitalAdapterConfiguration configuration,
final PlatformManagementInterfaceReader platformManagementInterfaceReader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public final class YamlOntologyProvider {

/**
* Constructor that takes the name of a YAML file and parses its content.
* @param yamlFileName the yaml config file path
*/
@SuppressWarnings("unchecked")
public YamlOntologyProvider(String yamlFileName) {
Expand Down Expand Up @@ -94,27 +95,31 @@ public YamlOntologyProvider(String yamlFileName) {

/**
* Returns the Digital Twin Type from the YAML file.
* @return an optional with the digital twin type
*/
public Optional<String> getDigitalTwinType() {
return digitalTwinType;
}

/**
* Returns the properties and relationships defined in the YAML file.
* @return a list of optional property configurations
*/
public List<Optional<Map<String, String>>> getProperties() {
return properties;
}

/**
* Returns the actions defined in the YAML file.
* @return a list of optional action configurations
*/
public List<Optional<Map<String, String>>> getActions() {
return actions;
}

/**
* Returns the events defined in the YAML file.
* @return a list of optional event configurations
*/
public List<Optional<Map<String, String>>> getEvents() {
return events;
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/io/github/webbasedwodt/WoDTAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
import io.github.webbasedwodt.config.ConfigurationLoader;
import io.github.webbasedwodt.config.EnvironmentConfigurationLoader;

/*
/**
* Application entry point.
*/
public class WoDTAdapter {
/**
* Main Entry point
* @param args the input args
*/
public static void main(String[] args) {
final ConfigurationLoader configurationLoader = new EnvironmentConfigurationLoader();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ public final class WoDTDigitalAdapterConfiguration {
private final Thing thing;
private final String digitalTwinVersion;

/**
* Default constructor.
* @param dittoUrl the ditto endpoint url
* @param dittoObservationEndpoint the endpoint to observe internal ditto activities
* @param dittoUsername ditto credential -- username
* @param dittoPassword ditto credential -- password
* @param thingId the ditto thing id to expose as a wodt dt
* @param yamlOntologyPath the path for the configuration file
* @param physicalAssetId the physical asset id associated to the dt
* @param platformToRegister the set of WoDT Platforms to automatically register to
* @param digitalTwinUri the digital twin uri to expose
* @param digitalTwinExposedPort the digital twin wodt adapter exposed port
* @param digitalTwinVersion the digital twin model version
*/
public WoDTDigitalAdapterConfiguration(
final URI dittoUrl,
final URI dittoObservationEndpoint,
Expand Down Expand Up @@ -84,8 +98,9 @@ private Thing obtainDittoThing(String dittoThingId) {
*/
public String getDittoPassword() {return this.dittoPassword;}

/*
/**
* Return the Ditto Thing associated with the Digital Twin.
* @return the thing
*/
public Thing getDittoThing() {
return this.thing;
Expand Down Expand Up @@ -131,6 +146,10 @@ public Set<URI> getPlatformToRegister() {
return new HashSet<>(this.platformToRegister);
}

/**
* Obtain the digital twin version.
* @return the digital twin version.
*/
public String getDigitalTwinVersion() {
return this.digitalTwinVersion;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/*
/**
* This class handle a Ditto Client that listen to Thing changes and messages.
*/
public class DittoThingListener extends Thread {
Expand All @@ -18,6 +18,13 @@ public class DittoThingListener extends Thread {
private final DittoBase client;
private final WoDTDigitalAdapter woDTDigitalAdapter;

/**
* Default constructor.
* @param dittoEndpoint the ditto endpoint
* @param dittoUsername ditto endpoint credential - username
* @param dittoPassword ditto endpoint credential - password
* @param woDTDigitalAdapter the wodt digital adapter
*/
public DittoThingListener(final URI dittoEndpoint,
final String dittoUsername,
final String dittoPassword,
Expand Down Expand Up @@ -47,7 +54,10 @@ public void run() {
woDTDigitalAdapter.stopAdapter();
}
}


/**
* Stop the {@link DittoThingListener}.
*/
public void stopThread() {
latch.countDown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ private void startAdapter() {
dittoClientThread.start();
}

/**
* Stop the adapter.
*/
public void stopAdapter() {
this.platformManagementInterface.signalDigitalTwinDeletion();
this.dittoClientThread.stopThread();
Expand Down Expand Up @@ -171,6 +174,10 @@ private void syncWithDittoThing(final Thing thing) {
.forEach(event -> handleEvent(event.getField(), false, null));
}

/**
* Handle a thing change.
* @param change the change to handle
*/
public void onThingChange(ThingChange change) {
switch (change.getAction()) {
case CREATED, MERGED, UPDATED:
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/io/github/webbasedwodt/common/DittoBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ public class DittoBase {
private static final int TIMEOUT = 10;
private final DittoClient client;

/**
* Default constructor
* @param dittoEndpoint the ditto endpoint
* @param dittoUsername ditto endpoint credential - username
* @param dittoPassword ditto endpoint credential - password
*/
public DittoBase(final URI dittoEndpoint, final String dittoUsername, final String dittoPassword) {
try {
client = buildClient(dittoEndpoint, dittoUsername, dittoPassword)
Expand All @@ -55,6 +61,10 @@ public DittoBase(final URI dittoEndpoint, final String dittoUsername, final Stri
}
}

/**
* Get ditto client.
* @return the client
*/
public DittoClient getClient() {
return this.client;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@

import java.util.Optional;

/*
/**
* Class representing a Thing Model field.
*/
public class ThingModelElement {
private final String field;
private final Optional<String> feature;
private final Optional<String> domainTag;

/**
* Default constructor.
* @param field the thing model field
* @param feature the thing feature, if present
* @param domainTag the domain tag, if present
*/
public ThingModelElement(String field, Optional<String> feature, Optional<String> domainTag) {
this.field = field;
this.feature = (feature.isPresent() && !feature.get().isEmpty()) ? feature : Optional.empty();
Expand Down Expand Up @@ -45,14 +51,26 @@ public String toString() {
'}';
}

/**
* Get the field name.
* @return the field name
*/
public String getField() {
return this.field;
}

/**
* Get the feature, if present.
* @return an optional for the feature
*/
public Optional<String> getFeature() {
return this.feature;
}

/**
* Get the domain tag, if present.
* @return an optional for the domain tag
*/
public Optional<String> getDomainTag() {
return this.domainTag;
}
Expand Down
Loading

0 comments on commit 97281d1

Please sign in to comment.