|By Dave Ross, Chris Scott||
|January 31, 2006 09:00 AM EST||
ColdSpring is a framework for ColdFusion Components, inspired by the Spring Framework for Java, and its core focus is to manage the dependencies within your CFC "model."
Dependencies are more common than you think: when one CFC needs another CFC to perform a task, it depends on that other CFC (and those two CFCs are known as "collaborators"). When a CFC needs a piece of configuration data, such as a datasource name, it depends on that piece of data. ColdSpring enables you to declaratively supply your CFCs with their dependencies, freeing you from having to write the code to do so (which unfortunately ends up in just about each and every component). ColdSpring practices what many refer to as "inversion-of-control." This simply means that the control of creating objects and resolving their dependencies is lifted out of the code and into the code's "container," which in this case is ColdSpring. "Dependency-Injection" is probably a better term to describe what ColdSpring does: it injects dependencies into your CFCs as they are created.
Also part of ColdSpring is the first aspect-oriented-programming (AOP) framework for CFCs (which we'll cover in further detail shortly).
For building an application like the Pet Market, ColdSpring would typically be used in conjunction with one of the other MVC application frameworks like Fusebox, Mach-II, or Model-Glue. However, for the purposes of this article, we were unable to use one of those frameworks, so we took the approach of attempting to retrofit a brand new ColdSpring-managed model on top of the existing Pet Market application. This means that our version of the Pet Market should be used to examine how ColdSpring manages a model regardless of the application framework used. (The code for this article can be downloaded from www.cfpetmarket.com.)
Figure 1 provides a picture of where ColdSpring sits in the overall Pet Market application architecture.
Figure 1 is an example of typical MVC (Model-View-Controller) architecture. The "Service," "DAO," "Gateway," and "Utility" components are part of our Pet Market model. Each component is "managed" by ColdSpring, meaning ColdSpring is responsible for both creating the component and resolving its dependencies. When the controller layer needs to talk to a model component, it simply asks ColdSpring for the component. After retrieving a component from ColdSpring, the controller layer would call methods directly on that component, so ColdSpring doesn't really "sit between" the controller and the model.
To use ColdSpring with your application, you need to write some code to create a ColdSpring "BeanFactory". The BeanFactory is typically the only ColdSpring CFC that you will interact with, thus setting up ColdSpring for use within an application is trivial. It's worth mentioning that none of this is necessary if you are using the Mach-II or ModelGlue application frameworks, as both offer hooks to handle creating the ColdSpring BeanFactory automatically. However, to see how we set up ColdSpring in the Pet Market application, take a look at our application.cfm, the relevant part of which is shown here:
All we are doing here is creating the ColdSpring BeanFactory and placing it in the application scope. The <cfif/> and <cflock/> blocks are necessary to ensure that the BeanFactory starts up in a thread-safe manner, because as you can see from the code, we are storing the BeanFactory in the application scope and we want to make sure that all requests wait while the BeanFactory is created (this only happens once during application "startup"). In order to tell ColdSpring about your CFCs, we need to supply it with a set of "bean definitions," which are written in a simple XML format. We named our configuration file components.xml. You can see this done in the code above, where we are passing components.xml's file path into the BeanFactory using the loadBeans() method. Here's a quick sample of our bean definitions:
<cfif not structKeyExists(application,"beanFactory")
<cflock name="PetMarket_Startup" timeout="25">
<cfif not structKeyExists(application,"beanFactory")
<cfset application.beanFactory = createObject('component',
Use <bean/> tags to define your CFCs. You may have heard the term "bean" used in a number of different contexts related to CFC development, but here it's chosen because ColdSpring expects that, in order to take advantage of certain features, you adhere to the Java programming language's JavaBean specification/conventions. Now we will take a look at the XML above in detail. First we defined a <bean/> and gave it an ID of "SessionService". The class attribute, "petmarket.util.UsageSessionService", tells ColdSpring which CFC it should use when asked for the "SessionService". You will also see the "UserService" <bean/> definition, but this one is a bit more complex. We define the ID and class just like our SessionService, however, we also define some <property/> tags within the <bean/> tag. First we define a "UserDAO" <property/> (DAO stands for "Data Access Object", it's part of the gritty details of our Pet Market model but has nothing to do with ColdSpring itself). Whatever you put between the <property></property> tags will be injected, by ColdSpring, when the CFC is actually created. Thus, we have defined an "inner-bean" within the UserDAO property, meaning ColdSpring will create a UserDAO CFC and pass that into the UserService when it is created. You must provide ColdSpring with a way to do this, and, in the case of <property/>, ColdSpring expects there to be a "setter method" that will accept the UserDAO, and it must be named "setUserDAO". This is where ColdSpring relies on the JavaBeans spec, meaning that you adhere to the JavaBean convention of providing setter methods for public properties. The setter method within our UserService that accepts the UserDAO looks like this:
<!-- Session Service Definition -->
<!-- User Service -->
<!-- needs a UserDAO -->
<!-- also needs the session service -->
<cffunction name="setUserDAO" access="public"
returntype="void" output="false" hint="Dependency: userDAO">
<cfargument name="UserDAO" type="petmarket.component.user.UserDAO"
<cfset variables.userDAO = arguments.UserDAO />
All major researchers estimate there will be tens of billions devices - computers, smartphones, tablets, and sensors - connected to the Internet by 2020. This number will continue to grow at a rapid pace for the next several decades. With major technology companies and startups seriously embracing IoT strategies, now is the perfect time to attend @ThingsExpo, June 9-11, 2015, at the Javits Center in New York City. Learn what is going on, contribute to the discussions, and ensure that your enterprise is as "IoT-Ready" as it can be
May. 25, 2015 01:15 PM EDT Reads: 2,385
The security devil is always in the details of the attack: the ones you've endured, the ones you prepare yourself to fend off, and the ones that, you fear, will catch you completely unaware and defenseless. The Internet of Things (IoT) is nothing if not an endless proliferation of details. It's the vision of a world in which continuous Internet connectivity and addressability is embedded into a growing range of human artifacts, into the natural world, and even into our smartphones, appliances, and physical persons. In the IoT vision, every new "thing" - sensor, actuator, data source, data con...
May. 25, 2015 01:00 PM EDT Reads: 6,393
Container frameworks, such as Docker, provide a variety of benefits, including density of deployment across infrastructure, convenience for application developers to push updates with low operational hand-holding, and a fairly well-defined deployment workflow that can be orchestrated. Container frameworks also enable a DevOps approach to application development by cleanly separating concerns between operations and development teams. But running multi-container, multi-server apps with containers is very hard. You have to learn five new and different technologies and best practices (libswarm, sy...
May. 25, 2015 12:00 PM EDT Reads: 2,270
SYS-CON Events announced today that DragonGlass, an enterprise search platform, will exhibit at SYS-CON's 16th International Cloud Expo®, which will take place on June 9-11, 2015, at the Javits Center in New York City, NY. After eleven years of designing and building custom applications, OpenCrowd has launched DragonGlass, a cloud-based platform that enables the development of search-based applications. These are a new breed of applications that utilize a search index as their backbone for data retrieval. They can easily adapt to new data sets and provide access to both structured and unstruc...
May. 25, 2015 12:00 PM EDT Reads: 2,083
There's Big Data, then there's really Big Data from the Internet of Things. IoT is evolving to include many data possibilities like new types of event, log and network data. The volumes are enormous, generating tens of billions of logs per day, which raise data challenges. Early IoT deployments are relying heavily on both the cloud and managed service providers to navigate these challenges. In her session at Big Data Expo®, Hannah Smalltree, Director at Treasure Data, discussed how IoT, Big Data and deployments are processing massive data volumes from wearables, utilities and other machines...
May. 25, 2015 10:00 AM EDT Reads: 4,248
Buzzword alert: Microservices and IoT at a DevOps conference? What could possibly go wrong? In this Power Panel at DevOps Summit, moderated by Jason Bloomberg, the leading expert on architecting agility for the enterprise and president of Intellyx, panelists will peel away the buzz and discuss the important architectural principles behind implementing IoT solutions for the enterprise. As remote IoT devices and sensors become increasingly intelligent, they become part of our distributed cloud environment, and we must architect and code accordingly. At the very least, you'll have no problem fil...
May. 25, 2015 10:00 AM EDT Reads: 2,077
SYS-CON Events announced today that MetraTech, now part of Ericsson, has been named “Silver Sponsor” of SYS-CON's 16th International Cloud Expo®, which will take place on June 9–11, 2015, at the Javits Center in New York, NY. Ericsson is the driving force behind the Networked Society- a world leader in communications infrastructure, software and services. Some 40% of the world’s mobile traffic runs through networks Ericsson has supplied, serving more than 2.5 billion subscribers.
May. 25, 2015 09:45 AM EDT Reads: 1,755
The 4th International Internet of @ThingsExpo, co-located with the 17th International Cloud Expo - to be held November 3-5, 2015, at the Santa Clara Convention Center in Santa Clara, CA - announces that its Call for Papers is open. The Internet of Things (IoT) is the biggest idea since the creation of the Worldwide Web more than 20 years ago.
May. 25, 2015 09:00 AM EDT Reads: 2,045
The worldwide cellular network will be the backbone of the future IoT, and the telecom industry is clamoring to get on board as more than just a data pipe. In his session at @ThingsExpo, Evan McGee, CTO of Ring Plus, Inc., discussed what service operators can offer that would benefit IoT entrepreneurs, inventors, and consumers. Evan McGee is the CTO of RingPlus, a leading innovative U.S. MVNO and wireless enabler. His focus is on combining web technologies with traditional telecom to create a new breed of unified communication that is easily accessible to the general consumer. With over a de...
May. 25, 2015 06:00 AM EDT Reads: 4,787
Disruptive macro trends in technology are impacting and dramatically changing the "art of the possible" relative to supply chain management practices through the innovative use of IoT, cloud, machine learning and Big Data to enable connected ecosystems of engagement. Enterprise informatics can now move beyond point solutions that merely monitor the past and implement integrated enterprise fabrics that enable end-to-end supply chain visibility to improve customer service delivery and optimize supplier management. Learn about enterprise architecture strategies for designing connected systems tha...
May. 25, 2015 05:00 AM EDT Reads: 6,058
Cloud is not a commodity. And no matter what you call it, computing doesn’t come out of the sky. It comes from physical hardware inside brick and mortar facilities connected by hundreds of miles of networking cable. And no two clouds are built the same way. SoftLayer gives you the highest performing cloud infrastructure available. One platform that takes data centers around the world that are full of the widest range of cloud computing options, and then integrates and automates everything. Join SoftLayer on June 9 at 16th Cloud Expo to learn about IBM Cloud's SoftLayer platform, explore se...
May. 25, 2015 04:45 AM EDT Reads: 3,268
SYS-CON Media announced today that 9 out of 10 " most read" DevOps articles are published by @DevOpsSummit Blog. Launched in October 2014, @DevOpsSummit Blog offers top articles, news stories, and blog posts from the world's well-known experts and guarantees better exposure for its authors than any other publication. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time to wait for long development cycles that produce softw...
May. 25, 2015 04:15 AM EDT Reads: 4,282
With major technology companies and startups seriously embracing IoT strategies, now is the perfect time to attend @ThingsExpo in Silicon Valley. Learn what is going on, contribute to the discussions, and ensure that your enterprise is as "IoT-Ready" as it can be! Internet of @ThingsExpo, taking place Nov 3-5, 2015, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 17th Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal an...
May. 25, 2015 04:00 AM EDT Reads: 2,945
15th Cloud Expo, which took place Nov. 4-6, 2014, at the Santa Clara Convention Center in Santa Clara, CA, expanded the conference content of @ThingsExpo, Big Data Expo, and DevOps Summit to include two developer events. IBM held a Bluemix Developer Playground on November 5 and ElasticBox held a Hackathon on November 6. Both events took place on the expo floor. The Bluemix Developer Playground, for developers of all levels, highlighted the ease of use of Bluemix, its services and functionality and provide short-term introductory projects that developers can complete between sessions.
May. 25, 2015 04:00 AM EDT Reads: 6,427
From telemedicine to smart cars, digital homes and industrial monitoring, the explosive growth of IoT has created exciting new business opportunities for real time calls and messaging. In his session at @ThingsExpo, Ivelin Ivanov, CEO and Co-Founder of Telestax, shared some of the new revenue sources that IoT created for Restcomm – the open source telephony platform from Telestax. Ivelin Ivanov is a technology entrepreneur who founded Mobicents, an Open Source VoIP Platform, to help create, deploy, and manage applications integrating voice, video and data. He is the co-founder of TeleStax, a...
May. 25, 2015 04:00 AM EDT Reads: 6,537
The Internet of Things (IoT) promises to evolve the way the world does business; however, understanding how to apply it to your company can be a mystery. Most people struggle with understanding the potential business uses or tend to get caught up in the technology, resulting in solutions that fail to meet even minimum business goals. In his session at @ThingsExpo, Jesse Shiah, CEO / President / Co-Founder of AgilePoint Inc., showed what is needed to leverage the IoT to transform your business. He discussed opportunities and challenges ahead for the IoT from a market and technical point of vie...
May. 25, 2015 04:00 AM EDT Reads: 6,912
Grow your business with enterprise wearable apps using SAP Platforms and Google Glass. SAP and Google just launched the SAP and Google Glass Challenge, an opportunity for you to innovate and develop the best Enterprise Wearable App using SAP Platforms and Google Glass and gain valuable market exposure. In his session at @ThingsExpo, Brian McPhail, Senior Director of Business Development, ISVs & Digital Commerce at SAP, outlined the timeline of the SAP Google Glass Challenge and the opportunity for developers, start-ups, and companies of all sizes to engage with SAP today.
May. 25, 2015 03:00 AM EDT Reads: 5,148
The 3rd International @ThingsExpo, co-located with the 16th International Cloud Expo – to be held June 9-11, 2015, at the Javits Center in New York City, NY – is now accepting Hackathon proposals. Hackathon sponsorship benefits include general brand exposure and increasing engagement with the developer ecosystem. At Cloud Expo 2014 Silicon Valley, IBM held the Bluemix Developer Playground on November 5 and ElasticBox held the DevOps Hackathon on November 6. Both events took place on the expo floor. The Bluemix Developer Playground, for developers of all levels, highlighted the ease of use of...
May. 25, 2015 03:00 AM EDT Reads: 3,535
Enthusiasm for the Internet of Things has reached an all-time high. In 2013 alone, venture capitalists spent more than $1 billion dollars investing in the IoT space. With "smart" appliances and devices, IoT covers wearable smart devices, cloud services to hardware companies. Nest, a Google company, detects temperatures inside homes and automatically adjusts it by tracking its user's habit. These technologies are quickly developing and with it come challenges such as bridging infrastructure gaps, abiding by privacy concerns and making the concept a reality. These challenges can't be addressed w...
May. 25, 2015 02:45 AM EDT Reads: 6,846
The industrial software market has treated data with the mentality of “collect everything now, worry about how to use it later.” We now find ourselves buried in data, with the pervasive connectivity of the (Industrial) Internet of Things only piling on more numbers. There’s too much data and not enough information. In his session at @ThingsExpo, Bob Gates, Global Marketing Director, GE’s Intelligent Platforms business, to discuss how realizing the power of IoT, software developers are now focused on understanding how industrial data can create intelligence for industrial operations. Imagine ...
May. 25, 2015 02:00 AM EDT Reads: 5,355