-
-
Save nkeiter/340479cf4194aee7eab3 to your computer and use it in GitHub Desktop.
Working Core Override Plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package edu.gettysburg.nkeiter.override.com.dotmarketing.factories.osgi; | |
import com.dotmarketing.factories.EmailFactory; | |
import com.dotmarketing.osgi.GenericBundleActivator; | |
import com.dotmarketing.util.Logger; | |
import org.osgi.framework.BundleContext; | |
public class Activator extends GenericBundleActivator | |
{ | |
@Override | |
public void start( BundleContext bundleContext ) throws Exception | |
{ | |
Logger.info( this, "Got to start( BundleContext )" ); | |
//Initializing services... | |
initializeServices( bundleContext ); | |
//Verify the override. | |
String verification = EmailFactory.verifyOverride(); | |
Logger.info( this, verification ); | |
} | |
@Override | |
public void stop( BundleContext bundleContext ) throws Exception | |
{ | |
Logger.info( this, "Got to stop( BundleContext )" ); | |
//Unpublish bundle services | |
unpublishBundleServices(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'application' | |
apply plugin: 'osgi' | |
apply plugin: 'war' | |
apply plugin: 'eclipse' | |
sourceCompatibility = '1.7' | |
version = '1.0' | |
repositories { | |
maven { | |
url "http://repo.dotcms.com/artifactory/libs-release" | |
} | |
} | |
dependencies { | |
compile fileTree(dir: 'src/main/resources/libs', include: '*.jar') | |
compile (group: 'com.dotcms', name: 'dotcms', version: '2.5.3'){ | |
transitive = true | |
} | |
providedCompile "javax.servlet:servlet-api:2.5" | |
} | |
jar { | |
manifest { | |
name = 'Override of com.dotmarketing.factories.EmailFactory' | |
symbolicName = 'Override of com.dotmarketing.factories.EmailFactory' | |
instruction 'Bundle-Vendor', 'nkeiter' | |
instruction 'Bundle-Description', 'nkeiter - Override of com.dotmarketing.factories.EmailFactory' | |
instruction 'Bundle-DocURL', 'http://www.gettysburg.edu' | |
instruction 'Bundle-Activator', 'edu.gettysburg.nkeiter.override.com.dotmarketing.factories.osgi.Activator' | |
instruction 'Override-Classes', 'com.dotmarketing.factories.EmailFactory' | |
instruction 'DynamicImport-Package', '*' | |
instruction 'Import-Package', '*;version=0' | |
} | |
} | |
task wrapper(type: Wrapper) { | |
gradleVersion = '2.1' | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dotmarketing.factories; | |
... | |
import com.dotmarketing.util.Logger; | |
... | |
public class EmailFactory { | |
... | |
public static String verifyOverride() | |
{ | |
String message = "EmailFactory.verifyOverride() Override of EmailFactory.java verified!"; | |
Logger.info( EmailFactory.class, message ); | |
return message; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment