PUBLIC - Liferay Portal Community Edition
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-30554

Deploy Listener hook that allows plugins to hook into deploy events before and after an event has occurred

    Details

    • Branch Version/s:
      6.1.x
    • Similar Issues:
      Show 3 results 

      Activity

      Hide
      Brian Chan added a comment -

      Added a new class in the deploy-listener-shared.jar called BaseDeployListenerMessageListener

      To use it, make sure your plugin "requires" deploy-listener-hook in liferay-plugin-package.properties

      Then add the deploy-listener-shared.jar (manually) or automatically via build.xml's

      <property name="import.shared" value="deploy-listener-shared" />

      Note the automatic method will only work from Liferay's actual plugins SDK (not just the skeleton SDK) because it's looking for the source to deploy-listener-shared (will make it smart enough to fetch from the Internet / Github later).

      Then write a class that extends BaseDeployListenerMessageListener

      Overwrite the methods you want:

      public void onAfterDeploy(Message message) throws Exception {
      }

      public void onAfterRedeploy(Message message) throws Exception {
      }

      public void onAfterUndeploy(Message message) throws Exception {
      }

      public void onBeforeDeploy(Message message) throws Exception {
      }

      public void onBeforeRedeploy(Message message) throws Exception {
      }

      public void onBeforeUndeploy(Message message) throws Exception {
      }

      Wire it in messaging-spring.xml with the proper context destination:

      <bean id="messageListener.deploy_listener" class="com.liferay.so.messaging.DeployListenerMessageListener" />

      ...

      <entry key="liferay/deploy_listener/so-portlet">
      <list value-type="com.liferay.portal.kernel.messaging.MessageListener">
      <ref bean="messageListener.deploy_listener" />
      </list>
      </entry>

      ..

      That's the sample from SO to allow us to add logic when uninstalling SO.

      See https://github.com/brianchandotcom/liferay-plugins/commit/1dd74edd4d28a850b8e9be4cba7f93b8484c74e5

      for how it was added and used.

      Show
      Brian Chan added a comment - Added a new class in the deploy-listener-shared.jar called BaseDeployListenerMessageListener To use it, make sure your plugin "requires" deploy-listener-hook in liferay-plugin-package.properties Then add the deploy-listener-shared.jar (manually) or automatically via build.xml's <property name="import.shared" value="deploy-listener-shared" /> Note the automatic method will only work from Liferay's actual plugins SDK (not just the skeleton SDK) because it's looking for the source to deploy-listener-shared (will make it smart enough to fetch from the Internet / Github later). Then write a class that extends BaseDeployListenerMessageListener Overwrite the methods you want: public void onAfterDeploy(Message message) throws Exception { } public void onAfterRedeploy(Message message) throws Exception { } public void onAfterUndeploy(Message message) throws Exception { } public void onBeforeDeploy(Message message) throws Exception { } public void onBeforeRedeploy(Message message) throws Exception { } public void onBeforeUndeploy(Message message) throws Exception { } Wire it in messaging-spring.xml with the proper context destination: <bean id="messageListener.deploy_listener" class="com.liferay.so.messaging.DeployListenerMessageListener" /> ... <entry key="liferay/deploy_listener/so-portlet"> <list value-type="com.liferay.portal.kernel.messaging.MessageListener"> <ref bean="messageListener.deploy_listener" /> </list> </entry> .. That's the sample from SO to allow us to add logic when uninstalling SO. See https://github.com/brianchandotcom/liferay-plugins/commit/1dd74edd4d28a850b8e9be4cba7f93b8484c74e5 for how it was added and used.
      Hide
      Michael Saechang added a comment -

      Committed on:
      Plugins 6.1.x GIT ID: 356fbe7a04b7a1d66b2a9a560cf866f68cc20bcd.
      Plugins 6.2.x GIT ID: 7aecb7ccba4d1be72c01bf08cd86932deb5cd04c.

      Show
      Michael Saechang added a comment - Committed on: Plugins 6.1.x GIT ID: 356fbe7a04b7a1d66b2a9a560cf866f68cc20bcd. Plugins 6.2.x GIT ID: 7aecb7ccba4d1be72c01bf08cd86932deb5cd04c.

        People

        • Votes:
          0 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved:

            Development

              Structure Helper Panel