Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: net/jxta/impl/membership/pse/PSECrendentialBeanInfo.java


1   /*
2    * Copyright (c) 2001 Sun Microsystems, Inc.  All rights reserved.
3    *
4    * Redistribution and use in source and binary forms, with or without
5    * modification, are permitted provided that the following conditions
6    * are met:
7    *
8    * 1. Redistributions of source code must retain the above copyright
9    *    notice, this list of conditions and the following disclaimer.
10   *
11   * 2. Redistributions in binary form must reproduce the above copyright
12   *    notice, this list of conditions and the following disclaimer in
13   *    the documentation and/or other materials provided with the
14   *    distribution.
15   *
16   * 3. The end-user documentation included with the redistribution,
17   *    if any, must include the following acknowledgment:
18   *       "This product includes software developed by the
19   *       Sun Microsystems, Inc. for Project JXTA."
20   *    Alternately, this acknowledgment may appear in the software itself,
21   *    if and wherever such third-party acknowledgments normally appear.
22   *
23   * 4. The names "Sun", "Sun Microsystems, Inc.", "JXTA" and "Project JXTA"
24   *    must not be used to endorse or promote products derived from this
25   *    software without prior written permission. For written
26   *    permission, please contact Project JXTA at http://www.jxta.org.
27   *
28   * 5. Products derived from this software may not be called "JXTA",
29   *    nor may "JXTA" appear in their name, without prior written
30   *    permission of Sun.
31   *
32   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
33   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
34   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
35   * DISCLAIMED.  IN NO EVENT SHALL SUN MICROSYSTEMS OR
36   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
37   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
38   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
39   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
40   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
41   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
42   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
43   * SUCH DAMAGE.
44   * ====================================================================
45   *
46   * This software consists of voluntary contributions made by many
47   * individuals on behalf of Project JXTA.  For more
48   * information on Project JXTA, please see
49   * <http://www.jxta.org/>.
50   *
51   * This license is based on the BSD license adopted by the Apache Foundation.
52   *
53   * $Id: PSECrendentialBeanInfo.java,v 1.2 2004/05/05 01:29:36 bondolo Exp $
54   */
55  
56  package net.jxta.impl.membership.pse;
57  
58  import java.beans.BeanDescriptor;
59  import java.beans.EventSetDescriptor;
60  import java.beans.PropertyChangeListener;
61  import java.beans.PropertyDescriptor;
62  import java.beans.SimpleBeanInfo;
63  
64  import java.beans.IntrospectionException;
65  import java.lang.reflect.UndeclaredThrowableException;
66  
67  /**
68   *  BeanInfo for PSECrendential
69   **/
70  public class PSECrendentialBeanInfo extends SimpleBeanInfo {
71      
72      /**
73       *  {@inheritDoc}
74       **/
75      public BeanDescriptor getBeanDescriptor() {
76          return new BeanDescriptor( PSECredential.class );
77      }
78      
79      
80      /**
81       *  {@inheritDoc}
82       **/
83      public EventSetDescriptor[] getEventSetDescriptors() {
84          try {
85              EventSetDescriptor changed = new EventSetDescriptor( PSECredential.class,
86              "propertyChange",
87              PropertyChangeListener.class,
88              "propertyChange");
89              
90              changed.setDisplayName("bound property change");
91              
92              EventSetDescriptor[] rv = { changed };
93              return rv;
94          } catch (IntrospectionException failed) {
95              throw new UndeclaredThrowableException( failed, "Configuration error" );
96          }
97      }
98      
99      /**
100      *  {@inheritDoc}
101      **/
102     public PropertyDescriptor[] getPropertyDescriptors() {
103         try {
104             PropertyDescriptor subject =
105             new PropertyDescriptor( "subject", PSECredential.class );
106             
107             PropertyDescriptor peerid =
108             new PropertyDescriptor( "peerID", PSECredential.class );
109             
110             PropertyDescriptor peerGroupID =
111             new PropertyDescriptor( "peerGroupID", PSECredential.class );
112             
113             PropertyDescriptor certificate =
114             new PropertyDescriptor( "certificate", PSECredential.class );
115             
116             PropertyDescriptor privatekey =
117             new PropertyDescriptor( "privateKey", PSECredential.class );
118             
119             PropertyDescriptor expired =
120             new PropertyDescriptor( "expired", PSECredential.class );
121             expired.setBound(true);
122             
123             PropertyDescriptor valid =
124             new PropertyDescriptor( "valid", PSECredential.class );
125             valid.setBound(true);
126             
127             PropertyDescriptor rv[] = { subject, peerid, peerGroupID, certificate, privatekey, expired, valid };
128             
129             return rv;
130         } catch ( IntrospectionException failed ) {
131             throw new UndeclaredThrowableException( failed, "Configuration error" );
132         }
133     }
134 }