'ITWeb/개발일반'에 해당되는 글 489건

  1. 2012.03.22 java HttpSessionBindingListener 맛보기.
  2. 2012.03.21 알만한 사람은 다 아는 접근제어자
  3. 2012.03.20 Eclipse 에서 서블릿 프로젝트 맛보기.
  4. 2012.03.20 Phonegap 맛보기.
  5. 2012.03.19 Spring MVC Controller Junit Test 작성해보기.
  6. 2012.03.16 HTML5 Server Sent Events 맛보기.
  7. 2012.03.15 HTML5 Server Sent Events 를 이용한 웹채팅 Prototype.
  8. 2012.03.15 Spring Annotation (java.lang.annotation) 관련 내용 모음.
  9. 2012.03.14 [egovframework] bbsmanagement-2.0.0 컴포넌트 적용해보기.
  10. 2012.03.14 jdbc driver... log4jdbc

java HttpSessionBindingListener 맛보기.

ITWeb/개발일반 2012. 3. 22. 19:26
뭐 어찌 어찌 하다보니.. 이것도 보게 되었습니다.
그래서 테스트.. ^^;
코드는 무지 짧습니다.
서블릿 파일 하나, binding listenr 클래스 하나..

[참고사이트]


[CreateSessionBinding.java]


[SessionBindingListener.java]


※ 자, 그럼 이걸 어디에 써먹어야 할까요???
이 예제는 보시면 아시겠지만 session.setAttribute 즉 session key/value 에 binding 되면 event 가 발생하게 되는 거랍니다.
그니까.. isNew() 할때.. 필요한 걸 session 에 저장한 다음.. session expired 되거나 하면 자동으로 삭제가 되도록 필요한 기능을 구현 하면 되겠죠.
불필요한 session 을 삭제 하거나 아니면 status 등을 처리 한다거나 할때.. 별도의 listener 없이 이걸 가지고 구현 하면 쉽게 할 수 있을 듯 합니다.

배도 고프고 해서 오늘은 여기까지만.. ㅎㅎ

실행 방법은 잘 아시죠.. servlet 하나 생성 하셔서 Run on Server 하시면 되요.. 
-> http://localhost:8080/proto.session/CreateSessionBinding


[실행로그]

2012. 3. 22 오후 7:32:39 org.apache.catalina.core.ApplicationContext log

정보: BOUND to C7A16EA8F0687784DAA17367695BA501

2012. 3. 22 오후 7:32:39 org.apache.catalina.core.ApplicationContext log

정보: new session.binding : C7A16EA8F0687784DAA17367695BA501

2012. 3. 22 오후 7:33:37 org.apache.catalina.core.ApplicationContext log

정보: UNBOUND from C7A16EA8F0687784DAA17367695BA501

- 보시면 처음 페이지가 열리면 BOUND 되구요.
- Session expired 되면 UNBOUND 됩니다.
- 또는 session.setAttribute 해서 binding 하셔도 UNBOUND 됩니다.
- tomcat 의 web.xml 에서 아래 처럼 변경했습니다. (1분)

    <session-config>

        <session-timeout>1</session-timeout>

    </session-config>


역시 배고파서 작성하는 글은.. 좀 부족하내요.. ㅋㅋ
집에 와서 다시 업데이트..
위에 CreateSessionBinding 서블릿 클래스를 보시면 빨간 부분 보이시죠..
그렇습니다.
위에 설명한 "또는 session.setAttribute 해서 binding 하셔도 UNBOUND 됩니다." 는.. set 한 key 에 대해서 binding 되면 event 가 발생을 하게 되는 것입니다.
테스트가 부족했으니 내일 다시 최종 확인 결과 올리겠습니다. ㅡ.ㅡ;;

[최종테스트결과]

- 이론이 역시 맞습니다.

session.setAttribute("session.id", new SessionBindingListener(context));

- session 에 listener 를 등록해 줬기 때문에 이넘이 bound, unbound 되면 event 가 발생하게 되는 것입니다.

 
:

알만한 사람은 다 아는 접근제어자

ITWeb/개발일반 2012. 3. 21. 12:46
remind 차원에서... ;;;

[참고사이트]


[원문내용]

Controlling Access to Members of a Class

Access level modifiers determine whether other classes can use a particular field or invoke a particular method. There are two levels of access control:

  • At the top level—public, or package-private (no explicit modifier).
  • At the member level—public, private, protected, or package-private (no explicit modifier).

A class may be declared with the modifier public, in which case that class is visible to all classes everywhere. If a class has no modifier (the default, also known as package-private), it is visible only within its own package (packages are named groups of related classes — you will learn about them in a later lesson.)

At the member level, you can also use the public modifier or no modifier (package-private) just as with top-level classes, and with the same meaning. For members, there are two additional access modifiers: private and protected. The private modifier specifies that the member can only be accessed in its own class. The protected modifier specifies that the member can only be accessed within its own package (as with package-private) and, in addition, by a subclass of its class in another package.

The following table shows the access to members permitted by each modifier.

Access Levels
ModifierClassPackageSubclassWorld
public Y Y Y Y
protected Y Y Y N
no modifier Y Y N N
private Y N N N

The first data column indicates whether the class itself has access to the member defined by the access level. As you can see, a class always has access to its own members. The second column indicates whether classes in the same package as the class (regardless of their parentage) have access to the member. The third column indicates whether subclasses of the class — declared outside this package — have access to the member. The fourth column indicates whether all classes have access to the member.

Access levels affect you in two ways. First, when you use classes that come from another source, such as the classes in the Java platform, access levels determine which members of those classes your own classes can use. Second, when you write a class, you need to decide what access level every member variable and every method in your class should have.

Let's look at a collection of classes and see how access levels affect visibility. The following figure shows the four classes in this example and how they are related.


Classes and Packages of the Example Used to Illustrate Access Levels

The following table shows where the members of the Alpha class are visible for each of the access modifiers that can be applied to them.

Visibility
ModifierAlphaBetaAlphasubGamma
public Y Y Y Y
protected Y Y Y N
no modifier Y Y N N
private Y N N N

Tips on Choosing an Access Level: 

If other programmers use your class, you want to ensure that errors from misuse cannot happen. Access levels can help you do this.

  • Use the most restrictive access level that makes sense for a particular member. Use private unless you have a good reason not to.
  • Avoid public fields except for constants. (Many of the examples in the tutorial use public fields. This may help to illustrate some points concisely, but is not recommended for production code.) Public fields tend to link you to a particular implementation and limit your flexibility in changing your code.

 
:

Eclipse 에서 서블릿 프로젝트 맛보기.

ITWeb/개발일반 2012. 3. 20. 15:44
Tomcat Advanced I/O 관련 서블릿 테스트를 해보려고 합니다.
맛보기 들어가 봅시다.. ㅎㅎ


[서블릿 프로젝트생성]
- Eclipse 에서 dynamic web project 로 생성 하시면 됩니다.


- 그 다음은 어떻게 따라 하는지 잘 모르시겠다면.. 아래 링크 참고하세요. ㅋㅋ

- 생성을 완료 하셨으면 WebContent 폴더 아래 index.jsp 파일을 하나 만들어서 HelloWorld 를 찍어 봅니다.

<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Insert title here</title>

</head>

<body>

Hello World

</body>

</html>


- index.jsp 파일에서 우클릭 Run As -> Run on Server 를 실행해서 결과 화면을 봅니다.



자, 이제 Tomcat Advanced I/O 관련 코딩을 해보겠습니다.
- Servlet 을 하나 생성 합니다.


- 역시 그 다음을 잘 모르시겠다면 아래 링크 참고하세요.

- Servlet 코딩했으면 실행을 시켜야 겠죠.

http://localhost:8080/CONTEXT/SERVLET_CLASSNAME
- CONTEXT : Tomcat 설정 파일중 server.xml 에 보시면 

<Context docBase="proto.dwp.comet" path="/proto.dwp.comet" ..../>


- SERVLET_CLASSNAME : 아래 코드로 예를 들었습니다. ChatServlet.java....

예)
http://localhost:8080/proto.dwp.comet/ChatServlet



[참고문서]


[Tomcat 설정변경]
- server.xml

[Before]
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>


[After]
<Connector connectionTimeout="20000" port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol" useComet="true" redirectPort="8443"/>



[ChatServlet.java]
- 이 파일은 tomcat.apache.org 에 있는 예제 입니다.
- 이걸로 전체 테스트를 진행 하였습니다.
- event.getEventType 이 READ 부분에 보시면 빨간 부분만 추가했습니다.
- 추가한 이유는 server 에서 client 로 message 를 넘길 영역을 테스트 하기 위해서 입니다.
- 녹색 추가 및 주석은 그냥 한글 코드랑 HTML 코드 형태가 아닌 그냥 text 스탈로 처리 하려고 넣었습니다.

[index.jsp]
- ChatServlet 으로 메시지를 request 하고 Server 로 부터 response 를 받는 기능을 담당 합니다.
- XHR 에서 request method 는 POST 로 하셔야 합니다.


[BroadcasterServlet.java]
- 이넘은 Client 에서 Request 를 받는 역할을 하게 됩니다.
- 또한 response 를 하기 위한 작업도 이 넘이 하겠지요.


[MessageSender.java]
- client 로 message 를 전송 하는 역할을 합니다.


[정리하면서]

- 일단 이걸 가지고 뭘 해야 좋을지는 좀더 고민을 해봐야겠다.
- 테스트 하면서 느낀건데 이넘을 테스트 하면서 READ 상태에서 END 가 되지 않을경우 이전 message 에 대한 buffer 를 다 유지하고 있는 것 같다.
- 틀린 내용이라 삭제 합니다.. ㅡ.ㅡ;; 화면 출력할때.. 잘 못 했더라구요..이런.. 
- 코드를 깊게 분석하지 않은 관계로 원인 규명은 다음으로.. ;;;;;
- Server Push 기능이나 Notification Chatting 같은걸 구현 하는데 사용이 가능해 보인다.
- 다만 이런 것들이 HTML5 로 넘어 오면서 많은 부분들이 브라우저에서 처리가 가능해 졌다는 점에서...
- 뭐.. 여기까지만.. ㅋㅋ

:

Phonegap 맛보기.

ITWeb/개발일반 2012. 3. 20. 11:50
phonegap 을 이용해서 android webapp HelloWorld 를 테스트 해보겠습니다.
뭐 제가 정리 하지 않아도 phonegap 사이트에 들어가면 Getting Start 가 잘 되어 있긴 합니다.
걍.. remind 하는 차원에서 정리해 봅니다.

[참고사이트]


[문제점]

- phonegap 최신 버전 1.5.0 에서는 이전 버전과 바뀐내용들이 있습니다.
- 그래서 위 참고사이트에 나와 있는데로 하면 오류 납니다.

[오류내용]

... 중략
android.content.res.Resources$NotFoundException: Resource ID #0x0
... 중략  

- 이건 최신 버전을 다운로드 받아서 압축을 푸시면 xml 폴더가 하나 더 있습니다.
- xml 폴더를 생성하신 android project 의 res 밑으로 복사해서 넣으시면 됩니다.

- 수정합니다. 업데이트된 내용이 따로 있내요.



[바뀐점]

[Before]
phonegap-VERSION.jar
phonegap-VERSION.js

[After] 
cordova-1.5.0.jar
cordova-1.5.0.js
xml/cordova.xml
xml/plugins.xml

- 패키지도 아래 처럼 바뀌었내요. (이건 소스코드 내려서 받아 보면 될듯 하내요.)
import org.apache.cordova.DroidGap; 



[시작하기]

1. Eclipse
2. JDK
3. ADT Plugin
- 이건 eclipse plugin 으로 설치를 하셔도 되고 아님 걍 SDK 를 별도 설치 하셔서 location 지정을 하셔도 됩니다.
4. PhoneGap 다운로드 (.js / .jar / .xml)


- AVD 하나 생성 하시지요.
- 옆에 있는 New 버튼 누르시고 하면 됩니다. tutorial 에서 처럼 10MB 만 할당 했습니다.

- Android project 하나 생성하셔서 tutorial 에 있는 것처럼 
- jar 파일은 libs 에, js 파일은 www 에 , xml 폴더는 res 에 복사해서 넣으시면 됩니다.
- index.html 파일은 만드시면 되구요.
- 그런 다음에 manifest 파일을 tutorial 에 있는 것처럼 수정 하시면 됩니다.
- 이제 Run As -> Android Application 을 해볼까요..



※ 해보시면 아시겠지만 어려울게 하나도 없습니다.

[소스코드]
[helloworldActivity.java]



[index.html]


[AndroidManifest.xml]
 
:

Spring MVC Controller Junit Test 작성해보기.

ITWeb/개발일반 2012. 3. 19. 19:10
java 개발 하면서 TDD 많이들 들어 보셨을 겁니다.
또는 Code 의 품질 확보를 위한 방법으로도 junit 을 적용하기도 하구요.
뭐.. 이유야 어찌되었건... 오늘은 spring mvc 로 개발한 controller 에 대해서 test code 를 작성해 보겠습니다.
아래 예제는 Mockito 를 이용해서 작성 하였습니다.

[참고사이트]



[BoardContentViewController.java - Controller]


[BoardContentViewControllerTest.java - Controller] 
- 다들 아시겠지만, src/test/java 아래 동일 패키지명으로 해서 해당 클래스 뒤에 Test 만 붙히시면 됩니다.
- Model 같은 경우 interface 이기 때문에 initialize 를 하면 오류가 발생 합니다. 그렇다 보니 이넘이 구현체를 가지고 initialize 하시면 오류가 없습니다.
- Controller 에서 @Autowired 를 했기 때문에 따로 service 객체에 대한 setter 를 구현 안했었는데요, 이렇게 하니 Test 에서 service 객체가 null 이라고 계속 오류를 냅니다.
- 그래서 위에서 처럼 setter 를 생성 해서 해결 했습니다. (다른 방법 아시는 분은 공유 부탁 합니다.)


[pom.xml 추가설정]


※ 예제를 보셔서 아시겠지만 초절정 쉬운 TestCase 작성 내용이였습니다.
이를 기반으로 확장및 응용은 각자의 몫으로 남기겠습니다.

:

HTML5 Server Sent Events 맛보기.

ITWeb/개발일반 2012. 3. 16. 12:27
항상 그렇지만.. 저는 기본 문서 부터 봅니다..

[참고사이트]


[EventSource Interface]

[Constructor(DOMString url, optional EventSourceInit eventSourceInitDict)]
interface EventSource : EventTarget {
  readonly attribute DOMString url;
  readonly attribute boolean withCredentials;

  // ready state
  const unsigned short CONNECTING = 0;
  const unsigned short OPEN = 1;
  const unsigned short CLOSED = 2;
  readonly attribute unsigned short readyState;

  // networking
  [TreatNonCallableAsNull] attribute Function? onopen;
  [TreatNonCallableAsNull] attribute Function? onmessage;
  [TreatNonCallableAsNull] attribute Function? onerror;
  void close();
};

dictionary EventSourceInit {
  boolean withCredentials = false;
};



[Event Stream]
- 중요하다고 싶은 것만... 

Streams must be decoded as UTF-8

If the line is empty (a blank line)

Dispatch the event, as defined below.

If the line starts with a U+003A COLON character (:)

Ignore the line.

If the line contains a U+003A COLON character (:)

Collect the characters on the line before the first U+003A COLON character (:), and let field be that string.

Collect the characters on the line after the first U+003A COLON character (:), and let value be that string. If value starts with a U+0020 SPACE character, remove it from value.

Process the field using the steps described below, using field as the field name and value as the field value.

Otherwise, the string is not empty but does not contain a U+003A COLON character (:)

Process the field using the steps described below, using the whole line as the field name, and the empty string as the field value.

Once the end of the file is reached, any pending data must be discarded. (If the file ends in the middle of an event, before the final empty line, the incomplete event is not dispatched.)


The steps to process the field given a field name and a field value depend on the field name, as given in the following list. Field names must be compared literally, with no case folding performed.

If the field name is "event"

Set the event name buffer to field value.

If the field name is "data"

Append the field value to the data buffer, then append a single U+000A LINE FEED (LF) character to the data buffer.

If the field name is "id"

Set the last event ID buffer to the field value.

If the field name is "retry"

If the field value consists of only characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then interpret the field value as an integer in base ten, and set the event stream's reconnection time to that integer. Otherwise, ignore the field.

Otherwise

The field is ignored.



[Event Stream onmessage Event - data]

[Case 1]

data: 1

data: 2


data: 3


