当前位置: 首页>>代码示例>>Java>>正文


Java Error.pop方法代码示例

本文整理汇总了Java中com.redhat.lightblue.util.Error.pop方法的典型用法代码示例。如果您正苦于以下问题:Java Error.pop方法的具体用法?Java Error.pop怎么用?Java Error.pop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.redhat.lightblue.util.Error的用法示例。


在下文中一共展示了Error.pop方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getConnection

import com.redhat.lightblue.util.Error; //导入方法依赖的package包/类
public static Connection getConnection(RDBMSContext context) {
    if (context.getDataSource() == null) {
        throw new IllegalArgumentException("No dataSource supplied");
    }
    LOGGER.debug("getConnection() start");
    Error.push("RDBMSUtils");
    Error.push("getConnection");
    Connection c = null;
    try {
        c = context.getDataSource().getConnection();
    } catch (SQLException e) {
        // throw new Error (preserves current error context)
        LOGGER.error(e.getMessage(), e);
        throw Error.get(RDBMSConstants.ERR_GET_CONNECTION_FAILED, e.getMessage());
    } finally {
        Error.pop();
        Error.pop();
    }
    context.setConnection(c);
    LOGGER.debug("getConnection() stop");
    return c;
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:23,代码来源:RDBMSUtilsMetadata.java

示例2: getDataSource

import com.redhat.lightblue.util.Error; //导入方法依赖的package包/类
/**
 * This method search in the javax.naming.InitialContext for the given JNDI name. An Error will rise if not found.
 *
 * @param name
 *  The JNDI name
 * @return
 *  If found, it will return the DataSource bound into the InitialContext
 */
public static DataSource getDataSource(String name) {
    LOGGER.debug("getDataSource() start");
    Error.push("RDBMSUtils");
    Error.push("getDataSource");
    DataSource ds = null;
    try {
        // relying on garbage collection to close context
        InitialContext context = new InitialContext();
        ds = (DataSource) context.lookup(name);
    } catch (NamingException e) {
        LOGGER.error(e.getMessage(), e);
        throw Error.get(RDBMSConstants.ERR_DATASOURCE_NOT_FOUND, e.getMessage());
    } finally {
        Error.pop();
        Error.pop();
    }
    LOGGER.debug("getDataSource() stop");
    return ds;
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:28,代码来源:RDBMSUtils.java

示例3: translate

import com.redhat.lightblue.util.Error; //导入方法依赖的package包/类
public ModifyRequest translate(JsonDoc document, String dn) {
    Error.push(LdapConstant.ATTRIBUTE_DN + "=" + dn);
    try {
        return new ModifyRequest(dn, translate(document));
    } finally {
        Error.pop();
    }
}
 
开发者ID:lightblue-platform,项目名称:lightblue-ldap,代码行数:9,代码来源:ModificationTranslatorFromJson.java

示例4: translate

import com.redhat.lightblue.util.Error; //导入方法依赖的package包/类
@Override
public JsonDoc translate(SearchResultEntry entry){
    Error.push(LdapConstant.ATTRIBUTE_DN + "=" + entry.getDN());
    try{
        JsonDoc jdoc = super.translate(entry);
        jdoc.modify(dnPath, toJson(StringType.TYPE, entry.getDN()), true);
        return jdoc;
    }
    finally{
        Error.pop();
    }
}
 
开发者ID:lightblue-platform,项目名称:lightblue-ldap,代码行数:13,代码来源:ResultTranslatorToJson.java

示例5: translate

import com.redhat.lightblue.util.Error; //导入方法依赖的package包/类
@Override
public void translate(JsonDoc document, Entry target){
    Error.push(LdapConstant.ATTRIBUTE_DN + "=" + target.getDN());
    try{
        super.translate(document, target);
    }
    finally{
        Error.pop();
    }
}
 
开发者ID:lightblue-platform,项目名称:lightblue-ldap,代码行数:11,代码来源:EntryTranslatorFromJson.java

示例6: insert

import com.redhat.lightblue.util.Error; //导入方法依赖的package包/类
@Override
public CRUDInsertionResponse insert(CRUDOperationContext crudOperationContext, Projection projection) {
    LOGGER.debug("insert() start");
    Error.push("insert");
    //crudOperationContext.getDocuments(); // input? or maybe the projection mapping the values to be processed
    CRUDInsertionResponse response = new CRUDInsertionResponse();
    int n = 0;

    try {
        EntityMetadata md = crudOperationContext.getEntityMetadata(crudOperationContext.getEntityName());
        if (md.getAccess().getInsert().hasAccess(crudOperationContext.getCallerRoles())) {
            FieldAccessRoleEvaluator roleEval = new FieldAccessRoleEvaluator(md, crudOperationContext.getCallerRoles());
            RDBMSContext rdbmsContext = new RDBMSContext(null,null,null,projection,md,nodeFactory,rds,roleEval, crudOperationContext,"insert");

            RDBMSProcessor.process(rdbmsContext);

            crudOperationContext.getHookManager().queueHooks(crudOperationContext);

            n= rdbmsContext.getResultInteger() == null? 0 : rdbmsContext.getResultInteger() ;
        } else {
            crudOperationContext.addError(Error.get(RDBMSConstants.ERR_NO_ACCESS, "find:" + crudOperationContext.getEntityName()));
        }
    } finally {
        Error.pop();
    }

    response.setNumInserted(n);

    Error.pop();
    LOGGER.debug("insert() stop");
    return response;
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:33,代码来源:RDBMSCRUDController.java

示例7: save

import com.redhat.lightblue.util.Error; //导入方法依赖的package包/类
@Override
public CRUDSaveResponse save(CRUDOperationContext crudOperationContext, boolean upsert, Projection projection) {
    LOGGER.debug("save() start");
    Error.push("save");

    CRUDSaveResponse response = new CRUDSaveResponse();
    int n = 0;

    try {
        EntityMetadata md = crudOperationContext.getEntityMetadata(crudOperationContext.getEntityName());
        if (md.getAccess().getUpdate().hasAccess(crudOperationContext.getCallerRoles())  && md.getAccess().getInsert().hasAccess(crudOperationContext.getCallerRoles())) {
            FieldAccessRoleEvaluator roleEval = new FieldAccessRoleEvaluator(md, crudOperationContext.getCallerRoles());
            RDBMSContext rdbmsContext = new RDBMSContext(null,null,null,projection,md,nodeFactory,rds,roleEval, crudOperationContext,"save");

            RDBMSProcessor.process(rdbmsContext);

            crudOperationContext.getHookManager().queueHooks(crudOperationContext);

            n= rdbmsContext.getResultInteger();
        } else {
            crudOperationContext.addError(Error.get(RDBMSConstants.ERR_NO_ACCESS, "find:" + crudOperationContext.getEntityName()));
        }
    } finally {
        Error.pop();
    }

    response.setNumSaved(n);

    Error.pop();
    LOGGER.debug("save() stop");
    return response;
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:33,代码来源:RDBMSCRUDController.java

示例8: update

import com.redhat.lightblue.util.Error; //导入方法依赖的package包/类
@Override
public CRUDUpdateResponse update(CRUDOperationContext crudOperationContext,
                                 QueryExpression queryExpression,
                                 UpdateExpression updateExpression,
                                 Projection projection) {
    if (queryExpression == null) {
        throw new IllegalArgumentException("No queryExpression informed");
    }
    LOGGER.debug("update start: q:{} u:{} p:{}", queryExpression, updateExpression, projection);
    Error.push("update");

    CRUDUpdateResponse response = new CRUDUpdateResponse();

    try {
        EntityMetadata md = crudOperationContext.getEntityMetadata(crudOperationContext.getEntityName());
        if (md.getAccess().getUpdate().hasAccess(crudOperationContext.getCallerRoles())) {
            FieldAccessRoleEvaluator roleEval = new FieldAccessRoleEvaluator(md, crudOperationContext.getCallerRoles());
            RDBMSContext rdbmsContext = new RDBMSContext(null,null,queryExpression,projection,md,nodeFactory,rds,roleEval, crudOperationContext,"update");
            rdbmsContext.setUpdateExpression(updateExpression);
            RDBMSProcessor.process(rdbmsContext);

            crudOperationContext.getHookManager().queueHooks(crudOperationContext);
        } else {
            crudOperationContext.addError(Error.get(RDBMSConstants.ERR_NO_ACCESS, "find:" + crudOperationContext.getEntityName()));
        }
    } finally {
        Error.pop();
    }

    Error.pop();
    LOGGER.debug("update end: updated: {}, failed: {}", response.getNumUpdated(), response.getNumFailed());
    return response;
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:34,代码来源:RDBMSCRUDController.java

示例9: delete

import com.redhat.lightblue.util.Error; //导入方法依赖的package包/类
@Override
public CRUDDeleteResponse delete(CRUDOperationContext crudOperationContext,
                                 QueryExpression queryExpression) {
    if (queryExpression == null) {
        throw new IllegalArgumentException("No queryExpression informed");
    }
    LOGGER.debug("delete start: q:{}", queryExpression);
    Error.push("delete");

    CRUDDeleteResponse response = new CRUDDeleteResponse();

    try {
        EntityMetadata md = crudOperationContext.getEntityMetadata(crudOperationContext.getEntityName());
        if (md.getAccess().getDelete().hasAccess(crudOperationContext.getCallerRoles())) {
            FieldAccessRoleEvaluator roleEval = new FieldAccessRoleEvaluator(md, crudOperationContext.getCallerRoles());
            RDBMSContext rdbmsContext = new RDBMSContext(null,null,queryExpression,null,md,nodeFactory,rds,roleEval, crudOperationContext,"delete");

            RDBMSProcessor.process(rdbmsContext);

            crudOperationContext.getHookManager().queueHooks(crudOperationContext);
        } else {
            crudOperationContext.addError(Error.get(RDBMSConstants.ERR_NO_ACCESS, "find:" + crudOperationContext.getEntityName()));
        }
    } finally {
        Error.pop();
    }

    Error.pop();
    LOGGER.debug("delete end: deleted: {}}", response.getNumDeleted());
    return response;
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:32,代码来源:RDBMSCRUDController.java

示例10: find

import com.redhat.lightblue.util.Error; //导入方法依赖的package包/类
@Override
public CRUDFindResponse find(CRUDOperationContext crudOperationContext,
                             QueryExpression queryExpression,
                             Projection projection,
                             Sort sort,
                             Long from,
                             Long to) {
    if (queryExpression == null) {
        throw new IllegalArgumentException("No query informed");
    }
    if (projection == null) {
        throw new IllegalArgumentException("No projection informed");
    }
    LOGGER.debug("find start: q:{} p:{} sort:{} from:{} to:{}", queryExpression, projection, sort, from, to);
    Error.push("find");
    CRUDFindResponse response = new CRUDFindResponse();

    try {
        EntityMetadata md = crudOperationContext.getEntityMetadata(crudOperationContext.getEntityName());
        if (md.getAccess().getFind().hasAccess(crudOperationContext.getCallerRoles())) {
            FieldAccessRoleEvaluator roleEval = new FieldAccessRoleEvaluator(md, crudOperationContext.getCallerRoles());
            RDBMSContext rdbmsContext = new RDBMSContext(from,to,queryExpression,projection,md,nodeFactory,rds,roleEval, crudOperationContext,"find");

            RDBMSProcessor.process(rdbmsContext);

            crudOperationContext.getHookManager().queueHooks(crudOperationContext);
        } else {
            crudOperationContext.addError(Error.get(RDBMSConstants.ERR_NO_ACCESS, "find:" + crudOperationContext.getEntityName()));
        }
    } finally {
        Error.pop();
    }
    LOGGER.debug("find end: query: {} results: {}", response.getSize());
    return response;
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:36,代码来源:RDBMSCRUDController.java

示例11: getPreparedStatement

import com.redhat.lightblue.util.Error; //导入方法依赖的package包/类
public static PreparedStatement getPreparedStatement(RDBMSContext context) {
    if (context.getConnection() == null) {
        throw new IllegalArgumentException("No connection supplied");
    }
    if (context.getSql() == null) {
        throw new IllegalArgumentException("No sql statement supplied");
    }
    if (context.getType() == null) {
        throw new IllegalArgumentException("No sql statement type supplied");
    }
    LOGGER.debug("getPreparedStatement() start");
    Error.push("RDBMSUtils");
    Error.push("getStatement");
    PreparedStatement ps = null;
    try {
        ps = context.getConnection().prepareStatement(context.getSql());
    } catch (SQLException e) {
        // throw new Error (preserves current error context)
        LOGGER.error(e.getMessage(), e);
        throw Error.get(RDBMSConstants.ERR_GET_STATEMENT_FAILED, e.getMessage());
    } finally {
        Error.pop();
        Error.pop();
    }
    context.setPreparedStatement(ps);
    LOGGER.debug("getPreparedStatement() stop");
    return ps;
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:29,代码来源:RDBMSUtilsMetadata.java

示例12: getStatement

import com.redhat.lightblue.util.Error; //导入方法依赖的package包/类
public static PreparedStatement getStatement(RDBMSContext context) {
    if (context.getConnection() == null) {
        throw new IllegalArgumentException("No connection supplied");
    }
    if (context.getSql() == null) {
        throw new IllegalArgumentException("No sql statement supplied");
    }
    if (context.getType() == null) {
        throw new IllegalArgumentException("No sql statement type supplied");
    }
    LOGGER.debug("getStatement() start");
    Error.push("RDBMSUtils");
    Error.push("getStatement");
    PreparedStatement ps = null;
    try {
        NamedParameterStatement nps = new NamedParameterStatement(context.getConnection(), context.getSql());
        DynVar dynVar = context.getInVar();
        processDynVar(context,nps,dynVar);
        dynVar = context.getOutVar();
        processDynVar(context,nps,dynVar);
        ps = nps.getPrepareStatement();
    } catch (SQLException e) {
        // throw new Error (preserves current error context)
        LOGGER.error(e.getMessage(), e);
        throw Error.get(RDBMSConstants.ERR_GET_STATEMENT_FAILED, e.getMessage());
    } finally {
        Error.pop();
        Error.pop();
    }
    context.setPreparedStatement(ps);
    LOGGER.debug("getStatement() stop");
    return ps;
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:34,代码来源:RDBMSUtilsMetadata.java


注:本文中的com.redhat.lightblue.util.Error.pop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。