Error updating asset
I have various processes to update assets that create, modify and categorize assets, and they work without problems.
But I also have one that just categorizes the existing assets.
It just recover the asset and the category from the repository and then assigns the category to the asset. Basically something like that:
and then I save the asset with
Finally I call
Release works fine, but the call to clear throws the exception:
The directory actually is created and exists during the execution, but apparently is deleted before invoking clear()
I use the same method to close the session with all the other processes but this one is the only that doesn't work.
Any idea of what can cause this error?
Thanks.
But I also have one that just categorizes the existing assets.
It just recover the asset and the category from the repository and then assigns the category to the asset. Basically something like that:
RAMAsset asset = MethodToRecoverAsset.
String cat = "Cat Code";
String tst = "Test";
RAMCategorySchema catSchema = CatalogoDeServicios.getInstance().getSession().getCategorySchema(cat);
RAMCategory subCat = (RAMCategory) catSchema.getCategory(cat);
categoriaTest = (RAMSubCategory) subCat.getSubCategory(tst);
asset.categorize(categoriaTest);
and then I save the asset with
session.put(asset, new NullProgressMonitor());
Finally I call
session.release() ;
session.clear()
Release works fine, but the call to clear throws the exception:
com.ibm.ram.common.data.exception.RAMRuntimeException: java.io.FileNotFoundException: /tmp/local_ram_store/com_ibm_ram_client_RAMSession_362a362a/schemas/http___eidesramp_svb_lacaixa_es_ram_/categorizacindenegocio.xmi (No such file or directory)
at com.ibm.ram.client.RAMAsset.getManifestBuilder(RAMAsset.java:912)
at com.ibm.ram.client.RAMSession.remove(RAMSession.java:4655)
at com.ibm.ram.client.RAMSession.clear(RAMSession.java:1448)
at es.lacaixa.ram.api.interfazRAM.CatalogoDeServicios.cerrarConnexionCAS(CatalogoDeServicios.java:155)
at es.lacaixa.ram.api.cargaServicios.EjecutarCargaActualizacionEstado.ejecutaCarga(EjecutarCargaActualizacionEstado.java:211)
at es.lacaixa.ram.api.cargaServicios.EjecutarCargaActualizacionEstado.main(EjecutarCargaActualizacionEstado.java:64)
Caused by: org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: java.io.FileNotFoundException: /tmp/local_ram_store/com_ibm_ram_client_RAMSession_362a362a/schemas/http___eidesramp_svb_lacaixa_es_ram_/categorizacindenegocio.xmi (No such file or directory)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:316)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:275)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:398)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getEObject(ResourceSetImpl.java:217)
at com.ibm.ram.common.util.ManifestAccessor.internalInitializeClassifications(ManifestAccessor.java:1166)
at com.ibm.ram.common.util.ManifestBuilder.internalInitializeClassifications(ManifestBuilder.java:1755)
at com.ibm.ram.common.util.ManifestBuilder.validationManagerReinit(ManifestBuilder.java:1670)
at com.ibm.ram.common.util.ValidationManager.initialize(ValidationManager.java:458)
at com.ibm.ram.common.util.ManifestBuilder.setValidationManager(ManifestBuilder.java:2377)
at com.ibm.ram.client.RAMAsset.getManifestBuilder(RAMAsset.java:904)
... 5 more
Caused by: java.io.FileNotFoundException: /tmp/local_ram_store/com_ibm_ram_client_RAMSession_362a362a/schemas/http___eidesramp_svb_lacaixa_es_ram_/categorizacindenegocio.xmi (No such file or directory)
at java.io.FileInputStream.<init>(FileInputStream.java:135)
at org.eclipse.emf.ecore.resource.impl.URIConverterImpl.createFileInputStream(URIConverterImpl.java:562)
at org.eclipse.emf.ecore.resource.impl.URIConverterImpl.createInputStream(URIConverterImpl.java:527)
at com.ibm.ram.common.util.CachedRAMURIConverter.createInputStream(CachedRAMURIConverter.java:98)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1152)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:256)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:271)
... 13 more
The directory actually is created and exists during the execution, but apparently is deleted before invoking clear()
I use the same method to close the session with all the other processes but this one is the only that doesn't work.
Any idea of what can cause this error?
Thanks.
5 answers
One more thing. It isn't clear from your append, but RAMSession's are not multithreaded. You can reuse RAMSessions but a particular instance can't be used at the same time between threads.
Thanks for your help. Without clear() the code doesn't throw an exception, but when I consult the changed Asset it doesn't appears modified.
Is possible that I need to do some modification in the asset beyond assign the new category?
The execution is in a single thread.
Hi,
do
asset.refresh();
That will resync it with the host.
release() is actually only needed when you are done. It can log you out of the host besides clearing the caches. You shouldn't need to do that if you are going to use it again right away.
Thanks for your help.
I finally managed to modify the assets.