|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.uni.bamberg.wiai.minf.forflow.datagenerator.controller.ControllerBackgroundTask
public class ControllerBackgroundTask
Long running computations or I/O bound task should never run on EDT.
| Constructor Summary | |
|---|---|
protected |
ControllerBackgroundTask()
sole default constructor only visible to same package |
| Method Summary | |
|---|---|
void |
deleteArtefact(javax.swing.tree.DefaultTreeModel model,
javax.swing.tree.DefaultMutableTreeNode nodeToDelete,
boolean isAbstractTerm)
manages the deletion of an artefact. |
void |
generateProabilityDensityFunction(ProbabilityDistribution distribution,
Graph graph)
to get a clue of the current probability distribution it is visualized at a graph panel. |
void |
generateTestData(java.net.URI path,
java.lang.String fileName,
java.lang.String ext)
here is the method generating the test data. |
void |
loadEMFModel(DataGeneratorActions dga,
java.lang.String path)
The job of this method is to load an EMF Ecore model file. |
void |
loadFacets(javax.swing.tree.TreePath path,
javax.swing.tree.DefaultMutableTreeNode selectedNode,
DataGeneratorView view)
with this method the user gets the ability to get facets to an artefact by just clicking to the corresponding node at the tree in the GUI. |
java.util.List<java.lang.String> |
loadValueFile(java.net.URI file)
This method is used to get a whole value file retrieved. |
void |
log(java.util.logging.Level level,
java.lang.String message,
java.lang.Throwable e,
java.util.logging.Logger logger)
Logging is done, of course, in background because there are I/O processes involved. |
void |
openMultiplicityDialog(Multiplicity dialog)
fetches all attributes and build an temporarily data structure to display the current situation. |
void |
openNullValuesDialog(NullValues nullValuesDialog)
Creates an background thread for doing this job. |
void |
saveMultiplicityValues(Multiplicity dialog,
java.util.List<FacetSimplified> tableData)
once the multiplicity dialog has been displayed and the settings are accepted, they are going to be saved in the data structure in model layer. |
void |
saveNullValues(NullValues dialog,
java.util.List<FacetSimplified> tableData)
This method is only invoked, when the above method openNullValuesDialog(NullValues) has been invoked
earlier. |
void |
saveValueFile(java.net.URI workingDir,
java.util.List<java.lang.String> values,
java.lang.String fileName)
This method is used to create a plain text file with possible values for an attribute. |
void |
updateObservers(java.util.List<MetaClass> artefacts,
javax.swing.tree.DefaultTreeModel treeModel,
javax.swing.JTree tree,
ArtefactType type)
method does run an update on the product artefacts. |
void |
updateQuantity(int quantity,
javax.swing.tree.TreePath path,
javax.swing.tree.DefaultMutableTreeNode selectedNode)
runs an update on the quantity. |
void |
updateUnit(java.util.List<java.lang.String> data,
java.lang.String name,
javax.swing.JTree tree,
javax.swing.tree.DefaultTreeModel model)
runs an update on the unit tree component. |
void |
updateUnitCustom(java.util.List<Custom> data,
java.lang.String name,
javax.swing.JTree tree,
javax.swing.tree.DefaultTreeModel model)
runs an update on the unit tree component. |
void |
updateXMLFile(java.net.URI xml,
java.net.URI xsd,
XMLStartup xmlHandler,
boolean adding,
java.lang.String tagElement,
java.lang.Object content)
runs an update on the XML startup file to reflect the user actions. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected ControllerBackgroundTask()
| Method Detail |
|---|
public void loadEMFModel(DataGeneratorActions dga, java.lang.String path)
LoadEMFModel
public void updateObservers(java.util.List<MetaClass> artefacts, javax.swing.tree.DefaultTreeModel treeModel, javax.swing.JTree tree, ArtefactType type)
artefacts
- list of artefacts to display in UItreeModel
- model to represent the artefactstree
- Tree component in UItype
- defines which type of artefacts to updateArtefactUpdater
public void deleteArtefact(javax.swing.tree.DefaultTreeModel model, javax.swing.tree.DefaultMutableTreeNode nodeToDelete, boolean isAbstractTerm)
model
- identifies the tree component where the deleting occurednodeToDelete
- identifies the desired node to kick outisAbstractTerm
- flag indicates, whether the whole linked collection will be
deleted.public void openNullValuesDialog(NullValues nullValuesDialog)
NullValues
dialog and displayed.
When displayed it is ready for further manipulation of the data.
nullValuesDialog
- dialog defining null values for facets.public void saveNullValues(NullValues dialog, java.util.List<FacetSimplified> tableData)
openNullValuesDialog(NullValues)
has been invoked
earlier.
It sets the null value allowed flags to each facet. This
is needed for test data generation, because there might be
facets which allow this setting.
dialog
- reference to dialog.
Needed to close when the job is done.tableData
- data of the table modelpublic void openMultiplicityDialog(Multiplicity dialog)
dialog
- multiplicity dialog called when done.public void saveMultiplicityValues(Multiplicity dialog, java.util.List<FacetSimplified> tableData)
dialog
- reference to multiplicity dialog, to handle closing.tableData
- the actual data to setpublic void updateXMLFile(java.net.URI xml, java.net.URI xsd, XMLStartup xmlHandler, boolean adding, java.lang.String tagElement, java.lang.Object content)
xml
- path to XML startup filexsd
- path to XML's XSD filexmlHandler
- class which handles the action to reflect the change in the fileadding
- indicates whether to add or to remove something from the XML filetagElement
- to get a clue where to make the change in the XML file structure.
XMLType refers to a XMl element tag used within.content
- here's the object when it comes to add something new to the file.
Together with XMLType controller knows which class type it is, when
casting is done.
If adding is false, content parameter holds the content to delete
from the file.public void loadFacets(javax.swing.tree.TreePath path, javax.swing.tree.DefaultMutableTreeNode selectedNode, DataGeneratorView view)
path
- represents the path to a selected nodeselectedNode
- the artefact to load its facets. When the background job
is created the tree node of the UI is transformed to an
actual artefact object.view
- reference to main view.
This is needed later to set the computed resultspublic void updateQuantity(int quantity, javax.swing.tree.TreePath path, javax.swing.tree.DefaultMutableTreeNode selectedNode)
quantity
- how many test data to generate?path
- the path where the selected node residesselectedNode
- the name is very wordy! It's the selected node in the pathpublic void updateUnit(java.util.List<java.lang.String> data, java.lang.String name, javax.swing.JTree tree, javax.swing.tree.DefaultTreeModel model)
data
- here is the latest data to update in UI.
It comes directly form model layer, when data structure changes.name
- the name of the unit that has send a notification.tree
- tree component in UI.model
- the corresponding tree model.
Here is the latest data updated.public void updateUnitCustom(java.util.List<Custom> data, java.lang.String name, javax.swing.JTree tree, javax.swing.tree.DefaultTreeModel model)
data
- here is the latest data to update in UI.
It comes directly form model layer, when data structure changes.name
- the name of the unit that has send a notification.tree
- tree component in UI.model
- the corresponding tree model.
Here is the latest data updated.public void saveValueFile(java.net.URI workingDir, java.util.List<java.lang.String> values, java.lang.String fileName)
workingDir
- the current directoryvalues
- the list of values for an given attribute.fileName
- the name of the file to createpublic java.util.List<java.lang.String> loadValueFile(java.net.URI file)
file
- the name of the value filepublic void log(java.util.logging.Level level, java.lang.String message, java.lang.Throwable e, java.util.logging.Logger logger)
level
- defines the logging level. It's a mechanism to make
logging very flexible and cots very little at runtime
when logging code is not used, e.g. in production.message
- as the parameter already says: you've got the opportunity
to put same custom information here in.e
- superclass of all errors and exceptionslogger
- the logger object is passed down, toopublic void generateProabilityDensityFunction(ProbabilityDistribution distribution, Graph graph)
distribution
- probability distribution to visualize its corresponding
probability density function.graph
- that's the component to draw topublic void generateTestData(java.net.URI path, java.lang.String fileName, java.lang.String ext)
path
- the path to save the generated test data tofileName
- the file nameext
- the file extension
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


