Module io.quarkus.qute.debug
Class SourceReferenceRegistry
java.lang.Object
io.quarkus.qute.debug.agent.source.SourceReferenceRegistry
Registry responsible for managing
SourceResponse objects used by the
Debug Adapter Protocol (DAP) to serve source content for Qute templates.
Each source reference corresponds to a unique integer ID associated with a specific URI. This allows the DAP client to request the source content of a template (e.g. a file embedded inside a JAR) by reference rather than by path.
Usage example:
int ref = registry.registerSourceReference(uri);
SourceResponse src = registry.getSourceReference(ref);
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.lsp4j.debug.SourceResponsegetSourceReference(int sourceReference) Returns theSourceResponseassociated with the given source reference ID.static StringreadFromJarUri(URI uri) Reads the content of the resource identified by the given URI.intRegisters a newSourceResponsefor the given URI and assigns it a unique source reference ID.voidreset()Clears all registered source references.
-
Constructor Details
-
SourceReferenceRegistry
public SourceReferenceRegistry()
-
-
Method Details
-
getSourceReference
public org.eclipse.lsp4j.debug.SourceResponse getSourceReference(int sourceReference) Returns theSourceResponseassociated with the given source reference ID.- Parameters:
sourceReference- the ID assigned to the source reference- Returns:
- the corresponding
SourceResponse, ornullif not found
-
registerSourceReference
Registers a newSourceResponsefor the given URI and assigns it a unique source reference ID.This method reads the template content directly from the JAR or file specified by the URI, stores it in memory, and returns the assigned ID.
- Parameters:
uri- the URI of the template (typically ajar:file:...!/...URI)- Returns:
- a unique source reference ID
-
readFromJarUri
Reads the content of the resource identified by the given URI.This method is primarily intended for reading files stored inside JARs (using
jar:file:...!/...URIs), but also works for standard file URIs.- Parameters:
uri- the resource URI- Returns:
- the content of the resource as a UTF-8 string, or an empty string if an error occurs
-
reset
public void reset()Clears all registered source references.Typically called when restarting or detaching a debugging session.
-