KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > deployment > plugins > api > IncrementalDeployment


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /*
21  * IncrementalDeployment.java
22  *
23  * Created on November 14, 2003, 9:13 AM
24  */

25
26 package org.netbeans.modules.j2ee.deployment.plugins.api;
27
28 import org.netbeans.modules.j2ee.deployment.plugins.api.AppChangeDescriptor;
29 import javax.enterprise.deploy.spi.Target JavaDoc;
30 import javax.enterprise.deploy.spi.TargetModuleID JavaDoc;
31 import javax.enterprise.deploy.spi.status.ProgressObject JavaDoc;
32 import javax.enterprise.deploy.model.DeployableObject JavaDoc;
33 import javax.enterprise.deploy.spi.DeploymentConfiguration JavaDoc;
34
35 import java.io.File JavaDoc;
36
37 /**
38  * This interface replaces DeploymentManager calls <code>deploy</code> and <code>redeploy</code> during
39  * directory-based deployment. The calling sequence is as following:
40  * <P>
41  * Initially, j2eeserver will call <code>getDirectoryForNewApplication()</code>
42  * to request destination directory to deliver the being deployed application or
43  * stand-alone module. In case of J2EE applications, <code>getDirectoryForNewModule()</code>
44  * will be called for each child module.
45  * <P>
46  * After done with copying of files over to the destination, <code>initialDeploy()</code> will
47  * be called to signal the copying is done. Processing of the returned <code>ProgressObject</code>
48  * is the same as in <code>DeploymentManager.distribute()</code> call.
49  * <P>
50  * Subsequent deployments are incremental. For each root and child module the IDE will ask plugin
51  * for destination directory by calling <code>getDirectoryForModule()</code>. After delivering
52  * the changed files for all modules, the IDE then call <code>incrementalDeploy</code> with
53  * the description of what have changed since previous deployment.
54  *<P>
55  * For in-place file deployment, where the file copying step is skipped, method
56  * <code>getDirectoryForNewApplication</code> or <code>getDirectoryForNewModule</code> calls
57  * return null.
58  * <P>
59  * J2eeserver optain an instance of IncrementalDeployment from server integration plugin by
60  * calling {@link OptionalDeploymentManagerFactory} to optain an instance of IncrementalDeployment
61  * for each {@link javax.enterprise.deploy.spi.DeploymentManager} instance.
62  * <P>
63  * @author George Finklang
64  */

65 public abstract class IncrementalDeployment {
66
67     /**
68      * First time deployment file distribution. Before this method is called
69      * the module content files should be ready in the destination location.
70      *
71      * @param target target of deployment
72      * @param app the app to deploy
73      * @param configuration server specific data for deployment
74      * @param dir the destination directory for the given deploy app
75      * @return the object for feedback on progress of deployment
76      */

77     public abstract ProgressObject JavaDoc initialDeploy(Target JavaDoc target, DeployableObject JavaDoc app, DeploymentConfiguration JavaDoc configuration, File JavaDoc dir);
78
79     /**
80      * Before this method is called, the on-disk representation of TargetModuleID
81      * is updated.
82      * @param module the TargetModuleID of the deployed application or stand-alone module.
83      * @param changes AppChangeDescriptor describing what in the application changed.
84      * @return the ProgressObject providing feedback on deployment progress.
85      **/

86     public abstract ProgressObject JavaDoc incrementalDeploy(TargetModuleID JavaDoc module, AppChangeDescriptor changes);
87     
88     /**
89      * Whether the deployable object could be file deployed to the specified target
90      * @param target target in question
91      * @param deployable the deployable object in question
92      * @return true if it is possible to do file deployment
93      */

94     public abstract boolean canFileDeploy(Target JavaDoc target, DeployableObject JavaDoc deployable);
95     
96     /**
97      * Return absolute path which the IDE will write the specified app or
98      * stand-alone module content to.
99      * @param target target server of the deployment
100      * @param app the app or stand-alone module to deploy
101      * @param configuration server specific data for deployment
102      * @return absolute path root directory for the specified app or
103      * null if server can accept the deployment from an arbitrary directory.
104      */

105     public abstract File JavaDoc getDirectoryForNewApplication(Target JavaDoc target, DeployableObject JavaDoc app, DeploymentConfiguration JavaDoc configuration);
106     
107     /**
108      * Return absolute path the IDE will write the app or stand-alone module content to.
109      * Note: to use deployment name, implementation nees to override this.
110      *
111      * @param deploymentName name to use in deployment
112      * @param target target server of the deployment
113      * @param configuration server specific data for deployment
114      * @return absolute path root directory for the specified app or null if server can accept the deployment from an arbitrary directory.
115      */

116     public File JavaDoc getDirectoryForNewApplication(String JavaDoc deploymentName, Target JavaDoc target, DeploymentConfiguration JavaDoc configuration) {
117         return getDirectoryForNewApplication(target, configuration.getDeployableObject(), configuration);
118   }
119
120   /**
121      * Return absolute path to which the IDE will write the specified module content.
122      * @param appDir the root directory of containing application
123      * @param uri the URI of child module within the app
124      * @param module the child module object to deploy
125      * @param configuration server specific data for deployment
126      * @return absolute path root directory for the specified module.
127      */

128     public abstract File JavaDoc getDirectoryForNewModule(File JavaDoc appDir, String JavaDoc uri, DeployableObject JavaDoc module, DeploymentConfiguration JavaDoc configuration);
129     
130     /**
131      * Return absolute path to which the IDE will write the content changes of specified module.
132      * @param module id for the target module.
133      * @return absolute path root directory for the specified module.
134      */

135     public abstract File JavaDoc getDirectoryForModule(TargetModuleID JavaDoc module);
136     
137     /**
138      * Get the URI pointing to location of child module inside a application archive.
139      *
140      * @param module TargetModuleID of the child module
141      * @return its relative path within application archive, returns null by
142      * default (for standalone module)
143      */

144     public String JavaDoc getModuleUrl(TargetModuleID JavaDoc module) {
145         return null;
146     }
147     
148     /**
149      * Inform the plugin that the specified module is being deployed. Notification
150      * is sent even if there is really nothing needed to be deployed.
151      *
152      * @param module module which is being deployed.
153      */

154     public void notifyDeployment(TargetModuleID JavaDoc module) {
155         //do nothing, override if needed
156
}
157 }
158
Popular Tags