• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ConnectorException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.identityconnectors.framework.common.exceptions.ConnectorException的典型用法代码示例。如果您正苦于以下问题:Java ConnectorException类的具体用法?Java ConnectorException怎么用?Java ConnectorException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ConnectorException类属于org.identityconnectors.framework.common.exceptions包,在下文中一共展示了ConnectorException类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: checkAlive

import org.identityconnectors.framework.common.exceptions.ConnectorException; //导入依赖的package包/类
/**
 * Check the instance connection of {@link KerberosConnector} to be reused.
 *
 * It only check, if the connection has not been disposed. Otherwise always OK.
 *
 * @see org.identityconnectors.framework.spi.PoolableConnector#checkAlive()
 */
public void checkAlive() {
	if (configuration == null) {
		throw new ConnectorException("checkAlive(): Connector not initialized");
	}
	if (configuration.getLifeTime() == 0) {
		throw new ConnectorException("checkAlive(): No connection re-use with credentials lifetime 0");
	}

	long currentTime = System.currentTimeMillis();
	long sessionTime = currentTime - lastLoginTime;
	if (sessionTime >= configuration.getLifeTime()) {
		logger.info("Closing session, connection time: {} s, max time: {} s", sessionTime / 1000, configuration.getLifeTime() / 1000);
		throw new ConnectorException("Credentials lifetime ended");
	}
}
 
开发者ID:CESNET,项目名称:kerberos-connector,代码行数:23,代码来源:KerberosConnector.java


示例2: runScriptOnResource

import org.identityconnectors.framework.common.exceptions.ConnectorException; //导入依赖的package包/类
@Override
public Object runScriptOnResource(ScriptContext scriptCtx, OperationOptions options) {
	String scriptLanguage = scriptCtx.getScriptLanguage();
	PowerHell powerHell = getPowerHell(scriptLanguage);
	
	String command = scriptCtx.getScriptText();
	OperationLog.log("{0} Script REQ {1}: {2}", winRmHost, scriptLanguage, command);
	LOG.ok("Executing {0} script on {0} as {1} using {2}: {3}", scriptLanguage, winRmHost, winRmUsername, powerHell.getImplementationName(), command);
	
	String output;
	try {
		
		output = powerHell.runCommand(command, scriptCtx.getScriptArguments());
		
	} catch (PowerHellException e) {
		OperationLog.error("{0} Script ERR {1}", winRmHost, e.getMessage());
		throw new ConnectorException("Script execution failed: "+e.getMessage(), e);
	}
				
	OperationLog.log("{0} Script RES {1}", winRmHost, (output==null||output.isEmpty())?"no output":("output "+output.length()+" chars"));
	LOG.ok("Script returned output\n{0}", output);
	
	return output;
}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:25,代码来源:AdLdapConnector.java


示例3: schema

import org.identityconnectors.framework.common.exceptions.ConnectorException; //导入依赖的package包/类
@Override
public Schema schema() {
   	if (!connectionManager.isConnected()) {
   		return null;
   	}
   	// always fetch fresh schema when this method is called
   	schemaManager = null;
   	schemaTranslator = null;
   	try {
   		return getSchemaTranslator().translateSchema(connectionManager);
   	} catch (InvalidConnectionException e) {
   		// The connection might have been disconnected. Try to reconnect.
   		connectionManager.connect();
		try {
			return getSchemaTranslator().translateSchema(connectionManager);
		} catch (InvalidConnectionException e1) {
			throw new ConnectorException("Reconnect error: "+e.getMessage(), e);
		}
   	}
}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:21,代码来源:AbstractLdapConnector.java


示例4: asDn

import org.identityconnectors.framework.common.exceptions.ConnectorException; //导入依赖的package包/类
private Dn asDn(String stringDn) {
	try {
		return new Dn(stringDn);
	} catch (LdapInvalidDnException e) {
		throw new ConnectorException("Cannot parse '"+stringDn+" as DN: "+e.getMessage(), e);
	}
}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:8,代码来源:AbstractLdapConnector.java


示例5: prepareIcfSchema

