Application plugins with parts

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Application plugins with parts

panyasan
Hi,

my app uses plugins to extend its functionality. So far, the plugins aren't really plugins, because they are part of the app's namespace, but will be loaded on-demand as scripts. This creates all kind of problems, for example, the translations cannot be separated from the main app's translations, and the on-demand loading has to be done manually, using the ScriptLoader.

I would like to replace this system with one that uses separate libraries and parts. This seems to be an ideal combination. Creating plugins as qooxdoo libraries separates the development of the main app from the plugins (so that third-parties can create and contribute plugins) and using parts ensures that the app will load only the plugin code that is actually enabled and used by the main app. To be sure, it is still necessary to build the app with all plugins present (in order to create the parts), they cannot be distributed and installed separately without the build step. But that is acceptable, given the obvious advatages that qx libraries/parts provide.

At the moment, I am stuck with an error that I have reported separately here [1]. Maybe someone can figure out what is wrong. The relevant parts of my config.json [2] are:

"jobs" :
  {
      
    "libraries" : 
    {
      "library" :
      [
        ...
        
        // plugins
        { "manifest" : "plugins/csl/Manifest.json" },
        { "manifest" : "plugins/z3950/Manifest.json" },
        { "manifest" : "plugins/isbnscanner/Manifest.json" }

      ]
    },
    
    "parts-config":
    {
      "packages" :
      {
        "parts"  :
        {
          "boot": { "include" : [ "${QXTHEME}", "bibliograph.Application" ] },
          "plugin.csl"          : { "include" : [ "csl.*" ] },
          "plugin.z3950"        : { "include" : [ "z3950.*" ] },
          "plugin.isbnscanner"  : { "include" : [ "isbnscanner.*" ] }
        }
      }
    },
    
   ...
    
    "source" :
    {
      "extend" : [ "parts-config" ]
    },       
    
    ...
    
    "build" :
    {
      "extend" : [ "parts-config" ],
      "compile-options" :
      {
        // don't optimize privates, neccessary because we need to call internal function
        "code" : { "=optimize" : ["variables", "basecalls", "strings"] }
      }
    }
  }
}

Maybe my setup is wrong. I am using qooxdoo v3.5.1. The error occurs in the qx/Part.js, line 253, and a step-by-step debugging showed that the this.__parts array contains one element with value undefined.

Thanks for any advice!

C.



[1] http://qooxdoo.678.n2.nabble.com/qooxdoo-Stacktrace-problems-td7586130.html
[2] https://github.com/cboulanger/bibliograph/blob/master/bibliograph/config.json
Reply | Threaded
Open this post in threaded view
|

Re: Application plugins with parts

Mustafa Sak-5
Hi,

It is not a good advice to use wild cards to determine parts.
You have to understand the include property of parts as an entry point. So just include those classes to your part, where you start to use the library. The generator will do the job to collect all dependencies.

For example:

...
          "plugin.csl"          : { "include" : [ "bibliography.MyClassUsingCSL" ] },
          "plugin.z3950"        : { "include" : [ "bibliography.MyClassUsingz3950",  "bibliography.AnotherClassUsingz3950" ] }
...

Gruß
Mustafa Sak

Applications & Integration

1&1 Internet AG
Ernst-Frey-Straße 10
DE-76135 Karlsruhe

-----Ursprüngliche Nachricht-----
Von: panyasan [mailto:[hidden email]]
Gesendet: Donnerstag, 4. September 2014 08:44
An: [hidden email]
Betreff: [qooxdoo-devel] Application plugins with parts

Hi,

my app uses plugins to extend its functionality. So far, the plugins aren't really plugins, because they are part of the app's namespace, but will be loaded on-demand as scripts. This creates all kind of problems, for example, the translations cannot be separated from the main app's translations, and the on-demand loading has to be done manually, using the ScriptLoader.

