+ Reply to Thread
Results 1 to 7 of 7

Thread: using code from another extension

  1. #1
    Senior Member
    Join Date
    May 2011
    Posts
    146
    Thanks
    2
    Thanked 0 Times in 0 Posts

    using code from another extension

    I have developed two extensions .. one takes care of the login funcitonality and the other one deals with all the games.. I have an api (which contains a controller object acquired through the controller factory) in the games extension which I want to call from the login extension.. from my search it looks like that is not possible.. but i just want to be sure that i am not overlooking anything and is there another way of doing it?

    Thanks!

  2. #2
    Former Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,663
    Thanks
    83
    Thanked 1,162 Times in 1,150 Posts
    Most developers just throw everything into a single extension, because that is much easier. There IS however a way to have one extension ask another extension to do something and return an EsObject. See the PluginInterop example, which shows how the PluginInteropExample plugin can communicate with the DatabasePlugin which is in the DatabaseWithJDBI extension, assuming that other extension is on the same ES5.

    Seriously, it's usually much simpler to just put everything into a single extension.
    Teresa Carrigan
    Senior Software Developer
    Janus Research Group, Inc.
    previously
    Senior Engineer
    Electrotank, Inc.

  3. #3
    Former Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,663
    Thanks
    83
    Thanked 1,162 Times in 1,150 Posts
    When you create the merged extension, it will have a single Extension.xml that has your logout handler, your login handler, your plugins, etc. After deploying that and restarting ES5, you will be able to see it in ES Admin for creating server level components.
    Teresa Carrigan
    Senior Software Developer
    Janus Research Group, Inc.
    previously
    Senior Engineer
    Electrotank, Inc.

  4. #4
    Senior Member
    Join Date
    May 2011
    Posts
    146
    Thanks
    2
    Thanked 0 Times in 0 Posts
    so I got past that error and now everything is in one plugin but my load User query fails now. I have two factories, controller factory and login controller factory. could this be an issue?

  5. #5
    Former Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,663
    Thanks
    83
    Thanked 1,162 Times in 1,150 Posts
    Do your two managed object factories have different names? If so, then there shouldn't be any problem, unless they are both doing database access. Did you deploy the config folder part of the extension?
    Teresa Carrigan
    Senior Software Developer
    Janus Research Group, Inc.
    previously
    Senior Engineer
    Electrotank, Inc.

  6. #6
    Senior Member
    Join Date
    May 2011
    Posts
    146
    Thanks
    2
    Thanked 0 Times in 0 Posts
    they have different names .. i am not sure if they are accessing the db at the same time .. how do i find that out? this is the error that i see in the logs -

    2012-Feb-23 16:31:49:830 [worker-12 BinaryTCP-0] ERROR login.LoginController - com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorEx ception: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'login/sql/LoadUser.sql' at line 1

  7. #7
    Former Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,663
    Thanks
    83
    Thanked 1,162 Times in 1,150 Posts
    If both controllers are doing database work, I would strongly suggest that you merge the code in the two controllers, so that you just have one managed object for all the database accesses. Keeping all your database access code in the same class makes it much easier to maintain. Any other class can then communicate with the database Controller class when it needs to access the database.
    Teresa Carrigan
    Senior Software Developer
    Janus Research Group, Inc.
    previously
    Senior Engineer
    Electrotank, Inc.

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts