KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mx4j > tools > remote > soap > axis > ser > SubjectDeser


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 mx4j.tools.remote.soap.axis.ser;
10
11 import java.util.Set JavaDoc;
12 import javax.security.auth.Subject JavaDoc;
13
14 import org.xml.sax.SAXException JavaDoc;
15
16 /**
17  * @version $Revision: 1.4 $
18  */

19 public class SubjectDeser extends AxisDeserializer
20 {
21    private boolean readOnly;
22    private Set JavaDoc principals;
23    private Set JavaDoc publicCredentials;
24    private Set JavaDoc privateCredentials;
25
26    public void onSetChildValue(Object JavaDoc value, Object JavaDoc hint) throws SAXException JavaDoc
27    {
28       if (SubjectSer.READ_ONLY.equals(hint))
29          readOnly = ((Boolean JavaDoc)value).booleanValue();
30       else if (SubjectSer.PRINCIPALS.equals(hint))
31          principals = (Set JavaDoc)value;
32       else if (SubjectSer.PUBLIC_CREDENTIALS.equals(hint))
33          publicCredentials = (Set JavaDoc)value;
34       else if (SubjectSer.PRIVATE_CREDENTIALS.equals(hint)) privateCredentials = (Set JavaDoc)value;
35    }
36
37    protected Object JavaDoc createObject() throws SAXException JavaDoc
38    {
39       return new Subject JavaDoc(readOnly, principals, publicCredentials, privateCredentials);
40    }
41 }
42
Popular Tags