21#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
24#include <com/sun/star/embed/XStorage.hpp>
25#include <com/sun/star/lang/IllegalArgumentException.hpp>
42 (JNIEnv * env, jobject ,jstring key, jstring
name)
44 TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(StorageContainer::jstring2ustring(
env,key));
45 auto storage = aStoragePair.mapStorage();
51 OUString
sName = StorageContainer::jstring2ustring(
env,
name);
54 OUString sOldName = StorageContainer::removeOldURLPrefix(
sName);
55 if ( storage->isStreamElement(sOldName) )
59 storage->renameElement(sOldName,StorageContainer::removeURLPrefix(
sName,aStoragePair.url));
66 catch(
const NoSuchElementException&)
69 catch(
const IllegalArgumentException&)
72 return storage->isStreamElement(StorageContainer::removeURLPrefix(
sName,aStoragePair.url));
74 catch(
const NoSuchElementException&)
80 if (
env->ExceptionCheck())
81 env->ExceptionClear();
93 (JNIEnv * env, jobject ,jstring key, jstring
name)
97 OUString sKey = StorageContainer::jstring2ustring(
env,key);
98 OUString
sName = StorageContainer::jstring2ustring(
env,
name);
101 TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(StorageContainer::jstring2ustring(
env,key));
102 auto storage = aStoragePair.mapStorage();
108 storage->removeElement(StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(
env,
name),aStoragePair.url));
110 catch(
const NoSuchElementException&)
112 if (
env->ExceptionCheck())
113 env->ExceptionClear();
118 StorageContainer::throwJavaException(e,
env);
129 (JNIEnv * env, jobject ,jstring key, jstring oldname, jstring newname)
133 OUString sKey = StorageContainer::jstring2ustring(
env,key);
134 OUString sNewName = StorageContainer::jstring2ustring(
env,newname);
135 OUString sOldName = StorageContainer::jstring2ustring(
env,oldname);
138 TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(StorageContainer::jstring2ustring(
env,key));
139 auto storage = aStoragePair.mapStorage();
145 storage->renameElement(
146 StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(
env,oldname),aStoragePair.url),
147 StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(
env,newname),aStoragePair.url)
151 OUString sNewName = StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(
env,newname),aStoragePair.first.second);
152 OSL_ENSURE(aStoragePair.first.first->isStreamElement(sNewName),
"Stream could not be renamed");
156 catch(
const NoSuchElementException&)
161 TOOLS_WARN_EXCEPTION(
"connectivity.hsqldb",
"Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_renameElement");
162 StorageContainer::throwJavaException(e,
env);
SAL_JNI_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_removeElement(JNIEnv *env, jobject, jstring key, jstring name)
SAL_JNI_EXPORT jboolean JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_isStreamElement(JNIEnv *env, jobject, jstring key, jstring name)
SAL_JNI_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_renameElement(JNIEnv *env, jobject, jstring key, jstring oldname, jstring newname)
#define TOOLS_WARN_EXCEPTION(area, stream)
const css::uno::Reference< css::xml::crypto::XSecurityEnvironment > & env