SlideShare una empresa de Scribd logo
1 de 34
OPEN API PLATFORM
SYSTEM DEVELOPMENT
GUIDE


METADATA DRIVEN
SERVICE PLATFORM   HongSeong Jeon
                   jlooktech@gmail.com
                   jlook consulting
APPLICATION LOGICAL
ARCHITECTURE
                                Meta Driven Open API Service Platform
                                 Interfaces                   Services                  Repositories
                              Security Controller          Security Service           Security Repository
Open API Service Interfaces




                                                                                                            Metadata Management
                              Generic Controller           Generic Service            Generic Repository

                              Domain Controller            Domain Service             Domain Repository

                              Metadata Controller          Metadata Service           Metadata Repository


                                                           Infrastructures
                                Security            Component          Transaction         OR Mapping
                              Management            Management         Management          Management
                              Attachment            Dynamic View       Task & Batch         JDBC Pool
                              Management              Resolver          Scheduler          Management
APPLICATION TECHNICAL
SPECIFICATION
q  Spring framework
     q  Spring IoC Container
     q  Spring Web MVC
     q  Spring Security
q  JBoss – Hibernate, Javassist
q  Google h2 Database
q  Google gson
q  MVEL 2.0
q  Apache Velocity Template engine
q  Java & Spring framework Annotation
q  Qdox
PROJECT STRUCTURE
Project               Directory            Description
jlook                                      Project name
          src/main/java                    Java sources directory for platform
          src/test/java                    Java sources directory for JUnit test
          src/main/resource                Resources directory for platform
                              domain       Hibernate mapping configuration directory for domain
                              hibernate    Hibernate configuration file
                              jdbc         Hibernate jdbc properties file
                              properties   Environment properties file
                              spring       Spring configuration directory
                              template     Hibernate configuration template file
                              velocity     Velocity properties file
          bin                              Ant build file
JAVA PACKAGE
STRUCTURE
Package Structure
jlook.framework




                  domain                        Domain object package
                                   account      User, group, domain objects
                                   annotation   jclass, jattr annotation class
                                   batch        Batch domain objects
                                   common       Common service domain objects – menu, announcement
                                   docs         Value object for API documentation
                                   metadata     Metadata domain objects – JClass, JAttribute, JType
                                   management   Management domain objects - JAccessLog
                                   model        UI value object for client application
                                   security     Security domain objects – JRole, JDataAccessRule, JMenuAccessRule
                                   util         Utility domain object – JArray, JAttachment
                                   widget       UI widget domain objects – JWidgetDefinition, JWidgetInstance
                  infrastructure                Infrastructure components package for application
                                   annotation   Annotation – GsonExclude, Message
                                   batch        Batch task class
                                   context      Thread context for user information
                                   gson         Google gson utility
JAVA PACKAGE
STRUCTURE
Package Structure
jlook.framework




                  infrastructure   hibernate   Hibernate utility class
                                   http        http client component
                                   jdbc        Jdbc base class for repository component
                                   junit       Junit utility class
                                   loader      Metadata loading classes
                                   security    Security classes - JUserEntity
                                   tools       Generator classes – Hibernate config, API Documentation
                                   task        Multi threaded tasking classes
                                   util        Utility classes
                                   web         Web servlet and filter classes
                  interfaces                   Interfaces package
                                   account     Account interfaces – domain, user, group
                                   common      Common service interfaces – menu, announcement
                                   metadata    Metadata interfaces – JClass, JAttribute, JType
                                   security    Security interfaces – role, access rules
                                   utility     Utility interfaces – array, attachment
JAVA PACKAGE
STRUCTURE
Package Structure
jlook.framework




                  repository            Repository interface package
                               impl     Repository implementation class package
                  service               Service interface package
                               action   JClass Action classes
                               impl     Service implementation class package
                               util     Service utility classes
SYSTEM DOMAIN OBJECT
§    Table에 Entity value object를 정의한 것으로 모든 Domain object는 JObject로 부터 상속을 받
      아 정의된다.
§    Member variables for JObject domain class
     §  objectId : 한 Table내에서 entity를 식별하는 Id
     §  classId : Table를 식별하는 Id
     §  domainId : Domain을 식별하는 Id
     §  createdBy : Enttiy를 등록한 JUser objectId
     §  createdOn : Entity를 등록한 일시
     §  updatedBy : Entity를 변경한 JUser objectId
     §  updatedOn : Entity를 변경한 일시
§  Domain annotation : system domain object들의 metadata 를 등록하기 위해 domain object
    의 metadata를 annotation으로 정의한다.
       §    jclass : system domain object에 대한 JClass metadata 정보를 정의하는 annotation
       §    jattr : system domain object의 Member Variable에 대한 JAttribute metadata 정보를 정의하
             는 annotation
SYSTEM DOMAIN OBJECT
@jclass(cid=JMetaKeys.JOBJECT, did=JDomainDef.SYSTEM_ID, name=JObject.NAME,
              type=JClassType.INTERFACE_TYPE, status=JMetaStatus.NONE_TYPE)
public class JObject implements Serializable, Comparable<JObject> {
    public static final String NAME = "JObject”;
    public static final String A_OID = "objectId";
    public static final String A_CID = "classId";
    public static final String A_DID = "domainId";
    public static final String A_CREATED_BY = "createdBy";
    public static final String A_CREATED_ON = "createdOn";
    public static final String A_UPDATED_BY = "updatedBy";
    public static final String A_UPDATED_ON = "updatedOn";

   @jattr(name=A_OID, label="Object Id", type=JPrimitive.LONG_TYPE, length=15, description="Object Id",
            required=true, unique=true, searchable=true, derived=true) protected Long objectId;
   @jattr(name=A_CID, label="Class Id", type=JPrimitive.LONG_TYPE, length=15, description="Class Id",
            required=true, unique=false, searchable=true, derived=true) protected Long classId;
   @jattr(name=A_DID, label="Domain Id", type=JPrimitive.LONG_TYPE, length=15, description="Domain Id",
            required=true, primary=true, unique=false, searchable=true, derived=true) protected Long domainId;
   @jattr(name=A_CREATED_BY, label="CreatedBy", type=JPrimitive.LONG_TYPE, length=15, description="CreatedBy",
            required=true, unique=false, searchable=true, derived=true) protected Long createdBy;
   @jattr(name=A_CREATED_ON, label="CreatedOn", type=JPrimitive.TIMESTAMP_TYPE, description="CreatedOn",
            required=true, unique=false, searchable=true, derived=true) protected Timestamp createdOn;
   @jattr(name=A_UPDATED_BY, label="UpdatedBy", type=JPrimitive.LONG_TYPE, length=15, description="UpdatedBy",
            required=false, unique=false, searchable=true, derived=true) protected Long updatedBy;
   @jattr(name=A_UPDATED_ON, label="UpdatedOn", type=JPrimitive.TIMESTAMP_TYPE, description="UpdatedOn",
            required=false, unique=false, searchable=true, derived=true) protected Timestamp updatedOn;
HIBERNATE DOMAIN
CONFIGURATION
§    Hibernate domain configuration에는 Database Table과 Domain object간의 mapping 정보
      를 정의한다.
§    System domain object에 대한 Hibernate domain configuration파일은 resource/framework/
      domain Directory 밑에 정의한다.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping SYSTEM "classpath://hibernate-mapping-3.0.dtd">
<hibernate-mapping package="jlook.framework.domain.metadata">
       <class name="JClass" table="JCLASS">
             <id name="objectId" column="OBJECTID">
                          <generator class="native"/>
             </id>
             <property name="classId"                type="long" column="CLASSID"         insert="true"/>
             <property name="domainId"               type="long" column="DOMAINID"/>
             <property name="name"                   type="string” column="NAME” length="4000” not-null="true"/>
             <property name="label"                  type="string" column="LABEL”         length="4000”/>
             <property name="description”            type="string" column="DESCRIPTION" length="4000”/>
             <property name="category"               type="string" column="CATEGORY”      length="4000”/>
             <property name="type"                   type="string" column="TYPE”          length="4000”/>
             <many-to-one name="inheritanceJClass” class="Jclass” column="INHERITANCEJCLASS” lazy="false"/>
             <property name="inheritanceType”        type="string” column="INHERITANCETYPE” length="4000”/>
             <property name="actionClass"            type="string" column="ACTIONCLASS” length="4000”/>
             <property name="summaryFilter"          type="string" column="SUMMARYFILTER” length="4000”/>
             <property name="JObjectRule"            type="string" column="JOBJECTRULE” length="4000”/>
             <property name="accessRule"             type="string" column="ACCESSRULE" length="9" />
HIBERNATE DOMAIN
 CONFIGURATION
             <property name="status"               type="string" column="STATUS”          length="4000”/>
             <property name="createdBy"            type="long" column="CREATEDBY” insert="true"/>
             <property name="createdOn"            type="timestamp” column="CREATEDON” insert="true"/>
             <property name="updatedBy"            type="long" column="UPDATEDBY” update="true"/>
             <property name="updatedOn"            type="timestamp” column="UPDATEDON" update="true"/>
             <map name="JAttributes" lazy="false" cascade="none"             inverse="true">
                         <key                      column="JCLASS"/>
                         <map-key                  column="NAME"            type="string"/>
                         <one-to-many              class="JAttribute"/>
             </map>

