본문 바로가기

카테고리 없음

FSP setup

FSP setup

FSP는 Eclipse의 Dynamic Web Project 형태로 배포되며, 그 기능은 SQL문장을 가지고 있으면서 MiPlatform 클라이언트에서 요청할 경우 해당 SQL문장을 실행하여 XML 형태로 응답하는 서버측 모듈이다. 또, 클라이언트 측에서 호출해야 하는 Javascript함수도 포함하고 있다, 개발자는 주로 FSP를 이용하여 SQL문장을 작성하여 등록하고 등록된 SQL문장을 MiPlatform 에서 요청하는 작업을 하게 된다.

FSP를 배포형태(구성)
- FSP 서버측 라이브러리
- JDK
- Eclipse IDE
- 기본 프로젝트 : 이 프로젝트를 기반으로 MiPlatform 과 연동하는 웹프로그램의 개발을 시작하면 된다

설정파일
- web.xml : 웹컨텍스트의 절대경로 및 service.xml 파일의 절대경로 등록
- context.xml : FSP 서버가 접속해야 할 데이터베이스 연결정보 등록
- service.xml : ID, Pwd 등록

배포한 폴더의 KODT.ZIP 압축해제
압축을 해제하면 다음과 같은 폴더로 구성된 것을 확인할 수 있다.
압축을 해제하면 생성되는 kodt.zip 폴더를 프로젝트명으로 변경하는 좋다.

- eclipse : 기본 프로젝트 + FSP 라이브러리 포함, 이 프로젝트를 기반으로 개발을 시작하면 된다
- jdk : 이 프로젝트가 사용할 JDK이지만 시스템에 설치된 JDK를 사용해도 된다
- tomcat : 시스템에 Tomcat이 설치되지 않은 경우에는 이 것을 사용하면 된다
- workspace : 위의 Eclipse가 실행되면서 읽어 들이는 프로젝트가 저장된 작업영역

위의 eclipse 폴더 안의 eclipse.exe를 실행하여 프로그램을 작성하면 된다.
 


포함된 Eclipse 실행
- 배포된 폴더중에서 eclipse/eclipse.exe 를 실행한다.
- workspace를 묻는 창에서 kodt폴더 명을 프로젝트 명으로 변경한 폴더를 지정해 준다
- Eclipse에서 FSP서버와 연동하는 웹프로젝트는 Context Root 를 반드시 '/' 즉, 루트로 설정해야 한다.
- 해당프로젝트 마우스우측 > Properties > Web Project Settings > Context Root : / 으로 입력
- SVN 등을 이용하여 프로젝트를 Check out 하여 로컬 시스템에 구성된 프로젝트도 반드시 위처럼 설정해 주어야 한다.

