本文整理汇总了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();
}
示例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);
}
示例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;
}
示例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());
}
示例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();
}
示例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());
}
示例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;
}
示例8: initStorageService
import org.osgl.storage.IStorageService; //导入依赖的package包/类
protected abstract IStorageService initStorageService(String id, App app, Map<String, String> conf);