merging old changes

This commit is contained in:
Alexander Nozik 2016-11-22 20:10:52 +03:00
parent 931c880259
commit 228d4c1187
9 changed files with 0 additions and 337 deletions

View File

@ -1,27 +0,0 @@
/*
* 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\\"))

View File

@ -1,12 +0,0 @@
/*
* 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")

View File

@ -1,44 +0,0 @@
/*
* 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.MetaStreamReader
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();
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(" "));
}
}

View File

@ -1,44 +0,0 @@
/*
* 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.MetaStreamReader
import hep.dataforge.io.MetaStreamWriter
import hep.dataforge.io.envelopes.Envelope
import hep.dataforge.io.envelopes.EnvelopeBuilder
import hep.dataforge.meta.Meta
import hep.dataforge.storage.commons.JSONMetaWriter
import hep.dataforge.storage.commons.StorageManager
import java.io.RandomAccessFile;
import java.nio.ByteBuffer
import inr.numass.client.NumassClient
import java.nio.MappedByteBuffer
import java.nio.channels.FileChannel
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);
}

View File

@ -1,20 +0,0 @@
/*
* 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.MetaStreamReader
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();
MetaStreamWriter parser = new JSONMetaWriter();
NumassClient.runComand("127.0.0.1", 8336, "addNote", "This is my note with <strong>html</strong>");

View File

@ -1,46 +0,0 @@
/*
* 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.MetaStreamReader
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();
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(" "));
}
}

View File

@ -1,43 +0,0 @@
/*
* 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.MetaStreamReader
import hep.dataforge.io.MetaStreamWriter
import hep.dataforge.io.envelopes.Envelope
import hep.dataforge.io.envelopes.EnvelopeBuilder
import hep.dataforge.meta.Meta
import hep.dataforge.meta.MetaBuilder
import hep.dataforge.storage.commons.JSONMetaWriter
import hep.dataforge.storage.commons.StorageManager
import java.io.RandomAccessFile;
import java.nio.ByteBuffer
import inr.numass.client.NumassClient
import java.nio.MappedByteBuffer
import java.nio.channels.FileChannel
import hep.dataforge.meta.MetaBuilder
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()
}

View File

@ -1,56 +0,0 @@
/*
* 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());
}

View File

@ -1,45 +0,0 @@
/*
* 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"