- Eclipse에 Tomcat 을 서버로 등록
- 접속하고자 하는 DB에 따른 JDBC 드라이버를 Eclipse WEB-INF/lib 안에 import 하여 등록
- Eclipse에 등록된 Tomcat 실행
- 웨브라우저 실행 ( http://www.softzam.com/fsp/ 으로 접속) --> FSP제어 프로그램(FSP_SQLMGR)이 다운로드/설치됨)
- ID, PWD요구--> service.xml 에 등록된 ID, PWD를 적절하게 변경하고 그 ID, PWD를 입력한다.
- URL : http://localhost:8080 (Tomcat의 URL)

FSP_SQLMGR 프로그램 실행
- 바탕화면에서 FSP_SQLMGR 아이콘 더블클릭
- Name: 임의의 이름, User: mcams, Password: mcams1, http URL: http://localhost:8080
- Save Passwor check, 연결버튼 클릭 (로컬의 Tomcat이 실행된 상태가 아니면 접속오류가 발생함)
- 상단 메뉴, SQL MAP 관리 > DEV_DB 더블클릭 > 4개의 탭으로 각 기능이 나열됨
- Sqls 탭: SQL 문장들의 집합을 관리, SQL문장 등록/수정/삭제, 그룹생성 등
- Tables탭: 현재 접속된 DB의 모든 테이블을 보여준다.
- Procs 탭: 현재 접속된 이용자의 모든 Stored Procedures 를 보여준다.
- 우측 SQL 편집창 : SQL 문장을 작성/실행(테스트) 가능


참고
WEB-INF/web.xml (현재 프로젝트 안의 service.xml 파일과 fsp 폴더의 물리적 경로가 일치해야 한다)

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
 <display-name>mcams</display-name>
 <filter>
     <filter-name>FSP_Filter</filter-name>
     <filter-class>com.sz.ui.ServiceLoaderFilter</filter-class>
        <init-param>
            <param-name>servicePath</param-name>
            <param-value>D:/mcams/workspace/mcams/WebContent/WEB-INF/fsp/conf/service.xml</param-value>
        </init-param>
        <init-param>
            <param-name>workingRootDirPath</param-name>
            <param-value>D:/mcams/workspace/mcams/WebContent/WEB-INF/fsp/</param-value>
        </init-param>
    </filter>
 <filter-mapping>
     <filter-name>FSP_Filter</filter-name>
     <url-pattern>/*</url-pattern>
 </filter-mapping>
 
  <filter>
   <filter-name>CharsetEncodingFilter</filter-name>
   <filter-class>com.sz.ui.CharacterEncodingFilter</filter-class>
   <init-param>
    <param-name>encoding</param-name>
    <param-value>utf-8</param-value>
   </init-param>
   <init-param>
    <param-name>ignore</param-name>
    <param-value>true</param-value>
   </init-param>
   </filter>
  <filter-mapping>
      <filter-name>CharsetEncodingFilter</filter-name>
      <servlet-name>WebMainServlet</servlet-name>
  </filter-mapping>
 
 <servlet>
  <display-name>Main Action Servlet</display-name>
  <servlet-name>MiplatformMainServlet</servlet-name>
  <servlet-class>com.sz.ui.miplatform.MiplatformMainServlet</servlet-class>
  <init-param>
       <param-name>SESSION_CHECK</param-name>
      <param-value>false</param-value>
     </init-param>
       <init-param>
      <param-name>SESSION_SERVICE</param-name>
      <param-value>SessionManager</param-value>
    </init-param>
 </servlet>
 
 <servlet-mapping>
  <servlet-name>MiplatformMainServlet</servlet-name>
  <url-pattern>/Main</url-pattern>
 </servlet-mapping>
 
 <servlet>
  <display-name>X-Main Action Servlet</display-name>
  <servlet-name>XplatformMainServlet</servlet-name>
  <servlet-class>com.sz.ui.xplatform.XplatformMainServlet</servlet-class>
 </servlet>
 
 <servlet-mapping>
  <servlet-name>XplatformMainServlet</servlet-name>
  <url-pattern>/XMain</url-pattern>
 </servlet-mapping>
   
 
 <servlet>
  <display-name>SqlMap In/Out</display-name>
  <servlet-name>DatasetListServlet</servlet-name>
  <servlet-class>com.sz.ui.miplatform.DatasetLayoutServlet</servlet-class>
  <init-param>
          <param-name>serviceName</param-name>
          <param-value>sql#SqlMapLayoutService</param-value>
     </init-param>
 </servlet>
 
 <servlet-mapping>
     <servlet-name>DatasetListServlet</servlet-name>
     <url-pattern>/default_service</url-pattern>
 </servlet-mapping>
 
 <!-- web 서블릿 -->
 <servlet>
  <display-name>Web Action Servlet</display-name>
  <servlet-name>WebMainServlet</servlet-name>
  <servlet-class>com.sz.ui.web.WebMainServlet</servlet-class>
 </servlet>
 <servlet-mapping>
  <servlet-name>WebMainServlet</servlet-name>
  <url-pattern>/WebMain</url-pattern>
 </servlet-mapping>
 <servlet>
  <display-name>File Upload</display-name>
  <servlet-name>FileUploader</servlet-name>
  <servlet-class>com.sz.ui.miplatform.HttpFileManagerServlet</servlet-class>
  <init-param>
      <param-name>serviceName</param-name>
      <param-value>HttpFileManagerService</param-value>
  </init-param>
 </servlet>
 
 <servlet-mapping>
  <servlet-name>FileUploader</servlet-name>
  <url-pattern>/FileUploader</url-pattern>
 </servlet-mapping>
 
 
 <welcome-file-list>
  <welcome-file>index.html</welcome-file>
  <welcome-file>index.htm</welcome-file>
  <welcome-file>index.jsp</welcome-file>
  <welcome-file>default.html</welcome-file>
  <welcome-file>default.htm</welcome-file>
  <welcome-file>default.jsp</welcome-file>
 </welcome-file-list>
</web-app>



META-INF/context.xml (접속할 데이터베이스 정보)

<Context reloadable="true">
    <Resource name="DEV_DB" auth="Container"
          type="javax.sql.DataSource" driverClassName="com.ibm.db2.jcc.DB2Driver"
          url="jdbc:db2://10.xxx.xxx.xxx:50000/costdb"
          username="cost01" password="cost01" maxActive="20" maxIdle="10"
          maxWait="-1" />                                             
</Context>



WEB-INF/fsp/conf/service.xml

<?xml version="1.0" encoding="euc-kr"?>
<server>
    <!-- 디폴트 로거의 로그 출력 레벨을 설정한다  디폴트는 콘솔에 출력된다. -->
    <default-log>
        <debug output="false"/>
        <information output="false"/>
        <warning output="false"/>
        <error output="false"/>
        <fatal output="false"/>
    </default-log>
   
    <!--  LOG에 IN/OUT 정보 표시 여부  -->
    <server-property name="INOUT_DEBUG">true</server-property>
   
    <log>DebugLogService</log>  
    <manager>       
  <service name="DebugLogCategoryService"
    code="com.sz.service.log.SimpleLogCategoryService">
            <!--attribute name="CategoryName">com.sz.service.log.DEBUG_METHOD_CATEGORY</attribute-->
            <attribute name="CategoryName">com.sz.service.log.SQL_INFO_CATEGORY</attribute>
            <attribute name="PriorityRange">50:99</attribute>
   <attribute name="RecordFactoryServiceName">#DebugLogRecordFactoryService</attribute> 
   <attribute name="RecordWriterServiceNames">
    #ConsoleWriter
   </attribute>  
   <depends>DebugLogRecordFactoryService</depends>
   <depends>ConsoleWriter</depends>
   <depends>FileWriter</depends>
        </service>
       
        <service name="DebugLogRecordFactoryService"
          code="com.sz.service.writer.LogRecordFactoryService">
   <attribute name="DateFormat">yyyy-MM-dd hh:mm:ss</attribute>
   <attribute name="Format">[%DATE%] %MESSAGE% %LOG_REQ_ID% %LOG_TIME%</attribute>
  </service>
  <service name="ConsoleWriter"
    code="com.sz.service.writer.ConsoleWriterService">
  </service>
 
  <service name="FileWriter"
     code="com.sz.service.writer.OneWriteFileMessageWriterService">
           <attribute name="File">logs/_</attribute> 
           <attribute name="OutputKey">false</attribute>  
           <!--attribute name="FilePrefix">%LOG_REQ_ID%</attribute--> 
           <!--attribute name="FilePrefix">LOG_REQ_ID</attribute-->
           <attribute name="FilePostfix">%LOG_TIME%.log</attribute>   
  </service>
 
    <service name="DebugLogService"
                  code="com.sz.service.log.ThreadManagedLogService">
            <attribute name="CategoryServiceNames">
             #DebugLogCategoryService
            </attribute>
            <attribute name="SystemDebugEnabled">false</attribute>
            <attribute name="SystemErrorEnabled">true</attribute>
            <attribute name="SystemFatalEnabled">true</attribute>
            <attribute name="SystemInfoEnabled">false</attribute>
            <attribute name="SystemWarnEnabled">false</attribute>
            <attribute name="DebugEnabled">true</attribute>
            <depends>DebugLogCategoryService</depends>
     </service>
     
     <!--  data source 용 jndi finder  -->
        <service name="DatasourceJndiFinder"
                  code="com.sz.service.jndi.DefaultJndiFinderService">
        </service>
       
         <!--  HttpFile 컴포넌트를 이용한 파일 업로드 서비스 -->
  <service name="HttpFileManagerService"
    code="com.sz.service.ui.miplatform.DefaultHttpFileManagerService">
           <!-- 파일을 저장한 루트 디렉토리를 정의
  WORK_DIR 속성으로부터 시작되는 상대경로 또는 절대경로로 지정 가능
  -->
   <attribute name="FileRootDir">upload/</attribute>
           <!-- 서브 디렉토리를 key=실제디렉토리의 형태로 지정 -->
   <attribute name="SubDirList">
                board=sample/board
                img=sample/images
   </attribute>
  <!-- 요청한 디렉토리 키 정보가 SubDirList에 존재하지 않을 경우 디렉토리의
  동적 생성을 지원할지 여부를 설정한다. 지원할 경우 true
  -->
   <attribute name="SupportDynamicDir">true</attribute>
   <attribute name="SystemEncoding">euc-kr</attribute>
  </service>
 
        <!-- Connection 정보 설정 Oracle -->
        <service name="DefaultConnectionFactory"
                 code="com.sz.service.resource.jdbc.JdbcConnectionFactoryDataSourceService">
            <attribute name="DataSourceName">DEV_DB</attribute>
            <attribute name="ManagedResource">false</attribute>
            <attribute name="JndiFinderServiceName">#DatasourceJndiFinder</attribute>
            <attribute name="JournalLevel">0</attribute>
            <attribute name="SQLLogServiceName">#DebugLogService</attribute>
            <attribute name="SupportGlobalTransaction">true</attribute>
            <depends>DatasourceJndiFinder</depends> 
            <depends>DebugLogService</depends> 
        </service>

        <!-- SQL Factory 서비스로 SQL 그룹정보를 가지고 있는 config 파일 및
  SQL 이 저장되어 있는 최상위 디렉토리를 설정한다. -->
  <service name="SqlFactory"
     code="com.sz.service.sqlmap.XMLFileSqlMapFactoryService">
   <attribute name="ServiceConfigUrl">conf/sqlmap_config.xml</attribute>
         <attribute name="SqlMapDirPath">sqlmap/</attribute>
         <attribute name="FileCheckInterval">10000</attribute>
         <attribute name="SqlMapFileCache">true</attribute>
  </service>
 
  <!--
         Action Class를 동적으로 생성해 주는 Factory 서비스이다.
        Services 항목에 서비스ID=실제구현 class 형태로 설정한다.
        -->
        <!--  개발   -->
        <service name="defaultAction"
          code="com.sz.service.ui.miplatform.DefaultMiplatformAction">
         <attribute name="SystemLoggerServiceName">#DebugLogService</attribute>
         <attribute name="BizServiceName">defaultBiz</attribute>
         <depends>DebugLogService</depends>
         <!-- attribute name="OutputType">ZLIB</attribute-->
        </service>    
        <service name="defaultBiz"
          code="com.sz.service.ui.miplatform.MiplatformExecutableService">
         <attribute name="JournalMode">false</attribute>
         <attribute name="ResourceFactoryServiceName">#DefaultConnectionFactory</attribute>
         <attribute name="SystemLoggerServiceName">#DebugLogService</attribute>
         <depends>DebugLogService</depends>
         <depends>DefaultConnectionFactory</depends>
        </service>
       
        <!-- 퍼포먼스 처리용 데이터베이스 기록자 서비스  -->
        <service name="PerformanceDbConnection"
                 code="com.sz.service.resource.jdbc.JdbcConnectionFactoryDataSourceService">
            <attribute name="DataSourceName">DEV_DB</attribute>
            <attribute name="JndiFinderServiceName">#DatasourceJndiFinder</attribute>
            <depends>DatasourceJndiFinder</depends> 
        </service>
        <!--  데이터베이스에 퍼포먼스를 기록하는 서비스  -->
        <service name="DBPerformanceManagerService"
         code="com.sz.service.performance.DatabasePerformanceManagerService">
         <attribute name="JdbcConnectionFactoryServiceName">#PerformanceDbConnection</attribute>
         <depends>PerformanceDbConnection</depends>
        </service>
       
        <service name="SqlServerBiz"
          code="com.sz.service.ui.miplatform.MiplatformExecutableService">
         <attribute name="JournalMode">false</attribute>
         <attribute name="ResourceFactoryServiceName">#SQLServerConnectionFactory</attribute>
         <attribute name="SystemLoggerServiceName">#DebugLogService</attribute>
         <depends>DebugLogService</depends>
         <depends>SQLServerConnectionFactory</depends>
        </service>

        <service name="DatabaseExecutorService"
                  code="com.sz.console.DatabaseExecutorService">          
        </service>

 
    </manager>
    <manager name="sql">
        <service name="SqlMapLayoutService"
         code="com.sz.service.sqlmap.layout.DefaultSqlMapLayoutService">
        </service>   
  <service name="DefaultSqlMapManagerService"
                 code="com.sz.console.sqlmap.SqlMapManagerService">
   <attribute name="ServiceConfigUrl">conf/sqlmap_config.xml</attribute>
         <attribute name="SqlMapDirPath">sqlmap/</attribute>
       </service>
        <service name="DatabaseExecutorService"
                 code="com.sz.console.DatabaseExecutorService">
        </service>
       
        <!-- ORACLE -->
        <service name="SqlMapManagerActionForOracle"
                 code="com.sz.console.sqlmap.SqlMapManagerAction">
            <attribute name="SqlMapManagerServiceName">#DefaultSqlMapManagerService</attribute>
            <attribute name="DBExecutorServiceName">#DatabaseExecutorService</attribute>
            <depends>DefaultSqlMapManagerService</depends>
            <depends>DatabaseExecutorService</depends>
        </service>

        <service name="SqlMapManagerAction"
                 code="com.sz.console.sqlmap.MultiSqlMapManagerAction">
            <attribute name="JdbcConnectionServiceNames">
             DEV_DB=DefaultConnectionFactory
            </attribute>
            <attribute name="SqlmapUser">mcams</attribute>
            <attribute name="SqlmapPwd">mcams1</attribute>
            <attribute name="SqlManagerActionNames">
             sql#SqlMapManagerActionForOracle
            </attribute>
            <attribute name="DatabaseLogin">
             false
            </attribute>
            <attribute name="UseActionProperties">
             sqlmgt=sql#SqlMapManagerAction,true
             performance=sql#SqlmapPerformanceAction,true
             serverInfo=sql#ServerInfoAction,true
            </attribute>
        </service>
        
        <!-- 서버정보 보기  -->
  <service name="ServerInfo" code="com.sz.service.context.ServerInfoService">
  </service>
 
  <!-- 서버정보 보기 Action  -->
  <service name="ServerInfoAction"
    code="com.sz.console.ui.ServerInfoViewAction">
   <attribute name="ServerInfoServiceName">sql#ServerInfo</attribute>
   <depends>sql#ServerInfo</depends>
  </service>
 
  <!-- 퍼포먼스 정보 보기 Action -->
  <service name="SqlmapPerformanceAction"
    code="com.sz.console.ui.PerformanceViewAction">
   <attribute name="PerformanceServiceName">FSPManager#DBPerformanceManagerService</attribute>
   <depends>FSPManager#DBPerformanceManagerService</depends>
  </service>
  </manager>   
</server>