|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 />
"LinearHub provides smart video conferencing, which is the Roundee service, and we archive all the video conferences and we also provide the transcript," stated Sunghyuk Kim, CEO of LinearHub, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA.
Jan. 20, 2017 03:00 PM EST Reads: 1,633
Things are changing so quickly in IoT that it would take a wizard to predict which ecosystem will gain the most traction. In order for IoT to reach its potential, smart devices must be able to work together. Today, there are a slew of interoperability standards being promoted by big names to make this happen: HomeKit, Brillo and Alljoyn. In his session at @ThingsExpo, Adam Justice, vice president and general manager of Grid Connect, will review what happens when smart devices don’t work togethe...
Jan. 20, 2017 02:15 PM EST Reads: 575
"There's a growing demand from users for things to be faster. When you think about all the transactions or interactions users will have with your product and everything that is between those transactions and interactions - what drives us at Catchpoint Systems is the idea to measure that and to analyze it," explained Leo Vasiliou, Director of Web Performance Engineering at Catchpoint Systems, in this SYS-CON.tv interview at 18th Cloud Expo, held June 7-9, 2016, at the Javits Center in New York Ci...
Jan. 20, 2017 01:30 PM EST Reads: 5,726
The 20th International Cloud Expo has announced that its Call for Papers is open. Cloud Expo, to be held June 6-8, 2017, at the Javits Center in New York City, brings together Cloud Computing, Big Data, Internet of Things, DevOps, Containers, Microservices and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding business opportunity. Submit your speaking proposal ...
Jan. 20, 2017 01:30 PM EST Reads: 5,232
Discover top technologies and tools all under one roof at April 24–28, 2017, at the Westin San Diego in San Diego, CA. Explore the Mobile Dev + Test and IoT Dev + Test Expo and enjoy all of these unique opportunities: The latest solutions, technologies, and tools in mobile or IoT software development and testing. Meet one-on-one with representatives from some of today's most innovative organizations
Jan. 20, 2017 12:30 PM EST Reads: 1,647
20th Cloud Expo, taking place June 6-8, 2017, at the Javits Center in New York City, NY, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy.
Jan. 20, 2017 12:30 PM EST Reads: 4,344
WebRTC is the future of browser-to-browser communications, and continues to make inroads into the traditional, difficult, plug-in web communications world. The 6th WebRTC Summit continues our tradition of delivering the latest and greatest presentations within the world of WebRTC. Topics include voice calling, video chat, P2P file sharing, and use cases that have already leveraged the power and convenience of WebRTC.
Jan. 20, 2017 12:30 PM EST Reads: 3,183
SYS-CON Events announced today that Super Micro Computer, Inc., a global leader in Embedded and IoT solutions, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 7-9, 2017, at the Javits Center in New York City, NY. Supermicro (NASDAQ: SMCI), the leading innovator in high-performance, high-efficiency server technology, is a premier provider of advanced server Building Block Solutions® for Data Center, Cloud Computing, Enterprise IT, Hadoop/Big Data, HPC and E...
Jan. 20, 2017 12:15 PM EST Reads: 5,833
Internet of @ThingsExpo, taking place June 6-8, 2017 at the Javits Center in New York City, New York, is co-located with the 20th International Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. @ThingsExpo New York Call for Papers is now open.
Jan. 20, 2017 10:45 AM EST Reads: 3,701
WebRTC sits at the intersection between VoIP and the Web. As such, it poses some interesting challenges for those developing services on top of it, but also for those who need to test and monitor these services. In his session at WebRTC Summit, Tsahi Levent-Levi, co-founder of testRTC, reviewed the various challenges posed by WebRTC when it comes to testing and monitoring and on ways to overcome them.
Jan. 20, 2017 10:45 AM EST Reads: 6,085
DevOps is being widely accepted (if not fully adopted) as essential in enterprise IT. But as Enterprise DevOps gains maturity, expands scope, and increases velocity, the need for data-driven decisions across teams becomes more acute. DevOps teams in any modern business must wrangle the ‘digital exhaust’ from the delivery toolchain, "pervasive" and "cognitive" computing, APIs and services, mobile devices and applications, the Internet of Things, and now even blockchain. In this power panel at @...
Jan. 20, 2017 09:45 AM EST Reads: 2,930
WebRTC services have already permeated corporate communications in the form of videoconferencing solutions. However, WebRTC has the potential of going beyond and catalyzing a new class of services providing more than calls with capabilities such as mass-scale real-time media broadcasting, enriched and augmented video, person-to-machine and machine-to-machine communications. In his session at @ThingsExpo, Luis Lopez, CEO of Kurento, introduced the technologies required for implementing these idea...
Jan. 20, 2017 08:30 AM EST Reads: 4,757
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 peeled 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 enviro...
Jan. 20, 2017 08:15 AM EST Reads: 4,949
"A lot of times people will come to us and have a very diverse set of requirements or very customized need and we'll help them to implement it in a fashion that you can't just buy off of the shelf," explained Nick Rose, CTO of Enzu, in this SYS-CON.tv interview at 18th Cloud Expo, held June 7-9, 2016, at the Javits Center in New York City, NY.
Jan. 20, 2017 08:15 AM EST Reads: 4,720
The WebRTC Summit New York, to be held June 6-8, 2017, at the Javits Center in New York City, NY, announces that its Call for Papers is now open. Topics include all aspects of improving IT delivery by eliminating waste through automated business models leveraging cloud technologies. WebRTC Summit is co-located with 20th International Cloud Expo and @ThingsExpo. WebRTC is the future of browser-to-browser communications, and continues to make inroads into the traditional, difficult, plug-in web co...
Jan. 20, 2017 07:15 AM EST Reads: 2,981
In his keynote at @ThingsExpo, Chris Matthieu, Director of IoT Engineering at Citrix and co-founder and CTO of Octoblu, focused on building an IoT platform and company. He provided a behind-the-scenes look at Octoblu’s platform, business, and pivots along the way (including the Citrix acquisition of Octoblu).
Jan. 20, 2017 07:00 AM EST Reads: 9,083
For basic one-to-one voice or video calling solutions, WebRTC has proven to be a very powerful technology. Although WebRTC’s core functionality is to provide secure, real-time p2p media streaming, leveraging native platform features and server-side components brings up new communication capabilities for web and native mobile applications, allowing for advanced multi-user use cases such as video broadcasting, conferencing, and media recording.
Jan. 20, 2017 07:00 AM EST Reads: 6,873
Web Real-Time Communication APIs have quickly revolutionized what browsers are capable of. In addition to video and audio streams, we can now bi-directionally send arbitrary data over WebRTC's PeerConnection Data Channels. With the advent of Progressive Web Apps and new hardware APIs such as WebBluetooh and WebUSB, we can finally enable users to stitch together the Internet of Things directly from their browsers while communicating privately and securely in a decentralized way.
Jan. 20, 2017 03:00 AM EST Reads: 918
WebRTC is about the data channel as much as about video and audio conferencing. However, basically all commercial WebRTC applications have been built with a focus on audio and video. The handling of “data” has been limited to text chat and file download – all other data sharing seems to end with screensharing. What is holding back a more intensive use of peer-to-peer data? In her session at @ThingsExpo, Dr Silvia Pfeiffer, WebRTC Applications Team Lead at National ICT Australia, looked at differ...
Jan. 20, 2017 02:30 AM EST Reads: 5,037
The security needs of IoT environments require a strong, proven approach to maintain security, trust and privacy in their ecosystem. Assurance and protection of device identity, secure data encryption and authentication are the key security challenges organizations are trying to address when integrating IoT devices. This holds true for IoT applications in a wide range of industries, for example, healthcare, consumer devices, and manufacturing. In his session at @ThingsExpo, Lancen LaChance, vic...
Jan. 20, 2017 02:00 AM EST Reads: 6,590