Oracle Coherence for C++ API
Release 3.6.0.0

E15728-01

coherence/security/auth/GenericSubject.hpp

00001 /*
00002 * GenericSubject.hpp
00003 *
00004 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
00005 *
00006 * Oracle is a registered trademarks of Oracle Corporation and/or its
00007 * affiliates.
00008 *
00009 * This software is the confidential and proprietary information of Oracle
00010 * Corporation. You shall not disclose such confidential and proprietary
00011 * information and shall use it only in accordance with the terms of the
00012 * license agreement you entered into with Oracle.
00013 *
00014 * This notice may not be removed or altered.
00015 */
00016 #ifndef COH_GENERIC_SUBJECT_HPP
00017 #define COH_GENERIC_SUBJECT_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include "coherence/security/auth/Subject.hpp"
00022 #include "coherence/util/Set.hpp"
00023 
00024 #include <ostream>
00025 
00026 COH_OPEN_NAMESPACE3(coherence,security,auth)
00027 
00028 using coherence::util::Set;
00029 
00030 /**
00031 * A generic implementation of the subject interface.
00032 *
00033 * @author mf 2008.08.22
00034 */
00035 class COH_EXPORT GenericSubject
00036     : public cloneable_spec<GenericSubject,
00037         extends<Object>,
00038         implements<Subject> >
00039     {
00040     friend class factory<GenericSubject>;
00041 
00042     // ----- constructors ---------------------------------------------------
00043 
00044     private:
00045         /**
00046         * Construct a Subject from a Set of Principals.
00047         *
00048         * @param vSet  the principal set to copy
00049         */
00050         GenericSubject(Set::View vSetPrincipals);
00051 
00052         /**
00053         * Construct a Subject containing a single GenericPrincipal.
00054         *
00055         * @param vsName  the name for the GenericPrincipal
00056         */
00057         GenericSubject(String::View vsName);
00058 
00059         /**
00060         * Copy constructor.
00061         */
00062         GenericSubject(const GenericSubject& that);
00063 
00064 
00065     // ----- Subject interface ----------------------------------------------
00066 
00067     public:
00068         /**
00069         * {@inheritDoc}
00070         */
00071         virtual Set::View getPrincipals() const;
00072 
00073 
00074     // ----- Object interface -----------------------------------------------
00075 
00076     public:
00077         /**
00078         * {@inheritDoc}
00079         */
00080         virtual bool equals(Object::View vThat) const;
00081 
00082         /**
00083         * {@inheritDoc}
00084         */
00085         virtual size32_t hashCode() const;
00086 
00087         /**
00088         * {@inheritDoc}
00089         */
00090         virtual bool isImmutable() const;
00091 
00092         /**
00093         * {@inheritDoc}
00094         */
00095         virtual void toStream(std::ostream& out) const;
00096 
00097 
00098     // ----- data members ---------------------------------------------------
00099 
00100     private:
00101         /**
00102         * The Principal set.
00103         */
00104         FinalView<Set> m_vSetPrincipals;
00105     };
00106 
00107 COH_CLOSE_NAMESPACE3
00108 
00109 #endif // COH_GENERIC_SUBJECT_HPP
Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.