I would like to replace this system with one that uses separate libraries and parts. This seems to be an ideal combination. Creating plugins as qooxdoo libraries separates the development of the main app from the plugins (so that third-parties can create and contribute plugins) and using parts ensures that the app will load only the plugin code that is actually enabled and used by the main app. To be sure, it is still necessary to build the app with all plugins present (in order to create the parts), they cannot be distributed and installed separately without the build step. But that is acceptable, given the obvious advatages that qx libraries/parts provide.

At the moment, I am stuck with an error that I have reported separately here [1]. Maybe someone can figure out what is wrong. The relevant parts of my config.json [2] are:



Maybe my setup is wrong. I am using qooxdoo v3.5.1. The error occurs in the qx/Part.js, line 253, and a step-by-step debugging showed that the this.__parts array contains one element with value undefined.

Thanks for any advice!

C.



[1]
http://qooxdoo.678.n2.nabble.com/qooxdoo-Stacktrace-problems-td7586130.html
[2]
https://github.com/cboulanger/bibliograph/blob/master/bibliograph/config.json



--
View this message in context: http://qooxdoo.678.n2.nabble.com/Application-plugins-with-parts-tp7586137.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Application plugins with parts

panyasan
Hi Mustafa,

thank you for the clarification! Since I want to minimize the amount of places where information has to be added in order to add a plugin, an additional separate class in the main app's namespace wouldn't be ideal. Is it also possible to include one class of the library, which then pulls in the dependencies, such as:

"plugin.csl"          : { "include" : [ "csl.Plugin" ] },

 Or do I have to always include a class in the main namespace?

Thanks,
C.
Reply | Threaded
Open this post in threaded view
|

Re: Application plugins with parts

Mustafa Sak-5
Hi,

No are not restricted to use main namespace. Sure you can choose a class of your library.

Gruß
Mustafa Sak

Applications & Integration

1&1 Internet AG
Ernst-Frey-Straße 10
DE-76135 Karlsruhe


-----Ursprüngliche Nachricht-----
Von: panyasan [mailto:[hidden email]]
Gesendet: Donnerstag, 4. September 2014 11:23
An: [hidden email]
Betreff: Re: [qooxdoo-devel] Application plugins with parts

Hi Mustafa,

thank you for the clarification! Since I want to minimize the amount of places where information has to be added in order to add a plugin, an additional separate class in the main app's namespace wouldn't be ideal. Is it also possible to include one class of the library, which then pulls in the dependencies, such as:

"plugin.csl"          : { "include" : [ "csl.Plugin" ] },

 Or do I have to always include a class in the main namespace?

Thanks,
C.



--
View this message in context: http://qooxdoo.678.n2.nabble.com/Application-plugins-with-parts-tp7586137p7586139.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Application plugins with parts

panyasan
Hi,

now my config.json contains the following:

...
    "parts-config":
    {
      "packages" :
      {
        "parts"  :
        {
          "boot": { "include" : [ "${QXTHEME}", "bibliograph.Application" ] },
          "plugin.csl"          : { "include" : [ "csl.Plugin" ] },
          "plugin.z3950"        : { "include" : [ "z3950.Plugin" ] },
          "plugin.isbnscanner"  : { "include" : [ "isbnscanner.Plugin" ] }
        }
      }
    },
...

plugins/csl/Plugin.js contains this:

/**
 * CSL Plugin:
 *
 *    This plugin allows to display the currently selected reference(s)
 *    formatted according to a citation style, based on the CSL formatting
 *    language and a compatible citation processor.
 * 
 * @use(csl.*)
 */
