2

작성 및 갱신 메소드에 대한 사용자 정의 파일 시스템 DOA가 두 번 호출되는 이유를 알 수 없으므로 사용자 정의 저장 영역에 동일한 레코드가 두 번 표시됩니다 신장.tridion 저장 영역 확장에서 각각에 대해 작성 및 갱신 메소드가 두 번 호출됩니다

  • 생성/업데이트 메소드가 두 번 호출됩니다. 데이터베이스에 저장되는 각각에 대해 두 페이지를 게시 할 때.
  • 제거는

내가 클래스 코드 아래에 있습니다 (페이지가 괜찮 게시 취소, 하나의 레코드 만 그러나 모든 페이지를 게시 취소 후, 다음에 출판이 특정 페이지에 대한 실패지고, 데이터베이스에 삽입지고) 구성 요소 및 바이너리 작성된 페이지와 같은 처리를위한 :

package com.tridion.storage.dao; 

import java.io.File; 

import com.tridion.broker.StorageException; 
import com.tridion.data.CharacterData; 

import com.tridion.storage.PageMeta; 
import com.tridion.storage.StorageManagerFactory; 
import com.tridion.storage.StorageTypeMapping; 
import com.tridion.storage.filesystem.FSEntityManager; 
import com.tridion.storage.filesystem.FSPageDAO; 

import org.slf4j.Logger; 
import org.slf4j.LoggerFactory; 

public class FSPageContentDAOExtension extends FSPageDAO implements PageDAO 
{ 
    private static Logger log = LoggerFactory.getLogger(FSPageContentDAOExtension.class); 

    public FSPageContentDAOExtension(String storageId, String storageName, File storageLocation) 
    { 
     super(storageId, storageName, storageLocation);  
     log.debug("Entering Constructor 1: FSPageContentDAOExtension(" + storageId + "," + storageLocation.getPath() + "," + storageName + ")"); 
    } 

    public FSPageContentDAOExtension(String storageId, String storageName, File storageLocation, FSEntityManager entityManager) { 
     super(storageId, storageName, storageLocation, entityManager); 
     log.debug("Entering Constructor 2: FSPageContentDAOExtension(" + storageId + "," + entityManager.toString() + "," + storageLocation.getPath() + "," + storageName + ")"); 
    } 


    public void create(CharacterData page, String relativepath) throws StorageException 
    { 
     super.create(page,relativepath);  

     log.info("Inside the Create"); 
     log.info("storageId.toLowerCase()-"+storageId.toLowerCase()); 

     try 
     { 
       log.info("Inside the Create - page.getPublicationId():"+page.getPublicationId()+"--"+relativepath); 
       ItemDAO item = (ItemDAO) StorageManagerFactory.getDAO(page.getPublicationId(),StorageTypeMapping.PAGE_META); 
       log.info("Inside the Create - item:"+item.getBindingName()); 
       if(item !=null) 
       {  
        log.info("Inside the Create - PageMeta:"); 
        PageMeta pageMeta = (PageMeta) item.findByPrimaryKey(page.getPublicationId(),page.getId()); 
        log.info("Inside the Create - PageMeta2:"+pageMeta.getFileName()); 
        if(pageMeta!=null) 
        { 
         log.info("Create - PageMeta-"+pageMeta.getTitle()); 
         int publicationId = pageMeta.getPublicationId(); 
         String strIgnorePubIds = "232,481"; 
         String pubId = Integer.toString(publicationId); 
         if(!strIgnorePubIds.contains(pubId)) 
         { 
          String url = pageMeta.getUrl(); 
          String tcmURI = Integer.toString(pageMeta.getItemId()); 
          PublishActionDAO publishActionDAO = (PublishActionDAO) StorageManagerFactory.getDefaultDAO("PublishAction"); 
          if(publishActionDAO !=null) 
          { 
           PublishAction publishAction = new PublishAction();   
           publishAction.setAction("ADD"); 
           publishAction.setPublicationID(publicationId); 
           publishAction.setUrl(url); 
           publishAction.setLastPublishedDate(pageMeta.getLastPublishDate()); 
           publishAction.setItemType(64); 
           publishAction.setTcmUri(tcmURI); 
           log.debug("Going to Store bean -"+ publishAction.toString()); 
           publishActionDAO.store(publishAction); 
           createFlag = false; 
          } 

         } 
        } 
       }   
     } 
     catch (StorageException se) 
     {   
      log.error("FSPageContentDAOExtension - Exception occurred " + se); 
     } 
    } 