[Case 1's onmessage]

- onmessage 이벤트는 두번처리 됩니다.

- data: 1, data: 2 를 묶어서 하나의 이벤트로 그리고 data: 3 을 또 다른 이벤트로 처리 합니다.

- 결국,  empty line 이 없이 바로 연결된 경우는 data buffer 에 메시지가 함께 들어가게 되는 구조 입니다.

- 다른 버퍼에 담아서 이벤트를 분리 하고 싶다면 개행을 두번 해주시면 됩니다.  


[Case 2]

data: 1

data: 2 

 
[Case 2's onmessage]

이미 위에서 설명한 것 처럼 두번의 onmessage 이벤트가 발생 합니다. 



[Event Stream onmessage Event - event] 
- 별도 이벤트를 등록하기 위한 방법입니다.

[event stream 구조]
- wakeup 이라는 이벤트가 발생하도록 메시지를 전달 합니다.

event: wakeup

data: 12345678


[event 추가]
- DOM Event 처리랑 동일 합니다.
- 전달 받은 data buffer 의 12345678 은 event.data 에 전달 되고 onwakeup 이벤트가 발생하게 됩니다.

var eventSource = new EventSource('http://192.168.1.2/sse.html');


eventSource.addEventListener('wakeup', onwakeup, false);


function onwakeup (event) {

console.log("onwakeup");

console.log(event.data);

} 



[Event Stream onmessage Event - id]

이 넘은 불행하게도 아직 고려중인 듯 합니다. 



[text/event-stream]


※ 추가적으로 CORS 관련 문제는 이전에 작성한 PostMessage API 를 참고 하시면 좋을 것 같습니다.

:

HTML5 Server Sent Events 를 이용한 웹채팅 Prototype.

ITWeb/개발일반 2012. 3. 15. 17:04
고민 하다가 걍.. 부재중 메시지나 아니면.. 읽기 전에 메시지를 연속으로 보냈을때 오류를 방지 하기 위해서.. 아래 처럼 코드 살짝 수정했습니다. ^^;

[status.html]

<?php

header('Content-type: text/event-stream');

header('Content-Transfer-Encoding: UTF-8');

header('Connection: keep-alive');


$file = $_GET['f'];


echo file_get_contents($file);

file_put_contents($file, '', LOCK_EX);

flush();

?>



[messages.html]

<?php

$sender = $_GET['sender'];

$receiver = $_GET['receiver'];

$message = $_GET['message'];


$sendMessage = "\n\n" . 'id: ' . time() . "\n\n" . 'data: {sender:"' . $sender . '", receiver:"' . $receiver . '", message:"' . $message . '}' . "\n\n";


file_put_contents($receiver . '.txt', $sendMessage, FILE_APPEND|LOCK_EX);

?>




정말이지 완전 쌩초보 프로토타입이니 걍.. 참고만 하시길 바라며.. 
전혀 웹서버에 대한 과도한 traffic 에 대해서 고려되지 않은 내용임을 밝힙니다... ㅋㅋ
(SSE 도 결국은 http request 방식을 사용하기 때문에 traffic 부하가 있습니다.)

해야 할건 무지 많습니다.
기본 chatting message 에 대한 structure 도 만들어야 하고 traffic 에 대한 분산을 어떻게 할지도 고민해서 만들어야 하고...등등.. 
걍.. 맛보기이니.. 나머지는 각자 알아서 만들어 보세요.. ^^;;


[참고문서]


[실행화면]



[구조소개]

[chat.html]
- 대화 상대를 선택하게 되면 열리는 채팅창입니다.

[status.html]
- EventSource 에서 이벤트를 받을 서버 URL 입니다.

[messages.html]
- XHR 을 이용해서 메시지를 전송할 서버 URL 입니다.
- 이넘이 입력한 메시지를 받아서 기록하게 됩니다. 



[소스코드 - chat1.html]


[소스코드 - chat2.html]
- 아래 코드만 chat1.html 과 다릅니다.

var messageVO = {

sender:'jjeong',

receiver:'henry',

message:''

}


var eventSource = new EventSource('http://localhost/status.html?f=jjeong.txt');



[소스코드 - status.html]

<?php

header('Content-type: text/event-stream');

header('Content-Transfer-Encoding: UTF-8');

header('Connection: keep-alive');


$file = $_GET['f'];
 

echo file_get_contents($file);

flush();

?>



[소스코드 - messages.html]

<?php

$sender = $_GET['sender'];

$receiver = $_GET['receiver'];

$message = $_GET['message'];


$sendMessage = "\n\n" . 'id: ' . time() . "\n\n" . 'data: {sender:"' . $sender . '", receiver:"' . $receiver . '", message:"' . $message . '}' . "\n\n";


file_put_contents($receiver . '.txt', $sendMessage, LOCK_EX);

?>

 
:

Spring Annotation (java.lang.annotation) 관련 내용 모음.

ITWeb/개발일반 2012. 3. 15. 10:49
[참고문서]

Package org.springframework.beans.factory.annotation

Support package for annotation-driven bean configuration. 
Annotation Types Summary
Autowired Marks a constructor, field, setter method or config method as to be autowired by Spring's dependency injection facilities.
Configurable Marks a class as being eligible for Spring-driven configuration.
Qualifier This annotation may be used on a field or parameter as a qualifier for candidate beans when autowiring.
Required Marks a method (typically a JavaBean setter method) as being 'required': that is, the setter method must be configured to be dependency-injected with a value.
Value Annotation at the field or method/constructor parameter level that indicates a default value expression for the affected argument.

Package org.springframework.context.annotation

Annotation support for the Application Context, including JSR-250 "common" annotations, component-scanning, and Java-based metadata for creating Spring-managed objects 
Annotation Types Summary
Bean Indicates that a method produces a bean to be managed by the Spring container.
ComponentScan Configures component scanning directives for use with @Configuration classes.
ComponentScan.Filter Declares the type filter to be used as an include filter or exclude filter.
Configuration Indicates that a class declares one or more @Bean methods and may be processed by the Spring container to generate bean definitions and service requests for those beans at runtime, for example:
 @Configuration
 public class AppConfig {
     @Bean
     public MyBean myBean() {
         // instantiate, configure and return bean ...
DependsOn Beans on which the current bean depends.
EnableAspectJAutoProxy Enables support for handling components marked with AspectJ's @Aspect annotation, similar to functionality found in Spring's <aop:aspectj-autoproxy> XML element.
EnableLoadTimeWeaving Activates a Spring LoadTimeWeaver for this application context, available as a bean with the name "loadTimeWeaver", similar to the <context:load-time-weaver> element in Spring XML.
Import Indicates one or more @Configuration classes to import.
ImportResource Indicates one or more resources containing bean definitions to import.
Lazy Indicates whether a bean is to be lazily initialized.
Primary Indicates that a bean should be given preference when multiple candidates are qualified to autowire a single-valued dependency.
Profile Indicates that a component is eligible for registration when one or more specified profiles are active.
PropertySource Annotation providing a convenient and declarative mechanism for adding a PropertySource to Spring's Environment.
Role Indicates the 'role' hint for a given bean.
Scope When used as a type-level annotation in conjunction with the Component annotation, indicates the name of a scope to use for instances of the annotated type.

Package org.springframework.core.annotation

Core support package for Java 5 annotations 
Annotation Types Summary
Order Annotation that defines ordering.

Package org.springframework.format.annotation

Annotations for declaratively configuring field formatting rules 
Annotation Types Summary
DateTimeFormat Declares that a field should be formatted as a date time.
NumberFormat Declares that a field should be formatted as a number.

Package org.springframework.jmx.export.annotation

JDK 1.5+ annotations for MBean exposure 
Annotation Types Summary
ManagedAttribute JDK 1.5+ method-level annotation that indicates to expose a given bean property as JMX attribute, corresponding to the ManagedAttribute attribute.
ManagedMetric JDK 1.5+ method-level annotation that indicates to expose a given bean property as JMX attribute, with added Descriptor properties to indicate that it is a metric.
ManagedNotification JDK 1.5+ method-level annotation that indicates a JMX notification emitted by a bean.
ManagedNotifications JDK 1.5+ method-level annotation that indicates JMX notifications emitted by a bean, containing multiple ManagedNotifications
ManagedOperation JDK 1.5+ method-level annotation that indicates to expose a given method as JMX operation, corresponding to the ManagedOperation attribute.
ManagedOperationParameter JDK 1.5+ method-level annotation used to provide metadata about operation parameters, corresponding to a ManagedOperationParameter attribute.
ManagedOperationParameters JDK 1.5+ method-level annotation used to provide metadata about operation parameters, corresponding to an array of ManagedOperationParameter attributes.
ManagedResource JDK 1.5+ class-level annotation that indicates to register instances of a class with a JMX server, corresponding to the ManagedResource attribute.

Package org.springframework.scheduling.annotation

JDK 1.5+ annotation for asynchronous method execution 
Class Summary
AbstractAsyncConfiguration Abstract base Configuration class providing common structure for enabling Spring's asynchronous method execution capability.
AsyncAnnotationAdvisor Advisor that activates asynchronous method execution through the Async annotation.
AsyncAnnotationBeanPostProcessor Bean post-processor that automatically applies asynchronous invocation behavior to any bean that carries the Async annotation at class or method-level by adding a corresponding AsyncAnnotationAdvisor to the exposed proxy (either an existing AOP proxy or a newly generated proxy that implements all of the target's interfaces).
AsyncConfigurationSelector Selects which implementation of AbstractAsyncConfiguration should be used based on the value of EnableAsync.mode() on the importing @Configuration class.
AsyncResult<V> A pass-through Future handle that can be used for method signatures which are declared with a Future return type for asynchronous execution.
ProxyAsyncConfiguration @Configuration class that registers the Spring infrastructure beans necessary to enable proxy-based asynchronous method execution.
ScheduledAnnotationBeanPostProcessor Bean post-processor that registers methods annotated with @Scheduled to be invoked by a TaskScheduler according to the "fixedRate", "fixedDelay", or "cron" expression provided via the annotation.
SchedulingConfiguration @Configuration class that registers a ScheduledAnnotationBeanPostProcessor bean capable of processing Spring's @Scheduled annotation.

Package org.springframework.test.annotation

Support classes for annotation-driven tests 
Annotation Types Summary
DirtiesContext Test annotation which indicates that the ApplicationContext associated with a test is dirty and should be closed: after the current test, when declared at the method level after each test method in the current test class, when declared at the class level with class mode set to AFTER_EACH_TEST_METHOD after the current test class, when declared at the class level with class mode set to AFTER_CLASS
ExpectedException Deprecated. as of Spring 3.1 in favor of using built-in support for declaring expected exceptions in the underlying testing framework (e.g., JUnit, TestNG, etc.)
IfProfileValue Test annotation to indicate that a test is enabled for a specific testing profile or environment.
NotTransactional Deprecated. as of Spring 3.0, in favor of moving the non-transactional test method to a separate (non-transactional) test class or to a @BeforeTransaction or @AfterTransaction method.
ProfileValueSourceConfiguration ProfileValueSourceConfiguration is a class-level annotation which is used to specify what type of ProfileValueSource to use when retrieving profile values configured via the @IfProfileValue annotation.
Repeat Test annotation to indicate that a test method should be invoked repeatedly.
Rollback Test annotation to indicate whether or not the transaction for the annotated test method should be rolled back after the test method has completed.
Timed Test-specific annotation to indicate that a test method has to finish execution in a specified time period.

Package org.springframework.transaction.annotation

JDK 1.5+ annotation for transaction demarcation 
Annotation Types Summary
EnableTransactionManagement Enables Spring's annotation-driven transaction management capability, similar to the support found in Spring's <tx:*> XML namespace.
Transactional Describes transaction attributes on a method or class.

Package org.springframework.validation.annotation

Support classes for annotation-based constraint evaluation, e.g 
Annotation Types Summary
Validated Variant of JSR-303's Valid, supporting the specification of validation groups.

Package org.springframework.web.bind.annotation

Annotations for binding requests to controllers and handler methods as well as for binding request parameters to method arguments 
Annotation Types Summary
CookieValue Annotation which indicates that a method parameter should be bound to an HTTP cookie.
ExceptionHandler Annotation for handling exceptions in specific handler classes and/or handler methods.
InitBinder Annotation that identifies methods which initialize the WebDataBinder which will be used for populating command and form object arguments of annotated handler methods.
Mapping Meta annotation that indicates a web mapping annotation.
ModelAttribute Annotation that binds a method parameter or method return value to a named model attribute, exposed to a web view.
PathVariable Annotation which indicates that a method parameter should be bound to a URI template variable.
RequestBody Annotation indicating a method parameter should be bound to the body of the web request.
RequestHeader Annotation which indicates that a method parameter should be bound to a web request header.
RequestMapping Annotation for mapping web requests onto specific handler classes and/or handler methods.
RequestParam Annotation which indicates that a method parameter should be bound to a web request parameter.
RequestPart Annotation that can be used to associate the part of a "multipart/form-data" request with a method argument.
ResponseBody Annotation which indicates that a method return value should be bound to the web response body.
ResponseStatus Marks a method or exception class with the status code and reason that should be returned.
SessionAttributes Annotation that indicates the session attributes that a specific handler uses.

Package org.springframework.web.portlet.bind.annotation

Annotations for binding portlet requests to handler methods 
Annotation Types Summary
ActionMapping Annotation for mapping Portlet action requests onto handler methods.
EventMapping Annotation for mapping Portlet event requests onto handler methods.
RenderMapping Annotation for mapping Portlet render requests onto handler methods.
ResourceMapping Annotation for mapping Portlet resource requests onto handler methods.

Package org.springframework.web.servlet.config.annotation

Annotation-based setup for Spring MVC 
Annotation Types Summary
EnableWebMvc Add this annotation to an @Configuration class to have the Spring MVC configuration defined in WebMvcConfigurationSupport imported:
 @Configuration
 @EnableWebMvc
 @ComponentScan(basePackageClasses = { MyConfiguration.class })
 public class MyWebConfiguration {

 }

Package org.springframework.stereotype

Annotations denoting the roles of types or methods in the overall architecture (at a conceptual, rather than implementation, level) 
Annotation Types Summary
Component Indicates that an annotated class is a "component".
Controller Indicates that an annotated class is a "Controller" (e.g.
Repository Indicates that an annotated class is a "Repository", originally defined by Domain-Driven Design (Evans, 2003) as "a mechanism for encapsulating storage, retrieval, and search behavior which emulates a collection of objects".
Service Indicates that an annotated class is a "Service", originally defined by Domain-Driven Design (Evans, 2003) as "an operation offered as an interface that stands alone in the model, with no encapsulated state."


Package java.lang.annotation

Provides library support for the Java programming language annotation facility.
Annotation Types Summary
Documented Indicates that annotations with a type are to be documented by javadoc and similar tools by default.
Inherited Indicates that an annotation type is automatically inherited.
Retention Indicates how long annotations with the annotated type are to be retained.
Target Indicates the kinds of program element to which an annotation type is applicable.
 
:

[egovframework] bbsmanagement-2.0.0 컴포넌트 적용해보기.

ITWeb/개발일반 2012. 3. 14. 14:40
자료실에 올라와 있는 교육자료를 받아 보시면 자세하게 나와 있습니다.
간략하게만 정리 합니다.

[준비물]

- eGovFrameDev-2.0.0-FullVer 다운로드
- egovframework-bbsmanagement-2.0.0 다운로드



[프로젝트생성]

- eGovFrame Web Project 생성
- eGovFrame Common Component Implements 추가
- 여기서 공통, 게시판 이렇게 두개 선택 합니다. 
- 저는 그냥 Database Source 에 사용하는 mysql 서버 등록해 놓고 걍 사용자 DB에 생성해서 Table 만들었습니다. 
- 이렇게 하시면 별도로 globals.properties 를 수정 하지 않아도 됩니다. 



[프로젝트실행]

- 해당 프로젝트에서 Run on Server 로 Tomcat 등록 후 실행
- 아래와 같은 관리자 화면이 나오게 됩니다.
- 이미 게시판을 하나 생성을 했지요.
- 일반 사용자가 쓸수 있도록 하기 위해서는 
1. 게시판속성관리에서 게시판을 생성 하시구요.
2. 게시판사용정보에서 등록 버튼 누르신 후 생성한 게시판을 등록해 주시면 됩니다. 



[게시판관리자화면]

 
- 게시판 등록을 하시면 사용자 화면 링크가 나옵니다.


[게시판사용자화면]



※ 교육자료 첨부합니다.


 
:

jdbc driver... log4jdbc

ITWeb/개발일반 2012. 3. 14. 12:10

흔히 많이 사용하던 mysql 용 JDBC Driver

com.mysql.jdbc.Driver


예전 부터 있었던 내용인데 그냥 회상용으로 올려봅니다.

내가 사용하는 DBMS 가 뭔지 고민하지 않고 알아서 적절한 jdbc driver 를 사용하게 해주는 아주 유용한 jdbc proxy util 이라고 하면 될 것 같습니다.

- 여기 들어가 보시면 잘 나와 있구요.

최근에 많이 쓰는건 아래와 같습니다.


[pom.xml 설정]

<dependency>

  <groupId>org.lazyluke</groupId>

  <artifactId>log4jdbc-remix</artifactId>

  <version>0.2.7</version>

</dependency>



[driverClassName]

jdbc.driverClassName=net.sf.log4jdbc.DriverSpy



뭐 늘 그렇지만 배울것도 많아 지는 것도 사실이지만 개발하는데 필요한 툴들도 많이 편리해 지고 있는 것도 사실인것 같내요. 
: