Skip to content

Commit

Permalink
Merge branch 'master' of github.com:nutzam/nutz
Browse files Browse the repository at this point in the history
  • Loading branch information
zozoh committed Aug 22, 2016
2 parents 7530a63 + 6f0d8dc commit 411d44c
Show file tree
Hide file tree
Showing 39 changed files with 836 additions and 323 deletions.
8 changes: 3 additions & 5 deletions doc/manual/faq/use_nutz_without_other_jar.man
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,20 @@
解答
# Nutz的源码中,依赖两个外部jar -- servlet-api.jar 和 log4j.jar
# 前者在任何标准J2EE Web应用中都有, Nutz仅支持Servlet 2.4或以上.
# 后者是极其常见的Log4j, 编译器依赖于1.2.14版,但在运行时仅要求是1.2.x. 不过,我推荐最新的log4j 1.2.16 .
# 后者是极其常见的Log4j, 编译器依赖于1.2.17版,但在运行时仅要求是1.2.x.
# 我们使用Nutz.Plugin,通过检测是否存在Log4j的核心接口 org.apache.log4j.Log是否存在来判断是否将日志输出到Log4j
# 由于仅检测是否存在org.apache.log4j.Log接口,这样就导致两个情况:
# 仅仅把Log4j的jar放进classpath,而没有配置之,那么输出日志时,log4j会警告你. 我们认为这是你的失误.
# 这样也提供了一个自由度,因为slf4j的log4j-over-slf4j桥也提供这个接口.
换句话说,如果你把log4j-over-slf4j.jar放进classpath,那么Nutz的日志也能通过Slf4j输出去.
换句话说,如果你把log4j-over-slf4j.jar放进classpath,那么Nutz的日志也能通过Slf4j输出去.

搭配组合
# 最精简搭配,适合尝试阶段的新手,默认输出的就是Debug信息,完全无鸭梨!!
* nutz.jar
# 经典搭配,适合大部分人的需要
* nutz.jar + log4j-1.2.17.jar
# 推荐搭配,搭配最新的log4j
* nutz.jar + log4j-1.2.17.jar
# 性能至上,使用Logback
* nutz.jar + log4j-over-slf4j.jar + slf4j-api.jar + logback.jar
* nutz.jar + log4j-over-slf4j.jar + slf4j-api.jar + logback-core.jar + logback-classic.jar
# 传统选择,使用JDK Loggging
* nutz.jar + log4j-over-slf4j.jar + slf4j-api.jar + slfj4-jdk.jar
# 另类之选,使用Apache Common Logging
Expand Down
2 changes: 1 addition & 1 deletion doc/manual/integration/daocache.man
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

请直接看看项目的README,不会让你失望的!!

https://github.com/nutzam/nutzmore/tree/master/nutz-plugins-daocache
[https://github.com/nutzam/nutzmore/tree/master/nutz-plugins-daocache nutz-plugins-daocache]
2 changes: 1 addition & 1 deletion doc/manual/integration/ehcache.man
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
-----------------------------------------------
准备工作

下载ehcache http://ehcache.org/downloads/catalog
下载[http://ehcache.org/downloads/catalog ehcache]

你需要一个js文件
--------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion doc/manual/integration/freemarker.man
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutz-plugins-views</artifactId>
<version>1.b.52.preview</version>
<version>1.r.57</version>
</dependency>
}}}

Expand Down
4 changes: 2 additions & 2 deletions doc/manual/integration/nutzmore.man
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
------------------------------------------------------------------------
项目概述

官网及源码地址 https://github.com/nutzam/nutzmore
官网及源码地址 [https://github.com/nutzam/nutzmore nutzmore]

为Nutz与其他框架的集成提供官方支持

Expand All @@ -22,4 +22,4 @@

nutzmore下的项目的代码量很少,建议先浏览源码熟悉一下逻辑

第三方集成是技术活, 需要对nutz与第三方框架都有一定的了解哦
第三方集成是技术活, 需要对nutz与第三方框架都有一定的了解哦
2 changes: 1 addition & 1 deletion doc/manual/integration/quartz.man
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

请直接看看项目的README,不会让你失望的!!

https://github.com/nutzam/nutzmore/tree/master/nutz-integration-quartz
[https://github.com/nutzam/nutzmore/tree/master/nutz-integration-quartz nutz-integration-quartz]
2 changes: 1 addition & 1 deletion doc/manual/integration/shiro.man
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

请直接看看项目的README,不会让你失望的!!

https://github.com/nutzam/nutzmore/tree/master/nutz-integration-shiro
[https://github.com/nutzam/nutzmore/tree/master/nutz-integration-shiro nutz-integration-shiro]
2 changes: 1 addition & 1 deletion doc/manual/integration/velocity.man
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutz-plugins-views</artifactId>
<version>1.b.52.preview</version>
<version>1.b.57</version>
</dependency>
}}}

Expand Down
26 changes: 13 additions & 13 deletions doc/manual/ioc/ioc_loader.man
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{
"对象名称" : {
type : "对象类型",
parent : "被继承的对象名称",
parent : "被继承的对象名称",
events : {
fetch : "触发器的类型或者函数名",
create : "触发器的类型或者函数名",
Expand Down Expand Up @@ -60,7 +60,7 @@
parent : 'bean',

// 不声明,默认为 true
singleton : true,
singleton : true,

// 这里声明对象的三种事件。事件的处理函数可以是一个接口,也可以是自身的
// 一个方法。
Expand Down Expand Up @@ -131,31 +131,31 @@
在 org.nutz.ioc.meta.IocObject 类中,你如果拿到它的源代码,或者是 JDoc,它描述了在容器中一个对象的全部
信息,你会发现它其实也简单:

{{{
public class IocObject {
{{{<Java>
public class IocObject {

// 对象的 Java 类型
private Class<?> type;
private Class<?> type;

// 声明对象是否为单例
private boolean singleton;
private boolean singleton;

// 对象监听何种事件,对应有
// "fetch" - 每次对象被 ioc.get 的时候,触发
// "create" - 当且仅当对象被 new 的时候触发
// "depose" - 当对象被容器销毁时触发
private IocEventSet events;
private IocEventSet events;

// 对象构造函数的参数列表
private List<IocValue> args;
private List<IocValue> args;

// 对象的字段
private List<IocField> fields;
private List<IocField> fields;

// 对象的缓存范围,默认为 "app"
private String scope;
// 省略所有的 getter 和 setter 函数
private String scope;

// 省略所有的 getter 和 setter 函数
}}}

事件集合 IocEventSet
Expand Down Expand Up @@ -199,7 +199,7 @@

你的 IocLoader 的实现类需要实现三个方法:

{{{
{{{<Java>
public interface IocLoader {

/**
Expand Down
2 changes: 1 addition & 1 deletion doc/manual/ioc/ioc_properties.man
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@

如果是这样,那么 @Inject 可以这样写:
{{{
@Inject("java:$config.get('xxxxx')
@Inject("java:$config.get('xxxxx')")
private String myXXXX;
}}}

Expand Down
19 changes: 9 additions & 10 deletions doc/manual/ioc/loader_combo.man
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,15 @@
复合加载器非常简单,似乎只花了 Wendal 同学不到 1 个小时的时间,因为它本身并不做任何
事情,它只是调用其他的加载器:
{{{<Java>
@IocBy(type=ComboIocLoader.class, args={
"*js",
"ioc/dao.js",
"ioc/service.js",
"*anno",
"com.myapp.module",
"com.myapp.service",
"*tx",
"*async" // @Async注解,异步执行.
})
ComboIocLoader loader = new ComboIocLoader("*js",
"ioc/dao.js",
"ioc/service.js",
"*anno",
"com.myapp.module",
"com.myapp.service",
"*tx",
// @Async注解,异步执行.
"*async");
}}}
如上面的例子,组合加载器,组合了3个 Ioc 加载器,一个是 JsonLoader,一个是
AnnotationIocLoader, 一个是AOP事务的TransIocLoader(1.b.52新增)。
Expand Down
5 changes: 5 additions & 0 deletions doc/manual/lang/mirror.man
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,8 @@
mirror.setValue(obj, "name", "XiaoBai");
}}}

获取静态字段
* 取静态属性
{{{
Field[] fields = mirror.getStaticField(nofinalOrAll);
}}}
9 changes: 6 additions & 3 deletions src/org/nutz/dao/Chain.java
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,15 @@ public void invoke(MappingField mf, Object val) {
//=============================================================

/**
* 添加一个特殊节点, 如果value非空,则有3个情况:<p>
* 添加一个特殊节点, 如果value非空而且是String类型,则有3个情况:<p>
* <li>+1 效果如age=age+1</li>
* <li>-1 效果如count=count-1</li>
* <li>支持的运算符有 + - *\/ % & ^ |
* <li>其他值, 则对value.toString(),效果如 time=todate("XXXXX")</li>
*
* <li>其他值, 则对value.toString()</li>
* <p/>
* <code>Chain chain = Chain.makeSpecial("age", "+1");//输出的SQL会是 age=age+1</code>
* <p/>
* <code>Chain chain = Chain.makeSpecial("ct", "now()");//输出的SQL会是 ct=now(),但不建议用依赖特定数据库的now(),仅供演示.</code>
* @since 1.b.44
*/
public abstract Chain addSpecial(String name, Object value);
Expand Down
12 changes: 12 additions & 0 deletions src/org/nutz/dao/DaoInterceptor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.nutz.dao;

/**
* Dao操作拦截器
* @author wendal
* @see org.nutz.dao.impl.interceptor.DaoLogInterceptor
* @see org.nutz.dao.impl.interceptor.DaoTimeInterceptor
*/
public interface DaoInterceptor {

void filter(DaoInterceptorChain chain) throws DaoException;
}
Loading

0 comments on commit 411d44c

Please sign in to comment.