Lookup spatial data for a set of points.
lookup_xy(data, shoredistance=TRUE, grids=TRUE, areas=FALSE, asdataframe=TRUE)
| data | The data frame with columns decimalLongitude and decimalLatitude. |
|---|---|
| shoredistance | Indicate whether the shoredistance should be returned
(default |
| grids | Indicate whether the grid values such as temperature and
bathymetry should be returned (default |
| areas | Indicate whether the area values should be returned and from
which distance in meters to the provided points (default |
| asdataframe | Indicate whether a dataframe or a list should be returned
(default |
Data frame or list with the values for the different requested fields.
When asdataframe
is FALSE
then data is returned in the
same order as the requested data as a list, with for each list item the
requested values. For invalid coordinates NULL
is returned.
When parameter areas
is a positive integer then all areas within a radius of
this distance in meters will be returned. A value of TRUE
is
equivalent to a distance of 0 meters, FALSE
indicates that no area
results are required.
# NOT RUN { lookup_xy(abra, shoredistance = TRUE, grids = TRUE, areas = FALSE) # }


HOME MENU ARCHIVE My Artworks
World Animals
T=7s
Slide the Bottom-Right-Square to read info in the Text Box © R.S.


In association with SIGMusic
Art concerned with combining vocal or instrumental sounds for beauty of form or emotional expression
An art form whose medium is sound.
Organized sound
SinOsc s => JCRev r => dac;
0.15 => r.mix;
0.7 => r.gain;
0.5 => dac.gain;
while (true) {
Math.random2(50, 80) => float f;
<<< f >>>;
Std.mtof(f) => s.freq;
100::ms => now;
}
An instrument created or adapted to make musical sounds
An instrument created or adapted to make reproducible musical sounds


Copyright 2020, 2021, 2022 Red Hat, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
package analyser
|
PipelineLogEntry represents one log entry (record) read from log file.
|
type PipelineLogEntry struct {
Level string `json:"levelname"`
Time string `json:"asctime"`
Name string `json:"name"`
Filename string `json:"filename"`
Message string `json:"message"`
}
var pipelineEntries [ ] PipelineLogEntry = nil
func readPipelineLogFile ( filename string ) ( [ ] PipelineLogEntry , error ) {
entries := [ ] PipelineLogEntry { }
|
disable "G304 (CWE-22): Potential file inclusion via variable"
|
file , err := os . Open ( filename )
if err != nil {
return entries , err
}
scanner := bufio . NewScanner ( file )
for scanner . Scan ( ) {
entry := PipelineLogEntry { }
err = json . Unmarshal ( [ ] byte ( scanner . Text ( ) ) , & entry )
if err != nil {
log . Println ( err )
} else {
entries = append ( entries , entry )
}
}
if err := scanner . Err ( ) ; err != nil {
return entries , err
}
|
in case of error all we can do is to just log the error
|
if err != nil {
log . Println ( err )
}
return entries , nil
}
func filterPipelineMessagesByMessage ( entries [ ] PipelineLogEntry , prefix string ) [ ] PipelineLogEntry {
filtered := [ ] PipelineLogEntry { }
for _ , entry := range entries {
if strings . HasPrefix ( entry . Message , prefix ) {
filtered = append ( filtered , entry )
}
}
return filtered
}
func printStatisticLinePipeline ( colorizer aurora . Aurora , what string , entries [ ] PipelineLogEntry ) {
e := strconv . Itoa ( len ( entries ) )
fmt . Printf ( "%-26s %s messages\n" , what , colorizer . Blue ( e ) )
}
func printPipelineStatistic ( colorizer aurora . Aurora , entries [ ] PipelineLogEntry ) {
validated1 := filterPipelineMessagesByMessage ( entries , "JSON schema validated" )
validated2 := filterPipelineMessagesByMessage ( entries , "Identity schema validated" )
downloaded := filterPipelineMessagesByMessage ( entries , "Downloading " )
saved := filterPipelineMessagesByMessage ( entries , "Saved " )
sendStart := filterPipelineMessagesByMessage ( entries , "Sending response to the " )
sendSuccess := filterPipelineMessagesByMessage ( entries , "Message has been sent successfully" )
contextRetrieved := filterPipelineMessagesByMessage ( entries , "Message context: " )
success := filterPipelineMessagesByMessage ( entries , "Status: Success; " )
printStatisticLinePipeline ( colorizer , "JSON schema validated" , validated1 )
printStatisticLinePipeline ( colorizer , "Identity schema validated" , validated2 )
printStatisticLinePipeline ( colorizer , "Downloaded" , downloaded )
printStatisticLinePipeline ( colorizer , "Saved" , saved )
printStatisticLinePipeline ( colorizer , "Sending start" , sendStart )
printStatisticLinePipeline ( colorizer , "Sending successful" , sendSuccess )
printStatisticLinePipeline ( colorizer , "Context retrieved" , contextRetrieved )
printStatisticLinePipeline ( colorizer , "Success" , success )
}
|
ReadPipelineLogFiles reads all log files gathered from CCX data pipeline pods.
|
func ReadPipelineLogFiles ( ) ( int , error ) {
var err error
pipelineEntries , err = readPipelineLogFile ( config . PipelineLogFileName )
if err != nil {
return 0 , err
}
return len ( pipelineEntries ) , nil
}
|
PrintPipelineStatistic prints statistic gathered from CCX data pipeline logs.
|
func PrintPipelineStatistic ( colorizer aurora . Aurora ) {
if pipelineEntries == nil {
fmt . Println ( colorizer . Red ( "logs are not loaded" ) )
return
}
if len ( pipelineEntries ) == 0 {
fmt . Println ( colorizer . Red ( "empty log" ) )
return
}
printPipelineStatistic ( colorizer , pipelineEntries )
}
|