Skip to content

Commit f534be9

Browse files
committed
Create a default fbjava.conf to be included in plugins.conf and work in progress with security.
1 parent 8049595 commit f534be9

File tree

4 files changed

+37
-6
lines changed

4 files changed

+37
-6
lines changed

src/etc/bin/create-package.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ cp $BASE_DIR/src/fbjava/target/*.jar $TARGET_DIR/jar
2626
cp $BASE_DIR/src/fbjava/target/dependency/*.jar $TARGET_DIR/jar
2727
cp $BASE_DIR/output/$CONFIG/lib/libfbjava.so $TARGET_DIR/lib
2828
cp $BASE_DIR/src/fbjava/src/main/resources/org/firebirdsql/fbjava/*.sql $TARGET_DIR/scripts
29-
cp $BASE_DIR/src/etc/scripts/*.sql $TARGET_DIR/scripts
29+
cp $BASE_DIR/src/etc/conf/fbjava.conf $TARGET_DIR/conf
30+
cp $BASE_DIR/src/etc/scripts/java-security.sql $TARGET_DIR/scripts
3031

3132
if [ -f $TARGET_DIR/conf/java-security.fdb ]; then
3233
rm $TARGET_DIR/conf/java-security.fdb

src/etc/conf/fbjava.conf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Plugin = JAVA {
2+
Module = $(this)/../lib/libfbjava.so
3+
Config = JAVA_config
4+
}
5+
6+
Config = JAVA_config {
7+
SecurityDatabase = $(this)/java-security.fdb
8+
}

src/fbjava/src/main/java/org/firebirdsql/fbjava/impl/ExternalEngine.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ boolean closeAttachment(IStatus status, IExternalContext context) throws IOExcep
126126
}
127127
}
128128

129-
private ExternalEngine()
129+
private ExternalEngine(String securityDatabase)
130130
{
131131
}
132132

@@ -1034,9 +1034,9 @@ private static int javaTimeToFb(long n)
10341034
return iscTime.value;
10351035
}
10361036

1037-
public static IExternalEngine create()
1037+
public static IExternalEngine create(String securityDatabase)
10381038
{
1039-
ExternalEngine wrapped = new ExternalEngine();
1039+
ExternalEngine wrapped = new ExternalEngine(securityDatabase);
10401040
wrapped.wrapper = JnaUtil.pin(new IExternalEngine(wrapped));
10411041
return wrapped.wrapper;
10421042
}

src/fbjava/src/main/java/org/firebirdsql/fbjava/impl/PluginFactory.java

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*/
1919
package org.firebirdsql.fbjava.impl;
2020

21+
import org.firebirdsql.fbjava.impl.FbClientLibrary.IConfig;
22+
import org.firebirdsql.fbjava.impl.FbClientLibrary.IConfigEntry;
2123
import org.firebirdsql.fbjava.impl.FbClientLibrary.IPluginBase;
2224
import org.firebirdsql.fbjava.impl.FbClientLibrary.IPluginConfig;
2325
import org.firebirdsql.fbjava.impl.FbClientLibrary.IPluginFactory;
@@ -37,8 +39,28 @@ public static IPluginFactory create()
3739
}
3840

3941
@Override
40-
public IPluginBase createPlugin(IStatus status, IPluginConfig factoryParameter) throws FbException
42+
public IPluginBase createPlugin(IStatus status, IPluginConfig pluginConfig) throws FbException
4143
{
42-
return ExternalEngine.create();
44+
String securityDatabase;
45+
46+
IConfig config = pluginConfig.getDefaultConfig(status);
47+
try
48+
{
49+
IConfigEntry entry = config.find(status, "SecurityDatabase");
50+
try
51+
{
52+
securityDatabase = entry.getValue();
53+
}
54+
finally
55+
{
56+
entry.release();
57+
}
58+
}
59+
finally
60+
{
61+
config.release();
62+
}
63+
64+
return ExternalEngine.create(securityDatabase);
4365
}
4466
}

0 commit comments

Comments
 (0)