Spring Framework Integration with ATG Framework:
Spring:
About: Spring framework is developed to simplify the developed of enterprise applications in Java technologies. It is an open source framework begin developed by Spring source company. Spring framework is also available for .NET framework (Spring .NET).
The Spring is light weight, non-invasive IoC Container and AOP framework. It provides support for JPA, Hibernate, Web services, Schedulers, Ajax, Struts, JSF and many other frameworks. The Spring MVC components can be used to developed MVC based web applications. Spring framework provides many features that makes the development of enterprise application easy work.
Integration with spring:
Spring:”http://www.springsource.org/documentation ” is an open source component framework. Like Nucleus, Spring is based on JavaBeans.
The ATG platform lets you integrate existing Nucleus-based and Spring-based applications. For example, if you have a Spring-based Web application that needs to access a property of an ATG user profile, you can use the integration to enable that.
The integration includes two classes:
- atg.nucleus.spring.NucleusResolverUtil enables Spring configurations to refer to Nucleus components
- atg.nucleus.spring.NucleusPublisher enables Nucleus components to refer to Spring components.
NucleusResolverUtil
The
NucleusResolverUtil
class contains a single static resolveName
method, which attempts to resolve the specified Nucleus path. Because Spring is unaware of Nucleus component scope, NucleusResolverUtil
first attempts to resolve the name in the current request of the current thread (which should succeed if the component is request- or session-scoped) and if that fails, it then attempts to resolve the name in the global Nucleus scope.To make a Nucleus component available in Spring, you declare it in your Spring configuration XML file. For example, to resolve the current user profile as a Spring component:
<bean name="/Profile" class="atg.nucleus.spring.NucleusResolverUtil"
factory-method="resolveName" singleton="false">
<constructor-arg value="/atg/userprofiling/Profile"/>
</bean>
Note: Nucleus components that do not have global scope should be specified with the
singleton
attribute set to false
. If singleton is set to true
, Spring caches the component, which can result in the wrong instance of a request- or session-scoped component being exposed. NucleusPublisher
The
NucleusPublisher
class publishes a Spring configuration (that is, a Spring ApplicationContext
) to a Nucleus path. The NucleusPublisher
appears in the specified location as a Nucleus NameContext
(a Nucleus folder) containing the JavaBeans from the Spring ApplicationContext
. You can view these Spring components in the Component Browser in Dynamo Administration.For example, you can have the
NucleusPublisher
publish an ApplicationContext
to /atg/
spring/From
Spring by including the following in the Spring configuration XML:<bean name="/NucleusPublisher" class="atg.nucleus.spring.NucleusPublisher"
singleton="true">
<property name="nucleusPath">
<value>/atg/spring/FromSpring</value>
</property>
</bean>
This enables Nucleus components to refer to Spring components in this
ApplicationContext
. For example, a Spring component called SpringBean
has this Nucleus address:/atg/
spring/From
Spring/
SpringBean
Because the
NucleusPublisher
itself is a Spring component, it can be referred to within Nucleus as:/atg/
spring/From
Spring/NucleusPublisher
The
NucleusPublisher
class is not in the main ATG CLASSPATH, but is included in a separate JAR file, <ATG9dir>/DAF/
spring/lib/
springtonucleus.jar
. NucleusPublisher
requires access to the Spring classes, so the springtonucleus.jar
must be added to the WEBINF/lib
directory of the Web application containing the Spring configuration to be exported.Note: The Nucleus
NameContext
created by the NucleusPublisher
is not be available until the Web application containing the Spring configuration has been started, so any Nucleus components that depend on Spring components must be started up after NucleusPublisher
. Therefore, NucleusPublisher
has an initialServicePaths
property, which can be configured with the paths of Nucleus components to start up after NucleusPublisher
has published the Spring ApplicationContext
. This property must be configured through the Spring configuration XML file, not through a Nucleus .properties
file.Nucleus: Organizing JavaBean Components
Nucleus is the Dynamo Application Framework’s component model for building applications from JavaBeans. Nucleus lets you assemble applications through simple configuration files that specify what components are used by the application, what parameters are used to initialize those components, and how those components hook up to each other. The ATG Control Center Components window provides a handy way to create, modify, and manage Nucleus components.
Nucleus by itself provides no application-specific functions. The JavaBean components implement all of an application’s functionality. Nucleus is the mechanism that gives those components a place to live, and a way for those components to find each other.
Nucleus also takes on the task of creating and initializing components. An application does not need to contain the code that creates a component and adds it to the Nucleus namespace. Instead, you can write a configuration file that specifies the class of the component and the initial values of the component’s properties. The first time that component is referenced by name, Nucleus finds the component’s configuration file, creates the component based on the values in that configuration file, and adds the component to the Nucleus namespace.
Nucleus provides a simple path for writing new components. Any Java object with an empty constructor can act as a component in Nucleus, so writing a new Nucleus component is as easy as writing a Java class. By adhering to JavaBeans standards for defining properties and events, a Java class can take advantage of Nucleus’s automatic creation and configuration mechanism. By implementing various interfaces, a Nucleus component can also take advantage of Nucleus services and notifications.
The Components window in the ATG Control Center provides a graphical user interface for creating, viewing, linking, and changing the states of application components. This lets you walk through the structure of a running application.
Note: This spring integration with ATG is exactly same as spring integration with Struts frame work only difference in configurable classes (licensers/ components/class) name.
To establish bridge between to two different frames works to make wiring between components sitting in different frame works .For this we have configure licensers/ components in frame work configuration to exchange configuration information from other frame work configuration to exchange components.
configuration as same as above sample example code.
configuration as same as above sample example code.
looks like you just copied text from ATG documentation.
ReplyDelete