当前位置: 首页>>代码示例>>Java>>正文


Java FmtLog类代码示例

本文整理汇总了Java中org.apache.jena.atlas.logging.FmtLog的典型用法代码示例。如果您正苦于以下问题:Java FmtLog类的具体用法?Java FmtLog怎么用?Java FmtLog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FmtLog类属于org.apache.jena.atlas.logging包,在下文中一共展示了FmtLog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fetch

import org.apache.jena.atlas.logging.FmtLog; //导入依赖的package包/类
/** Retrieve a patch by version. */
@Override
public RDFPatch fetch(Id dsRef, long version) {
    checkLink();
    DataSource source = getDataSourceOrNull(dsRef);
    if ( source == null )
        return null;
    RDFPatch patch = source.getPatchLog().fetch(version);
    if ( LOG.isInfoEnabled() ) {
        if ( patch == null ) {
            FmtLog.info(LOG, "fetch: Dest=%s, Version=%d, Not found", source, version);
        } else {
            Id id = Id.fromNode(patch.getId());
            FmtLog.info(LOG, "fetch: Dest=%s, Version=%d, Patch=%s", source, version, id);
        }
    }
    return patch;
}
 
开发者ID:afs,项目名称:rdf-delta,代码行数:19,代码来源:DeltaLinkLocal.java

示例2: initSystem

import org.apache.jena.atlas.logging.FmtLog; //导入依赖的package包/类
/** After Delta has initialized, make sure some sort of PatchStore provision is set. */ 
    static private void initSystem() {
        // Ensure the file-based PatchStore provider is available
        if ( ! PatchStoreMgr.isRegistered(DPS.PatchStoreFileProvider) ) {
            FmtLog.warn(LOG, "PatchStoreFile provider not registered");
            PatchStore ps = new PatchStoreFile();
            if ( ! DPS.PatchStoreFileProvider.equals(ps.getProviderName())) {
                FmtLog.error(LOG, "PatchStoreFile provider name is wrong (expected=%s, got=%s)", DPS.PatchStoreFileProvider, ps.getProviderName());
                throw new DeltaConfigException();
            }
            PatchStoreMgr.register(ps);
        }
        
//        if ( ! PatchStoreMgr.isRegistered(DPS.PatchStoreMemProvider) ) {
//            PatchStore psMem = new PatchStoreMem(DPS.PatchStoreMemProvider);
//            PatchStoreMgr.register(psMem);
//        }
        
        // Default the log provider to "file"
        if ( PatchStoreMgr.getDftPatchStore() == null ) {
            //FmtLog.warn(LOG, "PatchStore default not set.");
            PatchStoreMgr.setDftPatchStoreName(DPS.PatchStoreFileProvider);
        }
    }
 
开发者ID:afs,项目名称:rdf-delta,代码行数:25,代码来源:LocalServer.java

示例3: allocateFilename

import org.apache.jena.atlas.logging.FmtLog; //导入依赖的package包/类
/**
 * Return the {@link #nextFilename} along with a temporary filename.
 * <p>
 * This operation is thread-safe.
 */
public FileEntry allocateFilename() {
    // --> IOX
    // TODO Use Files.createTempFile? Or does recovery mean we need more control?
    synchronized(this) { 
        for ( ;; ) {
            long idx = nextIndex();
            Path fn = filename(idx);
            if ( Files.exists(fn) ) {
                FmtLog.warn(LOG, "Skipping existing file: %s", fn);
                continue;
            }
            Path tmpFn = filename(directory, tmpBasename, idx);
            if ( Files.exists(tmpFn) ) {
                FmtLog.warn(LOG, "Skipping existing tmp file: %s", tmpFn);
                continue;
            }
            return new FileEntry(idx, fn, tmpFn) ;
        }
    }
}
 
开发者ID:afs,项目名称:rdf-delta,代码行数:26,代码来源:FileStore.java

示例4: scanForIndex

import org.apache.jena.atlas.logging.FmtLog; //导入依赖的package包/类
/** Find the indexes of files in this FileStore. Return sorted, low to high. */
private static List<Long> scanForIndex(Path directory, String namebase) {
    List<Long> indexes = new ArrayList<>();
    try (DirectoryStream<Path> stream = Files.newDirectoryStream(directory, namebase + "*")) {
        for ( Path f : stream ) {
            long num = extractIndex(f.getFileName().toString(), namebase);
            if ( num == -1 ) {
                FmtLog.warn(LOG, "Can't parse filename: %s", f.toString());
                continue;
            }
            indexes.add(num);
        }
    } catch (IOException ex) {
        FmtLog.warn(LOG, "Can't inspect directory: (%s, %s)", directory, namebase);
        throw new PatchException(ex);
    }
    
    indexes.sort(Long::compareTo);
    return indexes;
}
 
开发者ID:afs,项目名称:rdf-delta,代码行数:21,代码来源:FileStore.java

示例5: deleteTmpFiles

import org.apache.jena.atlas.logging.FmtLog; //导入依赖的package包/类
/** Find the indexes of files in this FileStore. Return sorted, low to high. */
private static boolean deleteTmpFiles(Path directory) {
    boolean found = false;
    try (DirectoryStream<Path> stream = Files.newDirectoryStream(directory, tmpBasename + "*")) {
        for ( Path f : stream ) {
            found = true;
            Files.delete(f);
            if ( Files.exists(f) )
                FmtLog.error(LOG, "Failed to delete tmp file: %s", f);
        }
    } catch (IOException ex) {
        FmtLog.warn(LOG, "Can't check directory for tmp files: %s", directory);
        throw new PatchException(ex);
    }
    return found;
}
 
开发者ID:afs,项目名称:rdf-delta,代码行数:17,代码来源:FileStore.java

示例6: validateLatest

import org.apache.jena.atlas.logging.FmtLog; //导入依赖的package包/类
private void validateLatest() {
    if ( CHECKING ) {
        long x = fileStore.getCurrentIndex();
        // latestVersion = -1 (UNSET) and getCurrentIndex==0 (INIT) is OK
        if ( latestVersion == VERSION_UNSET ) {
            if ( x != VERSION_INIT )
                FmtLog.error(LOG, "Out of sync: latestVersion=%s, fileStore=%s", latestVersion, x);
        } else if ( x > VERSION_INIT ) {
            // Legal versions start 1.
            if ( latestVersion != x )
                FmtLog.error(LOG, "Out of sync: latestVersion=%s, fileStore=%s", latestVersion, x);
        }
        else if ( latestVersion > VERSION_INIT ) {
            FmtLog.error(LOG, "Out of sync: latestVersion=%s, fileStore=%s", latestVersion, x);
        }
    }
}
 
开发者ID:afs,项目名称:rdf-delta,代码行数:18,代码来源:PatchLogFile.java

示例7: validate

import org.apache.jena.atlas.logging.FmtLog; //导入依赖的package包/类
/** Validate a patch for this {@code PatchLog} */
public boolean validate(RDFPatch patch) {
    Id previousId = Id.fromNode(patch.getPrevious());
    Id patchId = Id.fromNode(patch.getId());
    if ( previousId == null ) {
        if ( !isEmpty() ) {
            FmtLog.warn(LOG, "No previous for patch when PatchLog is not empty: patch=%s", patchId);
            return false;
        }
    } else {
        if ( isEmpty() ) {
            FmtLog.warn(LOG, "Previous reference for patch but PatchLog is empty: patch=%s : previous=%s", patchId, previousId);
            return false ;
        }
    }
    try { 
        validate(patch.header(), patchId, previousId, this::badPatchEx);
        return true ;
    } catch (DeltaException ex) { return false; }
}
 
开发者ID:afs,项目名称:rdf-delta,代码行数:21,代码来源:PatchLogFile.java

示例8: listPersistent

import org.apache.jena.atlas.logging.FmtLog; //导入依赖的package包/类
@Override
public List<DataSource> listPersistent(LocalServerConfig config) {
    Pair<List<Path>, List<Path>> pair = Cfg.scanDirectory(config.location);
    List<Path> dataSourcePaths = pair.getLeft();
    List<Path> disabledDataSources = pair.getRight();

    //dataSources.forEach(p->LOG.info("Data source: "+p));
    disabledDataSources.forEach(p->LOG.info("Data source: "+p+" : Disabled"));

    List<DataSource> dataSources = ListUtils.toList
        (dataSourcePaths.stream().map(p->{
            // Extract name from disk name. 
            String dsName = p.getFileName().toString();
            DataSource ds = Cfg.makeDataSource(p);
            
            if ( LOG.isDebugEnabled() ) 
                FmtLog.debug(LOG, "DataSource: id=%s, source=%s", ds.getId(), p);
            if ( LOG.isDebugEnabled() ) 
                FmtLog.debug(LOG, "DataSource: %s (%s)", ds, ds.getName());
            
            sources.add(ds.getDescription());
            return ds;
        })); 
    return dataSources;
}
 
开发者ID:afs,项目名称:rdf-delta,代码行数:26,代码来源:PatchStoreFile.java

示例9: copy

import org.apache.jena.atlas.logging.FmtLog; //导入依赖的package包/类
/** Copy a file, not atomic. *
 * Can copy to a directory or over an existing file.
 * @param srcFilename
 * @param dstFilename
 */
public static void copy(String srcFilename, String dstFilename) {
    Path src = Paths.get(srcFilename);
    if ( ! Files.exists(src) )
        throw new RuntimeIOException("No such file: "+srcFilename);
    
    Path dst = Paths.get(dstFilename);
    if ( Files.isDirectory(dst) )
        dst = dst.resolve(src.getFileName());
    
    try { Files.copy(src, dst); }
    catch (IOException ex) {
        FmtLog.error(IOX.class, ex, "IOException copying %s to %s", srcFilename, dstFilename);
        throw IOX.exception(ex);
    }
}
 
开发者ID:afs,项目名称:rdf-delta,代码行数:21,代码来源:IOX.java

示例10: isFormattedDataState

import org.apache.jena.atlas.logging.FmtLog; //导入依赖的package包/类
private static boolean isFormattedDataState(Path path) {
        // Directory: "data/"
        // File: "state"
    
        boolean good = true;
        Path dataArea = path.resolve(DeltaConst.DATA);
//        if ( ! Files.exists(dataArea) ) {
//            // Should check its not a memory area.
//            FmtLog.warn(DataState.LOG,  "No data area: %s", path);
//            good = false;
//            //return false;
//        }
        
        Path pathState = path.resolve(DeltaConst.STATE_CLIENT);
        if ( ! Files.exists(pathState) )  {
            FmtLog.warn(DataState.LOG,  "No state file: %s", path);
            good = false;
        }
        // Development - try to continue.
        return true;
        //return good;
    }
 
开发者ID:afs,项目名称:rdf-delta,代码行数:23,代码来源:Zone.java

示例11: end

import org.apache.jena.atlas.logging.FmtLog; //导入依赖的package包/类
@Override
public void end() {
    Long z = getTxnId() ;
    /*if ( z != null )*/ {
        if ( z < 0 ) {
            if ( LOG_TXN )
                FmtLog.info(getLog(), "[Txn:%s:%d] end (no call)", getLabel(), getTxnId());
        } else { 
            if ( LOG_TXN )
                FmtLog.info(getLog(), "[Txn:%s:%d] end", getLabel(), getTxnId());
            ThriftLib.exec(lock, () -> rpc.txnEnd(getTxnId())) ;
        }
        currentTxnId.set(null) ;
    }

    // Because get may have created it. 
    currentTxnId.remove() ;
}
 
开发者ID:afs,项目名称:lizard,代码行数:19,代码来源:TxnClient.java

示例12: bulkLoad

import org.apache.jena.atlas.logging.FmtLog; //导入依赖的package包/类
public static void bulkLoad(Dataset ds, String ... files) {
    // c.f. TDB2 Loader.bulkLoad (which does not currently batch split).
    DatasetGraphTDB dsg = (DatasetGraphTDB)ds.asDatasetGraph() ;
    StreamRDF s1 = new StreamRDFBatchSplit(dsg, 100) ;
    
    ProgressMonitor plog = ProgressMonitor.create(log, "Triples", 100000, 10) ;
    ProgressStreamRDF sMonitor = new ProgressStreamRDF(s1, plog) ;
    StreamRDF s3 = sMonitor ;

    //plog.startMessage(); 
    plog.start(); 
    Txn.executeWrite(ds, () -> {
        for ( String fn : files ) {
            if ( files.length > 1 )
                FmtLog.info(log, "File: %s",fn);
            RDFDataMgr.parse(s3, fn) ;
        }
    }) ;
    plog.finish();
    plog.finishMessage();
}
 
开发者ID:afs,项目名称:lizard,代码行数:22,代码来源:Deploy.java

示例13: buildClientIndex

