Package uk.co.sculptor.kflibjava


package uk.co.sculptor.kflibjava

The uk.co.sculptor.kflibjava Java library contains the Java client interface to access the Sculptor server


example:
 import java.util.EnumSet;
 import uk.co.sculptor.kflibjava.Database;
 import uk.co.sculptor.kflibjava.Field;
 import uk.co.sculptor.kflibjava.KeyedFile;
 import uk.co.sculptor.kflibjava.KeyedFile.Mode;
 import uk.co.sculptor.kflibjava.KfException;
 import uk.co.sculptor.kflibjava.Realm;
 import uk.co.sculptor.kflibjava.Server;
 
 public class KfLibMin
 {
        public static void main(String[] args)
        {
                // Allocating the Realm in a try-with-resources, so that we make sure the realm.close()
                // will be called even when an exception happens. The realm.close() will make sure to
                // close all the servers, databases and files that belong to the Realm.

                try ( Realm realm = new Realm("KfLibMin") ) {
                        KfLibMin kfLibMin = new KfLibMin(realm);
                        kfLibMin.executeOperations();
                }
                catch (Exception e) {
                        e.printStackTrace();
                }
        }
 
        private Realm m_realm;
 
        public KfLibMin(Realm realm)
        {
                m_realm = realm;
        }
 
        public void executeOperations() throws Exception
        {
                // Open a server connection. Server must be running on localhost with a 10 second time out
                Server server = m_realm.openServer("localhost", 10);
 
                // Open a database, specifies the source directory where the KeyedFile's are relative to
                Database database = server.openDB("KfLibDatabase", Database.Type.SCULPTOR,
                                EnumSet.noneOf(Database.Flag.class), "C:/sc/demos/kflib/data", 5,
                                "C:/sc/demos/kflib/logs/kflib.log");
 
                // Open the keyed file file
                KeyedFile kflibmin = database.openTable("kflibmin", Mode.CREATE);
 
                // Get the fields to work with
                Field itemCode = kflibmin.getField("ItemCode");
                Field textData = kflibmin.getField("textData");
 
                // Insert data
                for (int i = 1; i <= 10; i++) {
                        itemCode.setLong(i);
                        textData.setLong(i);
                        kflibmin.insert();
                }
 
                kflibmin.rewind();
 
                // Show textData
                try {
                        for (;;) {
                                kflibmin.next();
                                System.out.println(textData.getString());
                        }
                }
                catch (KfException e) {
                        if (e.getKfStat() != KeyedFile.KfStat.NSR) throw e;
                }
        }
 }
 

History:
  • Sc620 r1823: ServerFile.refreshStatus() to use new KfServer 64 bit file status and ServerFile.(getDev|getInode|getNumLinks|getRDev) implemented.
  • Sc610 r389: Server.auditTransaction(*) implemented.
  • Sc610 r367: Fixed some eclipse warnings on the kflibjava unit test files.
  • Sc610 r366: Charset ISO-8859-1 conversion from Java Unicode to Sculptor ASCII.
  • Sc610 r362: Fixed some bugs that affect byte data types (key length values). Caused some exceptions with certain data files.
  • Sc610 r338: Changed m_len field from byte to short solving a signed issue when > 128. Fixed CREATE+RECREATE options on openTable.
  • Sc610 r337: Fixed the options argument on openTable being lost. Target JDK changed to 1.6 as android does not support 1.7
  • Sc610 r327: Fixed Secondary index bug when using fields of main index. Fixed Concurrency issues on Realm.close()
  • Sc610 r299: Small fix on ServerFile.closeFile()
  • Sc610 r298: Fixed Convert.set_String and removed unneeded code
Since:
v6.1.0
Author:
Sculptor Ltd.
  • Class
    Description
    General keyed file library constant definitions
    Represents the Database object and is the basic object needed to create KeyedFiles.
    Database flag enumeration
    Database mirror flag enumeration
    Database type enumeration
    Represents one field inside a FileIndex (main or secondary).
    Field Arithmetic data type (KF_TEXT, KF_LONG, KF_DOUBLE, KF_BINARY) enumerator.
    Field Sculptor field type (SCFT_*) enumerator.
    Field flag enumeration.
    Field Sculptor Logical Data type (SCLT_*) enumerator.
    Represents one KeyedFile index (main or secondary).
    Represents the KeyedFile object that contains all the indexes and fields.
    KeyedFile batch type enumerator used to know which kind of information is in the batch buffer.
    KeyedFile operation status values.
    KeyedFile lock mode enumerator.
    KeyedFile open mode enumerator.
    KeyedFile option enumerator.
    Sculptor Keyed file Exception class
    Realm where servers live.
    Represents the KfServer connection and is the basic object needed to work with the kflibjava library.
    Enumerator flags used to specify the copyFile options.
    Enumerator flags used to specify the executed process flags on the Server.
    Represents a file on the server, and can be used to get the file status, read, write, modify or create the file.
    Enumerator with the mode (text or binary) for opening a file.
    Enumerator with the options for opening a file.
    Enumerator with the types for opening a file.
    Enumerator with the possible seek origins
    Class that deals with the Secure Hash Standard Algorithms
    Possible Hash Algorithms