KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > tests > j2eeserver > plugin > IncrementalDeploySupport


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 package org.netbeans.tests.j2eeserver.plugin;
21
22 import javax.enterprise.deploy.model.*;
23 import javax.enterprise.deploy.spi.*;
24 import javax.enterprise.deploy.shared.*;
25 import javax.enterprise.deploy.spi.status.*;
26 import org.netbeans.modules.j2ee.deployment.plugins.api.*;
27 import org.netbeans.modules.j2ee.deployment.plugins.api.*;
28 import org.netbeans.tests.j2eeserver.plugin.jsr88.*;
29
30 import java.io.*;
31 import java.util.*;
32
33 /**
34  *
35  * @author nn136682
36  */

37 public class IncrementalDeploySupport extends IncrementalDeployment {
38     DepManager dm;
39     File applicationsDir;
40     HashMap moduleDirectories = new HashMap();
41     
42     /** Creates a new instance of IncrementalDeploySupport */
43     public IncrementalDeploySupport(DeploymentManager manager) {
44         this.dm = (DepManager) dm;
45     }
46     
47     public void setDeploymentManager(DeploymentManager manager) {
48         if (manager instanceof DepManager)
49             dm = (DepManager) manager;
50         else
51             throw new IllegalArgumentException JavaDoc("setDeploymentManager: Invalid manager type");
52     }
53     
54     File getApplicationsDir() {
55         if (applicationsDir != null)
56             return applicationsDir;
57         
58         File userdir = new File(System.getProperty("netbeans.user"));
59         applicationsDir = new File(userdir, "testplugin/applications");
60         if (! applicationsDir.exists())
61             applicationsDir.mkdirs();
62         return applicationsDir;
63     }
64         
65     static Map planFileNames = new HashMap();
66     static {
67         planFileNames.put(ModuleType.WAR, new String JavaDoc[] {"tpi-web.xml"});
68         planFileNames.put(ModuleType.EJB, new String JavaDoc[] {"tpi-ejb-jar.xml"});
69         planFileNames.put(ModuleType.EAR, new String JavaDoc[] {"tpi-application.xml"});
70     }
71     
72     public File getDirectoryForModule (TargetModuleID module) {
73         File appDir = new File(getApplicationsDir(), getModuleRelativePath((TestTargetMoid)module));
74         if (! appDir.exists())
75             appDir.mkdirs();
76         System.out.println("getDirectoryForModule("+module+") returned: "+appDir);
77         return appDir;
78     }
79     
80     String JavaDoc getModuleRelativePath(TestTargetMoid module) {
81         File path;
82         if (module.getParent() != null)
83             path = new File(module.getParent().getModuleID(), module.getModuleID());
84         else
85             path = new File(module.getModuleID());
86         return path.getPath();
87     }
88     
89     public String JavaDoc getModuleUrl(TargetModuleID module) {
90         return ((TestTargetMoid)module).getModuleUrl();
91     }
92     
93     
94     public ProgressObject incrementalDeploy (TargetModuleID module, AppChangeDescriptor changes) {
95         return null;//dm.incrementalDeploy(module, changes);
96
}
97     
98     public boolean canFileDeploy (Target target, DeployableObject deployable) {
99         return true;
100     }
101     
102     public File getDirectoryForNewApplication (Target target, DeployableObject app, DeploymentConfiguration configuration) {
103         return null;
104     }
105     
106     public File getDirectoryForNewModule (File appDir, String JavaDoc uri, DeployableObject module, DeploymentConfiguration configuration) {
107         return null;
108     }
109     
110     public ProgressObject initialDeploy (Target target, DeployableObject app, DeploymentConfiguration configuration, File dir) {
111         return null;
112     }
113     
114 }
115
Popular Tags