The Ortus BlogBox

"Ortus: A rise, beginning, coming into being, born, the origin!"

 

 

Category Filtering: 'modules'

 

CBCMS2016 - ContentBox 3 - Modules are everywhere

Gavin Pickin
Jul 06, 2016

 

I hope you are enjoying Ortus Solutions' ContentBox Roadshow so far. We're had one free webinar already, and a few blog posts, with plenty more to come. Today I'm going to talk about modules a little more. I mentioned them in my "What's New with ContentBox" presentation ( you can read more about it and watch the recording here  ), but you might not have known, I got excited about ContentBox and all of the modules before the roadshow even started.

ColdBox MVC, CommandBox, ContentBox CMS, Modules, RoadShow 0

ContentBox - Creating Custom Layouts for you Custom Modules

Gavin Pickin
May 24, 2016

 

In our last post on Extending ContentBox 3 with your own Custom Modules we learned that you could build a custom ColdBox Modile with amazingly, just 2 files. You could paste in your legacy spaghetti code right into your default view, and it would work. Of course, we probably want to dress it up a little more, and add some more functionality, so lets look at the layout first.

ColdBox MVC, ContentBox CMS, Modules 0

ContentBox - Extending ContentBox 3 with your Own Custom Modules

Gavin Pickin
May 20, 2016

 

In a previous Post, we talked about extending ContentBox easily with modules, and showed you how you could just download a module, activate it and use it in minutes. In this post, we'll look at how to add Modules into your website, by building your own, and how to leverage Module Layouts.

Whether you have used ColdBox before or not, using Modules with ContentBox and ColdBox is fairly straightforward, in fact, I think its a great way to dip your toes into using both technologies. Working with Modules is like everything else in ColdBox, you work with conventions, but you have control. In this previous post, 'Modules Modules everywhere, Extending ContentBox', we show you how there are 4 locations for modules in ContentBox, and depending on how your module will work, you should choose the appropriate location. In this post, we're going to build a custom ColdBox module, which it not managed by ContentBox Admin's Module Manager.

ColdBox MVC, ContentBox CMS, Modules 0

Attention: MessageBox is Now a Module

Scott Coldwell
Feb 27, 2015

 

The beloved MessageBox plugin has been a staple of the ColdBox platform since the beginning. With ColdBox 4.0 it's still available, but if you don't need it, you have the freedom to leave it out.

The new modular approach (and deprecation of plugins) of ColdBox 4.0 means much of its built-in functionality has been moved to separate, installable modules. One of the many new modules introduced with ColdBox 4.0 is the MessageBox Module. To install, simply fire up CommandBox:

box install cbmessagebox

 

For the plugin, you might have had code like this:

getPlugin("MessageBox").info( "Hello" );

With the module, your syntax changes slightly to:

getInstance("messagebox@cbmessagebox").info( "Hello" );

or, leveraging WireBox:

property name="messagebox" inject="messagebox@cbmessagebox";

...

variables.messagebox.info( "Hello" );

 

Happy messaging!

ColdBox MVC, CommandBox, Modules 0

ColdBox 4.0 Removed Plugins

Brad Wood
Feb 26, 2015

 

ColdBox Plugins have graduated to become just models. The plugins convention has been removed and all references to plugin injection or DSL's are gone. You must now 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.

ColdBox MVC, Modules, Plugins, Tutorials 0

Module Bundles in ColdBox 4

Luis Majano
Feb 24, 2015

 

With the advent of so much more functionality in modules, in ColdBox 4 we added the ability to group modules in a single directory we lovingly call The Module Bundle.  This feature became a reality due to a real client's need of being able to logically separate modules into logical buckets.  His application had an extensive amount of modules and he wanted to further segregate them, thus module bundles became a reality.  

 

 

Module bundles does not add extra functionality or features to the framework, but it is a mere logical boundary between modules.  It will allow you to create a folder with the convention {name}-bundle, notice the bundle suffix.  Then you can drop any amount of modules and sub-modules within it.  You can even drop in module bundles inside of it as well.

 

coldbox-bundle
  * cbstorages
  * cborm
  * cbsecurity

 

In ColdBox 4.X we will introduce the ability to package these bundles via CommandBox and even deliver them as a coldbox.bundle archive, which ColdBox will know how to unpack and install.

ColdBox MVC, Modules, Tutorials 0

The Storages Module

Curt Gratz
Feb 23, 2015

 

If you have been following our series here on ColdBox 4.0, you are probably sensing a theme.  

Another major change in ColdBox 4.0 was the removal of plugins as a thing.  They were just model objects anyway and we had treated them as such within the framework for some time.   However, because of that, we needed to do something with some of our various "core" plugins.  So sticking with our aforementioned theme, many of them were converted into modules.  

We decided that we could bundle a few of our old "core" plugins that had similar functionality together into one module.  The Storages Module.  This module consists of what was the

  • Session Storage Plugin
  • Application Storage Plugin
  • Client Storage Plugin
  • Cluster Storage Plugin
  • Cookie Storage Plugin

To install The Storages Module using command box simply use the following command.

box install cbstorages

If you have existing calls to the old plugins such as 

getPlugin( 'SessionStorage' )
getPlugin( 'ApplicationStorage' )
getPlugin( 'CookieStorage' )
etc...

Then after you install the module you can replace those with

getInstance( 'sessionStorage@cbstorages' )
getInstance( 'applicationStorage@cbstorages' )
getInstance( 'cookieStorage@cbstorages' )
etc...

We didn't make any changes to the API of the objects so everything should work as always after that.

Now...Module all the things...

ColdBox MVC, Modules, Plugins, Tutorials 0

Easily Inject Java into Your ColdBox App

Scott Coldwell
Feb 18, 2015

 

If you've ever worked with jars or raw java in ColdFusion, you will love the JavaLoader module for ColdBox. The JavaLoader module will interface with Mark Mandel's JavaLoader to allow you to do a network class loader, compiler and proxy. You can keep jars with your application's code instead of putting them in ColdFusion classpath, and you can even dynamically compile java code to use in your app.

To get started, simply install the module using CommandBox:

box install cbjavaloader

 

The module registers a new WireBox DSL called javaloader. You can then use this custom DSL for injecting direct java class loaded classes very easily:

property name="name"  inject="javaloader:{class-path}";
property name="hello" inject="javaloader:HelloWorld";
property name="buffer" inject="javaloader:org.class.path.StringBuffer";

 

With some basic configuration in your Coldbox.cfc, you can load jars or compile java:

// JavaLoader settings
javaloader = {
    // The array paths to load
    loadPaths = getJars( getDirectoryFromPath( getCurrentTemplatePath() ) & "lib" ),
    // Load ColdFusion classes with loader
    loadColdFusionClassPath = false,
    // Attach a custom class loader as a parent
    parentClassLoader = "",
    // Directories that contain Java source code that are to be dynamically compiled
    sourceDirectories = [],
    // the directory to build the .jar file for dynamic compilation in, defaults to ./tmp
    compileDirectory = getDirectoryFromPath( getCurrentTemplatePath() ) & "model/javaloader/tmp",
    // Whether or not the source is trusted, i.e. it is going to change? Defaults to false, so changes will be recompiled and loaded
    trustedSource = false
};

Happy Java-ing!

 

ColdBox MVC, Modules, Tutorials 0

The Security Module

Curt Gratz
Feb 16, 2015

 

Looking to secure your ColdBox application?  The Security Module can be your security rules engine for your application.  It provides flexible options to rules based security for you to use.

We have often talked about how a module can be either complex or as simple as an interceptor.  Our Security Module is basically just an interceptor that gets registered in your application to enforce rules you define.  Installing it is easy using CommandBox run the following command

box install cbsecurity

The module will register a security interceptor with empty rules for you.  You can update the security rules included in the `config` folder or comment the interceptor out and just add it to your main application or necessary modules using the mapping it creates for you.

The full documentation for the security interceptor can be found at

http://wiki.coldbox.org/wiki/Security.cfm​ 

Feel free to take advantage of this module to help your secure your application and take care of some of the boiler plate work for you. 

ColdBox MVC, Modules, Tutorials 0

Hey, where'd my debugger go?

Curt Gratz
Feb 09, 2015

 

You may be wondering where all that amazing debugging information went in your ColdBox 4.0 application.  Have no fear.  You can still have your cake and eat it too.  We modularized it (sensing a theme in ColdBox 4.0 yet?) So, how do you get all that wonderful debugging info?

Easy! Using CommandBox, run the following command.

box install cbdebugger --saveDev

Notice the --saveDev we added to our command.  This is handy as it tells CommandBox that you only want this as a dependency for your application in development.  

Once the debugger module is installed, you can control the settings via the debugger structure in your main Coldbox config file.  

Also, if you need access to the debugger service or the timer, they are available via the following WireBox mappings.

  • debuggerService@cbdebugger
  • timer@cbdebugger

Just call getInstance() on either to snag them as needed.

Debug to your heart's content.

ColdBox MVC, CommandBox, Modules, Tutorials, WireBox 2