Git Product home page Git Product logo

stars's Introduction

Stars is the extension that brings full stack development experience to Stripes users.

##Stars & Stripes Stars is the extension that brings full stack development experience to Stripes users.

##The benefit of using Stars

  • Be able to change the service provider easily (Just a few configurations)
  • Be able to reuse existing knowledge because you can use target framework's native annotations which you are already familiar with such as @EJB, @Autowired, etc.
  • Small footprint and lightweight.

##Features

  • Stars enhances existing ActionBean classes by providing dependency injection capability.
  • JSR 250's annotations @PostConstruct, @PreDestroy and @Resource
  • Spring integration - @Autowired annotation support and Spring callback interfaces such as InitializingBean, DisposableBean, ApplicationContextAware, BeanFactoryAware.
  • EJB integration - @EJB annotation support.
  • For Java Persistence API - @PersistenceUnit, @PersistenceContext with multiple persistence units support. Transaction type support depends on configuration and service provider.
  • Bootstrap class with dependency injection support
  • Built-in service container called Stars local service which supports annotation configuration as well. For example @Service, @ServiceBean
  • It's easy to configure and customize.
  • Useful taglibs

##Up Coming Features

  • Generic DAO
  • Security Framework Ingration (Added in 0.5.0 Release)
  • CDI
  • Web Service
  • UI Helper
  • Scripting

##Code Snippet Example The below snippet show how to implement bootstrap and use annotation in Stars. Stars does not manage transaction for Bootstrap class even you're using Stars local service, so you have to manage your own transaction. I use @SkipInjectionError to mark the bootstrap class in order to avoid injection error blocks the bootstrap job.

##Injection error? Yes! because Stars supports multiple service providers and therefore fail to inject the missing resource. In this example, if you run the web application in Java EE container managed environment, the UserTransaction resource will be avaiable; otherwise the resource will be missing. That's why @SkipInjectionError comes into play. Why Stars does not set the null value to attribute for unavailable resource instead of throwing error? The answer is http://en.wikipedia.org/wiki/Fail-fast'>Fail-fast

BugzookyBootstrap.java

@SkipInjectionError 
public class BugzookyBootstrap implements StarsBootstrap {

@PersistenceContext
private EntityManager em;

@Resource
private UserTransaction userTx;

@Override
public void execute(ServletContext servletContext) throws Exception {
    if(ServiceProvider.isEjb(servletContext)){
        userTx.begin();
    }else{
        if(!em.getTransaction().isActive()) 
            em.getTransaction().begin();
    }

The below snippet show how to inject service instance to ActionBean's attribute using annotation configuration. There are 3 annotations for 3 types of service provider- Stars local service, Spring, and EJB respectively. The amazing feature of Stars, you can change service provider easily by changing a few line of configuration (No code change!!!). It means that the below ActionBean can use 3 difference types of service by just changing a few configurations without code changing. That's cool, isn't it. You can touch this cool feature with your hand by downloading the stars-examples right now.

MultiBugActionBean.java

@UrlBinding("/bugzooky/multiBug.action") public class MultiBugActionBean extends BugzookyActionBean {

@Service(impl=BugManagerImpl.class)
@Autowired
@EJB
private BugManager bugManager;
... ```

stars's People

Contributors

hussachai avatar andylow avatar

Watchers

James Cloos avatar

stars's Issues

Unable to run stars-examples on Glassfish 3.1

What steps will reproduce the problem?
Deploy stars-examples.war to Glassfish 3.1

What is the expected output? What do you see instead?
It was deployed without any problems but StripesFilter
cannot be started due to some errors.



Original issue reported on code.google.com by [email protected] on 20 Apr 2011 at 6:57

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.