Blog

ColdBox 4.0 Removed Plugins

Brad Wood February 26, 2015

Spread the word

Brad Wood

February 26, 2015

Spread the word


Share your thoughts

ColdBox Plugins have graduated to become just models. The plugins convention has been removed and all WireBox references to plugin injection or DSL's are gone. You now just place all your plugins in your models directory and request them via getInstance() or getModel() calls.

Plugins are an old ColdBox convention but their baggage doesn't really serve a purpose now that we have modules for easy packaging of libraries and WireBox for easy creation of CFCs. Neither of those existed back when Plugins were birthed. It's time to say goodbye to the concept of plugins, but all their functionality will still be here, just with a slightly different (and more standardized) way of creating them.

// old
getPlugin("MyPlugin")
property name="foobar" inject="coldbox:plugin:foobar";
property name="foobar" inject="coldbox:myPlugin:foobar";

// new
getInstance( "foobar@myModule" );
property name="foobar" inject="foobar@myModule";

You'll notice ColdBox used to make a differentiation between core plugins and custom plugins.   There is no such difference now.  A couple plugins that got baked into ColdBox as model such as the HTMLHelper and XMLConverter plugins are now simply called HTMLHelper@coldbox and xmlConverter@coldbox.  All the rest of the plugins that were shipped off into modules are simply namespaced by the module name which is the standard model convention for modules.

  • sessionStorage@cbstorages
  • ValidationManager@cbvalidation
  • messagebox@cbmessagebox
  • i18n@cbi18n
  • QueryHelper@cbcommons
  • etc...

If a model isn't defined, check and make sure you have installed the module and reinitted.  When you install modules via CommandBox, you can use the handy list command to check and see.

CommandBox> list
Dependency Hierarchy myApp (1.0.0)
├── coldbox-be (4.0.0)
└─┬ cbvalidation (1.0.0)
  └── cbi18n (1.0.0)

Plugin Base Class

With the removal of plugins, coldbox.system.Plugin no longer exists. If have custom-written plugins that used some of the convenience variables such as controller, logbox, or wirebox that came from this base class, you'll need to inject them using the appropriate injection DSL. If you were using any of the convenience methods such as getRequestContext() or getRequestCollection() should be delegated to the appropriate service or the ColdBox controller.  (The request context can be obtained from the RequestService)

Any variables or methods related to instance.pluginName, instance.pluginVersion, etc serve no purpose now and can be removed from the code.

Sharing Code

So now that plugins are no more,  you have two main options for sharing a bit of code with other developers that you want them to be able to easily drop in and use.

  1. Put on ForgeBox as a model.   This works well for very small stand-alone pieces of functionality that don't need a load/unload lifecycle and don't depend on anything else.
  2. Put on ForgeBox as a module.  Modules can be very simple, but also can allow for multiple models, configuration, a load/unload lifecycle, and other dependencies.  This is the recommended approach for any bit of code you want to share since it's the most flexible.

Add Your Comment

Recent Entries

The 12 Days of Christmas - ITB 2022 Video Release— Day 2 - New Modules

The 12 Days of Christmas - ITB 2022 Video Release— Day 2 - New Modules

It's that time of year again. Trees are lit, presents are being wrapped, and relatives are coming to visit. That's right, it's time again for the 12 days of Christmas-- 2022 ITB Video Release Edition! 

Today, Day 2's Videos from Into the Box 2022 Conference, are all newly announced modules.

Gavin Pickin
Gavin Pickin
December 09, 2022
The 12 Days of Christmas - ITB 2022 Video Release— Day 1

The 12 Days of Christmas - ITB 2022 Video Release— Day 1

It's that time of year again.  Trees are lit, presents are being wrapped, and relatives are coming to visit.  That's right, it's time again for the 12 days of Christmas-- 2022 ITB Video Release Edition!

For the next 12 business days up until Christmas, we'll be releasing a series of related videos each day on the CFCasts site for our CFCasts Subscribers, and a announcement with titles, descriptions, and links to the videos, right here on the Ortus blog.  Consider it our early Christmas gift to you.

Gavin Pickin
Gavin Pickin
December 08, 2022
CommandBox Docker v3.6.3 Images Released

CommandBox Docker v3.6.3 Images Released

CommandBox 3.6.3 Docker images released



Today we are pleased to announce the release of version 3.6.3 of our CommandBox Docker images, which contains significant upgrades to the underlying CommandBox engine.

Most significantly, this release upgrades the CommandBox binary to 5.7.0. Read the Release Notes for this version here. This image version also adds new distro builds for the RHEL Universal Base Image. These images may be utilized by using the ubi9 in the image tag in the same way the alpine base images currently do.

Jon Clausen
Jon Clausen
December 08, 2022