Search in sources :

Example 1 with SDBConnectionDesc

use of org.apache.jena.sdb.sql.SDBConnectionDesc in project jena by apache.

the class SDBConnectionDescAssembler method open.

@Override
public SDBConnectionDesc open(Assembler a, Resource root, Mode mode) {
    SDBConnectionDesc sDesc = SDBConnectionDesc.blank();
    sDesc.setType(GraphUtils.getStringValue(root, AssemblerVocab.pSDBtype));
    sDesc.setHost(GraphUtils.getStringValue(root, AssemblerVocab.pSDBhost));
    sDesc.setName(GraphUtils.getStringValue(root, AssemblerVocab.pSDBname));
    sDesc.setUser(GraphUtils.getStringValue(root, AssemblerVocab.pSDBuser));
    sDesc.setPassword(GraphUtils.getStringValue(root, AssemblerVocab.pSDBpassword));
    sDesc.setDriver(GraphUtils.getStringValue(root, AssemblerVocab.pDriver));
    sDesc.setJdbcURL(GraphUtils.getStringValue(root, AssemblerVocab.pJDBC));
    sDesc.setPoolSize(GraphUtils.getStringValue(root, AssemblerVocab.pPoolSize));
    sDesc.setLabel(GraphUtils.getStringValue(root, RDFS.label));
    if (sDesc.getUser() == null)
        sDesc.setUser(Access.getUser());
    if (sDesc.getPassword() == null)
        sDesc.setPassword(Access.getPassword());
    return sDesc;
}
Also used : SDBConnectionDesc(org.apache.jena.sdb.sql.SDBConnectionDesc)

Example 2 with SDBConnectionDesc

use of org.apache.jena.sdb.sql.SDBConnectionDesc in project jena by apache.

the class StoreDescAssembler method open.

@Override
public StoreDesc open(Assembler a, Resource root, Mode mode) {
    SDBConnectionDesc sdbConnDesc = null;
    Resource c = GraphUtils.getResourceValue(root, AssemblerVocab.pConnection);
    if (c != null)
        sdbConnDesc = (SDBConnectionDesc) a.open(c);
    String layoutName = GraphUtils.getStringValue(root, AssemblerVocab.pLayout);
    String dbType = chooseDBType(root, sdbConnDesc);
    // Features
    List<Resource> x = GraphUtils.multiValueResource(root, AssemblerVocab.featureProperty);
    FeatureSet fSet = new FeatureSet();
    for (Resource r : x) {
        String n = GraphUtils.getStringValue(r, AssemblerVocab.featureNameProperty);
        String v = GraphUtils.getStringValue(r, AssemblerVocab.featureValueProperty);
        Feature f = new Feature(new Feature.Name(n), v);
        fSet.addFeature(f);
    }
    StoreDesc storeDesc = new StoreDesc(layoutName, dbType, fSet);
    storeDesc.connDesc = sdbConnDesc;
    // MySQL specials
    String engineName = GraphUtils.getStringValue(root, AssemblerVocab.pMySQLEngine);
    storeDesc.engineType = null;
    if (engineName != null)
        try {
            storeDesc.engineType = MySQLEngineType.convert(engineName);
        } catch (SDBException ex) {
        }
    // SAP specials
    String storageType = GraphUtils.getStringValue(root, AssemblerVocab.pStorageType);
    if (storageType != null)
        try {
            storeDesc.storageType = SAPStorageType.convert(storageType);
        } catch (SDBException ex) {
        }
    return storeDesc;
}
Also used : StoreDesc(org.apache.jena.sdb.StoreDesc) SDBException(org.apache.jena.sdb.SDBException) SDBConnectionDesc(org.apache.jena.sdb.sql.SDBConnectionDesc) Resource(org.apache.jena.rdf.model.Resource) FeatureSet(org.apache.jena.sdb.store.FeatureSet) Feature(org.apache.jena.sdb.store.Feature)

Aggregations

SDBConnectionDesc (org.apache.jena.sdb.sql.SDBConnectionDesc)2 Resource (org.apache.jena.rdf.model.Resource)1 SDBException (org.apache.jena.sdb.SDBException)1 StoreDesc (org.apache.jena.sdb.StoreDesc)1 Feature (org.apache.jena.sdb.store.Feature)1 FeatureSet (org.apache.jena.sdb.store.FeatureSet)1