KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > ext > security > EntityVirtualNode


1 /*
2 * ################################################################
3 *
4 * ProActive: The Java(TM) library for Parallel, Distributed,
5 * Concurrent computing with Security and Mobility
6 *
7 * Copyright (C) 1997-2002 INRIA/University of Nice-Sophia Antipolis
8 * Contact: proactive-support@inria.fr
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 * USA
24 *
25 * Initial developer(s): The ProActive Team
26 * http://www.inria.fr/oasis/ProActive/contacts.html
27 * Contributor(s):
28 *
29 * ################################################################
30 */

31 package org.objectweb.proactive.ext.security;
32
33 import java.io.Serializable JavaDoc;
34 import java.security.cert.X509Certificate JavaDoc;
35
36
37 /**
38  * @author acontes
39  *
40  * To change the template for this generated type comment go to
41  * Window>Preferences>Java>Code Generation>Code and Comments
42  */

43 public class EntityVirtualNode extends Entity implements Serializable JavaDoc {
44     protected String JavaDoc virtualNodeName;
45
46     public EntityVirtualNode() {}
47
48     /**
49      * represent
50      */

51     public EntityVirtualNode(String JavaDoc name, X509Certificate JavaDoc application,
52         X509Certificate JavaDoc certificate) {
53         super();
54         virtualNodeName = name;
55         if (application == null ) {
56             System.out.println("APPPLICATION CERTITIFACATE IS NULLL");
57             throw new RuntimeException JavaDoc();
58         }
59         if (name == null ) {
60                   System.out.println("APPPLICATION Name IS NULLL");
61             throw new RuntimeException JavaDoc();
62               }
63               
64        System.out.println("VIRTUAL NODE ENTITY CONSTRUCTOR " + application.getSubjectDN());
65         this.applicationCertificate = application;
66         //this.certificate = certificate;
67
}
68
69     //public EntityVirtualNode(String name) {
70
// super();
71
// virtualNodeName = name;
72
// }
73

74     public String JavaDoc getName() {
75         return virtualNodeName;
76     }
77     
78     public String JavaDoc toString() {
79         String JavaDoc s = null;
80         s = virtualNodeName;
81         s += applicationCertificate.getSubjectDN().getName() +" |||| ";
82         //s+= certificate.getSubjectDN().getName();
83
return s ;
84     }
85     
86     public boolean equals(Entity e) {
87         if (e instanceof EntityVirtualNode) {
88          if (applicationCertificate == null) {
89          
90          logger.debug("applicationCErtificate null");
91          return false;
92          }
93     // logger.debug (" OP " + virtualNodeName + " OP C " + applicationCertificate.getSubjectDN().getName());
94
if (((EntityVirtualNode) e).getApplicationCertificate() == null) {
95                 logger.debug("distant applicationCErtificate null");
96                 return false;
97             }
98     // logger.debug (" DP " + ((EntityVirtualNode) e).virtualNodeName + " DC " + ((EntityVirtualNode) e).applicationCertificate.getSubjectDN().getName());
99

100           return this.virtualNodeName.equals(((EntityVirtualNode) e).virtualNodeName) && e.getApplicationCertificate().equals(applicationCertificate);
101         }
102         return false;
103     }
104     
105     
106
107     
108 }
109
Popular Tags