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(com.atlassian.gadgets.dashboard.spi.GadgetStateFactory stateFactory, com.atlassian.gadgets.spec.GadgetSpecFactory specFactory, com.atlassian.sal.api.message.I18nResolver i18n, com.atlassian.sal.api.message.HelpPathResolver helpPathResolver)
          Creates a new GadgetFactoryImpl that delegates to the specified factory.
 
Method Summary
 Gadget createGadget(com.atlassian.gadgets.GadgetState state, com.atlassian.gadgets.GadgetRequestContext gadgetRequestContext)
          Constructs a Gadget instance from the specified GadgetState.
 Gadget createGadget(String gadgetSpecUrl, com.atlassian.gadgets.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(com.atlassian.gadgets.dashboard.spi.GadgetStateFactory stateFactory,
                         com.atlassian.gadgets.spec.GadgetSpecFactory specFactory,
                         com.atlassian.sal.api.message.I18nResolver i18n,
                         com.atlassian.sal.api.message.HelpPathResolver helpPathResolver)
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
helpPathResolver -
Method Detail

createGadget

public Gadget createGadget(String gadgetSpecUrl,
                           com.atlassian.gadgets.GadgetRequestContext gadgetRequestContext)
                    throws com.atlassian.gadgets.GadgetParsingException,
                           com.atlassian.gadgets.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:
com.atlassian.gadgets.GadgetParsingException - if there is an error parsing the gadget spec at the specified URL
com.atlassian.gadgets.GadgetSpecUriNotAllowedException - if the specified gadget spec URL is not a valid URI

createGadget

public Gadget createGadget(com.atlassian.gadgets.GadgetState state,
                           com.atlassian.gadgets.GadgetRequestContext gadgetRequestContext)
                    throws com.atlassian.gadgets.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:
com.atlassian.gadgets.GadgetParsingException - if there is an error parsing the gadget spec at the URL specified by state.getGadgetSpecUri()


Copyright © 2011 Atlassian. All Rights Reserved.