import org.identityconnectors.framework.common.exceptions.ConnectorException; //导入依赖的package包/类
private void prepareIcfSchema() {
 	try {
 		getSchemaTranslator().prepareIcfSchema(connectionManager);
 	} catch (InvalidConnectionException e) {
 		// The connection might have been disconnected. Try to reconnect.
 		connectionManager.connect();
try {
	getSchemaTranslator().prepareIcfSchema(connectionManager);
} catch (InvalidConnectionException e1) {
	throw new ConnectorException("Reconnect error: "+e.getMessage(), e);
}
 	}
 }
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:14,代码来源:AbstractLdapConnector.java


示例6: checkAlive

import org.identityconnectors.framework.common.exceptions.ConnectorException; //导入依赖的package包/类
@Override
public void checkAlive() {
	if (!connectionManager.isAlive()) {
		LOG.ok("check alive: FAILED");
		throw new ConnectorException("Connection check failed");
	}
	LOG.ok("check alive: OK");
}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:9,代码来源:AbstractLdapConnector.java


示例7: dispose

import org.identityconnectors.framework.common.exceptions.ConnectorException; //导入依赖的package包/类
@Override
public void dispose() {
	try {
		if(connection != null && !connection.isClosed()){
			this.connection.close();
			this.connection = null;
		}
	} catch (SQLException ex) {
		LOGGER.error(ex.getMessage());
		if(rethrowSQLException(ex.getErrorCode())){
			throw new ConnectorException(ex.getMessage(), ex);
		}
	}
}
 
开发者ID:Evolveum,项目名称:polygon,代码行数:15,代码来源:AbstractJdbcConnector.java


示例8: processingResult

import org.identityconnectors.framework.common.exceptions.ConnectorException; //导入依赖的package包/类
private List<List<Attribute>> processingResult(ResultSet rs) {
	
	List<List<Attribute>> ret = new ArrayList<List<Attribute>>();
	
	try {
		
		while(rs.next()){
			int i = 1;
			List<Attribute> oneRow = new ArrayList<Attribute>();
			while(i <= rs.getMetaData().getColumnCount()){
				AttributeBuilder attrB = new AttributeBuilder();
				ResultSetMetaData metaData = rs.getMetaData();
				attrB.setName(metaData.getColumnName(i).toLowerCase());
				Object value = null;
				int type = metaData.getColumnType(i);
				if(!getConfiguration().isAllNative()){
					if(Types.TIMESTAMP == type || Types.TIME == type || Types.DATE == type){
						value = JdbcUtil.getValueOfColumn(type, i, rs, getConfiguration().getTimestampPresentation());
					} else if(JdbcUtil.getTypeOfAttribute(type, getConfiguration().getTimestampPresentation()).isAssignableFrom(String.class)){
						value = JdbcUtil.getValueOfColumn(Types.VARCHAR, i, rs, getConfiguration().getTimestampPresentation());
					} else {
						value = JdbcUtil.getValueOfColumn(type, i, rs, getConfiguration().getTimestampPresentation());
					}
				} else { 
					value = JdbcUtil.getValueOfColumn(type, i, rs, getConfiguration().getTimestampPresentation());
				}
				attrB.addValue(value);
				oneRow.add(attrB.build());
				i++;
			}
			ret.add(oneRow);
		}
	} catch (SQLException ex) {
		LOGGER.error(ex.getMessage());
		if(rethrowSQLException(ex.getErrorCode())){
			throw new ConnectorException(ex.getMessage(), ex);
		}
	}
	return ret;
}
 
开发者ID:Evolveum,项目名称:polygon,代码行数:41,代码来源:AbstractJdbcConnector.java


示例9: isRequired

import org.identityconnectors.framework.common.exceptions.ConnectorException; //导入依赖的package包/类
protected boolean isRequired(ResultSetMetaData metaData, int i){
try {
	return metaData.isNullable(i)==ResultSetMetaData.columnNoNulls;
} catch (SQLException ex) {
	LOGGER.error(ex.getMessage());
	if(rethrowSQLException(ex.getErrorCode())){
		throw new ConnectorException(ex.getMessage(), ex);
	}
}
return false; 
}
 
开发者ID:Evolveum,项目名称:polygon,代码行数:12,代码来源:AbstractJdbcConnector.java


示例10: hashBytes