qx.Class.define("csl.Plugin",

...

when I run ./generate.py, I get this:

...
>>> Assembling parts
  - part z3950    - Part #z3950 is ignored in current configuration
  - part csl    - Part #csl is ignored in current configuration
  - part boot  
  - part isbnscanner  
  - Part #isbnscanner is ignored in current configuration
...

Unsurprisingly, I'm still getting the same error. Thus the setup is still wrong. Any ideas?

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Application plugins with parts

Mustafa Sak-5
Sorry, but I am not able to see all of your message.

Gruß
Mustafa Sak

Applications & Integration

1&1 Internet AG
Ernst-Frey-Straße 10
DE-76135 Karlsruhe


-----Ursprüngliche Nachricht-----
Von: panyasan [mailto:[hidden email]]
Gesendet: Donnerstag, 4. September 2014 14:39
An: [hidden email]
Betreff: Re: [qooxdoo-devel] Application plugins with parts

Hi,

now my config.json contains the following:



plugins/csl/Plugin.js contains this:



when I run ./generate.py, I get this:



Unsurprisingly, I'm still getting the same error. Thus the setup is still
wrong. Any ideas?

Thanks!



--
View this message in context: http://qooxdoo.678.n2.nabble.com/Application-plugins-with-parts-tp7586137p7586143.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Application plugins with parts

panyasan
Oh. I posted it on Nabble, probably didn't translate well into an email:

http://qooxdoo.678.n2.nabble.com/Application-plugins-with-parts-tp7586137p7586143.html

Hi,

now my config.json contains the following:

...
    "parts-config":
    {
      "packages" :
      {
        "parts"  :
        {
          "boot": { "include" : [ "${QXTHEME}", "bibliograph.Application" ] },
          "plugin.csl"          : { "include" : [ "csl.Plugin" ] },
          "plugin.z3950"        : { "include" : [ "z3950.Plugin" ] },
          "plugin.isbnscanner"  : { "include" : [ "isbnscanner.Plugin" ] }
        }
      }
    },
...

plugins/csl/Plugin.js contains this:

/**
 * CSL Plugin:
 *
 *    This plugin allows to display the currently selected reference(s)
 *    formatted according to a citation style, based on the CSL formatting
 *    language and a compatible citation processor.
 *
 * @use(csl.*)
 */
qx.Class.define("csl.Plugin",

...

when I run ./generate.py, I get this:

...
>>> Assembling parts
  - part z3950    - Part #z3950 is ignored in current configuration
  - part csl    - Part #csl is ignored in current configuration
  - part boot  
  - part isbnscanner  
  - Part #isbnscanner is ignored in current configuration
...

Unsurprisingly, I'm still getting the same error. Thus the setup is still wrong. Any ideas?

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Application plugins with parts

Mustafa Sak-5
Hi,

you wrote:

plugins/csl/Plugin.js contains this:

IMHO, the path should look like: plugins/csl/source/class/csl/Plugin.js

Could you please show me your libraries config?

Gruß
Mustafa Sak

Applications & Integration

1&1 Internet AG
Ernst-Frey-Straße 10
DE-76135 Karlsruhe

-----Ursprüngliche Nachricht-----
Von: panyasan [mailto:[hidden email]]
Gesendet: Donnerstag, 4. September 2014 16:22
An: [hidden email]
Betreff: Re: [qooxdoo-devel] Application plugins with parts

Oh. I posted it on Nabble, probably didn't translate well into an email:

http://qooxdoo.678.n2.nabble.com/Application-plugins-with-parts-tp7586137p7586143.html

Hi,

now my config.json contains the following:

...
    "parts-config":
    {
      "packages" :
      {
        "parts"  :
        {
          "boot": { "include" : [ "${QXTHEME}", "bibliograph.Application" ] },
          "plugin.csl"          : { "include" : [ "csl.Plugin" ] },
          "plugin.z3950"        : { "include" : [ "z3950.Plugin" ] },
          "plugin.isbnscanner"  : { "include" : [ "isbnscanner.Plugin" ] }
        }
      }
    },
...

plugins/csl/Plugin.js contains this:

/**
 * CSL Plugin:
 *
 *    This plugin allows to display the currently selected reference(s)
 *    formatted according to a citation style, based on the CSL formatting
 *    language and a compatible citation processor.
 *
 * @use(csl.*)
 */
qx.Class.define("csl.Plugin",

...

when I run ./generate.py, I get this:

...
>>> Assembling parts
  - part z3950    - Part #z3950 is ignored in current configuration
  - part csl    - Part #csl is ignored in current configuration
  - part boot
  - part isbnscanner
  - Part #isbnscanner is ignored in current configuration ...

Unsurprisingly, I'm still getting the same error. Thus the setup is still wrong. Any ideas?

Thanks!



--
View this message in context: http://qooxdoo.678.n2.nabble.com/Application-plugins-with-parts-tp7586137p7586148.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Application plugins with parts

panyasan
Hi,

the whole config.json is here:

https://github.com/cboulanger/bibliograph/blob/master/bibliograph/config.json

and you can see the plugin classes here:

https://github.com/cboulanger/bibliograph/tree/master/bibliograph/plugins

and the mentioned plugin class is here:

https://github.com/cboulanger/bibliograph/blob/master/bibliograph/plugins/csl/source/class/csl/Plugin.js

So you are right, that's the path, but it is there (I was wrong in my post). But it is not working.

If you want, the whole setup (ready for testing) is here:

https://ide.c9.io/cboulanger/bibliograph2

in a virtual machine that you can join and try out different things and run the build step to see what happens. I am more than happy to give you access if your are interested.
Reply | Threaded
Open this post in threaded view
|

Re: Application plugins with parts

Mustafa Sak-5
Hi,

I checked out your project. As I could see everything is fine with your plugins. But contrib path is confusing me. There is no Dialog library, UploadWidget is just partially existing. I would advise you to use git submodules to manage third party repositories.

Furthermore I am not able to know which error message you mentioned before.

If you want me to help you, please make the whole project clone able.

Gruß
Mustafa Sak

Applications & Integration

1&1 Internet AG
Ernst-Frey-Straße 10
DE-76135 Karlsruhe


-----Ursprüngliche Nachricht-----
Von: panyasan [mailto:[hidden email]]
Gesendet: Freitag, 5. September 2014 09:09
An: [hidden email]
Betreff: Re: [qooxdoo-devel] Application plugins with parts

Hi,

the whole config.json is here:

https://github.com/cboulanger/bibliograph/blob/master/bibliograph/config.json

and you can see the plugin classes here:

https://github.com/cboulanger/bibliograph/tree/master/bibliograph/plugins

and the mentioned plugin class is here:

https://github.com/cboulanger/bibliograph/blob/master/bibliograph/plugins/csl/source/class/csl/Plugin.js

So you are right, that's the path, but it is there (I was wrong in my post).
But it is not working.

If you want, the whole setup (ready for testing) is here:

https://ide.c9.io/cboulanger/bibliograph2

in a virtual machine that you can join and try out different things and run the build step to see what happens. I am more than happy to give you access if your are interested.




--
View this message in context: http://qooxdoo.678.n2.nabble.com/Application-plugins-with-parts-tp7586137p7586155.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Application plugins with parts

panyasan
Hi Mustafa,

thank you for taking time to look into this. Creating the right development environment for my project is in fact a bit tricky, because you need a working backend with php/apache/mysql all configured. The frontend does not work without setting up the backend first, which might require more time than you might want to invest [1]. 

That is why I am suggesting to use the one that I already use for development on Cloud9IDE - you can just enter the virtual machine and jump right into my setup where everything is configured: https://ide.c9.io/cboulanger/bibliograph2. Cloud9IDE is a great tool for collaborative debugging just because you don’t have to replicate the development environment on your side.

In any case, I have updated config.json to download the UploadWidget and Dialog contribs instead of using the downloaded files as it is now (to save time during build steps). It should be clonable and buildable now. 

The error message that I referred to is described here [2], it results from the incorrectly configured part setup [3].

Thank you for looking into this. 

Christian

Reply | Threaded
Open this post in threaded view
|

Re: Application plugins with parts

panyasan
Just had a great collaborative debugging session with Mustafa on https://c9.io and we could locate the source of the problem: it is the way qx.io.PartLoader.require works. There is some hidden magic that involved a lookup in the code syntax tree that is not obvious if you don't know it.

Thanks, Mustafa, for your support. Qooxdoo rules!

C.