T2 has mainly web application framework., but it has some common features, like utility classes,
and also has IoC container, Lucy.
From now, we gonna separate these features as sub projects.
So there are three projects:
-Teeda2 : Web application framework
-Lucy : Simple IoC container
-commons : common utility classes
Basically these sub projects are only for Teeda2,
and there are not considered to use any other framework in right now.
Thursday, July 10, 2008
Wednesday, July 9, 2008
Working on Teeda2
I've been working on Teeda2 to do more with less.
We are adding some great new features like AMF messaging, or Ajax,
but we do not want to be larger, we want it keep small.
So, what we are doing is refactor codes and tests, and writes documents.
What framework needs is not features.It needs the core policy and small codes.
That's the thing we are trying to do.
Just keep in touch.
We are adding some great new features like AMF messaging, or Ajax,
but we do not want to be larger, we want it keep small.
So, what we are doing is refactor codes and tests, and writes documents.
What framework needs is not features.It needs the core policy and small codes.
That's the thing we are trying to do.
Just keep in touch.
Friday, February 15, 2008
T2 - a simple web base -
There are too many frameworks around Java development.
But none of those frameworks are simple enough to me.
So we create a new one for Lucy IoC container.
Let me introduce Teeda2(T2), a simple "web base".
Only you need to create is view(like jsp or whatever you like) and POJO(we name Page).
Here is a sample.
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" errorPage="/error/debug.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>足し算画面</title>
</head>
<body>
<form action="/t2-samples/add" method="post">
<input type="text" name="arg1" />
<br />
<input type="text" name="arg2" />
<br />
<span>${result}</span><br />
<input type="submit" name="add" value="同一ページ"/>
<input type="submit" name="addAndMove" value="結果ページ"/>
</form>
</body>
</html>
So, how to bind jsp to AddPage.java?
It's really simple.We do a way to use URL like REST.
You see @Page annotation and there is "add". This is a part of URL.
So, you access like http://localhost:8080/whatever-context-path/add
then, T2 binds to AddPage.java.
To be continued.
But none of those frameworks are simple enough to me.
So we create a new one for Lucy IoC container.
Let me introduce Teeda2(T2), a simple "web base".
Only you need to create is view(like jsp or whatever you like) and POJO(we name Page).
Here is a sample.
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" errorPage="/error/debug.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>足し算画面</title>
</head>
<body>
<form action="/t2-samples/add" method="post">
<input type="text" name="arg1" />
<br />
<input type="text" name="arg2" />
<br />
<span>${result}</span><br />
<input type="submit" name="add" value="同一ページ"/>
<input type="submit" name="addAndMove" value="結果ページ"/>
</form>
</body>
</html>
@RequestScope
@Page("add")
public class AddPage {
@Default
public Navigation index(TeedaContext context) {
return Redirect.to("jsp/add.jsp");
}
@POST
@ActionParam
public Navigation add(TeedaContext context) {
Request request = context.getRequest();
Integer arg1 = Integer.valueOf(request.getParameter("arg1"));
Integer arg2 = Integer.valueOf(request.getParameter("arg2"));
request.setAttribute("arg1", arg1);
request.setAttribute("arg2", arg2);
request.setAttribute("result", new Integer(arg1.intValue() + arg2.intValue()));
return Forward.to("jsp/add.jsp");
}
@POST
@ActionParam
public Navigation addAndMove(TeedaContext context) {
Request request = context.getRequest();
Integer arg1 = Integer.valueOf(request.getParameter("arg1"));
Integer arg2 = Integer.valueOf(request.getParameter("arg2"));
request.setAttribute("result", new Integer(arg1.intValue() + arg2.intValue()));
return Forward.to("jsp/addResult.jsp");
}
}
So, how to bind jsp to AddPage.java?
It's really simple.We do a way to use URL like REST.
You see @Page annotation and there is "add". This is a part of URL.
So, you access like http://localhost:8080/whatever-context-path/add
then, T2 binds to AddPage.java.
To be continued.
Monday, January 28, 2008
do what you really want, minimally.
Like iPod and iPhone elegant design, we should keep in mind that
all of products, even if it is just open source product, keep very simple(we call it, it's "pure") .
Do not go the way like hey-i-want-this-feature-and-ok-we-do!!
Lucy/Teeda2 has purely simple, really-needed features, at least I hope.
So what is it?
For Teeda2, remote call and binding URL to POJO is all the thing you need.
So what about validation?
My answer : No, you do that using, not us.
Conversion like JSF converter?
My answer : Don't you know JSF converter really sucks?Anyway, again, you do that.
Teeda2 does not do conversion automatically(maybe we provide plugin, but not now),
so you do like Struts or anyhow you want.
So, do things what you really want, minimally and directly, with Teeda2/Lucy
all of products, even if it is just open source product, keep very simple(we call it, it's "pure") .
Do not go the way like hey-i-want-this-feature-and-ok-we-do!!
Lucy/Teeda2 has purely simple, really-needed features, at least I hope.
So what is it?
For Teeda2, remote call and binding URL to POJO is all the thing you need.
So what about validation?
My answer : No, you do that using, not us.
Conversion like JSF converter?
My answer : Don't you know JSF converter really sucks?Anyway, again, you do that.
Teeda2 does not do conversion automatically(maybe we provide plugin, but not now),
so you do like Struts or anyhow you want.
So, do things what you really want, minimally and directly, with Teeda2/Lucy
Wednesday, January 9, 2008
Happy new year!
Happy new year!
Hope early of this year, we gonna make a first version of Lucy.
We have almost done for injection by configuration file.
So we gonna make a new step, making a Lucy kernel.
Hope early of this year, we gonna make a first version of Lucy.
We have almost done for injection by configuration file.
So we gonna make a new step, making a Lucy kernel.
Thursday, December 13, 2007
Composite Annotation
In the creation time of AOP, I realized that java annotation is too weak to use.
Java annotation does not extend or implement, it is irritated me so much
because I see there are much more and more annotation at java programming.
So the idea has come to my thoughts.
We can not extend annotation by annotation, but we can do pretend that
there is composited annotation, offcourse with Lucy.
It is where @Composite is used for:
With the example above, @SingletonComponent has two meanings.
1.This is pretend to be @Component
2.This is pretend to be @Singleton
How to pretend?
This is @Composite.
@Composite gives you abbreviate multiple annotation meanings at just one annotaion.
How Lucy do this is when creating annotation meta class, AnnotationDesc,
the annotation which is put @Composite treats as composited annotation that means
there are multiple annotations to make meta class.If so, Lucy analyzes all annotations from
child to parent, and makes multiple annotation meta class.
I mention that Lucy simply does not make annotation meta class for java.lang type annotation and @Composite itself.
So, what gives you if using @Composite are:
-your code are much simpler to see. keep your code clean, baby:)
-it gives you to create so easily one simple annotation from multiple annotaions(isn't that good?)
-you can do customize of framework annotation meanings.
Java annotation does not extend or implement, it is irritated me so much
because I see there are much more and more annotation at java programming.
So the idea has come to my thoughts.
We can not extend annotation by annotation, but we can do pretend that
there is composited annotation, offcourse with Lucy.
It is where @Composite is used for:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Composite
@Component
@Singleton
public @interface SingletonComponent {
}
With the example above, @SingletonComponent has two meanings.
1.This is pretend to be @Component
2.This is pretend to be @Singleton
How to pretend?
This is @Composite.
@Composite gives you abbreviate multiple annotation meanings at just one annotaion.
How Lucy do this is when creating annotation meta class, AnnotationDesc,
the annotation which is put @Composite treats as composited annotation that means
there are multiple annotations to make meta class.If so, Lucy analyzes all annotations from
child to parent, and makes multiple annotation meta class.
I mention that Lucy simply does not make annotation meta class for java.lang type annotation and @Composite itself.
So, what gives you if using @Composite are:
-your code are much simpler to see. keep your code clean, baby:)
-it gives you to create so easily one simple annotation from multiple annotaions(isn't that good?)
-you can do customize of framework annotation meanings.
Wednesday, December 12, 2007
The next feature, AOP
Offcource, there are famous AOP framework with IoC.
Spring, JBoss AOP, Seasar2, well I know.
So how about Lucy?Is that any AOP features?
I can say it will be.
Lucy AOP is based on Javassist byte code enhancing.
It will be like this:
It points out Aaa is gonna be enhanced by StringReplaceInterceptor,
and also mentions that if method name is like "replace", by what?
By @Aspect.
@Aspect puts on class and method.
If you do like below:
if "replace" method invoked, StringReplaceInterceptor and AppendInterceptor are
gonna work.
What @Aspect looks like?
@Aspect has two methods, interceptBy and pointcut.
interceptBy() must be declared without any exception,
however, pointcut() is just optional.
So with design decision, we are not gonna use aop alliance provided jar.
Why? It is very simple. It is just useless and no one wants to use it.
There are some reasonable reasons to have MethodInvocation,
MethodInterceptor , but others, uhmmm,,,
there is no need to use it. So we simply do not use and make our Interceptor and Invocation.
So, where is StringReplaceInterceptor?
Calm down, here is StringReplaceInterceptor:
Interceptor is very much like AOP alliance Interceptor.
But we can add some good feature and also can consider much better architecure
and add feature when needed because we HAVE this code.
All component is managed by Lucy.
We hope we can provide good and simple AOP feature with Lucy.
Spring, JBoss AOP, Seasar2, well I know.
So how about Lucy?Is that any AOP features?
I can say it will be.
Lucy AOP is based on Javassist byte code enhancing.
It will be like this:
@Component
@Singleton
@Aspect(interceptBy = StringReplaceInterceptor.class, pointcut = "replace")
public class Aaa {
public String replace() {
return "aaa";
}
}
It points out Aaa is gonna be enhanced by StringReplaceInterceptor,
and also mentions that if method name is like "replace", by what?
By @Aspect.
@Aspect puts on class and method.
If you do like below:
@Component
@Singleton
@Aspect(interceptBy = StringReplaceInterceptor.class, pointcut = "replace")
public class Aaa {
@Aspect(interceptBy=AppendInterceptor.class)
public String replace() {
return "aaa";
}
}
if "replace" method invoked, StringReplaceInterceptor and AppendInterceptor are
gonna work.
What @Aspect looks like?
@Aspect has two methods, interceptBy and pointcut.
interceptBy() must be declared without any exception,
however, pointcut() is just optional.
@Retention(RetentionPolicy.RUNTIME)
@Target( { ElementType.TYPE, ElementType.METHOD })
public @interface Aspect {
Class[] interceptBy();
String[] pointcut() default ".*";
}
So with design decision, we are not gonna use aop alliance provided jar.
Why? It is very simple. It is just useless and no one wants to use it.
There are some reasonable reasons to have MethodInvocation,
MethodInterceptor , but others, uhmmm,,,
there is no need to use it. So we simply do not use and make our Interceptor and Invocation.
So, where is StringReplaceInterceptor?
Calm down, here is StringReplaceInterceptor:
@Component
@Singleton
public class StringReplaceInterceptor implements Interceptor {
@Override
public Object intercept(Invocationinvocation)
throws InvocationException {
return "bbb";
}
}
Interceptor is very much like AOP alliance Interceptor.
But we can add some good feature and also can consider much better architecure
and add feature when needed because we HAVE this code.
All component is managed by Lucy.
We hope we can provide good and simple AOP feature with Lucy.
Subscribe to:
Comments (Atom)