org.osgl.storage.IStorageService Java Examples

The following examples show how to use org.osgl.storage.IStorageService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Gh1128.java    From actframework with Apache License 2.0 5 votes vote down vote up
@PostAction
public void upload(ISObject file, StorageServiceManager ssMgr) {
    IStorageService ss = ssMgr.storageService("1128_upload");
    String key = ss.getKey();
    file.getAttribute(ISObject.ATTR_FILE_NAME);
    file = ss.put(key, file);
}
 
Example #2
Source File: UploadFileStorageService.java    From actframework with Apache License 2.0 5 votes vote down vote up
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());
}
 
Example #3
Source File: SObject.java    From java-tool with Apache License 2.0 4 votes vote down vote up
public static SObject lazyLoad(String key, IStorageService ss) {
    return new LazyLoadSObject(key, ss);
}
 
Example #4
Source File: SObject.java    From java-tool with Apache License 2.0 4 votes vote down vote up
public static SObject lazyLoad(String key, IStorageService ss, Map<String, String> conf) {
    SObject sobj = lazyLoad(key, ss);
    sobj.setAttributes(conf);
    return sobj;
}
 
Example #5
Source File: SObject.java    From java-tool with Apache License 2.0 4 votes vote down vote up
public static SObject lazyLoad(String key, IStorageService ss, String... attrs) {
    SObject sobj = lazyLoad(key, ss);
    Map<String, String> map = C.Map(attrs);
    sobj.setAttributes(map);
    return sobj;
}
 
Example #6
Source File: SObject.java    From java-tool with Apache License 2.0 4 votes vote down vote up
LazyLoadSObject(String key, IStorageService ss) {
    super(key);
    E.NPE(ss);
    ss_ = ss;
}