I want to do following operation by using Storage Extension
- When DCP is published, DCP is stored to Broker DB as usual.
- After that, extract some data from DCP and store it to another custom DB by Storage Extension.
But when I ran a test program of Storage Extension, the test program was executed but DCP was not stored to Broker DB. It seems Storage Extension program totally overrides existing behavior.
Is it possible to run Storage Extension program without changing exsting behavior? If it's possible, how can I do that?
package com.tridion.storage.extension;
@Component("JPAComponentPresentationDAOImpl")
@Scope("prototype")
public class JPAComponentPresentationDAOImpl extends JPABaseDAO
implements ComponentPresentationDAO {
public JPAComponentPresentationDAOImpl(String storageId,
EntityManagerFactory entityManagerFactory,
EntityManager entityManager, String storageName) {
super(storageId, entityManagerFactory, entityManager, storageName);
outputLog("JPAComponentPresentationDAOImpl Constructor 1");
}
public JPAComponentPresentationDAOImpl(String storageId,
EntityManagerFactory entityManagerFactory,
String storageName) {
super(storageId, entityManagerFactory, storageName);
outputLog("JPAComponentPresentationDAOImplConstructor2");
}
/**
* @param args
*/
public static void main(String[] args) {}
public void create(ComponentPresentation componentPresentation,
ComponentPresentationTypeEnum type)
throws StorageException {
outputLog("JPAComponentPresentationDAOImpl create");
try {
outputLog("componentPresentation:" + new String(componentPresentation.getContent(),
"UTF-8"));
} catch (UnsupportedEncodingException e) {
}
}
private static void outputLog(String msg){
try{
File f = new File("C:\\tridion\\log-custom\\InsertAPITest.log");
BufferedWriter bw = new BufferedWriter(new FileWriter(f,true));
bw.write(msg);
bw.newLine();
bw.close();
}catch(IOException e){}
}
}
This is storage DAO bundle configuration file, "JPAComponentPresentationDAOImpl.xml".
<?xml version="1.0" encoding="UTF-8"?>
<StorageDAOBundles>
<StorageDAOBundle type="persistence">
<StorageDAO typeMapping="ComponentPresentation" class="com.tridion.storage.extension.JPAComponentPresentationDAOImpl" />
</StorageDAOBundle>
</StorageDAOBundles>
And those are setting in cd_storage_conf.xml
<StorageBindings>
<Bundle src="undo_dao_bundle.xml"/>
<Bundle src="JPAComponentPresentationDAOImpl.xml"/>
</StorageBindings>
<Item typeMapping="Binary" storageId="defaultFile" cached="false"/>