KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > api > SunURIManager


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  * SunURIManager
21  *
22  */

23
24 package org.netbeans.modules.j2ee.sun.api;
25
26
27 import java.io.File JavaDoc;
28 import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceCreationException;
29 import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
30
31
32
33 public class SunURIManager {
34
35     public static final String JavaDoc SUNSERVERSURI = "deployer:Sun:AppServer::"; //NOI18N
36

37     /**
38      * Returns instance properties for the server instance.
39      *
40      * @param url the url connection string to get the instance deployment manager.
41      * @return the InstanceProperties object, null if instance does not exists.
42      */

43     
44     public static InstanceProperties getInstanceProperties(File JavaDoc serverLocation, String JavaDoc host, int port){
45         InstanceProperties instanceProperties =
46                 InstanceProperties.getInstanceProperties("["+serverLocation.getAbsolutePath()+"]"+SUNSERVERSURI+host+":"+port);
47
48         return instanceProperties;
49     }
50     /**
51      * Create new instance and returns instance properties for the server instance.
52      *
53      * @param url the url connection string to get the instance deployment manager.
54      * @param username username which is used by the deployment manager.
55      * @param password password which is used by the deployment manager.
56      * @param displayName display name which is used by IDE to represent this
57      * server instance.
58      * @return the <code>InstanceProperties</code> object, <code>null</code> if
59      * instance does not exists.
60      * @exception InstanceCreationException when instance with same url already
61      * registered.
62      */

63     public static InstanceProperties createInstanceProperties(File JavaDoc serverLocation, String JavaDoc host, String JavaDoc port, String JavaDoc user, String JavaDoc password, String JavaDoc displayName) throws InstanceCreationException {
64         InstanceProperties instanceProperties = InstanceProperties.createInstanceProperties(
65                 "["+serverLocation.getAbsolutePath()+"]"+SUNSERVERSURI+host+":"+port,
66                 user,
67                 password,displayName);
68         
69         return instanceProperties;
70     }
71     
72     
73 }
Popular Tags