Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Plugin and CLASSPATH
 Post subject: Plugin and CLASSPATH Post rating: 0   New post Posted: Thu 31 Oct, 2013, 11:08 

User rating: 1
Joined: Sun 20 May, 2012, 09:29
Posts: 22
Location: Czech Republic, programmer
Hello API Support team,

Please, add Plugins to JForex platform CLASSPATH.
If I have plugin:
import com.dukascopy.api.IConsole;
import com.dukascopy.api.JFException;
import com.dukascopy.api.plugins.IPluginContext;
import com.dukascopy.api.plugins.Plugin;

public class SimplePlugin extends Plugin {   
   
    private IConsole console;
   
    @Override
    public void onStart(IPluginContext context) throws JFException {
        console = context.getConsole();
        console.getOut().println("Plugin started");
    }

    @Override
    public void onStop() throws JFException {
        console.getOut().println("Plugin stopped");
    }

    public static boolean isTest() {
        return true;
    }

}


I would like to use plugins in strategy
import SimplePlugin;

public class Strategy implements IStrategy {
    public void onStart(IContext context) throws JFException {
        boolean b = SimplePlugin.isTest();
    }
}


Thank you


 
 Post subject: Re: Plugin and CLASSPATH Post rating: 0   New post Posted: Fri 01 Nov, 2013, 14:59 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Plugin is a jar file. Simply import that jar as a library, see:
https://www.dukascopy.com/wiki/#Include_libraries


 
 Post subject: Re: Plugin and CLASSPATH Post rating: 0   New post Posted: Wed 01 Jan, 2014, 13:15 

User rating: 1
Joined: Sun 20 May, 2012, 09:29
Posts: 22
Location: Czech Republic, programmer
API Support wrote:
Plugin is a jar file. Simply import that jar as a library, see:
https://www.dukascopy.com/wiki/#Include_libraries


I know about it and think it is not acceptable.
It is far more convenient to register external library as plugin.

For example, I have 100 strategies which sending emails and in each strategy it is needed to write code as mentioned here https://www.dukascopy.com/wiki/#Send_e-mail.
But if the code above will be written in plugin, then in strategy it is needed to write only

MailPlugin.sendMail("subject", "text");


Can you implement this in JForex platform?


 
 Post subject: Re: Plugin and CLASSPATH Post rating: 0   New post Posted: Thu 02 Jan, 2014, 09:02 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
velldes wrote:
But if the code above will be written in plugin, then in strategy it is needed to write only
MailPlugin.sendMail("subject", "text");
And with our suggested approach you would add an @Library annotation and an import declaration and do the same. What is so inconvenient about this?


 
 Post subject: Re: Plugin and CLASSPATH Post rating: 0   New post Posted: Thu 02 Jan, 2014, 11:53 

User rating: 1
Joined: Sun 20 May, 2012, 09:29
Posts: 22
Location: Czech Republic, programmer
API Support wrote:
And with our suggested approach you would add an @Library annotation and an import declaration and do the same. What is so inconvenient about this?


Approach I suggested is more native extension of JForex API. @Library annotation, I think, is work around in extending API..
I think it would be better to set up default "Recipient mail", "Sender mail" and "SMTP host" in plugin settings page (in one place).
I am not sure if @Library annotation support jfx extension..
Another advantage is less code in strategy.
If I will use in strategy a lot of libraries - annotation will look ugly and not readable.
And plugin easier to distribute.

Email sender is just simple example. Please, imaging more complex extensions.

Thank you.


 
 Post subject: Re: Plugin and CLASSPATH Post rating: 0   New post Posted: Thu 02 Jan, 2014, 15:18 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
velldes wrote:
I am not sure if @Library annotation support jfx extension..
Packaging to jfx file for plugins is optional - you can use them as jar files.
velldes wrote:
If I will use in strategy a lot of libraries - annotation will look ugly and not readable.
If that is an issue, you can package all your libraries into a single jar file archive.


 
 Post subject: Re: Plugin and CLASSPATH Post rating: 0   New post Posted: Thu 02 Jan, 2014, 15:40 

User rating: 1
Joined: Sun 20 May, 2012, 09:29
Posts: 22
Location: Czech Republic, programmer
API Support wrote:
velldes wrote:
I am not sure if @Library annotation support jfx extension..

Packaging to jfx file for plugins is optional - you can use them as jar files.

Actually, I would like to use jfx file.

API Support wrote:
velldes wrote:
If I will use in strategy a lot of libraries - annotation will look ugly and not readable.

If that is an issue, you can package all your libraries into a single jar file archive.

Too much manual work, instead of installing plugin from JStore and use it in strategy.


 

Jump to:  

cron
  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com