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


Java ConfigManager类代码示例

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


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

示例1: parseSignedDoc

import ee.sk.utils.ConfigManager; //导入依赖的package包/类
/**
 * @throws IllegalArgumentException if content is not DDoc
 * @param content
 * @return
 * @throws IOException 
 */
public ValidatedSignedDoc parseSignedDoc(String fileName,  String id,  InputStream content) throws IOException  {
	
	ArrayList<DigiDocException> warnings = new ArrayList<DigiDocException>();

	try {
		DigiDocFactory factory = ConfigManager.instance().getDigiDocFactory();
		SignedDoc doc = factory.readSignedDocFromStreamOfType(content, factory.isBdocExtension(fileName), warnings);
		
		if (doc == null) {
			throw new IllegalArgumentException("content is not a ddoc/bdoc: " + warnings);
		}
		
		return new ValidatedSignedDoc(doc, warnings);
		
	} catch (DigiDocException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:aleksz,项目名称:driveddoc,代码行数:25,代码来源:DigiDocService.java

示例2: init

import ee.sk.utils.ConfigManager; //导入依赖的package包/类
/**l
 * initializes the implementation class
 */
public void init()
    throws DigiDocException 
{
    try {
        String proxyHost = ConfigManager.instance().
            getProperty("DIGIDOC_PROXY_HOST");
        String proxyPort = ConfigManager.instance().
            getProperty("DIGIDOC_PROXY_PORT");
        if(proxyHost != null && proxyPort != null) {
            System.setProperty("http.proxyHost", proxyHost);
            System.setProperty("http.proxyPort", proxyPort);
        }
        String sigFlag = ConfigManager.instance().getProperty("SIGN_OCSP_REQUESTS");
    	m_bSignRequests = (sigFlag != null && sigFlag.equals("true"));
    	// only need this if we must sign the requests
        Provider prv = (Provider)Class.forName(ConfigManager.
            instance().getProperty("DIGIDOC_SECURITY_PROVIDER")).newInstance();
        //System.out.println("Provider");
        //prv.list(System.out);
        Security.addProvider(prv);
                 
    } catch(Exception ex) {
        DigiDocException.handleException(ex, DigiDocException.ERR_NOT_FAC_INIT);
    }
}
 
开发者ID:aleksz,项目名称:driveddoc,代码行数:29,代码来源:FlexibleBouncyCastleNotaryFactory.java

示例3: validateContainerWithJDigidoc

import ee.sk.utils.ConfigManager; //导入依赖的package包/类
private List validateContainerWithJDigidoc(String containerFilePath) throws DigiDocException {
  boolean isBdoc = true;
  List errors = new ArrayList();
  DigiDocFactory digFac = ConfigManager.instance().getDigiDocFactory();
  digFac.readSignedDocOfType(containerFilePath, isBdoc, errors);
  return errors;
}
 
开发者ID:open-eid,项目名称:digidoc4j,代码行数:8,代码来源:PerformanceTest.java

示例4: validateContainerWithJDigiDoc

import ee.sk.utils.ConfigManager; //导入依赖的package包/类
private void validateContainerWithJDigiDoc(String containerFilePath) throws DigiDocException {
    boolean isBdoc = true;
    List errors = new ArrayList();
    DigiDocFactory digFac = ConfigManager.instance().getDigiDocFactory();
    digFac.readSignedDocOfType(containerFilePath, isBdoc, errors);
    assertTrue(getJDigiDocErrorMessage(errors), errors.isEmpty());
}
 
开发者ID:open-eid,项目名称:digidoc4j,代码行数:8,代码来源:LibraryInteroperabilityTest.java

示例5: canonicalizeXml

import ee.sk.utils.ConfigManager; //导入依赖的package包/类
/**
 * Helper method to canonicalize a piece of xml
 * @param xml data to be canonicalized
 * @return canonicalized xml
 */
private String canonicalizeXml(String xml) {
	try {				 
		CanonicalizationFactory canFac = ConfigManager.
				instance().getCanonicalizationFactory();
		byte[] tmp = canFac.canonicalize(xml.getBytes("UTF-8"), 
				SignedDoc.CANONICALIZATION_METHOD_20010315);
		return new String(tmp, "UTF-8");
   } catch(Exception ex) {
	   m_logger.error("Canonicalizing exception: " + ex);
   }
   return null;
}
 
开发者ID:aleksz,项目名称:driveddoc,代码行数:18,代码来源:DigiDocFactoryWithoutCaches.java

示例6: getNotaryCert

import ee.sk.utils.ConfigManager; //导入依赖的package包/类
/**
 * Returns the OCSP responders certificate
 * @param responderCN responder-id's CN
 * @param specificCertNr specific cert number that we search.
 * If this parameter is null then the newest cert is seleced (if many exist)
 * @returns OCSP responders certificate
 */
public X509Certificate getNotaryCert(String responderCN, String specificCertNr)
	
{
	try {
	  TrustServiceFactory tslFac = ConfigManager.instance().getTslFactory();
      boolean bUseLocal = ConfigManager.instance().getBooleanProperty("DIGIDOC_USE_LOCAL_TSL", false);
	  return tslFac.findOcspByCN(responderCN, bUseLocal);
	} catch(Exception ex) {
		m_logger.error("Error searching responder cert for: " + responderCN + " - " + ex);
	}
	return null;
}
 
开发者ID:aleksz,项目名称:driveddoc,代码行数:20,代码来源:FlexibleBouncyCastleNotaryFactory.java

示例7: getNotaryCerts

import ee.sk.utils.ConfigManager; //导入依赖的package包/类
/**
 * Returns the OCSP responders certificate
 * @param responderCN responder-id's CN
 * @param specificCertNr specific cert number that we search.
 * If this parameter is null then the newest cert is seleced (if many exist)
 * @returns OCSP responders certificate
 */
public X509Certificate[] getNotaryCerts(String responderCN, String specificCertNr)
	
{
	try {
	  TrustServiceFactory tslFac = ConfigManager.instance().getTslFactory();
      boolean bUseLocal = ConfigManager.instance().getBooleanProperty("DIGIDOC_USE_LOCAL_TSL", false);
	  return tslFac.findOcspsByCNAndNr(responderCN, bUseLocal, specificCertNr);
	} catch(Exception ex) {
		m_logger.error("Error searching responder cert for: " + responderCN + " - " + ex);
	}
	return null;
}
 
开发者ID:aleksz,项目名称:driveddoc,代码行数:20,代码来源:FlexibleBouncyCastleNotaryFactory.java

示例8: getCACert

import ee.sk.utils.ConfigManager; //导入依赖的package包/类
/**
 * Returns the OCSP responders CA certificate
 * @param responderCN responder-id's CN
 * @returns OCSP responders CA certificate
 */
public X509Certificate getCACert(String responderCN)
{
	try {
  	  TrustServiceFactory tslFac = ConfigManager.instance().getTslFactory();
        boolean bUseLocal = ConfigManager.instance().getBooleanProperty("DIGIDOC_USE_LOCAL_TSL", false);
  	  X509Certificate cert = tslFac.findOcspByCN(responderCN, bUseLocal);
  	  if(cert != null)
  	    return tslFac.findCaForCert(cert, bUseLocal);
  	} catch(Exception ex) {
  		m_logger.error("Error searching responder ca cert for: " + responderCN + " - " + ex);
  	}
  	return null;
}
 
开发者ID:aleksz,项目名称:driveddoc,代码行数:19,代码来源:FlexibleBouncyCastleNotaryFactory.java

示例9: getConfirmation

import ee.sk.utils.ConfigManager; //导入依赖的package包/类
/**
 * Get confirmation from AS Sertifitseerimiskeskus
 * by creating an OCSP request and parsing the returned
 * OCSP response
 * @param nonce signature nonce
 * @param signersCert signature owners cert
 * @param notId new id for Notary object
 * @param httpFrom HTTP_FROM header value (optional)
 * @returns Notary object
 */
public Notary getConfirmation(byte[] nonce, 
    X509Certificate signersCert, String notId, String httpFrom) 
    throws DigiDocException
{        
	boolean bUseLocal = ConfigManager.instance().getBooleanProperty("DIGIDOC_USE_LOCAL_TSL", false);
    TrustServiceFactory tslFac = ConfigManager.instance().getTslFactory();
    X509Certificate caCert = tslFac.findCaForCert(signersCert, bUseLocal);
    X509Certificate ocspCert = tslFac.findOcspByCN(ConvertUtils.getCommonName(ConvertUtils.convX509Name(signersCert.getIssuerX500Principal())), bUseLocal);
    return getConfirmation(nonce, signersCert, caCert, ocspCert, notId, httpFrom);
}
 
开发者ID:aleksz,项目名称:driveddoc,代码行数:21,代码来源:FlexibleBouncyCastleNotaryFactory.java

示例10: sendRequest

import ee.sk.utils.ConfigManager; //导入依赖的package包/类
/**
 * Sends the OCSP request to Notary and
 * retrieves the response
 * @param req OCSP request
 * @param httpFrom HTTP_FROM value (optional)
 * @returns OCSP response
 */
private OCSPResp sendRequest(OCSPReq req, String httpFrom, String format, String formatVer)
    throws DigiDocException 
{
	String responderUrl = ConfigManager.instance().
    	getProperty("DIGIDOC_OCSP_RESPONDER_URL");
	return sendRequestToUrl(req, responderUrl, httpFrom, format, formatVer);
}
 
开发者ID:aleksz,项目名称:driveddoc,代码行数:15,代码来源:FlexibleBouncyCastleNotaryFactory.java

示例11: createdContainerWritesDataFileBody

import ee.sk.utils.ConfigManager; //导入依赖的package包/类
@Test
public void createdContainerWritesDataFileBody() throws Exception {
	String content = "abc";
	SignedDoc container = service.createContainer("test.txt", "text/plain", new ByteArrayInputStream(content.getBytes()));
	ByteArrayOutputStream os = new ByteArrayOutputStream();
	container.writeToStream(os);
	SignedDoc parsed = ConfigManager	.instance()	.getDigiDocFactory()
			.readDigiDocFromStream(	new ByteArrayInputStream(os.toByteArray()));
	assertEquals(content, parsed.getDataFile(0).getBodyAsString());
}
 
开发者ID:aleksz,项目名称:driveddoc,代码行数:11,代码来源:DigiDocServiceTest.java

示例12: forceInitConfigManager

import ee.sk.utils.ConfigManager; //导入依赖的package包/类
public static synchronized void forceInitConfigManager(Configuration configuration) {
  logger.info("Initializing DDoc configuration manager");
  ConfigManager.init(configuration.getJDigiDocConfiguration());
  ConfigManager.addProvider();
  configManagerInitialized = true;
}
 
开发者ID:open-eid,项目名称:digidoc4j,代码行数:7,代码来源:ConfigManagerInitializer.java

示例13: openContainerWithJdigidoc

import ee.sk.utils.ConfigManager; //导入依赖的package包/类
private SignedDoc openContainerWithJdigidoc(String containerFilePath) throws DigiDocException {
  boolean isBdoc = true;
  List errors = new ArrayList();
  DigiDocFactory digFac = ConfigManager.instance().getDigiDocFactory();
  return digFac.readSignedDocOfType(containerFilePath, isBdoc, errors);
}
 
开发者ID:open-eid,项目名称:digidoc4j,代码行数:7,代码来源:PerformanceTest.java

示例14: DigiDocService

import ee.sk.utils.ConfigManager; //导入依赖的package包/类
@Inject
public DigiDocService(MobileIdService mobileIdService) {
	this.mobileIdService = mobileIdService;
	ConfigManager.init("jar://jdigidoc.cfg");
}
 
开发者ID:aleksz,项目名称:driveddoc,代码行数:6,代码来源:DigiDocService.java

示例15: parseSignedDoc

import ee.sk.utils.ConfigManager; //导入依赖的package包/类
protected SignedDoc parseSignedDoc(InputStream input) throws DigiDocException {
	return ConfigManager.instance().getDigiDocFactory().readSignedDocFromStreamOfType(
			input, true, new ArrayList<>());
}
 
开发者ID:aleksz,项目名称:driveddoc,代码行数:5,代码来源:ContainerServiceTest.java


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