        </class>
 </hibernate-mapping>



resource/spring/context-persistence.xml
REPOSITORY LAYER
§      Database에 Access하기 위한 Repository Component를 HibernateRepository로부터 상속을
        받아 정의한다.
      package jlook.framework.repository.impl;

      @Repository(JGenericRepository.ID)
      public class JGenericRepositoryImpl extends HibernateRepository implements JGenericRepository {
           private static Log logger = Log.getLog(JGenericRepositoryImpl.class);

          @Override
          public Map<String, Object> selectSummaryData(String entityName, String filter, PageUtil page,
          Map<String,String[]> attrMap,List<String> parentAttrList, JObject parentJObject) throws JRepositoryException {
                  Session session = this.template.getSessionFactory().getCurrentSession();


§      Hibernate Template을 이용하여 Database에 Access하는 Logic을 구현한다.

                                                  HibernateRepository
                                                                                                   HibernateTemplate
                                 setSessionFactory(SessionFactory sessionFactory)
                                 setJContextFactory(JContextFactory jContextFactory)
        JGenericRepository       getDomainId()
                                 isAdministrator()                                                  JContextFactory




                         JGenericRepositoryImpl
SERVICE LAYER
§      Service Component는 Repository를 이용해서 Business Logic을 구현하고, Transaction 처
        리를 한다.
      package jlook.framework.service.impl;

      @Transactional(readOnly = true, rollbackForClassName={GlobalKeys.SERVICE_EXCEPTION,
      "org.hibernate.exception.ConstraintViolationException", "org.springframework.dao.DataIntegrityViolationException"})
      @Service(JGenericService.ID)
      public class JGenericServiceImpl implements JGenericService {

                   @Override
                   @PreAuthorize("hasPermission(#jObject, 'create')")
                   @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
                   public JResultModel create(JObject jObject) throws JServiceException {
                               JUserEntity entity = security.getUserEntity();
                               if(jObject.getClassId()==null) {
                                             throw new JServiceException("classId is not setted. - "+jObject);
                               }
SECURITY SERVICE
§      로그인한 사용자 정보를 얻고, domainId 및 client type 정보를 얻는 API를 제공한다.
      package jlook.framework.service.impl;

      @Transactional(readOnly = true, rollbackForClassName={GlobalKeys.SERVICE_EXCEPTION})
      @Service(JSecurityService.ID)
      public class JSecurityServiceImpl implements JSecurityService, UserDetailsService {




      package jlook.framework.service.impl;

      @Transactional(readOnly = true, rollbackForClassName={GlobalKeys.SERVICE_EXCEPTION,
      "org.hibernate.exception.ConstraintViolationException", "org.springframework.dao.DataIntegrityViolationException"})
      @Service(JGenericService.ID)
      public class JGenericServiceImpl implements JGenericService {
                    @Resource(name=JSecurityService.ID)
                    private JSecurityService security;

                   @Override
                   @PreAuthorize("hasPermission(#classId, {'read'})")
                   public JSummaryModel getSummaryData(JViewType jViewType, Long classId, PageUtil page,
                   Map<String, String[]> paramMap) throws JServiceException {
                               JUserEntity entity = security.getUserEntity();
INTERFACE LAYER
§      Client의 Request를 받아 Business Service를 실행하고 spring ModelAndView 객체를 생성하
        여 반환하는 Logic을 정의한다.
      @RequestMapping(value = "/generic/references", method = RequestMethod.GET)
      public ModelAndView getReferences(
                  @RequestHeader(value=JHeader.JCONTENT_TYPE, required=false) String contentType,
                  @RequestParam(value=ParamKeys.CLASS_ID,           required=true) Long classId)
      throws JControllerException {
                  Map<Long, String> map;
                  try {
                               map = this.jClassService.getReferences(classId);
                  } catch (JServiceException e) {
                               throw new JControllerException("Fail to get references for JClass. - "+classId,e);
                  }
                  JContentType jContentType = JContentType.getJContentType(contentType);
                  ModelAndView mview = jContentType.create("generic/references");
                  mview.addObject(JResultModel.DATA_KEY, map);
                  return mview;
      }
METADATA LOADER
§       Platform이 실행되기 위해 System Metadata를 초기에 Loading해야 하는 Component
          §  Package : jlook.framework.infrastructure.loader
          §  EnumLoader : System Metadata에서 사용하는 Enumeration Validation을 Loading함.
          §  MetataLoader : Domain Object에 정의한 Annotation을 Metadata Table에 Loading함.
          §  InitDataLoader : metadata package에 System Application을 구성하기 위한 Metadata를 정
              의한 Enum으로 부터 Metadata를 Loading함.
          §  ViewLoader : Loading된 JClass Metadata로 부터 각 JClass의 System default JView를 생
              성함.
§       Metadata Reloading API – MainController : /metadata/load
      @RequestMapping(value = "/metadata/load", method = RequestMethod.GET)
      public String loadMetadata(HttpServletRequest request, HttpServletResponse response) throws JControllerException {
                     JSessionFactoryBean bean = (JSessionFactoryBean)ApplicationContextHolder.getBean("&mySessionFactory");
                     bean.dropDatabaseSchema();
                     bean.createDatabaseSchema();
                     ry {
                                  this.enumLoader.setDataLoadEnabled(true);
                                  this.enumLoader.doInit();
                                  this.metadataLoader.setDataLoadEnabled(true);
                                  this.metadataLoader.doInit();
                                  this.dataLoader.setDataLoadEnabled(true);
                                  this.dataLoader.doInit();
METADATA LOADER
                                 this.viewLoader.setDataLoadEnabled(true);
                                 this.viewLoader.doInit();
                                 return "redirect:/";
                    } catch(Exception e) {
                                 throw new JControllerException("Cannot load metadata. - "+e.getMessage(), e);
                    }
      }

§        Source Review
           §    EnumLoader.java
           §    InitDataLoader.java
           §    MetadataLoader.java
           §    JMenuDef.java
GSON COMPONENT
§    JSon Response message를 생성하는 Google gson API를 Wrapper한 Class로 Response
      Message를 customization하는 Logic을 정의할 수 있다.
            è jlook.framework.infrastructure.gson.GsonFactory
§    JSon Mview에서 Response Value object를 JSon Message로 convert하기 위해 사용한다.
             Object obj = model.get(JResultModel.DATA_KEY);
             JResultModel rmodel = null;
             if(obj instanceof JResultModel) {
                            rmodel = (JResultModel)obj;
             } else {
                            rmodel = new JResultModel();
                            rmodel.setData(obj);
             }

             Object config = model.get(JResultModel.CONFIG_KEY);
             if(config instanceof Map) {
                            rmodel.addConfig((Map<String,Object>)config);
             }
             if(rmodel.getResult()==null) {
                            rmodel.setResult(JResultModel.SUCCESS);
             }

             GsonFactory gsonFactory = (GsonFactory)ApplicationContextHolder.getBean(GsonFactory.ID);
             Gson gson = gsonFactory.create();
             String jsonResult = gson.toJson(rmodel);
DYNAMIC VIEW
RENDERING
§       JViewResolver : spring View Resolver로 jlook-servlet.xml에 configuration되어 있으며,
         Response View Name에 따라서 해당 View객체를 생성하여 Response Message를 만들어
         Response한다.
      <bean id="jViewResolver"            class="jlook.framework.infrastructure.web.view.JViewResolver">
                   <property   name="jaxbModelList"      ref="jaxbModelList"/>
      </bean>

                  @Override
                  public View resolveViewName(String viewName, Locale locale) throws Exception {
                                if(logger.isDebugEnabled()) {
                                                logger.debug("--> resolveViewName - "+viewName);
                                }
                                View view = null;
                                if(JSonView.VIEWNAME.equals(viewName)) {
                                                view = new JSonView();
                                } else if(JXmlView.VIEWNAME.equals(viewName)) {
                                                view = new JXmlView(this.jaxbModelList);
                                } else if(JFileView.VIEWNAME.equals(viewName)) {
                                                view = new JFileView();
                                } else if(JExcelView.VIEWNAME.equals(viewName)) {
                                                view = new JExcelView();
                                }

                               return view;
                  }
DYNAMIC VIEW
RENDERING
§       jlook.framework.infrastructure.web.view package에 Custom View 정의됨
          §   JSonView
          §  JExcelView
          §  JFileView
          §  JXmlView
§       Client 요청 시 Header에 setting한 “jlook.content.type”에 따라서 Response Message Type
         이 결정된다.
      @RequestMapping(value = "/admin/environment", method = RequestMethod.GET)
      public ModelAndView envProperties(
                  @RequestHeader(value=JHeader.JCONTENT_TYPE, required=false) String contentType,
                  @RequestParam(value="name",         required=false) String name,
                  @RequestParam(value="value",        required=false) String value) throws JControllerException {
                             if(name!=null && value!=null) {
                                          environment.setProperty(name,value);
                             }
                             JContentType jContentType = JContentType.getJContentType(contentType);
                             ModelAndView mview = jContentType.create("admin/environment");
                             mview.addObject(JResultModel.DATA_KEY, environment);
                             return mview;
      }
SERVLET FILTER
§    jlook.framework.infrastructure.web.filter package에 두 가지 종류의 System Servlet Filter를
      제공함.
       §    JGlobelFilter : 모든 Request에 대한 Servlet Filter로 로그인한 사용자 정보를 Thread
             Context Variable에 Setting 하고, Access Log를 남긴다.
       §    JServiceFilter : /service/*에 대한 요청에 대한 Servlet Filter
SPRING SECURITY
§      Spring security framework은 web.xml에 아래와 같이 정의된 Filter에 의해 모든 Request에 대
        한 Web Resource의 권한 체크가 처리된다.
      <filter>
                  <filter-name>springSecurityFilterChain</filter-name>
                  <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
      </filter>

      <filter-mapping>
                   <filter-name>springSecurityFilterChain</filter-name>
                   <url-pattern>/*</url-pattern>
      </filter-mapping>
§      Spring security configuration file은 resource/spring/context-security.xml 이다.
§      Service Layer business method에서 아래와 같이 Authorization을 Annotation으로 정의할 수
        있다.
                  @Override
                  @PreAuthorize("hasPermission(#classId, {'read'})")
                  public JSummaryModel getSummaryData(
                             JViewType jViewType, Long classId, PageUtil page, Map<String, String[]> paramMap)
                             throws JServiceException {
SPRING SECURITY
§    resource/spring/context-security.xml
              <global-method-security pre-post-annotations="enabled">
              <expression-handler ref="expressionHandler"/>
              </global-method-security>

              <http use-expressions="true">
                           <intercept-url pattern="/service/metadata/load"         access="permitAll" />
                           <intercept-url pattern="/service/testing/**"            access="permitAll" />
                           <intercept-url pattern="/console/**”                    access="permitAll" />
                           <intercept-url pattern="/docs/**"                       access="permitAll" />
                           <intercept-url pattern="/apidocs/**"                    access="permitAll" />
                           <intercept-url pattern="/service/mobile/download"       access="permitAll" />
                           <intercept-url pattern="/service/file/upload"           access="permitAll" />
                           <intercept-url pattern="/service/security/signInFrm"    access="permitAll" />
                           <intercept-url pattern="/service/security/signIn"       access="permitAll" />
                           <intercept-url pattern="/service/security/register"     access="permitAll" />
                           <intercept-url pattern="/service/security/registration" access="permitAll" />
                           <intercept-url pattern="/service/domain/register"       access="permitAll" />
                           <intercept-url pattern="/service/domain/registration" access="permitAll" />
                           <intercept-url pattern="/admin/**"                      access="hasRole('Administrator')" />
                           <intercept-url pattern="/service/**"     access="hasRole('Administrator') or hasRole('User')" />

                            <form-login login-page="/service/security/signInFrm"
                                        authentication-success-handler-ref="authenticationSuccessHandler"
                                        authentication-failure-handler-ref="authenticationFailureHandler"/>
                            <logout     success-handler-ref="logoutSuccessHandler"
                                        invalidate-session="true"/>
SPRING SECURITY
§      resource/spring/context-security.xml
                               <session-management>
                                    <concurrency-control max-sessions="100" error-if-maximum-exceeded="true" />
                               </session-management>
                  </http>

        <authentication-manager>
          <authentication-provider          ref="daoAuthenticationProvider"/>
                                                                                jlook.framework.infrastructure.secu
        </authentication-manager>                                                 rity.spring. JPermissionEvaluator

                  <beans:bean id="expressionHandler"
                  class= "org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler">
                                <beans:property name="permissionEvaluator" ref="jPermissionEvaluator"/>
                  </beans:bean>

                   <beans:bean id="anonymousAuthFilter"
      class="org.springframework.security.web.authentication.AnonymousAuthenticationFilter">
                               <beans:property name="key" value="foobar"/>
                               <beans:property name="userAttribute" value="anonymousUser,ROLE_ANONYMOUS"/>
                   </beans:bean>

                  <beans:bean id="anonymousAuthenticationProvider"
                              class="org.springframework.security.authentication.AnonymousAuthenticationProvider">
                              <beans:property name="key" value="foobar"/>
                  </beans:bean>
SPRING SECURITY
§      resource/spring/context-security.xml
                     <beans:bean id="daoAuthenticationProvider
                     class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
                                    <beans:property name="userDetailsService" ref="jSecurityService"/>
                                    <beans:property name="passwordEncoder"                 ref="passwordEncoder"/>
                     </beans:bean>
                     <beans:bean id="logoutSuccessHandler
                     class="jlook.framework.infrastructure.security.spring.SignOutSuccessHandler">
                                    <beans:property name="defaultTargetUrl" value="/service/security/signOut"/>
                                    <beans:property name="alwaysUseDefaultTargetUrl" value="true"/>
                     </beans:bean>
                     <beans:bean id="passwordEncoder”
                     class="org.springframework.security.authentication.encoding.ShaPasswordEncoder"                  >
                                    <beans:constructor-arg value="256"/>
                     </beans:bean>
                     <beans:bean id="authenticationSuccessHandler"
      class="jlook.framework.infrastructure.security.spring.AuthenticationSuccessHandler" >
                                    <beans:property name="defaultTargetUrl”               value="/service/security/signIn"/>
                                    <beans:property name="alwaysUseDefaultTargetUrl" value="true"/>
                     </beans:bean>
         <beans:bean id="authenticationFailureHandler"
                     class="jlook.framework.infrastructure.security.spring.AuthenticationFailureHandler" >
                     <beans:property name="useForward” value="true"/>
                     <beans:property name="defaultFailureUrl” value="/service/security/signInFrm?singIn_error=true"/>
         </beans:bean>
OPEN API GENERATOR
HIBERNATE GENERATOR
JAVA CLASS GENERATOR
JGENERIC SERVICE
JCLASSLOADER
§    Application Home directory 밑에 classes 디렉토리에 있는 domain class들을 loading하는
      ClassLoader로 Web Application ClassLoader를 parent ClassLoader로 갖는다.




                                       CLASSPATH 경로의 Class          System
                                        들을 Loading하는 JVM          ClassLoader
                                            ClassLoader


                                       Web Application Class들을   WebApplication
                                          Loading하는 WAS           ClassLoader
                                            ClassLoader


                                       Custom Domain Class들을
                                        Loading하는 Application    JClassLoader
                                             ClassLoader
ENTITY META
 MANAGEMENT
                                        AbstractSession
                                         FactoryBean
                                                                 JConfigLoader         Config.xml

   Hibernate            Session         JSpringSession
   Repository           Factory          FactoryBean

                                                                 JClassLoader           Domain
                                                                                         class
                      Configuration




                                         Hibernate                               JavaClass
JGenericRepository
 JGenericRepository                      Generator                               Generator



   1.    Create domain class
   2.    Create hibernate config                           JMetaService
   3.    Add config to hibernate Configuration
   4.    Build new SessionFactory by hibernate Configuration
   5.    Create JView
ENTITY LIFECYCLE
                                                 Mapping entity
                     NONE                        Change entity
                                                 Unmapping entity
                                                 Remapping entity
                          Mapping
        MAPERROR          entity                 Build Metadata

                                     Unmapping
                                     entity
                    CREATED                      UNMAPED
   Change
   entity
                                                        Remapping
                                                        entity

                    Build Metadata
  CHANGED                                        REMAPED




                   BUILDERROR
ENTITY MAP ACTION
q  Mapping entity
     q  Make java class from metadata
     q  Make hibernate config from metadata
q  Change entity
     q  Add and remove attribute
     q  Change attribute : name, type, primary, unique, virtual
     q  Cannot change : name and category for JClass (CREATED)
q  Unmapping entity
     q  Change status from CREATED to UNMAPPED
q  Remapping entity
     q  Change status from UNMAP to REMAPPED
q  Build metadata
    q    Make java class from metadata for all entities.
    q    Make hibernate config from metadata for all entities.
    q    Create and initialize JClassLoader
    q    Create and initialize JSpringSessionFactoryBean
METADATA CHANGE
HISTORY
q  Change history for JClass and Jattribute
q  JClass
     q  Name, Category
     q  InheritanceClass, InheritanceType
q  JAttribute
    q  JClass, Name, Type
    q  Primary, Unique, Virtual

Más contenido relacionado

Destacado

Jlook open api server platform
Jlook open api server platformJlook open api server platform
Jlook open api server platformHongSeong Jeon
 
시시콜콜 및 OPEN API 설명
시시콜콜 및 OPEN API 설명시시콜콜 및 OPEN API 설명
시시콜콜 및 OPEN API 설명건우 이
 
OpenFest 2016 - Open Microservice Architecture
OpenFest 2016 - Open Microservice ArchitectureOpenFest 2016 - Open Microservice Architecture
OpenFest 2016 - Open Microservice ArchitectureNikolay Stoitsev
 
open api seminar
open api seminaropen api seminar
open api seminarNamhoon Kim
 
Understanding Open Api Service
Understanding Open Api ServiceUnderstanding Open Api Service
Understanding Open Api Service준일 엄
 
Geo Service Open API 플랫폼 구축 전략
Geo Service Open API 플랫폼 구축 전략Geo Service Open API 플랫폼 구축 전략
Geo Service Open API 플랫폼 구축 전략Channy Yun
 
Open api개발을 위한 자료1
Open api개발을 위한 자료1Open api개발을 위한 자료1
Open api개발을 위한 자료1도성 김
 
Daum 음성인식 API (김한샘)
Daum 음성인식 API (김한샘)Daum 음성인식 API (김한샘)
Daum 음성인식 API (김한샘)Daum DNA
 
Open API - 웹 플랫폼 생태계를 만드는 기술 (2011)
Open API - 웹 플랫폼 생태계를 만드는 기술 (2011)Open API - 웹 플랫폼 생태계를 만드는 기술 (2011)
Open API - 웹 플랫폼 생태계를 만드는 기술 (2011)Channy Yun
 
Open API 발표자료 - 김연수
Open API 발표자료 - 김연수Open API 발표자료 - 김연수
Open API 발표자료 - 김연수Yeon Soo Kim
 
API Management Reference Architecture
API Management Reference ArchitectureAPI Management Reference Architecture
API Management Reference ArchitectureSeong-Bok Lee
 
Application Architecture: The Next Wave | MuleSoft
Application Architecture: The Next Wave | MuleSoftApplication Architecture: The Next Wave | MuleSoft
Application Architecture: The Next Wave | MuleSoftMuleSoft
 
Naver Open Api Reference Manual
Naver Open Api Reference ManualNaver Open Api Reference Manual
Naver Open Api Reference Manual성웅 강
 
Welcome to the API Economy: Developing Your API Strategy
Welcome to the API Economy: Developing Your API StrategyWelcome to the API Economy: Developing Your API Strategy
Welcome to the API Economy: Developing Your API StrategyMuleSoft
 

Destacado (16)

Jlook open api server platform
Jlook open api server platformJlook open api server platform
Jlook open api server platform
 
Open platform
Open platformOpen platform
Open platform
 
Open platform/API overview
Open platform/API overviewOpen platform/API overview
Open platform/API overview
 
시시콜콜 및 OPEN API 설명
시시콜콜 및 OPEN API 설명시시콜콜 및 OPEN API 설명
시시콜콜 및 OPEN API 설명
 
OpenFest 2016 - Open Microservice Architecture
OpenFest 2016 - Open Microservice ArchitectureOpenFest 2016 - Open Microservice Architecture
OpenFest 2016 - Open Microservice Architecture
 
open api seminar
open api seminaropen api seminar
open api seminar
 
Understanding Open Api Service
Understanding Open Api ServiceUnderstanding Open Api Service
Understanding Open Api Service
 
Geo Service Open API 플랫폼 구축 전략
Geo Service Open API 플랫폼 구축 전략Geo Service Open API 플랫폼 구축 전략
Geo Service Open API 플랫폼 구축 전략
 
Open api개발을 위한 자료1
Open api개발을 위한 자료1Open api개발을 위한 자료1
Open api개발을 위한 자료1
 
Daum 음성인식 API (김한샘)
Daum 음성인식 API (김한샘)Daum 음성인식 API (김한샘)
Daum 음성인식 API (김한샘)
 
Open API - 웹 플랫폼 생태계를 만드는 기술 (2011)
Open API - 웹 플랫폼 생태계를 만드는 기술 (2011)Open API - 웹 플랫폼 생태계를 만드는 기술 (2011)
Open API - 웹 플랫폼 생태계를 만드는 기술 (2011)
 
Open API 발표자료 - 김연수
Open API 발표자료 - 김연수Open API 발표자료 - 김연수
Open API 발표자료 - 김연수
 
API Management Reference Architecture
API Management Reference ArchitectureAPI Management Reference Architecture
API Management Reference Architecture
 
Application Architecture: The Next Wave | MuleSoft
Application Architecture: The Next Wave | MuleSoftApplication Architecture: The Next Wave | MuleSoft
Application Architecture: The Next Wave | MuleSoft
 
Naver Open Api Reference Manual
Naver Open Api Reference ManualNaver Open Api Reference Manual
Naver Open Api Reference Manual
 
Welcome to the API Economy: Developing Your API Strategy
Welcome to the API Economy: Developing Your API StrategyWelcome to the API Economy: Developing Your API Strategy
Welcome to the API Economy: Developing Your API Strategy
 

Similar a Jlook open api platform-sysdevguide

Java EE 與 雲端運算的展望
Java EE 與 雲端運算的展望 Java EE 與 雲端運算的展望
Java EE 與 雲端運算的展望 javatwo2011
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repositorynobby
 
Roma introduction and concepts
Roma introduction and conceptsRoma introduction and concepts
Roma introduction and conceptsLuca Garulli
 
Modular applications with montage components
Modular applications with montage componentsModular applications with montage components
Modular applications with montage componentsBenoit Marchant
 
JBoss Training and Consultation by experienced professional
JBoss Training and Consultation by experienced professionalJBoss Training and Consultation by experienced professional
JBoss Training and Consultation by experienced professionalFaisal Khan
 
OGCE MSI Presentation
OGCE MSI PresentationOGCE MSI Presentation
OGCE MSI Presentationmarpierc
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WAREFermin Galan
 
ADF Gold Nuggets (Oracle Open World 2011)
ADF Gold Nuggets (Oracle Open World 2011)ADF Gold Nuggets (Oracle Open World 2011)
ADF Gold Nuggets (Oracle Open World 2011)Lucas Jellema
 
Powering the Next Generation Services with Java Platform - Spark IT 2010
Powering the Next Generation Services with Java Platform - Spark IT 2010Powering the Next Generation Services with Java Platform - Spark IT 2010
Powering the Next Generation Services with Java Platform - Spark IT 2010Arun Gupta
 
3 rad extensibility-srilakshmi_s_rajesh_k
3 rad extensibility-srilakshmi_s_rajesh_k3 rad extensibility-srilakshmi_s_rajesh_k
3 rad extensibility-srilakshmi_s_rajesh_kIBM
 
Rad Extensibility - Srilakshmi S Rajesh K
Rad Extensibility - Srilakshmi S Rajesh KRad Extensibility - Srilakshmi S Rajesh K
Rad Extensibility - Srilakshmi S Rajesh KRoopa Nadkarni
 
Declarative Services - Dependency Injection OSGi Style
Declarative Services - Dependency Injection OSGi StyleDeclarative Services - Dependency Injection OSGi Style
Declarative Services - Dependency Injection OSGi StyleFelix Meschberger
 
Declarative Services - Dependency Injection OSGi Style
Declarative Services - Dependency Injection OSGi StyleDeclarative Services - Dependency Injection OSGi Style
Declarative Services - Dependency Injection OSGi StyleFelix Meschberger
 
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte FrühlingSpring 3 - Der dritte Frühling
Spring 3 - Der dritte FrühlingThorsten Kamann
 
Enterprise Java Web Application Frameworks Sample Stack Implementation
Enterprise Java Web Application Frameworks   Sample Stack ImplementationEnterprise Java Web Application Frameworks   Sample Stack Implementation
Enterprise Java Web Application Frameworks Sample Stack ImplementationMert Çalışkan
 
Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Rohit Kelapure
 

Similar a Jlook open api platform-sysdevguide (20)

Java EE 與 雲端運算的展望
Java EE 與 雲端運算的展望 Java EE 與 雲端運算的展望
Java EE 與 雲端運算的展望
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repository
 
Javaee6 Overview
Javaee6 OverviewJavaee6 Overview
Javaee6 Overview
 
Roma introduction and concepts
Roma introduction and conceptsRoma introduction and concepts
Roma introduction and concepts
 
Modular applications with montage components
Modular applications with montage componentsModular applications with montage components
Modular applications with montage components
 
Java se7 features
Java se7 featuresJava se7 features
Java se7 features
 
JBoss Training and Consultation by experienced professional
JBoss Training and Consultation by experienced professionalJBoss Training and Consultation by experienced professional
JBoss Training and Consultation by experienced professional
 
OGCE MSI Presentation
OGCE MSI PresentationOGCE MSI Presentation
OGCE MSI Presentation
 
Dropwizard
DropwizardDropwizard
Dropwizard
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WARE
 
ADF Gold Nuggets (Oracle Open World 2011)
ADF Gold Nuggets (Oracle Open World 2011)ADF Gold Nuggets (Oracle Open World 2011)
ADF Gold Nuggets (Oracle Open World 2011)
 
Powering the Next Generation Services with Java Platform - Spark IT 2010
Powering the Next Generation Services with Java Platform - Spark IT 2010Powering the Next Generation Services with Java Platform - Spark IT 2010
Powering the Next Generation Services with Java Platform - Spark IT 2010
 
3 rad extensibility-srilakshmi_s_rajesh_k
3 rad extensibility-srilakshmi_s_rajesh_k3 rad extensibility-srilakshmi_s_rajesh_k
3 rad extensibility-srilakshmi_s_rajesh_k
 
Rad Extensibility - Srilakshmi S Rajesh K
Rad Extensibility - Srilakshmi S Rajesh KRad Extensibility - Srilakshmi S Rajesh K
Rad Extensibility - Srilakshmi S Rajesh K
 
Declarative Services - Dependency Injection OSGi Style
Declarative Services - Dependency Injection OSGi StyleDeclarative Services - Dependency Injection OSGi Style
Declarative Services - Dependency Injection OSGi Style
 
Declarative Services - Dependency Injection OSGi Style
Declarative Services - Dependency Injection OSGi StyleDeclarative Services - Dependency Injection OSGi Style
Declarative Services - Dependency Injection OSGi Style
 
What's new in Java EE 6
What's new in Java EE 6What's new in Java EE 6
What's new in Java EE 6
 
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte FrühlingSpring 3 - Der dritte Frühling
Spring 3 - Der dritte Frühling
 
Enterprise Java Web Application Frameworks Sample Stack Implementation
Enterprise Java Web Application Frameworks   Sample Stack ImplementationEnterprise Java Web Application Frameworks   Sample Stack Implementation
Enterprise Java Web Application Frameworks Sample Stack Implementation
 
Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010Contextual Dependency Injection for Apachecon 2010
Contextual Dependency Injection for Apachecon 2010
 

Último

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Último (20)

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 

Jlook open api platform-sysdevguide

  • 1. OPEN API PLATFORM SYSTEM DEVELOPMENT GUIDE METADATA DRIVEN SERVICE PLATFORM HongSeong Jeon jlooktech@gmail.com jlook consulting
  • 2. APPLICATION LOGICAL ARCHITECTURE Meta Driven Open API Service Platform Interfaces Services Repositories Security Controller Security Service Security Repository Open API Service Interfaces Metadata Management Generic Controller Generic Service Generic Repository Domain Controller Domain Service Domain Repository Metadata Controller Metadata Service Metadata Repository Infrastructures Security Component Transaction OR Mapping Management Management Management Management Attachment Dynamic View Task & Batch JDBC Pool Management Resolver Scheduler Management
  • 3. APPLICATION TECHNICAL SPECIFICATION q  Spring framework q  Spring IoC Container q  Spring Web MVC q  Spring Security q  JBoss – Hibernate, Javassist q  Google h2 Database q  Google gson q  MVEL 2.0 q  Apache Velocity Template engine q  Java & Spring framework Annotation q  Qdox
  • 4. PROJECT STRUCTURE Project Directory Description jlook Project name src/main/java Java sources directory for platform src/test/java Java sources directory for JUnit test src/main/resource Resources directory for platform domain Hibernate mapping configuration directory for domain hibernate Hibernate configuration file jdbc Hibernate jdbc properties file properties Environment properties file spring Spring configuration directory template Hibernate configuration template file velocity Velocity properties file bin Ant build file
  • 5. JAVA PACKAGE STRUCTURE Package Structure jlook.framework domain Domain object package account User, group, domain objects annotation jclass, jattr annotation class batch Batch domain objects common Common service domain objects – menu, announcement docs Value object for API documentation metadata Metadata domain objects – JClass, JAttribute, JType management Management domain objects - JAccessLog model UI value object for client application security Security domain objects – JRole, JDataAccessRule, JMenuAccessRule util Utility domain object – JArray, JAttachment widget UI widget domain objects – JWidgetDefinition, JWidgetInstance infrastructure Infrastructure components package for application annotation Annotation – GsonExclude, Message batch Batch task class context Thread context for user information gson Google gson utility
  • 6. JAVA PACKAGE STRUCTURE Package Structure jlook.framework infrastructure hibernate Hibernate utility class http http client component jdbc Jdbc base class for repository component junit Junit utility class loader Metadata loading classes security Security classes - JUserEntity tools Generator classes – Hibernate config, API Documentation task Multi threaded tasking classes util Utility classes web Web servlet and filter classes interfaces Interfaces package account Account interfaces – domain, user, group common Common service interfaces – menu, announcement metadata Metadata interfaces – JClass, JAttribute, JType security Security interfaces – role, access rules utility Utility interfaces – array, attachment
  • 7. JAVA PACKAGE STRUCTURE Package Structure jlook.framework repository Repository interface package impl Repository implementation class package service Service interface package action JClass Action classes impl Service implementation class package util Service utility classes
  • 8. SYSTEM DOMAIN OBJECT §  Table에 Entity value object를 정의한 것으로 모든 Domain object는 JObject로 부터 상속을 받 아 정의된다. §  Member variables for JObject domain class §  objectId : 한 Table내에서 entity를 식별하는 Id §  classId : Table를 식별하는 Id §  domainId : Domain을 식별하는 Id §  createdBy : Enttiy를 등록한 JUser objectId §  createdOn : Entity를 등록한 일시 §  updatedBy : Entity를 변경한 JUser objectId §  updatedOn : Entity를 변경한 일시 §  Domain annotation : system domain object들의 metadata 를 등록하기 위해 domain object 의 metadata를 annotation으로 정의한다. §  jclass : system domain object에 대한 JClass metadata 정보를 정의하는 annotation §  jattr : system domain object의 Member Variable에 대한 JAttribute metadata 정보를 정의하 는 annotation
  • 9. SYSTEM DOMAIN OBJECT @jclass(cid=JMetaKeys.JOBJECT, did=JDomainDef.SYSTEM_ID, name=JObject.NAME, type=JClassType.INTERFACE_TYPE, status=JMetaStatus.NONE_TYPE) public class JObject implements Serializable, Comparable<JObject> { public static final String NAME = "JObject”; public static final String A_OID = "objectId"; public static final String A_CID = "classId"; public static final String A_DID = "domainId"; public static final String A_CREATED_BY = "createdBy"; public static final String A_CREATED_ON = "createdOn"; public static final String A_UPDATED_BY = "updatedBy"; public static final String A_UPDATED_ON = "updatedOn"; @jattr(name=A_OID, label="Object Id", type=JPrimitive.LONG_TYPE, length=15, description="Object Id", required=true, unique=true, searchable=true, derived=true) protected Long objectId; @jattr(name=A_CID, label="Class Id", type=JPrimitive.LONG_TYPE, length=15, description="Class Id", required=true, unique=false, searchable=true, derived=true) protected Long classId; @jattr(name=A_DID, label="Domain Id", type=JPrimitive.LONG_TYPE, length=15, description="Domain Id", required=true, primary=true, unique=false, searchable=true, derived=true) protected Long domainId; @jattr(name=A_CREATED_BY, label="CreatedBy", type=JPrimitive.LONG_TYPE, length=15, description="CreatedBy", required=true, unique=false, searchable=true, derived=true) protected Long createdBy; @jattr(name=A_CREATED_ON, label="CreatedOn", type=JPrimitive.TIMESTAMP_TYPE, description="CreatedOn", required=true, unique=false, searchable=true, derived=true) protected Timestamp createdOn; @jattr(name=A_UPDATED_BY, label="UpdatedBy", type=JPrimitive.LONG_TYPE, length=15, description="UpdatedBy", required=false, unique=false, searchable=true, derived=true) protected Long updatedBy; @jattr(name=A_UPDATED_ON, label="UpdatedOn", type=JPrimitive.TIMESTAMP_TYPE, description="UpdatedOn", required=false, unique=false, searchable=true, derived=true) protected Timestamp updatedOn;
  • 10. HIBERNATE DOMAIN CONFIGURATION §  Hibernate domain configuration에는 Database Table과 Domain object간의 mapping 정보 를 정의한다. §  System domain object에 대한 Hibernate domain configuration파일은 resource/framework/ domain Directory 밑에 정의한다. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping SYSTEM "classpath://hibernate-mapping-3.0.dtd"> <hibernate-mapping package="jlook.framework.domain.metadata"> <class name="JClass" table="JCLASS"> <id name="objectId" column="OBJECTID"> <generator class="native"/> </id> <property name="classId" type="long" column="CLASSID" insert="true"/> <property name="domainId" type="long" column="DOMAINID"/> <property name="name" type="string” column="NAME” length="4000” not-null="true"/> <property name="label" type="string" column="LABEL” length="4000”/> <property name="description” type="string" column="DESCRIPTION" length="4000”/> <property name="category" type="string" column="CATEGORY” length="4000”/> <property name="type" type="string" column="TYPE” length="4000”/> <many-to-one name="inheritanceJClass” class="Jclass” column="INHERITANCEJCLASS” lazy="false"/> <property name="inheritanceType” type="string” column="INHERITANCETYPE” length="4000”/> <property name="actionClass" type="string" column="ACTIONCLASS” length="4000”/> <property name="summaryFilter" type="string" column="SUMMARYFILTER” length="4000”/> <property name="JObjectRule" type="string" column="JOBJECTRULE” length="4000”/> <property name="accessRule" type="string" column="ACCESSRULE" length="9" />
  • 11. HIBERNATE DOMAIN CONFIGURATION <property name="status" type="string" column="STATUS” length="4000”/> <property name="createdBy" type="long" column="CREATEDBY” insert="true"/> <property name="createdOn" type="timestamp” column="CREATEDON” insert="true"/> <property name="updatedBy" type="long" column="UPDATEDBY” update="true"/> <property name="updatedOn" type="timestamp” column="UPDATEDON" update="true"/> <map name="JAttributes" lazy="false" cascade="none" inverse="true"> <key column="JCLASS"/> <map-key column="NAME" type="string"/> <one-to-many class="JAttribute"/> </map> </class> </hibernate-mapping> resource/spring/context-persistence.xml
  • 12. REPOSITORY LAYER §  Database에 Access하기 위한 Repository Component를 HibernateRepository로부터 상속을 받아 정의한다. package jlook.framework.repository.impl; @Repository(JGenericRepository.ID) public class JGenericRepositoryImpl extends HibernateRepository implements JGenericRepository { private static Log logger = Log.getLog(JGenericRepositoryImpl.class); @Override public Map<String, Object> selectSummaryData(String entityName, String filter, PageUtil page, Map<String,String[]> attrMap,List<String> parentAttrList, JObject parentJObject) throws JRepositoryException { Session session = this.template.getSessionFactory().getCurrentSession(); §  Hibernate Template을 이용하여 Database에 Access하는 Logic을 구현한다. HibernateRepository HibernateTemplate setSessionFactory(SessionFactory sessionFactory) setJContextFactory(JContextFactory jContextFactory) JGenericRepository getDomainId() isAdministrator() JContextFactory JGenericRepositoryImpl
  • 13. SERVICE LAYER §  Service Component는 Repository를 이용해서 Business Logic을 구현하고, Transaction 처 리를 한다. package jlook.framework.service.impl; @Transactional(readOnly = true, rollbackForClassName={GlobalKeys.SERVICE_EXCEPTION, "org.hibernate.exception.ConstraintViolationException", "org.springframework.dao.DataIntegrityViolationException"}) @Service(JGenericService.ID) public class JGenericServiceImpl implements JGenericService { @Override @PreAuthorize("hasPermission(#jObject, 'create')") @Transactional(readOnly = false, propagation = Propagation.REQUIRED) public JResultModel create(JObject jObject) throws JServiceException { JUserEntity entity = security.getUserEntity(); if(jObject.getClassId()==null) { throw new JServiceException("classId is not setted. - "+jObject); }
  • 14. SECURITY SERVICE §  로그인한 사용자 정보를 얻고, domainId 및 client type 정보를 얻는 API를 제공한다. package jlook.framework.service.impl; @Transactional(readOnly = true, rollbackForClassName={GlobalKeys.SERVICE_EXCEPTION}) @Service(JSecurityService.ID) public class JSecurityServiceImpl implements JSecurityService, UserDetailsService { package jlook.framework.service.impl; @Transactional(readOnly = true, rollbackForClassName={GlobalKeys.SERVICE_EXCEPTION, "org.hibernate.exception.ConstraintViolationException", "org.springframework.dao.DataIntegrityViolationException"}) @Service(JGenericService.ID) public class JGenericServiceImpl implements JGenericService { @Resource(name=JSecurityService.ID) private JSecurityService security; @Override @PreAuthorize("hasPermission(#classId, {'read'})") public JSummaryModel getSummaryData(JViewType jViewType, Long classId, PageUtil page, Map<String, String[]> paramMap) throws JServiceException { JUserEntity entity = security.getUserEntity();
  • 15. INTERFACE LAYER §  Client의 Request를 받아 Business Service를 실행하고 spring ModelAndView 객체를 생성하 여 반환하는 Logic을 정의한다. @RequestMapping(value = "/generic/references", method = RequestMethod.GET) public ModelAndView getReferences( @RequestHeader(value=JHeader.JCONTENT_TYPE, required=false) String contentType, @RequestParam(value=ParamKeys.CLASS_ID, required=true) Long classId) throws JControllerException { Map<Long, String> map; try { map = this.jClassService.getReferences(classId); } catch (JServiceException e) { throw new JControllerException("Fail to get references for JClass. - "+classId,e); } JContentType jContentType = JContentType.getJContentType(contentType); ModelAndView mview = jContentType.create("generic/references"); mview.addObject(JResultModel.DATA_KEY, map); return mview; }
  • 16. METADATA LOADER §  Platform이 실행되기 위해 System Metadata를 초기에 Loading해야 하는 Component §  Package : jlook.framework.infrastructure.loader §  EnumLoader : System Metadata에서 사용하는 Enumeration Validation을 Loading함. §  MetataLoader : Domain Object에 정의한 Annotation을 Metadata Table에 Loading함. §  InitDataLoader : metadata package에 System Application을 구성하기 위한 Metadata를 정 의한 Enum으로 부터 Metadata를 Loading함. §  ViewLoader : Loading된 JClass Metadata로 부터 각 JClass의 System default JView를 생 성함. §  Metadata Reloading API – MainController : /metadata/load @RequestMapping(value = "/metadata/load", method = RequestMethod.GET) public String loadMetadata(HttpServletRequest request, HttpServletResponse response) throws JControllerException { JSessionFactoryBean bean = (JSessionFactoryBean)ApplicationContextHolder.getBean("&mySessionFactory"); bean.dropDatabaseSchema(); bean.createDatabaseSchema(); ry { this.enumLoader.setDataLoadEnabled(true); this.enumLoader.doInit(); this.metadataLoader.setDataLoadEnabled(true); this.metadataLoader.doInit(); this.dataLoader.setDataLoadEnabled(true); this.dataLoader.doInit();
  • 17. METADATA LOADER this.viewLoader.setDataLoadEnabled(true); this.viewLoader.doInit(); return "redirect:/"; } catch(Exception e) { throw new JControllerException("Cannot load metadata. - "+e.getMessage(), e); } } §  Source Review §  EnumLoader.java §  InitDataLoader.java §  MetadataLoader.java §  JMenuDef.java
  • 18. GSON COMPONENT §  JSon Response message를 생성하는 Google gson API를 Wrapper한 Class로 Response Message를 customization하는 Logic을 정의할 수 있다. è jlook.framework.infrastructure.gson.GsonFactory §  JSon Mview에서 Response Value object를 JSon Message로 convert하기 위해 사용한다. Object obj = model.get(JResultModel.DATA_KEY); JResultModel rmodel = null; if(obj instanceof JResultModel) { rmodel = (JResultModel)obj; } else { rmodel = new JResultModel(); rmodel.setData(obj); } Object config = model.get(JResultModel.CONFIG_KEY); if(config instanceof Map) { rmodel.addConfig((Map<String,Object>)config); } if(rmodel.getResult()==null) { rmodel.setResult(JResultModel.SUCCESS); } GsonFactory gsonFactory = (GsonFactory)ApplicationContextHolder.getBean(GsonFactory.ID); Gson gson = gsonFactory.create(); String jsonResult = gson.toJson(rmodel);
  • 19. DYNAMIC VIEW RENDERING §  JViewResolver : spring View Resolver로 jlook-servlet.xml에 configuration되어 있으며, Response View Name에 따라서 해당 View객체를 생성하여 Response Message를 만들어 Response한다. <bean id="jViewResolver" class="jlook.framework.infrastructure.web.view.JViewResolver"> <property name="jaxbModelList" ref="jaxbModelList"/> </bean> @Override public View resolveViewName(String viewName, Locale locale) throws Exception { if(logger.isDebugEnabled()) { logger.debug("--> resolveViewName - "+viewName); } View view = null; if(JSonView.VIEWNAME.equals(viewName)) { view = new JSonView(); } else if(JXmlView.VIEWNAME.equals(viewName)) { view = new JXmlView(this.jaxbModelList); } else if(JFileView.VIEWNAME.equals(viewName)) { view = new JFileView(); } else if(JExcelView.VIEWNAME.equals(viewName)) { view = new JExcelView(); } return view; }
  • 20. DYNAMIC VIEW RENDERING §  jlook.framework.infrastructure.web.view package에 Custom View 정의됨 §  JSonView §  JExcelView §  JFileView §  JXmlView §  Client 요청 시 Header에 setting한 “jlook.content.type”에 따라서 Response Message Type 이 결정된다. @RequestMapping(value = "/admin/environment", method = RequestMethod.GET) public ModelAndView envProperties( @RequestHeader(value=JHeader.JCONTENT_TYPE, required=false) String contentType, @RequestParam(value="name", required=false) String name, @RequestParam(value="value", required=false) String value) throws JControllerException { if(name!=null && value!=null) { environment.setProperty(name,value); } JContentType jContentType = JContentType.getJContentType(contentType); ModelAndView mview = jContentType.create("admin/environment"); mview.addObject(JResultModel.DATA_KEY, environment); return mview; }
  • 21. SERVLET FILTER §  jlook.framework.infrastructure.web.filter package에 두 가지 종류의 System Servlet Filter를 제공함. §  JGlobelFilter : 모든 Request에 대한 Servlet Filter로 로그인한 사용자 정보를 Thread Context Variable에 Setting 하고, Access Log를 남긴다. §  JServiceFilter : /service/*에 대한 요청에 대한 Servlet Filter
  • 22. SPRING SECURITY §  Spring security framework은 web.xml에 아래와 같이 정의된 Filter에 의해 모든 Request에 대 한 Web Resource의 권한 체크가 처리된다. <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> §  Spring security configuration file은 resource/spring/context-security.xml 이다. §  Service Layer business method에서 아래와 같이 Authorization을 Annotation으로 정의할 수 있다. @Override @PreAuthorize("hasPermission(#classId, {'read'})") public JSummaryModel getSummaryData( JViewType jViewType, Long classId, PageUtil page, Map<String, String[]> paramMap) throws JServiceException {
  • 23. SPRING SECURITY §  resource/spring/context-security.xml <global-method-security pre-post-annotations="enabled"> <expression-handler ref="expressionHandler"/> </global-method-security> <http use-expressions="true"> <intercept-url pattern="/service/metadata/load" access="permitAll" /> <intercept-url pattern="/service/testing/**" access="permitAll" /> <intercept-url pattern="/console/**” access="permitAll" /> <intercept-url pattern="/docs/**" access="permitAll" /> <intercept-url pattern="/apidocs/**" access="permitAll" /> <intercept-url pattern="/service/mobile/download" access="permitAll" /> <intercept-url pattern="/service/file/upload" access="permitAll" /> <intercept-url pattern="/service/security/signInFrm" access="permitAll" /> <intercept-url pattern="/service/security/signIn" access="permitAll" /> <intercept-url pattern="/service/security/register" access="permitAll" /> <intercept-url pattern="/service/security/registration" access="permitAll" /> <intercept-url pattern="/service/domain/register" access="permitAll" /> <intercept-url pattern="/service/domain/registration" access="permitAll" /> <intercept-url pattern="/admin/**" access="hasRole('Administrator')" /> <intercept-url pattern="/service/**" access="hasRole('Administrator') or hasRole('User')" /> <form-login login-page="/service/security/signInFrm" authentication-success-handler-ref="authenticationSuccessHandler" authentication-failure-handler-ref="authenticationFailureHandler"/> <logout success-handler-ref="logoutSuccessHandler" invalidate-session="true"/>
  • 24. SPRING SECURITY §  resource/spring/context-security.xml <session-management> <concurrency-control max-sessions="100" error-if-maximum-exceeded="true" /> </session-management> </http> <authentication-manager> <authentication-provider ref="daoAuthenticationProvider"/> jlook.framework.infrastructure.secu </authentication-manager> rity.spring. JPermissionEvaluator <beans:bean id="expressionHandler" class= "org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler"> <beans:property name="permissionEvaluator" ref="jPermissionEvaluator"/> </beans:bean> <beans:bean id="anonymousAuthFilter" class="org.springframework.security.web.authentication.AnonymousAuthenticationFilter"> <beans:property name="key" value="foobar"/> <beans:property name="userAttribute" value="anonymousUser,ROLE_ANONYMOUS"/> </beans:bean> <beans:bean id="anonymousAuthenticationProvider" class="org.springframework.security.authentication.AnonymousAuthenticationProvider"> <beans:property name="key" value="foobar"/> </beans:bean>
  • 25. SPRING SECURITY §  resource/spring/context-security.xml <beans:bean id="daoAuthenticationProvider class="org.springframework.security.authentication.dao.DaoAuthenticationProvider"> <beans:property name="userDetailsService" ref="jSecurityService"/> <beans:property name="passwordEncoder" ref="passwordEncoder"/> </beans:bean> <beans:bean id="logoutSuccessHandler class="jlook.framework.infrastructure.security.spring.SignOutSuccessHandler"> <beans:property name="defaultTargetUrl" value="/service/security/signOut"/> <beans:property name="alwaysUseDefaultTargetUrl" value="true"/> </beans:bean> <beans:bean id="passwordEncoder” class="org.springframework.security.authentication.encoding.ShaPasswordEncoder" > <beans:constructor-arg value="256"/> </beans:bean> <beans:bean id="authenticationSuccessHandler" class="jlook.framework.infrastructure.security.spring.AuthenticationSuccessHandler" > <beans:property name="defaultTargetUrl” value="/service/security/signIn"/> <beans:property name="alwaysUseDefaultTargetUrl" value="true"/> </beans:bean> <beans:bean id="authenticationFailureHandler" class="jlook.framework.infrastructure.security.spring.AuthenticationFailureHandler" > <beans:property name="useForward” value="true"/> <beans:property name="defaultFailureUrl” value="/service/security/signInFrm?singIn_error=true"/> </beans:bean>
  • 30. JCLASSLOADER §  Application Home directory 밑에 classes 디렉토리에 있는 domain class들을 loading하는 ClassLoader로 Web Application ClassLoader를 parent ClassLoader로 갖는다. CLASSPATH 경로의 Class System 들을 Loading하는 JVM ClassLoader ClassLoader Web Application Class들을 WebApplication Loading하는 WAS ClassLoader ClassLoader Custom Domain Class들을 Loading하는 Application JClassLoader ClassLoader
  • 31. ENTITY META MANAGEMENT AbstractSession FactoryBean JConfigLoader Config.xml Hibernate Session JSpringSession Repository Factory FactoryBean JClassLoader Domain class Configuration Hibernate JavaClass JGenericRepository JGenericRepository Generator Generator 1.  Create domain class 2.  Create hibernate config JMetaService 3.  Add config to hibernate Configuration 4.  Build new SessionFactory by hibernate Configuration 5.  Create JView
  • 32. ENTITY LIFECYCLE Mapping entity NONE Change entity Unmapping entity Remapping entity Mapping MAPERROR entity Build Metadata Unmapping entity CREATED UNMAPED Change entity Remapping entity Build Metadata CHANGED REMAPED BUILDERROR
  • 33. ENTITY MAP ACTION q  Mapping entity q  Make java class from metadata q  Make hibernate config from metadata q  Change entity q  Add and remove attribute q  Change attribute : name, type, primary, unique, virtual q  Cannot change : name and category for JClass (CREATED) q  Unmapping entity q  Change status from CREATED to UNMAPPED q  Remapping entity q  Change status from UNMAP to REMAPPED q  Build metadata q  Make java class from metadata for all entities. q  Make hibernate config from metadata for all entities. q  Create and initialize JClassLoader q  Create and initialize JSpringSessionFactoryBean
  • 34. METADATA CHANGE HISTORY q  Change history for JClass and Jattribute q  JClass q  Name, Category q  InheritanceClass, InheritanceType q  JAttribute q  JClass, Name, Type q  Primary, Unique, Virtual