KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > javax > management > remote > compliance > serialization > support > RemoteInstantiator


1 /*
2  * Copyright (C) The MX4J Contributors.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the MX4J License version 1.0.
6  * See the terms of the MX4J License in the documentation provided with this software.
7  */

8
9 package test.javax.management.remote.compliance.serialization.support;
10
11 import java.net.MalformedURLException JavaDoc;
12 import java.util.HashMap JavaDoc;
13 import javax.management.remote.JMXConnectionNotification JavaDoc;
14 import javax.management.remote.JMXPrincipal JavaDoc;
15 import javax.management.remote.JMXProviderException JavaDoc;
16 import javax.management.remote.JMXServerErrorException JavaDoc;
17 import javax.management.remote.JMXServiceURL JavaDoc;
18 import javax.management.remote.NotificationResult JavaDoc;
19 import javax.management.remote.SubjectDelegationPermission JavaDoc;
20 import javax.management.remote.TargetedNotification JavaDoc;
21 import javax.management.remote.rmi.RMIConnector JavaDoc;
22
23 /**
24  * @version $Revision: 1.6 $
25  */

26 public class RemoteInstantiator
27 {
28    public JMXConnectionNotification JavaDoc createJMXConnectionNotification()
29    {
30       JMXConnectionNotification JavaDoc jcn = new JMXConnectionNotification JavaDoc(JMXConnectionNotification.OPENED,
31                                                                     "Source", "ConnectionID",
32                                                                     0L, "Message", "UserData");
33       return jcn;
34    }
35
36    public JMXPrincipal JavaDoc createJMXPrincipal()
37    {
38       JMXPrincipal JavaDoc jp = new JMXPrincipal JavaDoc(JMXPrincipal JavaDoc.class.getName());
39       return jp;
40    }
41
42    public JMXProviderException JavaDoc createJMXProviderException()
43    {
44       JMXProviderException JavaDoc ex = new JMXProviderException JavaDoc();
45       return ex;
46    }
47
48    public JMXServerErrorException JavaDoc createJMXServerErrorException()
49    {
50       JMXServerErrorException JavaDoc see = new JMXServerErrorException JavaDoc("Message", new Error JavaDoc());
51       return see;
52    }
53
54    public JMXServiceURL JavaDoc createJMXServiceURL()
55    {
56       try
57       {
58          JMXServiceURL JavaDoc jsu = new JMXServiceURL JavaDoc("rmi", "localhost", 1099);
59          return jsu;
60       }
61       catch (MalformedURLException JavaDoc e)
62       {
63          throw new RuntimeException JavaDoc();
64       }
65    }
66
67    public NotificationResult JavaDoc createNotificationResult()
68    {
69       TargetedNotification JavaDoc[] notifs =
70               {createTargetedNotification()};
71       NotificationResult JavaDoc result = new NotificationResult JavaDoc(0l, 1l, notifs);
72       return result;
73    }
74
75    public SubjectDelegationPermission JavaDoc createSubjectDelegationPermission()
76    {
77       SubjectDelegationPermission JavaDoc sdp = new SubjectDelegationPermission JavaDoc(SubjectDelegationPermission JavaDoc.class.getName());
78       return sdp;
79    }
80
81    public TargetedNotification JavaDoc createTargetedNotification()
82    {
83       TargetedNotification JavaDoc tn = new TargetedNotification JavaDoc(createJMXConnectionNotification(), Integer.decode("1"));
84       return tn;
85    }
86
87    public RMIConnector JavaDoc createRMIConnector()
88    {
89       RMIConnector JavaDoc rc = new RMIConnector JavaDoc(createJMXServiceURL(), new HashMap JavaDoc());
90       return rc;
91    }
92 }
93
Popular Tags