1 /**
2 * Copyright 2005-2006 the original author or authors.
3 *
4 * Licensed under the Gnu General Pubic License, Version 2.0 (the
5 * "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/gpl-license.php
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the Gnu General Public License for more details.
14 */
15 package org.figure8.join.view;
16
17 import org.figure8.join.businessobjects.artifact.Assembly;
18 import org.figure8.join.businessobjects.environment.Deployment;
19 import org.figure8.join.businessobjects.environment.LogicalEnvironment;
20
21 import java.io.Serializable;
22 /**
23 * This is a JavaBean encapsulating a LogicalEnvironemnt domain model object
24 * and its information on last deployment done.<br/>
25 * Instance of <code>EnvironemntView</code> class are intended to be stored within
26 * an Http layer context.
27 * @author <a href="mailto:laurent.broudoux@free.fr">Laurent Broudoux</a>
28 * @version $Revision: 1.1 $
29 */
30 public class EnvironmentView implements Serializable{
31
32
33
34 /** The encapsulated environment domain object */
35 protected LogicalEnvironment environment = null;
36 /** The optionnal last deployment completed onto this environment */
37 protected Deployment lastDeployment = null;
38
39
40
41
42 /**
43 * Creates a new instance of EnvironmentView
44 * @param environment The encapsulated environment domain object
45 * @param lastDeployment Information on last deployment done onto environment (may be null)
46 */
47 public EnvironmentView(LogicalEnvironment environment, Deployment lastDeployment){
48 this.environment = environment;
49 this.lastDeployment = lastDeployment;
50 }
51
52
53
54
55 /** @return The encapsulated environment domain object */
56 public LogicalEnvironment getLogicalEnvironment(){
57 return environment;
58 }
59
60 /** @return The last deployment done onto this environment */
61 public Deployment getLastDeployment(){
62 return lastDeployment;
63 }
64
65 /** @return A flag telling if environment is currently deployed */
66 public boolean isDeployed(){
67 return (lastDeployment != null);
68 }
69
70 /** @return The deployed assembly onto this environment if any, else null */
71 public Assembly getDeployedAssembly(){
72 if (lastDeployment == null)
73 return null;
74 return lastDeployment.getAssembly();
75 }
76 }