KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > deployment > SerializableDeploymentInfo


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, 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.deployment;
23
24 // $Id: SerializableDeploymentInfo.java 57108 2006-09-23 20:55:54Z scott.stark@jboss.org $
25

26 import javax.management.ObjectName JavaDoc;
27 import java.io.Serializable JavaDoc;
28 import java.net.URL JavaDoc;
29 import java.util.ArrayList JavaDoc;
30 import java.util.Collection JavaDoc;
31 import java.util.Date JavaDoc;
32 import java.util.List JavaDoc;
33
34 /**
35  * DeploymentInfo for remote access by the DeploymentManager.
36  * It provides a serializable subset of the information available in DeploymentInfo.
37  *
38  * @author thomas.diesler@jboss.org
39  * @version $Revision: 57108 $
40  */

41 public class SerializableDeploymentInfo implements Serializable JavaDoc
42 {
43    /** @since 4.0.2 */
44    private static final long serialVersionUID = -3847995513551913798L;
45    
46    // The initial construction timestamp
47
public Date JavaDoc date;
48    // The URL identifing this SDI
49
public URL JavaDoc url;
50    // An optional URL to a local copy of the deployment
51
public URL JavaDoc localUrl;
52    // The URL used to watch for changes when the deployment is unpacked
53
public URL JavaDoc watch;
54    // The suffix of the deployment url
55
public String JavaDoc shortName;
56    // The last system time the deployment inited by the MainDeployer
57
public long lastDeployed;
58    // Use for "should we redeploy failed"
59
public long lastModified;
60    // A free form status for the "state" can be Deployed/failed etc etc
61
public String JavaDoc status;
62    // The current state of the deployment
63
public DeploymentState state;
64    // The subdeployer that handles the deployment
65
public ObjectName JavaDoc deployer;
66    // The classpath declared by this xml descriptor, needs <classpath> entry
67
public Collection JavaDoc classpath = new ArrayList JavaDoc();
68    // The mbeans deployed
69
public List JavaDoc mbeans;
70    // Anyone can have subdeployments
71
public List JavaDoc subDeployments;
72    // And the subDeployments have a parent
73
public SerializableDeploymentInfo parent;
74    // the web root context in case of war file
75
public String JavaDoc webContext;
76    // An optional URL to the URL of the document loaded
77
public URL JavaDoc documentUrl;
78    // Is this a stand-alone service descriptor
79
public boolean isXML;
80    public boolean isScript;
81    // Does the deployment url point to a directory
82
public boolean isDirectory;
83    // Can contain the MBean that is created through the deployment
84
public ObjectName JavaDoc deployedObject;
85
86    // Constructors *****************************************************************************************************
87

88    /**
89     * Construct this object from a DeploymentInfo
90     */

91    public SerializableDeploymentInfo(DeploymentInfo info)
92    {
93       this.date = info.date;
94       this.url = info.url;
95       this.localUrl = info.localUrl;
96       this.watch = info.watch;
97       this.shortName = info.shortName;
98       this.lastDeployed = info.lastDeployed;
99       this.lastModified = info.lastModified;
100       this.status = info.status;
101       this.state = info.state;
102       this.deployer = info.deployer.getServiceName();
103       this.classpath = info.classpath;
104       this.mbeans = info.mbeans;
105       this.webContext = info.webContext;
106       this.documentUrl = info.documentUrl;
107       this.isXML = info.isXML;
108       this.isScript = info.isScript;
109       this.isDirectory = info.isDirectory;
110       this.deployedObject = info.deployedObject;
111
112       // we do these in a second iteration
113
this.parent = null;
114       this.subDeployments = new ArrayList JavaDoc();
115    }
116
117    /**
118     * Returns a string representation of the object.
119     */

120    public String JavaDoc toString()
121    {
122       StringBuffer JavaDoc s = new StringBuffer JavaDoc(super.toString());
123       s.append(" { url=" + url + " }\n");
124       s.append(" deployer: " + deployer + "\n");
125       s.append(" status: " + status + "\n");
126       s.append(" state: " + state + "\n");
127       s.append(" watch: " + watch + "\n");
128       s.append(" lastDeployed: " + lastDeployed + "\n");
129       s.append(" lastModified: " + lastModified + "\n");
130       s.append(" mbeans: " + mbeans + "\n");
131       s.append(" }\n");
132       return s.toString();
133    }
134 }
135
Popular Tags