Skip to main content

Home/ SoftwareEngineering/ Group items tagged graniteds

Rss Feed Group items tagged

kuni katsuya

8. Bean Validation (JSR-303) - Confluence - 0 views

  • "Bean Validation" specification (aka JSR-303) standardizes an annotation-based validation framework for Java
  • Flex doesn't provide by itself such framework. The standard way of processing validation is to use Validator subclasses and to bind each validator to each user input (see Validating data). This method is at least time consuming for the developer, source of inconsistancies between the client-side and the server-side validation processes, and source of redundancies in your MXML code.
  • GraniteDS introduces an ActionsScript3 implementation of the Bean Validation specification and provides code generation tools integration so that your Java constraint annotations are reproduced in your AS3 beans
  • ...16 more annotations...
  • GraniteDS validation framework provides a set of standard constraints
  • Constraint Description AssertFalse The annotated element must be false AssertTrue The annotated element must be true DecimalMax The annotated element must be a number whose value must be lower or equal to the specified maximum DecimalMin The annotated element must be a number whose value must be greater or equal to the specified minimum Digits The annotated element must be a number whithin accepted range Future The annotated element must be a date in the future Max The annotated element must be a number whose value must be lower or equal to the specified maximum Min The annotated element must be a number whose value must be greater or equal to the specified minimum NotNull The annotated element must not be null Null The annotated element must be null Past The annotated element must be a date in the past Pattern The annotated String must match the supplied regular expression Size The annotated element size must be between the specified boundaries (included)
  • Constraint annotations must be placed on public properties, either public variables or public accessors
  • -keep-as3-metadata+=AssertFalse,AssertTrue,DecimalMax,DecimalMin, Digits,Future,Max,Min,NotNull,Null,Past,Pattern,Size
  • must use
  • keep the constraint annotations in your compiled code
  • Error Messages and Localization
  • {name.notnull}
  • {name.minsize}
  • use the built-in ResourceBundle support offered by Flex:
  • to add support for different locales
  • follow the same principle:
  • create a ValidationMessages.properties for the new locale
  • translate all default error messages and add new ones for your customized message keys
  • Note that the bundle name must always be set to "ValidationMessages".
  • Using the FormValidator Class
kuni katsuya

Chapter 3. Project Setup - 0 views

  • The configuration of a GraniteDS project will generally involve the following steps : Add the GraniteDS jars to the WEB-INF/lib folder of the WAR file or the lib folder of the EAR file Add the GraniteDS listener, servlets and filters in the standard WEB-INF/web.xml configuration file Define the internal configuration of GraniteDS in the WEB-INF/granite/granite-config.xml file Define the application configuration of GraniteDS (remoting destinations, messaging topics...) in the WEB-INF/flex/services-config.xml
  • You will always need granite.jar
  • jar for your JPA provider (granite-hibernate.jar for Hibernate)
  • ...11 more annotations...
  • granite-beanvalidation.jar if you want to benefit from the integration with the Bean Validation API
  • configuration file declares 3 differents things
  • Channel endpoint
  • Service factories
  • Service/destinations
  • destinations using this factory will route incoming remote calls to EJB 3
  • endpoint
  • factory 
  • destination
  • channel 
  • factory
kuni katsuya

Chapter 6. Messaging (Gravity) - 0 views

  • Granite Data Services provides a messaging feature, code name Gravity, implemented as a Comet-like service with AMF3 data polling over HTTP (producer/consumer based architecture)
  • GraniteDS messaging relies on two main AS3 components on the Flex side: org.granite.gravity.Consumer and org.granite.gravity.Producer
  • 6.3. Common Configuration There are three main steps to configure Gravity in an application: Declare the Gravity servlet implementation for your target server in web.xml Declare a messaging service and destination in services-config.xml, mapped to a specific channel definition of type GravityChannel
  • ...10 more annotations...
  • org.granite.gravity.tomcat.GravityTomcatServlet
  • /gravityamf/*
  • 6.3.1. Supported Application Servers
  • GraniteDS provides a generic servlet implementation that can work in any compliant servlet container
  • blocking IO and thus will provide relatively limited scalability
  • GraniteDS thus provides implementations of non blocking messaging for the most popular application servers.
  • asynchronous non blocking servlets
  • JBoss 5+org.granite.gravity.jbossweb.GravityJBossWebServletOnly with APR/NIO enabled (APR highly recommended)
  • GlassFish 3.xorg.granite.gravity.async.GravityAsyncServletUsing Servlet 3.0
  • Tomcat 7.x / Jetty 8.xorg.granite.gravity.async.GravityAsyncServletUsing Servlet 3.0
kuni katsuya

JBoss AS 7 | Granite Data Services - 0 views

  • JBoss AS 7 with GDS 2.3
  • JBoss AS 7 is its deep integration with Hibernate 4 which makes very painful to deploy Hibernate 3.x applications
  • recommended to upgrade to H4
  • ...6 more annotations...
  • GraniteDS now fully supports Hibernate 4
  • use the granite-hibernate4.jar instead of granite-hibernate.jar
  • Flex 4.5 broke a few APIs and there were two main issues with Tide : The client libraries crashed when run in a mobile application The PagedQuery was unusable
  • These two issues are now fixed
  • granite-flex45.swc
  • Flex SDK 4.5 here
kuni katsuya

4. Configuration for CDI - Confluence - 0 views

  • In order to initialize GDS/Tide for CDI and Hibernate, you must add granite.jar, granite-hibernate.jar and granite-cdi.jar to your WEB-INF/lib
  • The easiest way to add GraniteDS support to a CDI project in a Servlet 3 compliant container (currently only GlassFish v3) is by adding a configuration class in your project. This class will be scanned by the servlet 3 container and GraniteDS will use the annotation parameters to determine the application configuration
  • GraniteConfig.java import org.granite.config.servlet3.FlexFilter; import org.granite.gravity.config.AbstractMessagingDestination; import org.granite.gravity.config.servlet3.MessagingDestination; import org.granite.tide.cdi.CDIServiceFactory; import org.granite.tide.cdi.Identity; @FlexFilter( tide=true, type="cdi", factoryClass=CDIServiceFactory.class, tideInterfaces={Identity.class} ) public class GraniteConfig { }
  • ...6 more annotations...
  • services-config.xml
  • define manually the endpoint for remote services
  • service initializer in a static block of the main mxml file
  • Cdi.getInstance().addComponentWithFactory("serviceInitializer", DefaultServiceInitializer, { contextRoot: "/my-cdi-app" } );
  • tideAnnotations
  • list of annotation names that enable remote access to CDI beans
kuni katsuya

Quick start with GraniteDS | Granite Data Services - 0 views

  • install the GraniteDS wizard and builder plugins in Eclipse
  • graniteds-tide-cdi-jpa
  • you don’t need to have a Flex SDK installed as it will be retrieved from the Maven repository
  • ...12 more annotations...
  • 3 separate projects: a Java project, a Flex project and a Webapp project.
  • GraniteDS archetypes
  • archetypeGroupId: org.graniteds.archetypes archetypeVersion: 1.1.0.GA archetypeArtifactId:
  • Maven 3.x required
  • mvn archetype:generate    -DarchetypeGroupId=org.graniteds.archetypes    -DarchetypeArtifactId=graniteds-tide-spring-jpa-hibernate    -DarchetypeVersion=1.1.0.GA    -DgroupId=org.example    -DartifactId=springgds    -Dversion=1.0-SNAPSHOT
  • cd springgdsmvn clean package
  • build the project
  • CDI archetype requires a Java EE 6 server and uses an embedded GlassFish
  • cd webappmvn embedded-glassfish:run
  • With the Eclipse Maven integration (the M2E plugin), you can simply choose one of the archetypes when doing New Maven Project.
  • mvn war:war
  • two very easy ways to quickly create a new GraniteDS project
kuni katsuya

Chapter 2. Usage Scenarios - 0 views

  • Client Options
  • client there are two main choices
  • standard Flex RemoteObject API
  • ...16 more annotations...
  • GraniteDS does not support the standard Consumer and Producer Flex messaging API
  • its own client implementations of these classes org.granite.gravity.Consumer and org.granite.gravity.Producer that provide very similar functionality
  • Tide remoting API with the GraniteDS/Tide server framework integration
  • most advanced features and greatly simplifies asynchronous handling and client data management
  • preferred for new projects
  • Server Options
  • two options
  • GraniteDS service factory
  • RemoteObject API,
  • GraniteDS support for externalization of lazily loaded JPA entities/collections, and support for scalable messaging though Gravity
  • GraniteDS/Tide service factory
  • Tide API
  • full feature set of Tide data management and further integration with data push through Gravity
  • complete support for Spring and Seam security or integration with CDI events
  • Tide/CDI/JPA2/Java EE 6 on JBoss 6/7 or GlassFish 3
  • If you are on a Java EE 6 compliant application server, it is definitely the best option
kuni katsuya

GraniteDS: Gas3 template for complex enums | Javalobby - 0 views

  • GraniteDS: Gas3 template for complex enums
  • changed enum.gsp from class:org/granite/generator/template/enum.gsp
  • I posted  a new version on github (master-branch) that
  • ...3 more annotations...
  • works with GraniteDS 3.0.0. 
  • https://github.com/graniteds/graniteds_builder 
  • fixed and committed to github
kuni katsuya

Chapter 3. Project Setup - 0 views

kuni katsuya

7. Logging - Confluence - 0 views

  • Granite Data Services uses log4j
  • If you need other logging implementation support, you may extend the org.granite.logging.Logger abstract class and register your custom logger with the org.granite.logger.impl system property:
    • kuni katsuya
       
      eg. logback implementation
  • -Dorg.granite.logger.impl=path.to.my.CustomLogger
  • ...2 more annotations...
  • <category name="org.granite.messaging.webapp.AMFMessageServlet"> <priority value="DEBUG" /> </category>
  • 7. Logging
  •  
    how to enable graniteds debug logging
kuni katsuya

Chapter 10. Integration with CDI - 0 views

  • Chapter 10. Integration with CDI
  • GraniteDS provides out-of-the-box integration with CDI via the Tide API
  • GraniteDS also integrates with container security for authentication and role-based authorization
  • ...37 more annotations...
  • always have to include this library in either WEB-INF/lib
  • support for CDI is included in the library granite-cdi.jar
  • 10.1. Configuration with Servlet 3 On Servlet 3 compliant containers, GraniteDS can use the new APIs to automatically register its own servlets and filters and thus does not need any particular configuration in web.xml. This automatic setup is triggered when GraniteDS finds a class annotated with @FlexFilter in one of the application archives:
  • @FlexFilter(configProvider=CDIConfigProvider.class) public class GraniteConfig { }  
  • list of annotation names that enable remote access to CDI beans
  • ConfigProvider
  • override these values by setting them in the annotation properties
  • tide=true,         type="cdi",         factoryClass=CDIServiceFactory.class,         tideInterfaces={Identity.class}
  • @FlexFilter declaration will setup an AMF processor for the specified url pattern
  • tideAnnotations
  • defines suitable default values
  • @TideEnabled
  • @RemoteDestination
  • always declared by default
  • tideInterfaces
  • tideRoles
  • exceptionConverters
  • identity
  • 10.3.2. Typesafe Remoting with Dependency Injection
  • It is possible to benefit from even more type safety by using the annotation [Inject] instead of In. When using this annotation, the full class name is used to find the target bean in the CDI context instead of the bean name.
  • Security
  • integration between the client RemoteObject credentials and the server-side container security
  • client-side component named
  • amf3MessageInterceptor
  • API to define runtime authorization checks on the Flex UI
  • login()
  • logout()
  • login(username, password, loginResult, loginFault)
  • logout()
  • bindable property
  • clear the security cache manually with
  • loggedIn
  • identity.loggedIn 
  • integrated with server-side role-based security
  • identity.hasRole('admin')
  • represents the current authentication state
  • identity.clearSecurityCache()
kuni katsuya

Interview of GraniteDS founders | RIAgora - 0 views

  • explained the origin of GraniteDS and the differences with LiveCycle Data Services
  • ActionScript3 reflection API
  • GraniteDS 2.2
  • ...8 more annotations...
  • JSR-303 (“Bean Validation”) ActionScript3 framework for form validation
  • validation framework is a specific adaptation of the JSR-303 (Bean Validation) specification to Flex: like its Java counterpart, it relies on validation annotations placed on bean properties and provides an engine API that lets you validate your forms without writing by hand a specific validator for each of your input fields
  • code generation tools provided by GraniteDS so that when you write your Java entity bean with validation annotations, they are automatically replicated in your ActionScript3 beans
  • problem with LCDS is mainly that it promotes a strict “client / server” architecture, with – roughly speaking – a heavy Flex client application connected to a server almost reduced to a database frontend
  • big majority of  these organizations use BlazeDS, a free and open-source subset of LCDS
  • need more advanced mechanisms than just Remoting start looking for open-source libraries to enable deeper integrations with the Java business layer, and GraniteDS is for sure the most popular project
  • “Flex Data Services” (now renamed to “Live Cycle Data Services”)
  • Flex Data Services seemed too “client-centric”
kuni katsuya

Chapter 4. Remoting and Serialization - 0 views

  • 4.3. Mapping Java and AS3 objects
  • data conversions are done during serialization/deserialization
  • Externalizers and AS3 Code Generation
  • ...21 more annotations...
  • Due to the limited capabilities of the ActionScript 3 reflection API than cannot access private fields, it is necessary to create an externalizable AS3 class (implementing flash.utils.IExternalizable and its corresponding externalizable Java class
  • writeExternal
  • In both classes you have to implement two methods
  • the Gas3 generator can automatically generate the writeExternal and readExternal methods.
  • With GraniteDS automated externalization and without any modification made to our bean, we may serialize all properties of the Person class, private or not
  • In order to externalize the Person.java entity bean, we must tell GraniteDS which classes we want to externalize with a
  • externalize all classes named com.myapp.entity.Person by using the org.granite.hibernate.HibernateExternalizer
  • you could use this declaration, but note that type in the example above is replaced by
  • instance-of:
  •             <include annotated-with="javax.persistence.Entity"/>             <include annotated-with="javax.persistence.MappedSuperclass"/>             <include annotated-with="javax.persistence.Embeddable"/>
  • : type
  • annotated-with
  • Instead of configuring externalizers with the above method, you may use the
  • feature:
  • precedence rules for these three configuration options:
  • <granite-config scan="true"/>
  • autoscan
  • GraniteDS will scan at startup all classes
  • found in the classloader of the GraniteConfig class, and discover all externalizers (classes that implements the GDS Externalizer interface)
  • DefaultExternalizer
  • this externalizer may be used with any POJO bean.
  •  
    4.3. Mapping Java and AS3 objects
kuni katsuya

Chapter 3. Project Setup - 0 views

  • Using Maven archetypes
  • GraniteDS/Tide/CDI/JPA: graniteds-tide-cdi-jpa
  • GraniteDS/Tide/Seam 2/JPA/Hibernate: graniteds-tide-seam-jpa-hibernate
  • ...3 more annotations...
  • Maven 3 is highly recommended but Maven 2.2 should also work
  • CDI archetype defines an embedded GlassFish run configuration
  • mvn embedded-glassfish:run
kuni katsuya

Remote call using class as parameter - Google Groups - 0 views

  • public class ClassHolderDTO<T> {    private Class<T> classToTransfer;// get/set boilerplate}
  • Resource
  • Class<Resource> entityClass
  • ...18 more annotations...
  • Class as parameter
  • serverside
  • Remote call using class as parameter
  • Does GraniteDS could manage date and TimeZone ?
  • Flash Player (GMT +X) -> IExternizable methods (GMT + X - X = GMT + 0) - > AMF over HTTP (GMT + 0) -> Granite AMF0Deserializer (GMT + 0) -> Granite Converter (GMT + 0 + Y = GMT + Y) -> Java Services (GMT + Y)Java Services (GMT + Y) -> Granite Converter (GMT + Y - Y = GMT + 0) -> Granite AMF0Deserializer (GMT + 0) -> AMF over HTTP (GMT + 0) -> IExternizable methods (GMT + 0 + X = GMT + X) -> Flash Player (GMT + X)
  • We use
  • GMT + 0
  • for AMF for convention
  • define a
  • fixed timezone
  • for your AMF that is over HTTP
  • GMT + X
  • : timezone for your flex client
  • GMT + Y
  • : timezone for your server
  • don't want to modify the default templates
  • override the readExternal / writeExternal methods and do the conversion here.
  • The patch is to use a custom template for generating your as files with a conversion to GMT 0 in the implementations of IExternalizable methods.On the server-side you add a Converter to convert dates GMT 0 to dates GMT + Y.
    • kuni katsuya
       
      see better suggestion below (ie. override instead of replace)
kuni katsuya

10. MXML & AS3 Web Compiler - Confluence - 0 views

  • GraniteDS comes with a powerful MXML/ActionScript3 compiler you may deploy in your servlet container. This servlet will compile your MXML code on the fly each time you have modified it and return a SWF
  • download the graniteds-webcompiler-***.zip bundle on SourceForge.
    • kuni katsuya
kuni katsuya

Chapter 9. Integration with Seam 2.2 - 0 views

  • 9.2.6. Integration with Seam Security
  • When not using the Seam native setup, you have to manually configure the integration of Seam Security in granite-config.xml.
  • <granite-config>    ...    <!--     ! Use Seam 2.1+ based security service.     !-->     <security type="org.granite.seam21.security.Seam21SecurityService"/> </granite-config>
kuni katsuya

Release Notes - GraniteDS - Version 3.0.0.M1 - HTML format - Granite Data Services - 0 views

  • Release Notes - GraniteDS - Version 3.0.0.M1
  • GAS3 does not handle Java generics with abstract class implementations
  • Generated as3 has compilation warnings: missing constructor
  • ...1 more annotation...
  • Rename flex-filter to server-filter and @FlexFilter to @ServerFilter
kuni katsuya

Chapter 10. Integration with CDI - 0 views

  • GraniteDS provides out-of-the-box integration with CDI via the Tide API
  • Integration with CDI
  • fully supports serialization of JPA entities from and to your Flex application, taking care of lazily loaded associations
  • ...3 more annotations...
  • GraniteDS also integrates with container security for authentication and role-based authorization
  • granite-cdi.jar
  • JBoss 6 and GlassFish v3
kuni katsuya

GraniteDS - deserialize ActionScript object to a Java Map object - Ross Henderson - 0 views

  • GraniteDS – deserialize ActionScript object to a Java Map object
  • key of type String and a value of type List
  • HOWEVER, the value has to be an ArrayCollection, not an Array.
  • ...2 more annotations...
  • Dictionary object is very similar to Java’s Map object.
  • Granite claims to implement the same serialization/deserialization matrix as BlazeDS (with two small exceptions).
1 - 20 of 106 Next › Last »
Showing 20 items per page