import org.b3log.latke.Latkes;
import org.b3log.latke.repository.RepositoryException;
import org.b3log.solo.model.Preference;
import org.b3log.solo.repository.PreferenceRepository;
import org.b3log.solo.repository.impl.PreferenceRepositoryImpl;
import org.json.JSONObject;
//实际上,这是从数据库中读记录
public class testPreference {
/**
* @param args
* @throws RepositoryException
*/
public static void main(String[] args) throws RepositoryException {
// TODO Auto-generated method stub
Latkes.initRuntimeEnv();
JSONObject preference;
PreferenceRepository preferenceRepository = PreferenceRepositoryImpl.getInstance();
preference = preferenceRepository.get(Preference.PREFERENCE);
System.out.println(preference);
}
}
结果:
{"skinName":"ease","keyOfSolo":"Your key","feedOutputMode":"abstract","enableArticleUpdateHint":true,"metaKeywords":"Java 博客,GAE,b3log","skinDirName":"ease","editorType":"tinyMCE","articleListPaginationWindowSize":15,"version":"0.6.0","feedOutputCnt":10,"randomArticlesDisplayCount":5,"htmlHead":"","articleListDisplayCount":20,"externalRelevantArticlesDisplayCount":5,"blogSubtitle":"Java 开源博客","commentable":true,"blogTitle":"B3log Solo 示例","pageCacheEnabled":true,"mostUsedTagDisplayCount":20,"signs":"[{\"signHTML\":\"\",\"oId\":0},{\"signHTML\":\"\",\"oId\":1},{\"signHTML\":\"\",\"oId\":2},{\"signHTML\":\"\",\"oId\":3}]","noticeBoard":"Open Source, Open Mind, <br/>Open Sight, Open Future!","relevantArticlesDisplayCount":5,"mostViewArticleDisplayCount":5,"metaDescription":"An open source blog with Java. Java 开源博客","articleListStyle":"titleAndAbstract","allowVisitDraftViaPermalink":false,"adminEmail":"liulixin.org@gmail.com","mostCommentArticleDisplayCount":5,"blogHost":"http://localhost:8080/b3log_v2","localeString":"zh_CN","recentArticleDisplayCount":10,"oId":"preference","skins":"[{\"skinName\":\"Tree House\",\"skinDirName\":\"tree-house\"},{\"skinName\":\"i-nove\",\"skinDirName\":\"i-nove\"},{\"skinName\":\"timeline\",\"skinDirName\":\"timeline\"},{\"skinName\":\"owmx-3.0\",\"skinDirName\":\"owmx-3.0\"},{\"skinName\":\"Community\",\"skinDirName\":\"community\"},{\"skinName\":\"Andrea\",\"skinDirName\":\"andrea\"},{\"skinName\":\"ease\",\"skinDirName\":\"ease\"},{\"skinName\":\"NeoEase\",\"skinDirName\":\"neoease\"},{\"skinName\":\"favourite\",\"skinDirName\":\"favourite\"},{\"skinName\":\"经典淡蓝\",\"skinDirName\":\"classic\"},{\"skinName\":\"Mobile\",\"skinDirName\":\"mobile\"}]","recentCommentDisplayCount":10,"timeZoneId":"Asia/Shanghai"}
看一下在数据库中直接查询的结果:
用select skins from b3_solo_preference得到一大堆: