Sure. Instead of waiting for my testing under 1.7rc2-SNAPSHOT, here's what
I've prepared:
I converted my embedded configuration from XML to Java. Initially I
started with the embedded documentation from the wiki.
Instead of calling:
oserver.startup({server.xml as String});
I called:
oserver.startup(OServerConfiguration conf)
Creating the OServerConfiguration is a little bit of a pain b/c you have to
initialize a bunch of instance variables set or add items to them. In
other words, it's not very pojo like and required a little code
investigation to get a valid OServiceConfiguration object. In any case,
here's the part related to Hazelcast:
OServiceConfiguration config = new OServiceConfiguration();
...
config.handlers = new LinkedList<>();
OServerHandlerConfiguration oServerHandlerConfiguration = new
OServerHandlerConfiguration();
oServerHandlerConfiguration.clazz = ProgrammaticOHazelcastPlugin.class.
getName();
oServerHandlerConfiguration.parameters = new OServerParameterConfiguration[]
{
new OServerParameterConfiguration("nodeName" , “
someNodeName”),
new OServerParameterConfiguration("enabled" ,
"true"),
new OServerParameterConfiguration("configuration.db.default" , “
somedir/default-distributed-config.json"),
new OServerParameterConfiguration("configuration.hazelcast" ,
“somedir/hazelcast.xml"),
new OServerParameterConfiguration("conflict.resolver.impl" ,
"com.orientechnologies.orient.server.distributed.conflict.ODefaultReplicationConflictResolver"
),
new OServerParameterConfiguration("sharding.strategy.round-robin",
"com.orientechnologies.orient.server.hazelcast.sharding.strategy.ORoundRobinPartitioninStrategy"
),
};
ProgrammaticOHazelcastPlugin.class is a custom class that extends
OHazelCastPlugin
and overrides configureHazelcast() just as Luca suggested. Luca's change
was added to git yesterday.
import com.hazelcast.core.HazelcastInstance;
import com.orientechnologies.orient.server.hazelcast.OHazelcastPlugin;
import java.io.FileNotFoundException;
public class ProgrammaticOHazelcastPlugin extends OHazelcastPlugin {
//For 1.7rc2 and above
@Override
protected HazelcastInstance configureHazelcast() throws
FileNotFoundException {
HazelcastInstance instance = ... //create the HazelcastInstance
programmatically according to the hazelcast documentation
return instance;
}
}
I haven't tested it with my HazelcastInstance b/c I'm not ready to test on
1.7rc2-SNAPSHOT but it should work fine.
On Thursday, February 27, 2014 10:13:02 AM UTC-5, [email protected]
wrote:
>
> Hi odbuser,
>
> Can you please share your findings a code sample when done?
>
> Regards,
> -Stefan
>
> On Thursday, 27 February 2014 04:33:06 UTC, odbuser wrote:
>>
>> Awesome. Thanks. I've made my coding changes and will try it as soon as
>> I move to 1.7.
>>
>> On Wednesday, February 26, 2014 5:24:32 PM UTC-5, Lvc@ wrote:
>>>
>>> Hi,
>>> I moved the configuration in a separate (develop branch), protected
>>> method:
>>>
>>> protected HazelcastInstance configureHazelcast() throws
>>> FileNotFoundException {
>>>
>>> Just overwrite it and call your class in orientdb-dserver-config.xml
>>> file.
>>>
>>> Lvc@
>>>
>>>
>>>
>>> On 26 February 2014 22:31, <[email protected]> wrote:
>>>
>>>>
>>>> Bump. Having this work with Zookeeper would be a great addition :)
>>>>
>>>>
>>>> On Wednesday, 26 February 2014 19:47:19 UTC, odbuser wrote:
>>>>>
>>>>> Bump. I would like to have programmatic hazelcast configuration.
>>>>> I'm trying to switch over to programmatic orientdb server.xml's as
>>>>> well.
>>>>>
>>>> --
>>>>
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "OrientDB" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>
>>>
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.