Skip to content

Commit 500a43f

Browse files
committed
Sonatype OSS requirements
1 parent beb3a93 commit 500a43f

File tree

3 files changed

+47
-18
lines changed

3 files changed

+47
-18
lines changed

vtl-bundles/vtl-r/RVTL/src/main/resources/R/R/VTLSession.R

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ VTLSession <- R6Class("VTLSession",
5353
#' This method should not be called by the application.
5454
finalize = function() {
5555
finalized <- T
56-
private$instance <- NULL
56+
private$clearInstance()
5757
return(invisible())
5858
},
5959

@@ -73,14 +73,14 @@ VTLSession <- R6Class("VTLSession",
7373
#' The editor code to associate this session
7474
setText = function(code) {
7575
self$text <- code
76-
instance <- NULL
76+
private$clearInstance()
7777
return(invisible(self))
7878
},
7979

8080
#' @description
8181
#' Compiles the VTL statements submitted for this session.
8282
compile = function () {
83-
private$instance = NULL;
83+
private$clearInstance()
8484
private$checkInstance()$compile()
8585
},
8686

@@ -107,13 +107,16 @@ VTLSession <- R6Class("VTLSession",
107107
#' @param nodes
108108
#' a list of names of nodes to compute from this session
109109
getValues = function (nodes) {
110-
jnodes <- sapply(X = nodes, private$checkInstance()$resolve)
111-
nodesdf <- lapply(names(jnodes), FUN = function(x, jnodes, jstructs) {
112-
jnode <- jnodes[[x]]
110+
nodesdf <- lapply(nodes, function(node) {
111+
df <- get0(node, envir = private$env)
112+
if (!is.null(df)) {
113+
return(df)
114+
}
115+
116+
jnode <- private$checkInstance()$resolve(node)
113117
if (jnode %instanceof% "it.bancaditalia.oss.vtl.model.data.ScalarValue") {
114118
df <- as.data.frame(list(Scalar = jnode$get()))
115-
}
116-
else if (jnode %instanceof% "it.bancaditalia.oss.vtl.model.data.DataSet") {
119+
} else {
117120
pager <- .jnew("it.bancaditalia.oss.vtl.util.Paginator",
118121
.jcast(jnode, "it.bancaditalia.oss.vtl.model.data.DataSet"), 100L)
119122
nc <- jnode$getMetadata()$size()
@@ -123,13 +126,15 @@ VTLSession <- R6Class("VTLSession",
123126
})
124127
attr(df, 'measures') <- sapply(jnode$getMetadata()$getMeasures(), function(x) { x$getVariable()$getName() })
125128
attr(df, 'identifiers') <- sapply(jnode$getMetadata()$getIDs(), function(x) { x$getVariable()$getName() })
129+
} else {
130+
stop(paste0("Unsupported result class: ", jnode$getClass()$getName()))
126131
}
127-
else
128-
stop(paste0("Unsupported result class: ", jnode$getClass()$getName()))
129132

130-
return (df)
131-
}, jnodes, jstructs)
132-
names(nodesdf) <- names(jnodes)
133+
assign(node, df, envir = private$env)
134+
return(df)
135+
})
136+
137+
names(nodesdf) <- nodes
133138
return(nodesdf)
134139
},
135140

@@ -198,6 +203,7 @@ VTLSession <- R6Class("VTLSession",
198203
),
199204
private = list(
200205
instance = NULL,
206+
env <- new.env(parent = emptyenv())
201207
finalized = F,
202208
checkInstance = function() {
203209
if (private$finalized)
@@ -207,6 +213,11 @@ VTLSession <- R6Class("VTLSession",
207213
}
208214
return(invisible(private$instance))
209215
}
216+
clearInstance = function() {
217+
self$instance <- NULL
218+
self$env <- new.env(parent = emptyenv())
219+
.jgc()
220+
}
210221
)
211222
)
212223

vtl-parser/javadoc/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
All sources are generated.

vtl-parser/pom.xml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@
5454
<groupId>org.codehaus.mojo</groupId>
5555
<artifactId>flatten-maven-plugin</artifactId>
5656
</plugin>
57-
<plugin>
58-
<groupId>org.apache.maven.plugins</groupId>
59-
<artifactId>maven-gpg-plugin</artifactId>
60-
</plugin>
6157
<plugin>
6258
<groupId>org.antlr</groupId>
6359
<artifactId>antlr4-maven-plugin</artifactId>
@@ -108,6 +104,23 @@
108104
<attach>true</attach>
109105
</configuration>
110106
</plugin>
107+
<plugin>
108+
<groupId>org.apache.maven.plugins</groupId>
109+
<artifactId>maven-jar-plugin</artifactId>
110+
<executions>
111+
<execution>
112+
<id>empty-javadoc</id>
113+
<phase>package</phase>
114+
<goals>
115+
<goal>jar</goal>
116+
</goals>
117+
<configuration>
118+
<classifier>javadoc</classifier>
119+
<classesDirectory>${basedir}/javadoc</classesDirectory>
120+
</configuration>
121+
</execution>
122+
</executions>
123+
</plugin>
111124
<plugin>
112125
<groupId>org.apache.maven.plugins</groupId>
113126
<artifactId>maven-source-plugin</artifactId>
@@ -116,9 +129,13 @@
116129
<groupId>org.apache.maven.plugins</groupId>
117130
<artifactId>maven-javadoc-plugin</artifactId>
118131
<configuration>
119-
<excludePackageNames>it.bancaditalia.oss.vtl.grammar</excludePackageNames>
132+
<skip>true</skip>
120133
</configuration>
121134
</plugin>
135+
<plugin>
136+
<groupId>org.apache.maven.plugins</groupId>
137+
<artifactId>maven-gpg-plugin</artifactId>
138+
</plugin>
122139
</plugins>
123140
</build>
124141
</project>

0 commit comments

Comments
 (0)