Package com.dotmarketing.osgi.hooks

Source Code of com.dotmarketing.osgi.hooks.Activator

package com.dotmarketing.osgi.hooks;

import com.dotcms.repackage.org.osgi.framework.BundleContext;
import com.dotmarketing.business.APILocator;
import com.dotmarketing.osgi.GenericBundleActivator;
import com.dotmarketing.portlets.contentlet.business.ContentletAPI;

/**
* Created by Jonathan Gamba
* Date: 6/18/12
*/
public class Activator extends GenericBundleActivator {

    @SuppressWarnings ("unchecked")
    public void start ( BundleContext context ) throws Exception {

        //Initializing services...
        initializeServices ( context );

        //Adding hooks
        addPreHook( Class.forName( SamplePreContentHook.class.getName() ).newInstance() );
        addPostHook( Class.forName( SamplePostContentHook.class.getName() ).newInstance() );

        //Testing the hooks
        ContentletAPI conAPI = APILocator.getContentletAPI();

        Long count = conAPI.contentletCount();
        System.out.println( "+++++++++++++++++++++++++++++++++++++++++++++++" );
        System.out.println( "ContentletAPI.contentletCount() = " + count );
        System.out.println( "+++++++++++++++++++++++++++++++++++++++++++++++" );
    }

    public void stop ( BundleContext context ) throws Exception {
        unregisterServices( context );
    }

}
TOP

Related Classes of com.dotmarketing.osgi.hooks.Activator

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.