is there any any way to override tuleap class file? - tuleap

I have to override tuleap functionality,is there any way to override tuleap core functionality that won't affect tuleap core functions
Thanks

I don't think so.
You should try to do a plugin instead. Overriding core functionalities will obviously affects core functions. You can try to play a bit with inheritance but I definitely don't think this is the way to go.

Related

Discovering koin modules in classpath

I'm designing an application that needs to support different feature sets in different deployments. I would like to build it in such a way that different feature implementations would be packaged into different jars. Depending on the actual jars in the classpath, respective features would be automatically discovered and activated by the microkernel.
I am looking to use Koin as the microkernel framework for the features autodiscovery. I like the fact it is very lightweight, native to Kotlin, and offers a great support for configuration and dependency management.
However, there does not seem to be support in Koin for modules autodiscovery via the classpath, and I wonder if I am missing something and there is a way to have modules automatically picked up?
I'm going to post my own 'pragmatic' solution which does not seem particularly Kotlin-esque, so would welcome welcome suggestions for better way of doing this!
The design I'm using is a classic for Java and relies on java.util.ServiceLoader. Each jar will have a file in /META-INF/services, which will contain a name of a class implementing ModuleProvider interface for that jar. The interface is defined as follows:
interface ModuleProvider {
fun buildModule(): org.koin.core.module.Module
}
My microkernel bootstrapping routine now looks like the following:
fun main() {
val app = startKoin {
environmentProperties() // allow system properties to be injected
modules(ServiceLoader.load(ModuleProvider::class.java).iterator().asSequence().map { it.buildModule() }.toList())
}
// rest of bootstrap
}
This works, but I can't help thinking that there must be a more elegant way, because surely I am not the only one with the need for module autodiscovery. Would appreciate suggestions!

How to override LayoutImpl in Liferay 7?

I want to override methods of LayoutImpl in Liferay 7. I tried with service wrapper but there is no option for this class in the Service Name category.
How can I achieve that? Do I need ModelListener for this?
Hint: A service wrapper is used to wrap services. Services in Liferay are usually named ...Service, like LayoutLocalService.
Conclusion: The class LayoutImpl is no service - thats why you can't wrap it with a service wrapper.
You could wrap LayoutLocalService in a service wrapper, wrap the return values in your LayoutWrapper and unwrap the parameters. But that is troublesome and will prevent Liferay upgrades.
If you want to override LayoutImpl for fixing bugs - you should use an Ext Plugin for that.
A ModelListener can only change the content during updates of an article, not the implementation - I don't think that this will help here.

Can we hot deploy *.xml files by using JREBEL?

Can we hot deploy *.xml files by using JREBEL?
In out project most of work is done through XML and we are planning to use JREBEL for the same.
The short answer:
Yes, you can.
The long answer:
It actually depends on the nature of those XML files, what your application is doing with those files. Are those the configuration files which might be used in order to populate some application specific structures? If so, then those internal structures have to be reinitialized. This is possible either by implementing a plugin for JRebel or by adding a callback method which can be called by JRebel once a class is reloaded.
Could you please provide more details about your use case?

Dynamics CRM 2011 - Does each plugin that related to a different entity have to have it's own assembly?

I am creating a series of related plugins. Each plugin is for a different entity. Does each plugin have to have it's own assembly? I'm using Visual Studio and I created a second project within the same solution but I can't see the new step in registration tool.
Thanks
It can do, but doesn't have to. That is pretty much your design decision. Consider if you had several classes all implementing IPlugin
public class MyFirstPlugin : IPlugin
{
//implemented as per usual
}
public class MySecondPlugin : IPlugin
{
//implemented as per usual
}
If you were to register that DLL in the plugin registration tool, you would see the following structure:
- Server
- DLL
- MyFirdtPlugin
- MySecondPlugin
You can then add steps to each plugin as desired.
The alternative would be to have one plugin per DLL, which would give you
- Server
- DLL1
- MyFirstPlugin
- DLL2
- MySecondPlugin
I must admit it seems like overkill - but it can also depend on how you are using your solutions.
In addition to glosrob's answer, I'm guessing that you're using the plugin registration tool to register your plugin. If so, you'll need to make sure that after you add your new plugin to the same dll, that you update the plugin dll itself with the registration tool, so you can register the new plugin method that you've created.
Yes, you can create each plugin in a different class library project but this is not a good practice. I'd prefer to collect all plugins into one class library.
Note that after selecting your assembly from the File Dialog you have to click on Load Assembly button to load all classes which implement the IPlugin interface.
To answer the question - no, each new plugin doesn't have to be contained in a new assembly.
To elaborate - it's technically possible to put in all the plugin code in just one project and a single file.
To warn - the above would be a nightmare to manage with all the ifs and buts, so it's a good example of can-but-shouldn't.
To suggest - I usually have a separate project for each entity's plugin and handle all the messages using a switch. On occasion, I might have two or three assemblies but you'll know when it's time to do so as you get there. Usually, one DLL is just enough.

ServiceStack Validation - method missing

I am trying to implement validation and in reading:
https://github.com/ServiceStack/ServiceStack/wiki/Validation
I see this method being used. It doesn't seem to be on the Funq container, what am I missing?
//This method scans the assembly for validators
container.RegisterValidators(typeof(UserValidator).Assembly);
If you think a method is missing in ServiceStack it's most likely an extension method. RegisterValidators() is an extension method in the ServiceStack.ServiceInterface.Validation namespace.
You should consider using ReSharper as there as it eliminates a whole class of issues with C# development including locating methods, auto including namespaces, auto referencing of dlls, etc.
Otherwise if for some reason you want to continue without ReSharper you can use the T short-cut looking in the ServiceStack GitHub Repo which helps find files, otherwise use Ctrl+Shift+F to do a solution-wide text search in a local fork of ServiceStack.

Resources