Does register my custom cluster selection strategy need to compile source code? - orientdb

I see the doc2.1.x describe the custom cluster selection strategy as follows:
that Register the implementation as a service. You can do this by creating a new file under META-INF/service. Use the filename com.orientechnologies.orient.core.metadata.schema.clusterselection.OClusterSelectionStrategy. For its contents, code your class with the full package.
Does it mean I must modify source code project, compile and publish?

Yes, you must modify the source code project and compile.
I have followed the docs http://orientdb.com/docs/2.1/Cluster-Selection.html#custom-cluster-selection-strategies
and it works.

Related

How to create a custom annotation processor for Eclipse

I'm trying to create a custom annotation processor that generates code at compilation time (as hibernate-jpamodelgen does). I've looked in the web, and I find custom annotation processors that works with maven, but do nothing when added to the Annotation Processing > Factory Path option. How could I create a processor compatible in this way? I have not found a tutorial that works.
My idea is to, for example, annotate an entity to generate automatically a base DTO, a base mapper, etc that can be extended to use in the final code.
Thank you all
OK, Already found out the problem. The tutorial I hda found out dint't specified that, in order to the compiler to be able to apply the annotation processor, there must be a META-INF/services/javax.annotation.processing.Processor file that contains the qualified class name of the processor (or processors).
I created the file pointing to my processor class, generated the jar and added it to Annotation Processing > Factory Path and all worked correctly.
Just be careful to keep the order of the processors correctly (for example, hibernate model generator claims the classes, so no more generation will be made after it), and change the jar file name each time you want to replace the library (it seems eclipse keeps a cache). These two things have given me a good headache.
Thanks all

Use ResourceSet within another Plugin

I use a xtext generated DSL in my project. I now want to generate some files with a wizard. I can currently create these files just by adding some strings to the file. But initially i wanted to create a Model Object of the DSL and add the new generated file to the resource set. I can't find a way accessing this without the StandaloneSetup of the DSL.
I'm now unsure if the use of the StandaloneSetup inside the Editor is the correct way, since it seems there should be a better way to access the already build up resource set used by the xtext framework to manage the already known files/sources. If i use the StandaloneSetup shouldn't there be 2 Injectors which could get really bad?
you can use the resource service provider registry to obtain the injector
http://koehnlein.blogspot.de/2012/11/xtext-tip-how-do-i-get-guice-injector.html
URI fakeOrRealUri = ...;
IResourceServiceProvider.Registry.INSTANCE.getResourceServiceProvider(fakeOrRealUri).get()

xtend2 code generation with ecore meta-model

I created an ecore-Metamodel, a genmodel and a corresponding model.
Now I want to generate Code from this.
I found this post and wanted to implement it. I get no errors and so on, but how do I bring the CodeGenerator to generate the wanted output in a File like 'test.txt' (taken that example from the referenced question)?
Do I require a workflow file (mwe2) or do I miss something?
I only needed to run the application as Java and the code worked. I don't need any workflow or mwe2!
But appearently I still cant create the files like I can with a Generator.
I just can use a simple filewriter.

How to create logic hook in sugarcrm when we create a module through module builder

I create a module Acquisitions through module builder and now want to make some calculations for some fields.i have no clue how to create a logic hook and where to create this logic hook. please tell me the full path and procedure for this.
I have this very problem. Unfortunately it's not possible because when you you deploy the package in Module Builder, the custom folder gets overwritten and that's exactly where the logic_hook file needs to be.
Even the fact that there is a parameter called "logic_hooks" for that manifest.php install_def, it still doesn't seem to work when the logic_hook you want to add is part of package you are deploying (Yes, that's very annoying).
I posted about this on the sugar forum, you can see more details #: http://www.sugarcrm.com/forums/f6/module-builder-deploy-deletes-my-logic_hook-php-76402/
See question 4196257 for using logic hooks.
You can create a logic hook under Custom folder so it will be safe upgrade
/custom/modules//logic_hooks.php
For understanding the logic hook you can follow this link
Logic hook
I hope this Will help you
1­Custom/modules/\logic_hooks.php
logic_hooks.php
Descriptions­
1­ ­: Array Index
/Leads/logichooks_class.php ­­:Logic hooks Class File path
ogic_hooks_class­:Logic_hooks Class Name
before_save_method­­:Logic Hooks class Method Name
Logichooks_class.php
id."' ";
}
?>

Error with Groovy AST transformations when cleaning project in Eclipse

I'm trying to work through groovy's Implementing Local AST Transformations tutorial, but whenever I clean my project I get this error in each file that has the #WithLogging annotation in it:
Groovy:Could not find class for Transformation Processor AC.LoggingASTTransformation declared by AC.WithLogging
So you have a package named "AC" that contains both "WithLogging.groovy" and "LoggingASTTransformation.groovy" classes? Does it also contain any classes that implement the "WithLogging" interface?
If so, I'd suggest you move the class(es) that use your annotation to a location outside of the annotation defining package (the default will suffice, for diagnostic purposes) - Order of compilation matters with transformations. See this post on the groovy users mailing list for more on that.
Also try changing the annotation from #WithLogging to #AC.WithLogging.
As far as cleaning with Eclipse is concerned, I had a similar issue and found that I had to make a trivial modification after a clean to any file that contained my annotation. IE, add a space somewhere. Then save the file. This should rebuild everything properly.