⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ippersistencemanager.java

📁 开源的OpenId的一个java实现
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * Copyright 2005,2006 WSO2, Inc. http://www.wso2.org * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *      http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.wso2.solutions.identity.persistence;import org.apache.axis2.AxisFault;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.hibernate.Session;import org.hibernate.Transaction;import org.wso2.solutions.identity.IdentityProviderException;import org.wso2.solutions.identity.persistence.dao.BaseDAO;import org.wso2.solutions.identity.persistence.dao.ClaimDAO;import org.wso2.solutions.identity.persistence.dao.DialectDAO;import org.wso2.solutions.identity.persistence.dao.InfoCardDAO;import org.wso2.solutions.identity.persistence.dao.IssuedTokenDAO;import org.wso2.solutions.identity.persistence.dao.OpenIDUserRPDAO;import org.wso2.solutions.identity.persistence.dao.PPIDValueDAO;import org.wso2.solutions.identity.persistence.dao.ParameterDAO;import org.wso2.solutions.identity.persistence.dao.RealmConfigurationDAO;import org.wso2.solutions.identity.persistence.dao.RealmDAO;import org.wso2.solutions.identity.persistence.dao.RegisteredInfoCardInfoDAO;import org.wso2.solutions.identity.persistence.dao.RelyingPartyDAO;import org.wso2.solutions.identity.persistence.dao.ReportDAO;import org.wso2.solutions.identity.persistence.dao.RevokedInfoCardDAO;import org.wso2.solutions.identity.persistence.dao.UserPersonalRelyingPartyDAO;import org.wso2.solutions.identity.persistence.dataobject.AbstractDataObject;import org.wso2.solutions.identity.persistence.dataobject.ActionDO;import org.wso2.solutions.identity.persistence.dataobject.ClaimDO;import org.wso2.solutions.identity.persistence.dataobject.DialectDO;import org.wso2.solutions.identity.persistence.dataobject.InfoCardDO;import org.wso2.solutions.identity.persistence.dataobject.IssuedTokensDO;import org.wso2.solutions.identity.persistence.dataobject.OpenIDUserRPDO;import org.wso2.solutions.identity.persistence.dataobject.PPIDValueDO;import org.wso2.solutions.identity.persistence.dataobject.ParameterDO;import org.wso2.solutions.identity.persistence.dataobject.RealmConfigurationDO;import org.wso2.solutions.identity.persistence.dataobject.RealmDO;import org.wso2.solutions.identity.persistence.dataobject.RegisteredInfoCardInfoDO;import org.wso2.solutions.identity.persistence.dataobject.RelyingPartyDO;import org.wso2.solutions.identity.persistence.dataobject.RevokedInfoCardDO;import org.wso2.solutions.identity.persistence.dataobject.UserPersonalRelyingPartyIdentifier;import org.wso2.solutions.identity.persistence.dataobject.UserTrustedRPDO;import org.wso2.solutions.identity.report.OpenIDSummaryReportData;import org.wso2.solutions.identity.report.SummaryReportData;import java.util.Date;import java.util.List;/** * Handles all database persistence related operations of WSO2 Identity * Solution. */public class IPPersistenceManager {    private static final String DEFAULT_CONFIG_FILE_NAME = "wso2identity-hibernate.cfg.xml";    public static final Log log = LogFactory.getLog(BaseDAO.class);    /**     * Hibernate configuration instance to access the database.     */    HibernateConfig hbConfig = null;    /**     * Singleton instance of the persistence manager.     */    private static IPPersistenceManager manager;    private IPPersistenceManager() throws IdentityProviderException {        hbConfig = new HibernateConfig(DEFAULT_CONFIG_FILE_NAME);    }    private IPPersistenceManager(String configFile)            throws IdentityProviderException {        hbConfig = new HibernateConfig(configFile);    }    public static IPPersistenceManager getPersistanceManager()            throws IdentityProviderException {        if (manager == null) {            manager = new IPPersistenceManager(DEFAULT_CONFIG_FILE_NAME);        }        return manager;    }    /**     * Create a new entry with the given data object.     *      * @param abstractDO     *            Data object to be added     * @return Identifier of the created entry.     * @throws IdentityProviderException     */    public Long create(AbstractDataObject abstractDO)            throws IdentityProviderException {        try {            BaseDAO base = new BaseDAO(hbConfig);            return base.create(abstractDO);        } catch (DuplicateEntityException e) {            throw new IdentityProviderException("databaseAccessError", e);        }    }    /**     * Update an entry with the given data object.     *      * @param abstractDO     *            Data object to be updated     */    public void update(AbstractDataObject abstractDO) {        BaseDAO base = new BaseDAO(hbConfig);        base.update(abstractDO);    }    /**     * Delete the entry of the given data object.     *      * @param abstractDO     *            Data object to be deleted.     */    public void delete(AbstractDataObject abstractDO) {        BaseDAO base = new BaseDAO(hbConfig);        base.delete(abstractDO);    }    /**     * Extract a data object of the given type bearing the given id.     *      * @param objClassName     *            Type of data object     * @param val     *            Identifier of the record     * @return If found, the requested data object     */    public AbstractDataObject getDataObject(String objClassName, Long val) {        BaseDAO base = new BaseDAO(hbConfig);        return base.getDataObject(objClassName, val);    }    /**     * Provides all supported claims.     *      * @return An array of     *         <code>org.wso2.solutions.identity.persistence.dataobject.ClaimDO</code>     *         instances.     */    public ClaimDO[] getAllSupportedClaims() {        ClaimDAO dao = new ClaimDAO(hbConfig);        return dao.getAllClaims();    }    /**     * Provides all claims that are mapped to attributes in a user store.     *      * @return An array of     *         <code>org.wso2.solutions.identity.persistence.dataobject.ClaimDO</code>     *         instances.     */    public ClaimDO[] getAllMappedClaims() {        ClaimDAO dao = new ClaimDAO(hbConfig);        return dao.getAllMappedClaims();    }    public ClaimDO[] getAllEnabledClaims() {        ClaimDAO dao = new ClaimDAO(hbConfig);        return dao.getAllEnabledClaims();    }    /**     * Provides all claims that are mapped and enabled.     *      * @return An array of     *         <code>org.wso2.solutions.identity.persistence.dataobject.ClaimDO</code>     *         instances.     */    public ClaimDO[] getAllMappedEnabledClaims() {        ClaimDAO dao = new ClaimDAO(hbConfig);        return dao.getAllMappedEnabledClaims();    }    /**     * Provide the mapped OpenID tag corresponding to the provided claim uri     * @param uri Claim uri     * @return Mapped OpenID tag     */    public String getMappedOpenIDTag(String uri) {        ClaimDAO dao = new ClaimDAO(hbConfig);        return dao.getMappedOpenIDTag(uri);    }    /**     * Provides all supported claim dialects.     *      * @return An array of     *         <code>org.wso2.solutions.identity.persistence.dataobject.DialectDO.java</code>     *         instances.     */    public DialectDO[] getAllSupportedDialects() {        DialectDAO dao = new DialectDAO(hbConfig);        return dao.getAllDialects();    }    /**     * Provides all PPID values in tokens issued for a given user.     *      * @param userid     *            The user identifier.     * @return An array of     *         <code>org.wso2.solutions.identity.persistence.dataobject.PPIDValueDO</code>     *         instances.     */    public PPIDValueDO[] getPPIDValuesForUser(String userid) {        PPIDValueDAO dao = new PPIDValueDAO(hbConfig);        return dao.getPPIDValuesForUser(userid);    }    public InfoCardDO[] getCardIdsForUser(String username) {        InfoCardDAO dao = new InfoCardDAO(hbConfig);        return dao.getCardIdsForUser(username);    }    public int executeSingleDMLStatement(String stmt, String name, String value) {        BaseDAO dao = new BaseDAO(hbConfig);        return dao.executeSingleDMLStatement(stmt, name, value);    }    public void getCardsIssuedBetween(String username, Date startDate,            Date endDate) {        InfoCardDAO dao = new InfoCardDAO(hbConfig);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -