pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.bundle
Class Bundle

java.lang.Object
  extended by org.torweg.pulse.bundle.Bundle
All Implemented Interfaces:
java.io.Serializable, LifecycleResource

@Entity
public final class Bundle
extends java.lang.Object
implements java.io.Serializable, LifecycleResource

a bundle in the pulse web application framework.

Version:
$Revision: 2071 $
Author:
Thomas Weber, Christian Schatt
See Also:
Serialized Form

Constructor Summary
protected Bundle()
          Deprecated. 
  Bundle(java.io.File dir)
          constructs a new startable bundle with the given name.
 
Method Summary
 boolean equals(java.lang.Object obj)
          compares the given object with the Bundle.
 ActionConfiguration getActionConfiguration(java.lang.String action)
          returns the ActionConfiguration for the given action.
 java.util.Collection<ActionConfiguration> getActionConfigurations()
          returns the action configurations of the bundle.
 java.util.Collection<java.lang.String> getActionsRequiringTokens()
          returns the actions requiring Tokens.
 java.util.Set<ControllerMethodConfiguration> getAnyActionConfigurations(Controller.AlwaysRun mode)
          returns the no-action configurations of the specified mode.
 java.util.Set<java.lang.Class<? extends java.lang.Object>> getContentTypes()
           
 java.util.List<Controller> getControllers()
           
 java.io.File getDirectory()
           
 java.lang.Long getId()
          returns the primary key.
 java.lang.String getName()
           
 ViewTypes getViewTypes(java.lang.Object object)
          Returns the Views of the Bundle for the given Content.
 int hashCode()
           
 boolean isModified()
          indicates whether this Resource or any of its Sub-Resources has been modified.
 void restart()
          reloads the bundle.
 void setControllerMappings(java.util.Map<java.lang.String,ActionConfiguration> actionConfs, java.util.Set<ControllerMethodConfiguration> anyActionPreConfs, java.util.Set<ControllerMethodConfiguration> anyActionPostConfs, java.util.Set<java.lang.String> requireTokenActions)
          sets the annotation based controller mappings.
 void shutdown()
          stops the bundle.
 void startup()
          starts the bundle.
 net.sf.json.JSONObject toJSON()
          Returns a JSON-representation of the Bundle.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Bundle

@Deprecated
protected Bundle()
Deprecated. 

used by HibernateTM.


Bundle

public Bundle(java.io.File dir)
constructs a new startable bundle with the given name.

Parameters:
dir - the bundle's root directory
Method Detail

getId

public java.lang.Long getId()
returns the primary key.

Returns:
the primary key

getName

public java.lang.String getName()
Returns:
the name of the Bundle

getControllers

public java.util.List<Controller> getControllers()
Returns:
the controllers of the Bundle

getActionsRequiringTokens

public java.util.Collection<java.lang.String> getActionsRequiringTokens()
returns the actions requiring Tokens.

Returns:
the actions requiring Tokens

setControllerMappings

public void setControllerMappings(java.util.Map<java.lang.String,ActionConfiguration> actionConfs,
                                  java.util.Set<ControllerMethodConfiguration> anyActionPreConfs,
                                  java.util.Set<ControllerMethodConfiguration> anyActionPostConfs,
                                  java.util.Set<java.lang.String> requireTokenActions)
sets the annotation based controller mappings.

Parameters:
actionConfs - the action configurations
anyActionPreConfs - the method configuration for any action methods (PRE)
anyActionPostConfs - the method configuration for any action methods (POST)
requireTokenActions - the actions requiring tokens
See Also:
Controller.AlwaysRun

getActionConfigurations

public java.util.Collection<ActionConfiguration> getActionConfigurations()
returns the action configurations of the bundle.

Returns:
the action configurations

getActionConfiguration

public ActionConfiguration getActionConfiguration(java.lang.String action)
returns the ActionConfiguration for the given action.

Parameters:
action - the action
Returns:
the ActionConfiguration, or null, if no such configuration exists.

getAnyActionConfigurations

public java.util.Set<ControllerMethodConfiguration> getAnyActionConfigurations(Controller.AlwaysRun mode)
returns the no-action configurations of the specified mode.

Parameters:
mode - the mode of the no-action configurations requested
Returns:
an unmodifiable view of the no-action configurations

getDirectory

public java.io.File getDirectory()
Returns:
the root directory of the Bundle

getContentTypes

public java.util.Set<java.lang.Class<? extends java.lang.Object>> getContentTypes()
Returns:
the Content types available from the Bundle

getViewTypes

public ViewTypes getViewTypes(java.lang.Object object)
Returns the Views of the Bundle for the given Content.

Parameters:
object - the object to check against
Returns:
the Views of the Bundle for the given Content.

isModified

public boolean isModified()
indicates whether this Resource or any of its Sub-Resources has been modified.

Specified by:
isModified in interface LifecycleResource
Returns:
true, if the resource has been modified

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
the hash code
See Also:
Object.hashCode()

equals

public boolean equals(java.lang.Object obj)
compares the given object with the Bundle.

If the object is not an instance of Bundle, the method returns false. Otherwise, if both bundles have an initialised, id the bundles are compared by id. If one of the bundles does not have an initialised id, the bundles are compared by name.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to check against
Returns:
true, if the given object is equal to the Bundle

startup

public void startup()
starts the bundle.

  1. the "bundle.xml" is read
  2. all page flows of the bundle are pre-initialised
  3. the BundleClassLoader is started
  4. the SymbolResolver for page flow symbols is set up
  5. if needed, a DataSourceFactory is started
  6. if defined in &lt;watch-resources/&gt;, these resources are added to the trigger list for reloads

Specified by:
startup in interface LifecycleResource

shutdown

public void shutdown()
stops the bundle.

  1. if present, the DataSourceFactory is stopped
  2. the SymbolResolver is set to null
  3. the page flows of the bundle are set to null
  4. the bundle is flushed from the config pool
  5. the BundleClassLoader is stopped
  6. clean up the watch resources
  7. the bundle.xml is set to null

Specified by:
shutdown in interface LifecycleResource

restart

public void restart()
reloads the bundle.

Specified by:
restart in interface LifecycleResource

toJSON

public net.sf.json.JSONObject toJSON()
Returns a JSON-representation of the Bundle.

Returns:
a JSON-representation of the Bundle