Moved groovymaths to dataforge-maths module.
This commit is contained in:
parent
5e5ffee64e
commit
58053812c4
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2015 Alexander Nozik.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
import static groovy.io.FileType.FILES
|
||||
|
||||
def fixStampEndings(File directory){
|
||||
directory.eachFileRecurse(FILES){
|
||||
byte[] bytes = it.bytes
|
||||
bytes[26] = '!'
|
||||
bytes[27] = '#'
|
||||
it.bytes = bytes
|
||||
}
|
||||
}
|
||||
|
||||
fixStampEndings(new File("C:\\Users\\darksnake\\Dropbox\\PlayGround\\data-test\\"))
|
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package inr.numass.scripts
|
||||
|
||||
import inr.numass.client.NumassClient
|
||||
|
||||
NumassClient client = new NumassClient("192.168.111.1", 8335);
|
||||
print client.startRun("2016_04")
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2015 Alexander Nozik.
|
||||
*
|
||||
* 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 inr.numass.scripts
|
||||
|
||||
import hep.dataforge.io.MetaStreamWriter
|
||||
import hep.dataforge.storage.commons.JSONMetaWriter
|
||||
import hep.dataforge.storage.commons.StorageManager
|
||||
|
||||
new StorageManager().startGlobal();
|
||||
|
||||
MetaStreamWriter parser = new JSONMetaWriter();
|
||||
|
||||
println "Starting Numass test client..."
|
||||
|
||||
String line = "";
|
||||
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(System.in))
|
||||
while(line == null || !line.startsWith("exit")){
|
||||
// print ">"
|
||||
line = br.readLine();
|
||||
if(line!= null && !line.startsWith("exit")){
|
||||
Cli.runComand("127.0.0.1", 8335, line.split(" "));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package inr.numass.scripts
|
||||
|
||||
import hep.dataforge.io.MetaStreamWriter
|
||||
import hep.dataforge.meta.Meta
|
||||
import hep.dataforge.storage.commons.JSONMetaWriter
|
||||
import hep.dataforge.storage.commons.StorageManager
|
||||
import inr.numass.client.NumassClient
|
||||
|
||||
new StorageManager().startGlobal();
|
||||
|
||||
new NumassClient("127.0.0.1",8335).withCloseable{
|
||||
|
||||
MetaStreamWriter parser = new JSONMetaWriter();
|
||||
|
||||
Meta startRun = it.startRun("test")
|
||||
|
||||
println parser.writeString(startRun);
|
||||
|
||||
Meta run = it.getCurrentRun();
|
||||
println parser.writeString(run);
|
||||
|
||||
Meta response = it.sendNumassData("C:\\Users\\darksnake\\Dropbox\\PlayGround\\data-test\\zip\\20150703143643_1.nm.zip");
|
||||
|
||||
println parser.writeString(response);
|
||||
|
||||
response = it.sendNumassData("C:\\Users\\darksnake\\Dropbox\\PlayGround\\data-test\\20150703144707_2");
|
||||
|
||||
println parser.writeString(response);
|
||||
}
|
||||
|
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package inr.numass.scripts
|
||||
|
||||
import hep.dataforge.io.MetaStreamWriter
|
||||
import hep.dataforge.storage.commons.JSONMetaWriter
|
||||
import hep.dataforge.storage.commons.StorageManager
|
||||
import inr.numass.client.NumassClient
|
||||
|
||||
new StorageManager().startGlobal();
|
||||
|
||||
MetaStreamWriter parser = new JSONMetaWriter();
|
||||
|
||||
NumassClient.runComand("127.0.0.1", 8336, "addNote", "This is my note with <strong>html</strong>");
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2015 Alexander Nozik.
|
||||
*
|
||||
* 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 inr.numass.scripts
|
||||
|
||||
import hep.dataforge.io.MetaStreamWriter
|
||||
import hep.dataforge.storage.commons.JSONMetaWriter
|
||||
import hep.dataforge.storage.commons.StorageManager
|
||||
import inr.numass.client.NumassClient
|
||||
|
||||
new StorageManager().startGlobal();
|
||||
|
||||
|
||||
|
||||
MetaStreamWriter parser = new JSONMetaWriter();
|
||||
|
||||
println "Starting Numass test client..."
|
||||
|
||||
String line = "";
|
||||
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(System.in))
|
||||
while(line == null || !line.startsWith("exit")){
|
||||
// print ">"
|
||||
line = br.readLine();
|
||||
if(!line.startsWith("exit")){
|
||||
NumassClient.runComand("192.168.111.1", 8335, line.split(" "));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2015 Alexander Nozik.
|
||||
*
|
||||
* 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 inr.numass.scripts
|
||||
|
||||
import hep.dataforge.storage.filestorage.VFSUtils
|
||||
import inr.numass.server.NumassServer
|
||||
import inr.numass.storage.NumassStorage
|
||||
import org.apache.commons.vfs2.FileObject
|
||||
|
||||
String path = "D:\\temp\\test\\numass\\"
|
||||
|
||||
FileObject file = VFSUtils.getLocalFile(new File(path))
|
||||
|
||||
NumassStorage storage = new NumassStorage(file,null)
|
||||
|
||||
println "Starting test numass listener in "+path
|
||||
|
||||
NumassServer listener = new NumassServer(storage, null);
|
||||
|
||||
listener.open()
|
||||
|
||||
String stopLine = "";
|
||||
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(System.in))
|
||||
while(stopLine == null || !stopLine.startsWith("exit")){
|
||||
// print ">"
|
||||
stopLine = br.readLine();
|
||||
}
|
||||
|
||||
listener.close()
|
||||
|
||||
println "Stopping test numass listener"
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package inr.numass.scripts
|
||||
|
||||
import hep.dataforge.io.MetaStreamWriter
|
||||
import hep.dataforge.meta.Meta
|
||||
import hep.dataforge.storage.commons.JSONMetaWriter
|
||||
import hep.dataforge.storage.commons.StorageManager
|
||||
import inr.numass.client.NumassClient
|
||||
|
||||
new StorageManager().startGlobal();
|
||||
|
||||
new NumassClient("127.0.0.1",8335).withCloseable{
|
||||
|
||||
MetaStreamWriter parser = new JSONMetaWriter();
|
||||
|
||||
Meta startRun = it.startRun("test")
|
||||
|
||||
println parser.writeString(startRun);
|
||||
|
||||
Meta set1 = it.setState("myState", 112);
|
||||
|
||||
println parser.writeString(set1);
|
||||
|
||||
Meta set2 = it.setState("otherState.property", ["a", "b", "c"])
|
||||
|
||||
println it.getStates()
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package inr.numass.scripts
|
||||
|
||||
import hep.dataforge.io.MetaStreamWriter
|
||||
import hep.dataforge.io.envelopes.Envelope
|
||||
import hep.dataforge.meta.Meta
|
||||
import hep.dataforge.meta.MetaBuilder
|
||||
import hep.dataforge.storage.commons.JSONMetaWriter
|
||||
import hep.dataforge.storage.commons.LoaderFactory
|
||||
import hep.dataforge.storage.commons.StorageManager
|
||||
import hep.dataforge.tables.MapPoint
|
||||
import inr.numass.client.NumassClient
|
||||
|
||||
new StorageManager().startGlobal();
|
||||
|
||||
new NumassClient("127.0.0.1",8335).withCloseable{
|
||||
|
||||
MetaStreamWriter parser = new JSONMetaWriter();
|
||||
|
||||
Meta startRun = it.startRun("test")
|
||||
|
||||
println parser.writeString(startRun);
|
||||
|
||||
|
||||
MetaBuilder target = new MetaBuilder("target")
|
||||
.setValue("type","loader")
|
||||
.setValue("name", "testPointLoader")
|
||||
.putNode(LoaderFactory.buildDataPointLoaderMeta("testPointLoader","a", DataFormat.forNames("a", "b", "c")).rename("meta"))
|
||||
|
||||
MetaBuilder data = new MetaBuilder("data");
|
||||
|
||||
String[] names = ["a","b","c"]
|
||||
|
||||
|
||||
for(int i = 0; i<5; i++){
|
||||
data.putNode(DataPoint.toMeta(new MapPoint(names,i, 2*i,3*i)));
|
||||
}
|
||||
|
||||
|
||||
Envelope bin = it.requestBase("numass.storage")
|
||||
.putMetaValue("action","push")
|
||||
.putMetaNode(target)
|
||||
.putMetaNode(data)
|
||||
.build();
|
||||
|
||||
|
||||
def response = it.respond(bin);
|
||||
|
||||
println parser.writeString(response.meta());
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user