    public void update(CharacterData page,String originalRelativePath, String newRelativepath)throws StorageException { 
     super.update(page,originalRelativePath,newRelativepath);; 
     log.info("Inside the Update"); 
     log.info("storageId.toLowerCase()-"+storageId); 

     try 
     { 

       log.info("Inside the Update - page.getPublicationId():"+page.getPublicationId()+"--"+originalRelativePath+"--"+newRelativepath); 
       ItemDAO item = (ItemDAO) StorageManagerFactory.getDAO(page.getPublicationId(),StorageTypeMapping.PAGE_META); 
       log.info("Inside the Update - item:"+item.getBindingName()); 
       if(item !=null) 
       {  
        log.info("Inside the Update - PageMeta:"); 
        PageMeta pageMeta = (PageMeta) item.findByPrimaryKey(page.getPublicationId(),page.getId()); 
        log.info("Inside the Update - PageMeta2:"+pageMeta.getFileName()); 
        if(pageMeta!=null) 
        { 
         log.info("Update - PageMeta-"+pageMeta.getTitle()); 
         int publicationId = pageMeta.getPublicationId(); 
         String strIgnorePubIds = "232,481"; 
         String pubId = Integer.toString(publicationId); 
         if(!strIgnorePubIds.contains(pubId)) 
         { 
          String url = pageMeta.getUrl(); 
          String tcmURI = Integer.toString(pageMeta.getItemId()); 
          PublishActionDAO publishActionDAO = (PublishActionDAO) StorageManagerFactory.getDefaultDAO("PublishAction"); 
          if(publishActionDAO !=null) 
          { 
           PublishAction publishAction = new PublishAction();   
           publishAction.setAction("UPD"); 
           publishAction.setUrl(url); 
           publishAction.setPublicationID(publicationId); 
           publishAction.setLastPublishedDate(pageMeta.getLastPublishDate()); 
           publishAction.setItemType(64); 
           publishAction.setTcmUri(tcmURI); 
           log.debug("Going to Store bean -"+ publishAction.toString()); 
           publishActionDAO.store(publishAction); 
           createFlag = false; 
          }      
         } 
        } 
       } 
     } 
     catch (StorageException se) 
     {   
      log.error("FSPageContentDAOExtension - Exception occurred " + se); 
     } 

    } 

    public void remove(final int publicationId, final int pageID, final String relativePath) throws StorageException { 

     log.info("Inside the Delete");  
     try 
     { 

       ItemDAO item = (ItemDAO) StorageManagerFactory.getDAO(publicationId,StorageTypeMapping.PAGE_META); 
       if(item !=null) 
       {  
        PageMeta pageMeta = (PageMeta) item.findByPrimaryKey(publicationId,pageID); 

        if(pageMeta!=null) 
        { 
         log.info("Delete - PageMeta-"+pageMeta.getTitle());     
         String strIgnorePubIds = "232,481"; 
         String pubId = Integer.toString(publicationId); 
         if(!strIgnorePubIds.contains(pubId)) 
         { 
          String url = pageMeta.getUrl(); 
          String tcmURI = Integer.toString(pageMeta.getItemId()); 
          PublishActionDAO publishActionDAO = (PublishActionDAO) StorageManagerFactory.getDefaultDAO("PublishAction"); 
          if(publishActionDAO !=null) 
          { 
           PublishAction publishAction = new PublishAction();   
           publishAction.setAction("DEL"); 
           publishAction.setUrl(url); 
           publishAction.setLastPublishedDate(pageMeta.getLastPublishDate()); 
           publishAction.setItemType(64); 
           publishAction.setTcmUri(tcmURI); 
           publishAction.setPublicationID(publicationId); 
           log.debug("Going to Store bean -"+ publishAction.toString()); 
           publishActionDAO.store(publishAction); 
          } 

         } 
        } 
       }   
     } 
     catch (StorageException se) 
     {   
      log.error("FSPageContentDAOExtension - Exception occurred " + se); 
     } 
     super.remove(publicationId, pageID, relativePath); 
    } 
} 

내 저장은 다음과 번들 :

<?xml version="1.0" encoding="UTF-8"?> 
<StorageDAOBundles> 
    <StorageDAOBundle type="persistence"> 
     <StorageDAO typeMapping="PublishAction" class="com.tridion.storage.dao.JPAPublishActionDAO" /> 
    </StorageDAOBundle> 

    <StorageDAOBundle type="filesystem"> 
    <StorageDAO typeMapping="Binary" class="com.tridion.storage.dao.FSBinaryContentDAOExtension" /> 
    </StorageDAOBundle> 

    <StorageDAOBundle type="filesystem"> 
     <StorageDAO typeMapping="Page" class="com.tridion.storage.dao.FSPageContentDAOExtension" /> 
    </StorageDAOBundle> 

    <StorageDAOBundle type="filesystem"> 
     <StorageDAO typeMapping="ComponentPresentation" class="com.tridion.storage.dao.FSComponentContentDAOExtension" /> 
    </StorageDAOBundle> 
</StorageDAOBundles> 

내 샘플 cd_storage의 XML

<Storages> 
    <StorageBindings> 
     <Bundle src="search_dao_bundle.xml"/> 
    </StorageBindings> 
    <Storage Type="persistence" Id="searchdb" dialect="MSSQL" Class="com.tridion.storage.persistence.JPADAOFactory"> 
     <Pool Type="jdbc" Size="5" MonitorInterval="60" IdleTimeout="120" CheckoutTimeout="120" /> 
     <DataSource Class="com.microsoft.sqlserver.jdbc.SQLServerDataSource"> 
      <Property Name="serverName" Value="*****" /> 
      <!--Property Name="portNumber" Value="1433" /--> 
      <Property Name="databaseName" Value="**********" /> 
      <Property Name="user" Value="*****" /> 
      <Property Name="password" Value="********" /> 
     </DataSource> 
    </Storage> 

    <Storage Type="filesystem" Class="com.tridion.storage.filesystem.FSDAOFactory" Id="defaultFile" defaultFilesystem="false"> 
     <Root Path="F:\test.com New" /> 
    </Storage> 
    <Storage Type="filesystem" Class="com.tridion.storage.filesystem.FSDAOFactory" Id="defaultDataFile" defaultFilesystem="true" defaultStorage="true"> 
     <Root Path="F:\test.com New\data" /> 
    </Storage> 
</Storages> 
<ItemTypes defaultStorageId="defaultdb" cached="false"> 
     <Item typeMapping="PublishAction" cached="false" storageId="searchdb" />  
     <Item typeMapping="Query" storageId="defaultdb"/> 
     <Item typeMapping="SearchFilter" storageId="defaultDataFile"/> 
     <Item typeMapping="XSLT" cached="false" storageId="defaultDataFile"/> 
     <Item typeMapping="ComponentPresentation" itemExtension=".Jsp" cached="false" storageId="defaultDataFile"/> 
     <Item typeMapping="ComponentPresentation" itemExtension=".Asp" cached="false" storageId="defaultDataFile"/> 
     <Item typeMapping="ComponentPresentation" itemExtension=".Xml" cached="false" storageId="defaultDataFile"/> 
     <Item typeMapping="ComponentPresentation" itemExtension=".txt" cached="false" storageId="defaultDataFile"/> 
     <Item typeMapping="Schema" cached="false" storageId="defaultDataFile"/> 
     <Item typeMapping="Page" cached="false" storageId="defaultFile"/> 
     <Item typeMapping="Binary" cached="false" storageId="defaultFile"/> 
</ItemTypes>  
+0

수퍼 클래스의 업데이트 메서드가 제거와 만들기의 조합으로 구현 될 수 있습니까? – Quirijn

+0

@Quirijn, FSPageDAO 클래스 및 PageDAO 인터페이스에서 어떤 구현도 볼 수 없기 때문에 수퍼 클래스를 고맙게 생각합니다. 그냥 확장한다면 알 수 있습니다. 그러나 PublishActionDAO도 super.create를 호출합니다. –

+0

안녕하세요. 당신은 코드가 두 번 호출된다고 언급했습니다. 통화가 가까이에 있는지, 아니면 그 사이에 다른 많은 일들이 일어나고 있는지 아십니까? 귀하의 경우 Tridion Deployer가 저장소의 무결성을 보장하기 위해 페이지를 두 번 쓸 가능성이 있습니다. –

답변

1

내 사용자 정의 테이블에 삽입하기 두 개의 레코드 우리가 우리의 프리젠 테이션 서버에 구현 된 두 개의 사용자 정의 페이지 배포자 확장자가있는 것이 었습니다 이유.

그래서 배포자는 모두 기본 클래스 FSPageDAO 및 PageDAO의 인터페이스 메소드를 호출합니다.

위의 문제는 DAO에서 기본 클래스를 호출하는 제한을 처리 할 수있는 코드가있는 경우에만 해결할 수 있습니다.

그렇지 않으면 서버에 구현 된 확장 프로그램 확장 프로그램이있는 경우이를 제어 할 수있는 방법이 없습니다.

가능한 경우 DAO에서 확인하고 제어 할 수 있다면 제안 해주세요.

감사합니다.

+0

어떤 종류의 배포자 확장 프로그램에 대해 이야기하고 있습니까? 커스텀 전개 자 모듈? 아니면 프로세서? 또는 다른 것? – Quirijn

+0

안녕하세요 Quirijin, 맞춤 배포자 모듈 –

+0

페이지 dao가 한 번만 호출되도록 맞춤 모듈을 다시 작성할 수 없습니까? 또한 작동하지 않는다면 페이지를 업데이트하여 업데이트를 인식하고 올바르게 처리 할 수 ​​없습니까? – Quirijn