import org.identityconnectors.framework.common.exceptions.ConnectorException; //导入依赖的package包/类
private String hashBytes(byte[] clear, String alg, long seed) {
    MessageDigest md = null;
    
	try {
        if (alg.equalsIgnoreCase("SSHA") || alg.equalsIgnoreCase("SHA")) {
        		md = MessageDigest.getInstance("SHA-1");
        } else if ( alg.equalsIgnoreCase("SMD5") || alg.equalsIgnoreCase("MD5") ) {
            md = MessageDigest.getInstance("MD5");
        }
	} catch (NoSuchAlgorithmException e) {
        throw new ConnectorException("Could not find MessageDigest algorithm: "+alg);
    }
    
    if (md == null) {
        throw new ConnectorException("Unsupported MessageDigest algorithm: " + alg);
    }

    byte[] salt = {};
    if (alg.equalsIgnoreCase("SSHA") || alg.equalsIgnoreCase("SMD5")) {
        Random rnd = new Random();
        rnd.setSeed(System.currentTimeMillis() + seed);
        salt = new byte[8];
        rnd.nextBytes(salt);
    }

    md.reset();
    md.update(clear);
    md.update(salt);
    byte[] hash = md.digest();

    byte[] hashAndSalt = new byte[hash.length + salt.length];
    System.arraycopy(hash, 0, hashAndSalt, 0, hash.length);
    System.arraycopy(salt, 0, hashAndSalt, hash.length, salt.length);

    StringBuilder resSb = new StringBuilder(alg.length() + hashAndSalt.length);
    resSb.append('{');
    resSb.append(alg);
    resSb.append('}');
    resSb.append(Base64.encode(hashAndSalt));

    return resSb.toString();
}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:43,代码来源:AbstractSchemaTranslator.java


示例11: buildAttributeInfosFromTable

import org.identityconnectors.framework.common.exceptions.ConnectorException; //导入依赖的package包/类
public Set<AttributeInfo> buildAttributeInfosFromTable(String nameOfTable, String keyNameOfTable, List<String> excludedNames) {
	this.namesOfRequiredColumns.clear();
	this.sqlTypes.clear();
	if (nameOfTable == null) {
		LOGGER.error("Attribute nameOfTable not provided.");
		throw new InvalidAttributeValueException("Attribute nameOfTable not provided.");
	}
	if (keyNameOfTable == null) {
		LOGGER.error("Attribute keyNameOfTable not provided.");
		throw new InvalidAttributeValueException("Attribute keyNameOfTable not provided.");
	}
	
	StringBuilder sb = new StringBuilder();
	sb.append("SELECT * FROM ").append(nameOfTable).append(" WHERE ").append(keyNameOfTable).append(" IS NULL");
	String sql = sb.toString();
	
	ResultSet result = null;
	Statement stmt = null;
	try {
		stmt = getConnection().createStatement();

		result = stmt.executeQuery(sql);
		Set<AttributeInfo> attrsInfo = new HashSet<AttributeInfo>();
		ResultSetMetaData metaData = result.getMetaData();
		int countOfAttributes = metaData.getColumnCount();
		for (int i = 1; i <= countOfAttributes; i++) {
			final String nameOfColumn = metaData.getColumnName(i);
			final AttributeInfoBuilder attrInfoBuilder = new AttributeInfoBuilder();
			final Integer numberOfType = metaData.getColumnType(i);
			this.sqlTypes.put(nameOfColumn.toLowerCase(), numberOfType);
			if (excludedNames == null || !excludedNames.contains(nameOfColumn)) {
				
				Class<?> type = JdbcUtil.getTypeOfAttribute(numberOfType, getConfiguration().getTimestampPresentation());
				attrInfoBuilder.setName(nameOfColumn.toLowerCase());
				attrInfoBuilder.setType(type);
				boolean required = isRequired(metaData, i);
				if(required && type.equals(String.class)){
					this.namesOfRequiredColumns.add(nameOfColumn.toLowerCase());
				}
				attrInfoBuilder.setRequired(required);
				attrInfoBuilder.setMultiValued(isMultivalue(metaData, i));
				attrsInfo.add(attrInfoBuilder.build());
			}
		}
		return attrsInfo;
	} catch (SQLException ex) {
		LOGGER.error(ex.getMessage());
		if(rethrowSQLException(ex.getErrorCode())){
			throw new ConnectorException(ex.getMessage(), ex);
		}
	}
	return null;
}
 
开发者ID:Evolveum,项目名称:polygon,代码行数:54,代码来源:AbstractJdbcConnector.java



注:本文中的org.identityconnectors.framework.common.exceptions.ConnectorException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EnumBiMap类代码示例发布时间:2022-05-22
下一篇:
Java FROMValidation类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap