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


Java IStorageService类代码示例

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


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

示例1: storageService

import org.osgl.storage.IStorageService; //导入依赖的package包/类
public IStorageService storageService(Class c, String fieldName) {
    $.T2<Class, String> key = $.T2(c, fieldName);
    $.Val<IStorageService> val = serviceByClass.get(key);
    if (null == val) {
        while (Object.class != c) {
            IStorageService ss = serviceByClassField.get(ssKey(c.getName(), fieldName));
            if (null == ss) {
                ss = serviceByClassField.get(c.getName());
            }
            if (null == ss) {
                c = c.getSuperclass();
                continue;
            }
            val = $.val(ss);
            serviceByClass.put(key, val);
            return ss;
        }
        val = $.val(null);
        serviceByClass.put(key, val);
    }
    return val.get();
}
 
开发者ID:actframework,项目名称:act-storage,代码行数:23,代码来源:StorageServiceManager.java

示例2: initService

import org.osgl.storage.IStorageService; //导入依赖的package包/类
private void initService(String ssId, Map<String, String> conf) {
    Map<String, String> svcConf = C.newMap();
    String prefix = "ss." + (S.empty(ssId) ? "" : ssId + ".");
    for (String key : conf.keySet()) {
        if (key.startsWith(prefix)) {
            String o = conf.get(key);
            svcConf.put(key.substring(prefix.length()), o);
        }
    }
    String impl = svcConf.remove("impl");
    String svcId = S.empty(ssId) ? DEFAULT : ssId;
    if (null == impl) {
        throw new ConfigurationException("Cannot init storage service[%s]: implementation not specified", svcId);
    }
    StoragePlugin plugin = StoragePluginManager.instance().plugin(impl);
    if (null == plugin) {
        throw new ConfigurationException("Cannot init storage service[%s]: implementation not found", svcId);
    }
    svcConf.put(IStorageService.CONF_ID, "".equals(ssId) ? DEFAULT : ssId);
    IStorageService svc = plugin.initStorageService(ssId, app(), svcConf);
    serviceById.put(svcId, svc);
    logger.info("storage service[%s] initialized", svcId);
}
 
开发者ID:actframework,项目名称:act-storage,代码行数:24,代码来源:StorageServiceManager.java

示例3: initStorageService

import org.osgl.storage.IStorageService; //导入依赖的package包/类
@Override
protected IStorageService initStorageService(String id, App app, Map<String, String> conf) {
    conf = calibrate(conf, "storage.fs.");
    FileSystemService ss = new FileSystemService(conf);
    ss.setKeyNameProvider(UploadFileStorageService.ACT_STORAGE_KEY_NAME_PROVIDER);
    String home = conf.get(CONF_HOME_DIR);
    String url = ss.getStaticWebEndpoint();
    if (null != url) {
        if (!url.endsWith("/")) {
            url = url + "/";
        }
        if (S.notBlank(url) && !url.startsWith("http") && !url.startsWith("//")) {
            App.instance().router().addMapping(H.Method.GET, url, new FileGetter(new File(home)), RouteSource.BUILD_IN);
        }
    }
    return ss;
}
 
开发者ID:actframework,项目名称:act-storage,代码行数:18,代码来源:FileSystemStoragePlugin.java

示例4: delete

import org.osgl.storage.IStorageService; //导入依赖的package包/类
public void delete(ISObject sobj) {
    String id = sobj.getAttribute(ISObject.ATTR_SS_ID);
    IStorageService ss = storageService(id);
    String contextPath = sobj.getAttribute(ISObject.ATTR_SS_CTX);
    if (S.notBlank(contextPath)) {
        ss = ss.subFolder(contextPath);
    }
    ss.remove(sobj.getKey());
}
 
开发者ID:actframework,项目名称:act-storage,代码行数:10,代码来源:StorageServiceManager.java

示例5: testRemoteFetch

import org.osgl.storage.IStorageService; //导入依赖的package包/类
@GetAction("/rmt")
public String testRemoteFetch(StorageServiceManager ssm) {
    String url = "https://propertymanage.atlassian.net/secure/projectavatar?pid=10400&avatarId=11200";
    ISObject sobj = new SObjectResolver().resolve(url);
    //sobj.setAttribute(ISObject.ATTR_FILE_NAME, "remote_file.png");
    IStorageService ss = ssm.storageService("store1");
    sobj = ss.put(ss.getKey(), sobj);
    return sobj.getUrl();
}
 
开发者ID:actframework,项目名称:act-demo-apps,代码行数:10,代码来源:UploadDemo.java

示例6: create

import org.osgl.storage.IStorageService; //导入依赖的package包/类
public static UploadFileStorageService create(App app) {
    File tmp = app.tmpDir();
    if (!tmp.exists() && !tmp.mkdirs()) {
        throw E.unexpected("Cannot create tmp dir");
    }
    Map<String, String> conf = C.newMap("storage.fs.home.dir", Files.file(app.tmpDir(), "uploads").getAbsolutePath(),
            "storage.keygen", KeyGenerator.Predefined.BY_DATE.name());
    conf.put(IStorageService.CONF_ID, "__upload");
    conf.put("storage.storeSuffix", "false");
    return new UploadFileStorageService(conf, app.config().uploadInMemoryCacheThreshold());
}
 
开发者ID:actframework,项目名称:actframework,代码行数:12,代码来源:UploadFileStorageService.java

示例7: initStorageService

import org.osgl.storage.IStorageService; //导入依赖的package包/类
@Override
protected IStorageService initStorageService(String id, App app, Map<String, String> conf) {
    S3Service ss = new S3Service(calibrate(conf, "storage.s3."));
    ss.setKeyNameProvider(UploadFileStorageService.ACT_STORAGE_KEY_NAME_PROVIDER);
    return ss;
}
 
开发者ID:actframework,项目名称:act-storage,代码行数:7,代码来源:S3StoragePlugin.java

示例8: initStorageService

import org.osgl.storage.IStorageService; //导入依赖的package包/类
protected abstract IStorageService initStorageService(String id, App app, Map<String, String> conf); 
开发者ID:actframework,项目名称:act-storage,代码行数:2,代码来源:StoragePlugin.java


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