KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jmanage > core > management > ServerConnectorTest


1 /**
2  * Copyright 2004-2005 jManage.org
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.jmanage.core.management;
17
18 import org.jmanage.core.config.ApplicationConfig;
19 import org.jmanage.core.config.ApplicationConfigFactory;
20
21 import java.util.Set JavaDoc;
22
23 /**
24  *
25  * date: Aug 18, 2004
26  * @author Rakesh Kalra
27  */

28 public class ServerConnectorTest {
29
30     public static void main(String JavaDoc[] args) throws Exception JavaDoc {
31         if(args.length == 0){
32             System.out.println("Usage: java ServerConnectorTest [weblogic, tomcat, jsr160]");
33             System.exit(0);
34         }
35         ApplicationConfig appConfig = getApplicationConfig(args[0]);
36         ServerConnection connection =
37                 ServerConnector.getServerConnection(appConfig);
38         Set JavaDoc objects = connection.queryNames(new ObjectName("*:*"));
39         connection.close();
40         System.out.println("number of objects:" + objects.size());
41     }
42
43     private static ApplicationConfig getApplicationConfig(String JavaDoc type){
44         final ApplicationConfig appConfig =
45                 ApplicationConfigFactory.create("1234",
46                         "test", type,
47                         "localhost", new Integer JavaDoc(7001), null,
48                         "system", "12345678", null);
49         return appConfig;
50     }
51
52 }
53
Popular Tags