경기도의회 SNS 연계 서비스 예제
경기도의회 SNS 연계 서비스 예제
대부분 아래 URL 게시판들 보면 다 나와있는내용인데, 제가 핵심링크만 보냅니다^^
1. mac / linux
$ cd /tmp
$ dd if=/dev/zero of=10mb.bin bs=10m count=10
-> 1m * 10 = 10mb.bin 테스트 파일생성
2.windows
fsutil file createnew c:\temp\10mb.bin 10485760
-> 10mb.bin 테스트 파일생성
.asmx란?
- 웹메서드를 제공하기 위한 파일.
- C#에서는 asmx를 참조함으로써 asmx 네임스페이스에 접근할 수 있다.
- sharepoint에서는 아래 표와 같은 asmx를 서비스한다.
페이지 | 설명 |
http://<server:5966>/_vti_adm/Admin.asmx | 사이트 생성이나 삭제등과 같은 관리 함수 - CreateSite - DeleteSite - GetLanguage - RefreshConfigCache |
http://<server>/_vti_bin/Alerts.asmx | 경고와 관련된 작업을 하는 함수 |
http://<server>/_vti_bin/DspSts.asmx | 데이터와 스키마 검색과 관련된 함수 |
http://<server>/_vti_bin/DWS.asmx | 문서 작업과 관련된 함수 |
http://<server>/_vti_bin/Forms.asmx | 사용자 인터페이스 폼과 관련된 함수 - GetForm - GetFormCollection |
http://<server>/_vti_bin/Imaging.asmx | 사진 라이브러리와 관련된 함수 |
http://<server>/_vti_bin/Lists.asmx | 리스트와 관련된 함수 |
http://<server>/_vti_bin/Meetings.asmx | 회의 작업과 관련된 함수 |
http://<server>/_vti_bin/Permissions.asmx | Sharepoint 보안과 관련된 함수 |
http://<server>/_vti_bin/SiteData.asmx | Sharepoint 포탈 서버에서 사용되는 함수 |
http://<server>/_vti_bin/Sites.asmx | 사이트 템플릿을 검색하기 위해 하나의 함수를 포함한다. |
http://<server>/_vti_bin/UserGroup.asmx | 사용자나 그룹과 관련된 작업 함수 |
http://<server>/_vti_bin/versions.asmx | file 버전과 관련된 작업 함수 - DeleteAllVersions - DeleteVersion - GetVersions - RestoreVersion |
http://<server>/_vti_bin/Views.asmx | 목록의 view와 관련된 함수 |
http://<server>/_vti_bin/WebPartPages.asmx | Web Part와 관련된 함수 |
http://<server>/_vti_bin/Webs.asmx | 사이트와 하위 사이트와 관련된 작업 함수 |
1 | http://sharepoint.com/_vti_bin/Lists.asmx?WSDL |
Stub code생성을 위해 console창을 열어 JDK에서 제공하는 wsimport tool을 사용하여 하래와 같이 실행합니다.
1 | wsimport -p com.microsoft.sharepoint -keep -extension sharepoint.wsdl |
정상적으로 실행이 되었다면 실행한 folder에 stub code가 생성됩니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | public static ListsSoap Authentication(String userName, String password) throws Exception { ListsSoap port = null; if (userName != null && password != null) { Lists service = new Lists(); port = service.getListsSoap(); ((BindingProvider) port).getRequestContext() .put(BindingProvider.USERNAME_PROPERTY, userName); ((BindingProvider) port).getRequestContext() .put(BindingProvider.PASSWORD_PROPERTY, password); } else { throw new Exception("Fail: Authentication."); } return port; } |
1 2 3 4 5 6 7 8 9 10 | public static void NTLMAuth(final String userName, final String password) { if (userName != null && password != null) { Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(userName, password.toCharArray()); } }); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | public static void readSharePointList(ListsSoap port, String listName, ArrayList<string> listColumnNames, String rowLimit) throws Exception { if (port != null && listName != null && listColumnNames != null && rowLimit != null) { try { String viewName = ""; GetListItems.ViewFields viewFields = null; GetListItems.Query query = null; GetListItems.QueryOptions queryOptions = null; String webID = ""; GetListItemsResponse.GetListItemsResult result = port.getListItems(listName, viewName, query, viewFields, rowLimit, queryOptions, webID); Object listResult = result.getContent().get(0); System.out.print(listResult); } catch (Exception ex) { throw new Exception("Exception :" + ex.toString() + "\n"); } } } </string> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | public static void main(String[] args) { String domain = "Domain\\"; String userName = "userName"; String password = "Password"; httpService.NTLMAuth(domain+userName, password); try { ArrayList<string> listColumnNames = new ArrayList<string>(); listColumnNames.add("Title"); listColumnNames.add("Comments"); ListsSoap port = sharepointService.Authentication(domain+userName, password); sharepointService.readSharePointList(port, "Issue Tracking", listColumnNames, "100"); } catch (Exception e) { e.printStackTrace(); } } </string></string> |
출처: http://xtech.tistory.com/entry/Sharepoint-%EB%82%B4%EC%9A%A9-%EC%9D%BD%EA%B8%B0-with-Java-Tutorial
java에서 클래스 명, 라인 번호 찍기.
java에서 php의 __FILE__ __LINE__과 유사한 기능을 구현하는 방법!!!
String a = "hahaha";
System.out.println("===========디버깅 시작했다~================");
System.out.print("file:" + (new Throwable()).getStackTrace()[0].getClassName() + " line");
System.out.println((new Throwable()).getStackTrace()[0].getLineNumber());
System.out.println(a);
System.out.println("===========디버깅 끝났다~================");
eclipse의 경우 템플릿을 지정해놓으면 더 쉽게 할 수 있다.
도구->환경설정->Java->편집기->템플리트
새로작성
이름: dprt
컨텍스트: java
자동삽입에 체크
설명: 디버깅용 프린트
패턴:
//* debugging~~ ${date} ${time}
System.out.println("===========디버깅 시작했다~================");
System.out.println("time:" + new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new java.util.Date()));
System.out.print(new Throwable().getStackTrace()[0].getClassName() +"." + new Throwable().getStackTrace()[0].getMethodName() + "()" );
System.out.println(" line: " + new Throwable().getStackTrace()[0].getLineNumber());
System.out.println(${cursor});
System.out.println("===========디버깅 끝났다~================");
// the end of debuuging.. */
요렇게 넣고 확인하면..
java 코드에서 "dprt"라고 치고 ctrl+space 치면 위의 구문들이 찍힌다. 디버깅용으로 굉장히 편하다.
log4j 써도 된다~
exiftool -Orientation -S a.jpg
exiftool -Orientation='Rotate 90 CW' a.jpg -overwrite_original *.jpg
exiftool -Orientation=6 -n a.jpg
-overwrite_original