com.atlassian.gadgets.dashboard.internal.impl
Class GadgetFactoryImpl

java.lang.Object
  extended by com.atlassian.gadgets.dashboard.internal.impl.GadgetFactoryImpl
All Implemented Interfaces:
GadgetFactory

public class GadgetFactoryImpl
extends Object
implements GadgetFactory

An implementation of GadgetFactory that delegates to a GadgetStateFactory and a GadgetSpecFactory and returns GadgetImpl instances.


Constructor Summary
GadgetFactoryImpl(GadgetStateFactory stateFactory, GadgetSpecFactory specFactory)
          Creates a new GadgetFactoryImpl that delegates to the specified factory.
 
Method Summary
 Gadget createGadget(GadgetState state, GadgetRequestContext gadgetRequestContext)
          Constructs a Gadget instance from the specified GadgetState.
 Gadget createGadget(String gadgetSpecUrl, GadgetRequestContext gadgetRequestContext)
          Creates a new gadget from the spec at the specified URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GadgetFactoryImpl

public GadgetFactoryImpl(GadgetStateFactory stateFactory,
                         GadgetSpecFactory specFactory)
Creates a new GadgetFactoryImpl that delegates to the specified factory.

Parameters:
stateFactory - the factory to use to create new gadget state objects
specFactory - the factory to use to retrieve gadget specs
Method Detail

createGadget

public Gadget createGadget(String gadgetSpecUrl,
                           GadgetRequestContext gadgetRequestContext)
                    throws GadgetParsingException,
                           GadgetSpecUriNotAllowedException
Creates a new gadget from the spec at the specified URL. This is used when creating new gadget instances.

Specified by:
createGadget in interface GadgetFactory
Parameters:
gadgetSpecUrl - the URL of the gadget spec file
gadgetRequestContext - context for this request
Returns:
the Gadget created from the specified spec URL
Throws:
GadgetParsingException - if there is an error parsing the gadget spec at the specified URL
GadgetSpecUriNotAllowedException - if the specified gadget spec URL is not a valid URI

createGadget

public Gadget createGadget(GadgetState state,
                           GadgetRequestContext gadgetRequestContext)
                    throws GadgetParsingException
Constructs a Gadget instance from the specified GadgetState. This is used to reconstruct existing gadget instances.

Specified by:
createGadget in interface GadgetFactory
Parameters:
state - the persistent gadget state to reconstruct from
gadgetRequestContext - context for this request
Returns:
the Gadget reconstructed from the specified state
Throws:
GadgetParsingException - if there is an error parsing the gadget spec at the URL specified by state.getGadgetSpecUri()


Copyright © 2009 Atlassian. All Rights Reserved.