I am trying to write a groovy script which obtains the source file location, I already tried using
SOurceDataStore.getLogicalSchema().getTechnology().getInternalName()
This only returns "FILE" technology that is being used.
If I wanted to obtain this path:
How can I achieve that?
Method getSchemaName() of class OdiPhysicalSchema can be used to retrieve the schema (or path for the file technology).
Now it looks like you want to retrieve it from a Datastore so you should first find the model, then the logical schema, then the physical schema linked to it through a specific context. You would need an IOdiContextFinder to get the OdiContext object. The code would be something like this :
context = ((IOdiContextFinder)odiInstance.getTransactionalEntityManager().getFinder(OdiContext.class)).findByCode("MY_CONTEXT");
filepath = SOurceDataStore.getModel().getLogicalSchema().getPhysicalSchema(context).getSchemaName();
Related
I'm currently trying to add scripting functionality to my C++ application by using v8. The goal is to process some data in buffers with JS and then return the result. I think I can generate an ArrayBuffer by using New with an appropriate BackingStore. The result would be a Local. I would now like to run scripts via v8::Script::Compile and v8::Script::Run. What would be the name of the ArrayBuffer - or how can I assign it a name so that it's accessible in the script? Do I need to make it a Globalif I need to run multiple scripts on the same ArrayBuffer?
If you want scripts to be able to access, say, my_array_buffer, then you'll have to install the ArrayBuffer as a property on the global object. See https://v8.dev/docs/embed for an introduction to embedding V8, and the additional examples linked from there. In short, it'll boil down to something like:
global_object->Set(context,
v8::String::NewFromUtf8(isolate, "my_array_buffer"),
array_buffer);
You don't need to store the ArrayBuffer in a Global for this to work.
Trying to save an h2o model with some specific name that differs from the model's model_id field, but trying something like...
h2o.save_model(model=model,
path='/some/path/then/filename',
force=False)
just creates a dir/file structure like
some
|__path
|__then
|__filename
|__<model_id>
as opposed to
some
|__path
|__then
|__filename
Is this possible to do from the save_model method?
I can't / hesitate to simply change the model_id before calling the save method because the model names have timestamps appended to them to avoid name collisions with other models that may be on the h2o cluster (am trying to remove these timestamps when saving on disk and simplifying the name on the cluster before saving creates a time where naming collision can occur if other processes are also attempting to save such a model (of, say, a different timestamp)).
Any way to get this behavior or other common alternatives / workarounds?
This is currently not possible, however I created a feature request here. There is a related question here which shows a solution for R (could be adapted to Python). The work-around is just to rename the file manually using a few lines of R/Python code.
I want to configure xpath or xquery in property file and need to use that variable while reading data.
for example, I configured xquery property in configuration file like
aXquery = types:Request/types:Person/type:details/type:a/text()
I need to use this aXquery variable in script some thing like
$RESTRequest/types:payload/string($configData/ns2:XPaths/ns2:aXquery)
Can anyone help me on this how to do in activevos?
I don't think that you can use property files directly. AFAIK there are three options to implement a dynamic configuration mechanism:
Use URN Mappings (Configurable in ActiveVOS Console / Administration / URN Mappings). You can read those with functions available in XQuery in ActiveVOS (resolveURN).
Place the configuration value in the database (e.g. create a new table) and read those with ActiveVOS DB access mechanisms.
Wrap your config file in a Web service and call the service from your process.
I'd like to create a new stub file "test.mp3" for instance, and add a Window Property to it ( System.Author for instance).
the solution must be usable for several file extension as text, picture, videos, etc...
If I just create a file and use IShellItem2::GetPropertyStore I get a HRESULT fail for invalid Arguments.
Use IShellItem2::GetPropertyStore on a real music file I can read and write Its properties just fine.
Please test your suggestions first.
Property Stores typically access and store data within the file itself. In your case of a mp3 file, it would be attempting to read and write the ID3 tags. Also, Property Stores are not stored in a database and cannot be arbitrarily added to files that don't support it.
You'll most likely need to implement your own property handlers to do what it appears you're trying to accomplish. For types that already have handlers, you'll have to replace the system handlers with your own.
The most likely reason your mp3 test is failing is that you have an empty file with no data and no valid ID3 tags.
I have been strugling with this for a long while.
I am using an outer API and I need to pass file's path directly. I cannot modify it.
I looks like: functionmethod(String path);
So i cannot use Resource because I need to pass just path.
Is it possible in SPRING?
Maybe you could use:
(new File("")).getAbsolutePath() that gives you the current path (application).
or (I think this one will fit better for you)
getResource("fileName").getFile()