KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > deployers > spi > IncompleteDeployments


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2006, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.deployers.spi;
23
24 import java.util.Collection JavaDoc;
25 import java.util.Collections JavaDoc;
26 import java.util.Map JavaDoc;
27 import java.util.Set JavaDoc;
28 import java.util.TreeMap JavaDoc;
29 import java.util.TreeSet JavaDoc;
30 import java.io.Serializable JavaDoc;
31
32 /**
33  * IncompleteDeployments.
34  *
35  * @author <a HREF="adrian@jboss.com">Adrian Brock</a>
36  * @version $Revision: 1.1 $
37  */

38 public class IncompleteDeployments implements Serializable JavaDoc
39 {
40    /** The serialVersionUID */
41    private static final long serialVersionUID = 1433292979582684692L;
42
43    /** Deployments in error */
44    private Map JavaDoc<String JavaDoc, Throwable JavaDoc> deploymentsInError;
45
46    /** Deployments missing deployer */
47    private Collection JavaDoc<String JavaDoc> deploymentsMissingDeployer;
48
49    /** Contexts in error */
50    private Map JavaDoc<String JavaDoc, Throwable JavaDoc> contextsInError;
51
52    /** Contexts missing dependencies */
53    private Map JavaDoc<String JavaDoc, Set JavaDoc<MissingDependency>> contextsMissingDependencies;
54
55    /**
56     * Create a new IncompleteDeploymentException.
57     *
58     * @param deploymentsInError
59     * @param deploymentsMissingDeployer
60     * @param contextsInError
61     * @param contextsMissingDependencies
62     */

63    public IncompleteDeployments(Map JavaDoc<String JavaDoc, Throwable JavaDoc> deploymentsInError, Collection JavaDoc<String JavaDoc> deploymentsMissingDeployer, Map JavaDoc<String JavaDoc, Throwable JavaDoc> contextsInError, Map JavaDoc<String JavaDoc, Set JavaDoc<MissingDependency>> contextsMissingDependencies)
64    {
65       if (deploymentsInError != null && deploymentsInError.isEmpty() == false)
66       {
67          this.deploymentsInError = new TreeMap JavaDoc<String JavaDoc, Throwable JavaDoc>();
68          this.deploymentsInError.putAll(deploymentsInError);
69       }
70       if (deploymentsMissingDeployer != null && deploymentsMissingDeployer.isEmpty() == false)
71       {
72          this.deploymentsMissingDeployer = new TreeSet JavaDoc<String JavaDoc>();
73          this.deploymentsMissingDeployer.addAll(deploymentsMissingDeployer);
74       }
75       if (contextsInError != null && contextsInError.isEmpty() == false)
76       {
77          this.contextsInError = new TreeMap JavaDoc<String JavaDoc, Throwable JavaDoc>();
78          this.contextsInError.putAll(contextsInError);
79       }
80       if (contextsMissingDependencies != null && contextsMissingDependencies.isEmpty() == false)
81       {
82          this.contextsMissingDependencies = new TreeMap JavaDoc<String JavaDoc, Set JavaDoc<MissingDependency>>();
83          this.contextsMissingDependencies.putAll(contextsMissingDependencies);
84       }
85    }
86
87    /**
88     * Whether it is incomplete
89     *
90     * @return true when incomplete
91     */

92    public boolean isIncomplete()
93    {
94       if (deploymentsInError != null)
95          return true;
96       if (deploymentsMissingDeployer != null )
97          return true;
98       if (contextsInError != null)
99          return true;
100       if (contextsMissingDependencies != null)
101          return true;
102       return false;
103    }
104
105    /**
106     * Get the contextsInError.
107     *
108     * @return the contextsInError.
109     */

110    public Map JavaDoc<String JavaDoc, Throwable JavaDoc> getContextsInError()
111    {
112       if (contextsInError == null)
113          return Collections.emptyMap();
114       else
115          return Collections.unmodifiableMap(contextsInError);
116    }
117
118    /**
119     * Get the contextsMissingDependencies.
120     *
121     * @return the contextsMissingDependencies.
122     */

123    public Map JavaDoc<String JavaDoc, Set JavaDoc<MissingDependency>> getContextsMissingDependencies()
124    {
125       if (contextsMissingDependencies == null)
126          return Collections.emptyMap();
127       else
128          return Collections.unmodifiableMap(contextsMissingDependencies);
129    }
130
131    /**
132     * Get the deploymentsInError.
133     *
134     * @return the deploymentsInError.
135     */

136    public Map JavaDoc<String JavaDoc, Throwable JavaDoc> getDeploymentsInError()
137    {
138       if (deploymentsInError == null)
139          return Collections.emptyMap();
140       else
141          return Collections.unmodifiableMap(deploymentsInError);
142    }
143
144    /**
145     * Get the deploymentsMissingDeployer.
146     *
147     * @return the deploymentsMissingDeployer.
148     */

149    public Collection JavaDoc<String JavaDoc> getDeploymentsMissingDeployer()
150    {
151       if (deploymentsMissingDeployer == null)
152          return Collections.emptySet();
153       else
154          return Collections.unmodifiableCollection(deploymentsMissingDeployer);
155    }
156 }
157
Popular Tags