~ubuntu-branches/ubuntu/raring/eucalyptus/raring

« back to all changes in this revision

Viewing changes to clc/modules/msgs/src/main/java/com/eucalyptus/component/event/StartComponentEvent.java

  • Committer: Package Import Robot
  • Author(s): Brian Thomason
  • Date: 2011-11-29 13:17:52 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 185.
  • Revision ID: package-import@ubuntu.com-20111129131752-rq31al3ntutv2vvl
Tags: upstream-3.0.999beta1
ImportĀ upstreamĀ versionĀ 3.0.999beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package com.eucalyptus.component.event;
2
 
 
3
 
import java.net.URI;
4
 
import java.net.URISyntaxException;
5
 
import org.apache.log4j.Logger;
6
 
import com.eucalyptus.component.Component;
7
 
import com.eucalyptus.component.ServiceConfiguration;
8
 
import com.eucalyptus.config.LocalConfiguration;
9
 
 
10
 
public class StartComponentEvent extends LifecycleEvent {
11
 
  private static Logger LOG = Logger.getLogger( StartComponentEvent.class );
12
 
  public static StartComponentEvent getLocal( ServiceConfiguration config ) {
13
 
    URI uri = null;
14
 
    try {
15
 
      uri = new URI( config.getUri( ) );
16
 
    } catch ( URISyntaxException e ) {
17
 
      LOG.fatal( "Failed to construct a valid URL from a component configuration", e );
18
 
    }
19
 
    return new StartComponentEvent( new LocalConfiguration( config.getComponent( ), uri ), config.getComponent(), true );
20
 
  }
21
 
  public static StartComponentEvent getLocal( com.eucalyptus.bootstrap.Component c ) {
22
 
    return new StartComponentEvent( new LocalConfiguration( c, c.getLocalUri( ) ), c, true );
23
 
  }
24
 
  public static StartComponentEvent getLocal( Component c ) {
25
 
    return new StartComponentEvent( new LocalConfiguration( c.getPeer( ), c.getConfiguration( ).getLocalUri( ) ), c.getPeer( ), true );
26
 
  }
27
 
  public static StartComponentEvent getRemote( ServiceConfiguration config ) {
28
 
    return new StartComponentEvent( config, config.getComponent( ), false );
29
 
  }
30
 
  
31
 
  private StartComponentEvent( ServiceConfiguration configuration, com.eucalyptus.bootstrap.Component component, boolean local ) {
32
 
    super( configuration, component.name( ), local );
33
 
  }
34
 
  @Override
35
 
  public String toString( ) {
36
 
    return "Start" + super.toString( );
37
 
  }
38
 
  
39
 
  
40
 
 
41
 
  
42
 
}