import org.apache.jena.atlas.logging.FmtLog; //导入依赖的package包/类
public static ClusterTupleIndex buildClientIndex(ConfCluster confCluster, ConfIndex ci, List<Component> startables, String hereVNode) {
    String idxOrder = ci.indexOrder ;
    int N = idxOrder.length() ;
    if ( N != 3 && N != 4 )
        FmtLog.warn(logConf, "Strange index size: %d (from '%s')", N, idxOrder) ;
    TupleMap tmap = TupleMap.create("SPO", idxOrder) ;
    DistributorTuplesReplicate dist = new DistributorTuplesReplicate(hereVNode, tmap) ;  
    List<TupleIndexRemote> indexes = new ArrayList<>() ;
    // Scan shards for index.
    confCluster.eltsIndex.stream().sequential()
        .filter(x -> ci.indexOrder.equals(x.conf.indexOrder))
        .forEach(x -> {
            // Is it "here"?
            if ( x.addr.sameHost(hereVNode) )
                logConf.info("HERE: Index: "+x.addr.getPort()) ;
            NetAddr netAddr = x.addr.placement(confCluster.placements, x.addr.getPort()) ; 
            TupleIndexRemote idx = TupleIndexRemote.create(hereVNode, netAddr.getName(), netAddr.getPort(), idxOrder, tmap) ;
            indexes.add(idx) ;
            startables.add(idx) ;
        }) ;
    dist.add(indexes);
    // All shards, all replicas.
    ClusterTupleIndex tupleIndex = new ClusterTupleIndex(dist, N, tmap, ci.indexOrder);
    return tupleIndex ;
}
 
开发者ID:afs,项目名称:lizard,代码行数:26,代码来源:LzBuilderDataset.java

示例14: start

import org.apache.jena.atlas.logging.FmtLog; //导入依赖的package包/类
@Override
public void start() {
    //FmtLog.debug(log, "Start node server, port = %d", getPort()) ;
    TLZ_NodeTable.Iface handler = new THandlerNodeTable(getTxnSystem(), getLabel(), nodeTable) ;
    TLZ_NodeTable.Processor<TLZ_NodeTable.Iface> processor = new TLZ_NodeTable.Processor<TLZ_NodeTable.Iface>(handler);

    // Semapahores to sync??
    new Thread(()-> {
        try {
            getTxnSystem().getTxnMgr().start();
            TThreadPoolServer.Args args = new TThreadPoolServer.Args(serverTransport) ;
            args.processor(processor) ;
            args.inputProtocolFactory(new TCompactProtocol.Factory()) ;
            args.outputProtocolFactory(new TCompactProtocol.Factory()) ;
            TServer server = new TThreadPoolServer(args);
            FmtLog.info(log, "Started node server: port = %d", getPort()) ;
            server.serve();
            FmtLog.info(log, "Finished node server: port = %d", getPort()) ;
            getTxnSystem().getTxnMgr().shutdown();
          } catch (Exception e) {
            e.printStackTrace();
          }
    }) .start() ;
    super.start() ;
}
 
开发者ID:afs,项目名称:lizard,代码行数:26,代码来源:TServerNode.java

示例15: getAllocateNodeId

import org.apache.jena.atlas.logging.FmtLog; //导入依赖的package包/类
@Override
public NodeId getAllocateNodeId(Node node) {
    // XXX Could useful know whether it was find or store
    // find - stop early, store, do all 
    List<NodeTableRemote> tables = distributor.storeAt(node) ;
    NodeId nid = null ; 
    
    for ( NodeTableRemote nt : tables ) {
        NodeId nid1 = nt.getAllocateNodeId(node) ;
        if ( nid == null )
            nid = nid1 ;
        else {
            if ( ! Objects.equals(nid, nid1) )
                FmtLog.warn(log, "Different NodeIds allocated for %s : %s != %s", node, nid, nid1) ;
        }
    }
    
    FmtLog.debug(log, "getAllocateNodeId(%s) -> %s", node, nid) ;
    if ( log.isDebugEnabled() )
        tables.forEach(nt -> FmtLog.debug(log, "  store(%s) @ %s", node, nt)) ;
    return nid ;
}
 
开发者ID:afs,项目名称:lizard,代码行数:23,代码来源:ClusterNodeTable.java


注:本文中的org.apache.jena.atlas.logging.FmtLog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。