Example usage for javax.xml.datatype DatatypeConfigurationException getMessage

List of usage examples for javax.xml.datatype DatatypeConfigurationException getMessage

Introduction

In this page you can find the example usage for javax.xml.datatype DatatypeConfigurationException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:be.fedict.eid.applet.service.signer.facets.XAdESSignatureFacet.java

/**
 * Main constructor./* ww  w.  j  a  v a2 s. c o m*/
 * 
 * @param clock
 *            the clock to be used for determining the xades:SigningTime
 * @param digestAlgorithm
 *            the digest algorithm to be used for all required XAdES digest
 *            operations. Possible values: "SHA-1", "SHA-256", or "SHA-512".
 * @param signaturePolicyService
 *            the optional signature policy service used for XAdES-EPES.
 */
public XAdESSignatureFacet(Clock clock, DigestAlgo digestAlgorithm,
        SignaturePolicyService signaturePolicyService) {
    this.clock = clock;
    this.digestAlgorithm = digestAlgorithm;
    this.signaturePolicyService = signaturePolicyService;

    try {
        this.datatypeFactory = DatatypeFactory.newInstance();
    } catch (DatatypeConfigurationException e) {
        throw new RuntimeException("datatype config error: " + e.getMessage(), e);
    }
    this.xadesObjectFactory = new ObjectFactory();
    this.xmldsigObjectFactory = new be.fedict.eid.applet.service.signer.jaxb.xmldsig.ObjectFactory();
    this.xadesNamespacePrefixMapper = new XAdESNamespacePrefixMapper();
    try {
        JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class);
        this.marshaller = jaxbContext.createMarshaller();
        this.marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", this.xadesNamespacePrefixMapper);
    } catch (JAXBException e) {
        throw new RuntimeException("JAXB error: " + e.getMessage(), e);
    }
    this.dataObjectFormatMimeTypes = new HashMap<String, String>();
}

From source file:be.fedict.eid.tsl.TrustService.java

TrustService(TSPServiceType tspService) {
    this.tspService = tspService;
    this.objectFactory = new ObjectFactory();
    try {/*from   w  ww  . j  a v  a 2s  .  c  o m*/
        this.datatypeFactory = DatatypeFactory.newInstance();
    } catch (DatatypeConfigurationException e) {
        throw new RuntimeException("datatype config error: " + e.getMessage(), e);
    }
    this.eccObjectFactory = new be.fedict.eid.tsl.jaxb.ecc.ObjectFactory();
    this.xadesObjectFactory = new be.fedict.eid.tsl.jaxb.xades.ObjectFactory();
}

From source file:ca.phon.session.io.xml.v12.XMLSessionWriter_v12.java

/**
 * Create a new jaxb version of the session
 * /*from ww w  .  j ava  2  s.co m*/
 * @param session
 * @return an version of the session use-able by jaxb 
 */
private JAXBElement<SessionType> toSessionType(Session session) throws IOException {
    final ObjectFactory factory = new ObjectFactory();
    final SessionType retVal = factory.createSessionType();

    // header data
    retVal.setVersion("PB1.2");
    retVal.setId(session.getName());
    retVal.setCorpus(session.getCorpus());

    final HeaderType headerData = factory.createHeaderType();
    if (session.getMediaLocation() != null && session.getMediaLocation().length() > 0) {
        headerData.setMedia(session.getMediaLocation());
    }
    final LocalDate date = (session.getDate() == null ? LocalDate.now() : session.getDate());
    try {
        final DatatypeFactory df = DatatypeFactory.newInstance();
        final XMLGregorianCalendar cal = df
                .newXMLGregorianCalendar(GregorianCalendar.from(date.atStartOfDay(ZoneId.systemDefault())));
        cal.setTimezone(DatatypeConstants.FIELD_UNDEFINED);
        headerData.setDate(cal);
    } catch (DatatypeConfigurationException e) {
        LOGGER.log(Level.WARNING, e.getMessage(), e);
    }
    final String lang = session.getLanguage();
    if (lang != null && lang.length() > 0) {
        final String langs[] = lang.split("\\p{Space}");
        for (String l : langs) {
            headerData.getLanguage().add(l);
        }
    }
    retVal.setHeader(headerData);

    final TranscriptType transcript = factory.createTranscriptType();
    // commets
    for (int i = 0; i < session.getMetadata().getNumberOfComments(); i++) {
        final Comment c = session.getMetadata().getComment(i);
        final CommentType ct = copyComment(factory, c);
        transcript.getUOrComment().add(ct);
    }

    // participants
    final ParticipantsType parts = factory.createParticipantsType();
    for (int i = 0; i < session.getParticipantCount(); i++) {
        final Participant part = session.getParticipant(i);
        final ParticipantType pt = copyParticipant(factory, part);
        parts.getParticipant().add(pt);
    }
    retVal.setParticipants(parts);

    // transcribers
    final TranscribersType tt = factory.createTranscribersType();
    for (int i = 0; i < session.getTranscriberCount(); i++) {
        final Transcriber tr = session.getTranscriber(i);
        final TranscriberType trt = copyTranscriber(factory, tr);
        tt.getTranscriber().add(trt);
    }
    retVal.setTranscribers(tt);

    // tier info/ordering
    final UserTiersType utt = factory.createUserTiersType();
    for (int i = 0; i < session.getUserTierCount(); i++) {
        final TierDescription td = session.getUserTier(i);
        final UserTierType tierType = copyTierDescription(factory, td);
        utt.getUserTier().add(tierType);
    }
    retVal.setUserTiers(utt);

    final TierOrderType tot = factory.createTierOrderType();
    for (TierViewItem tvi : session.getTierView()) {
        final TvType tvt = copyTierViewItem(factory, tvi);
        tot.getTier().add(tvt);
    }
    retVal.setTierOrder(tot);

    // session data
    for (int i = 0; i < session.getRecordCount(); i++) {
        final Record record = session.getRecord(i);

        // insert comments first
        for (int j = 0; j < record.getNumberOfComments(); j++) {
            final Comment com = record.getComment(j);
            final CommentType ct = copyComment(factory, com);
            transcript.getUOrComment().add(ct);
        }

        // copy record data
        final RecordType rt = copyRecord(factory, retVal, record);

        rt.setId(record.getUuid().toString());

        if (record.isExcludeFromSearches())
            rt.setExcludeFromSearches(record.isExcludeFromSearches());

        // setup participant
        if (record.getSpeaker() != null) {
            for (ParticipantType pt : parts.getParticipant()) {
                if (pt.getId().equals(record.getSpeaker().getId())) {
                    rt.setSpeaker(pt);
                    break;
                }
            }
        }

        transcript.getUOrComment().add(rt);
    }
    retVal.setTranscript(transcript);

    return factory.createSession(retVal);
}

From source file:be.fedict.eid.tsl.TrustService.java

public TrustService(String serviceName, String serviceTypeIdentifier, String serviceStatus,
        DateTime statusStartingDate, X509Certificate... certificates) {
    this.serviceName = serviceName;
    this.statusStartingDate = statusStartingDate;
    this.objectFactory = new ObjectFactory();
    try {/*from  w  ww  . ja va2 s . c  o  m*/
        this.datatypeFactory = DatatypeFactory.newInstance();
    } catch (DatatypeConfigurationException e) {
        throw new RuntimeException("datatype config error: " + e.getMessage(), e);
    }
    this.eccObjectFactory = new be.fedict.eid.tsl.jaxb.ecc.ObjectFactory();
    this.xadesObjectFactory = new be.fedict.eid.tsl.jaxb.xades.ObjectFactory();

    this.tspService = this.objectFactory.createTSPServiceType();
    TSPServiceInformationType tspServiceInformation = this.objectFactory.createTSPServiceInformationType();
    this.tspService.setServiceInformation(tspServiceInformation);
    tspServiceInformation.setServiceTypeIdentifier(serviceTypeIdentifier);
    InternationalNamesType i18nServiceName = this.objectFactory.createInternationalNamesType();
    List<MultiLangNormStringType> serviceNames = i18nServiceName.getName();
    MultiLangNormStringType serviceNameJaxb = this.objectFactory.createMultiLangNormStringType();
    serviceNames.add(serviceNameJaxb);
    serviceNameJaxb.setLang(Locale.ENGLISH.getLanguage());
    X509Certificate certificate = certificates[0];
    if (null == this.serviceName) {
        serviceNameJaxb.setValue(certificate.getSubjectX500Principal().toString());
    } else {
        serviceNameJaxb.setValue(this.serviceName);
    }
    tspServiceInformation.setServiceName(i18nServiceName);

    DigitalIdentityListType digitalIdentityList = createDigitalIdentityList(certificates);
    tspServiceInformation.setServiceDigitalIdentity(digitalIdentityList);

    tspServiceInformation.setServiceStatus(serviceStatus);

    GregorianCalendar statusStartingCalendar;
    if (null == this.statusStartingDate) {
        statusStartingCalendar = new DateTime(certificate.getNotBefore()).toGregorianCalendar();
    } else {
        statusStartingCalendar = this.statusStartingDate.toGregorianCalendar();
    }
    statusStartingCalendar.setTimeZone(TimeZone.getTimeZone("Z"));
    XMLGregorianCalendar statusStartingTime = this.datatypeFactory
            .newXMLGregorianCalendar(statusStartingCalendar);
    tspServiceInformation.setStatusStartingTime(statusStartingTime);
    /*
    if (null != serviceHistoryStatus){
       this.tspService.setServiceHistory(serviceHistoryStatus);
    }
    */
}

From source file:net.di2e.ecdr.describe.generator.DescribeGeneratorImpl.java

public DescribeGeneratorImpl(CatalogFramework fw, FilterBuilder builder, GeneratorConfiguration config) {
    this.framework = fw;
    this.filterBuilder = builder;
    this.generatorConfig = config;

    try {/*from   w ww  .j  a  va  2  s  .c o  m*/
        dtf = DatatypeFactory.newInstance();
    } catch (DatatypeConfigurationException e) {
        LOGGER.error(e.getMessage(), e);
    }

    this.requestProperties = new HashMap<>();
    this.requestProperties.put("ddf.security.subject", this.getSystemSubject());
    namespaceMap.put("ddms", DDMS_NAMESPACE);
    namespaceMap.put("ICISM", ICISM_NAMESPACE);
}

From source file:eu.europa.ec.fisheries.uvms.rules.service.bean.RulesMessageServiceBean.java

@Override
public FLUXResponseMessage generateFluxResponseMessage(ValidationResultDto faReportValidationResult) {
    FLUXResponseMessage responseMessage = new FLUXResponseMessage();
    try {//from www.  j av  a2s. c o m
        FLUXResponseDocument fluxResponseDocument = new FLUXResponseDocument();
        setFluxResponseDocument(faReportValidationResult, fluxResponseDocument);
        responseMessage.setFLUXResponseDocument(fluxResponseDocument);
        return responseMessage;
    } catch (DatatypeConfigurationException e) {
        log.error(e.getMessage(), e);
    }
    return responseMessage;
}

From source file:eu.europa.ec.fisheries.uvms.rules.service.bean.RulesMessageServiceBean.java

@Override
public FLUXResponseMessage generateFluxResponseMessageForFaQuery(ValidationResultDto faReportValidationResult,
        FLUXFAQueryMessage fluxfaQueryMessage) {
    FLUXResponseMessage responseMessage = new FLUXResponseMessage();
    try {//w ww . j  a v  a2 s.c om
        FLUXResponseDocument fluxResponseDocument = new FLUXResponseDocument();
        fluxResponseDocument.setReferencedID(fluxfaQueryMessage.getFAQuery().getID());
        setFluxResponseDocument(faReportValidationResult, fluxResponseDocument);
        responseMessage.setFLUXResponseDocument(fluxResponseDocument);
    } catch (DatatypeConfigurationException e) {
        log.error(e.getMessage(), e);
    }
    return responseMessage;
}

From source file:eu.europa.ec.fisheries.uvms.rules.service.bean.RulesMessageServiceBean.java

@Override
public FLUXResponseMessage generateFluxResponseMessageForFaReport(ValidationResultDto faReportValidationResult,
        FLUXFAReportMessage fluxfaReportMessage) {
    FLUXResponseMessage responseMessage = new FLUXResponseMessage();
    try {/*from  ww w . j ava 2 s .  com*/
        FLUXResponseDocument fluxResponseDocument = new FLUXResponseDocument();
        if (fluxfaReportMessage != null && fluxfaReportMessage.getFLUXReportDocument() != null) {
            List<IDType> requestId = fluxfaReportMessage.getFLUXReportDocument().getIDS();
            fluxResponseDocument
                    .setReferencedID((requestId != null && !requestId.isEmpty()) ? requestId.get(0) : null); // Set Request Id
        }
        setFluxResponseDocument(faReportValidationResult, fluxResponseDocument);
        responseMessage.setFLUXResponseDocument(fluxResponseDocument);
        return responseMessage;

    } catch (DatatypeConfigurationException e) {
        log.error(e.getMessage(), e);
    }
    return responseMessage;
}

From source file:eu.europa.ec.fisheries.uvms.rules.service.bean.RulesMessageServiceBean.java

@Override
public FLUXResponseMessage generateFluxResponseMessageForFaResponse(
        ValidationResultDto faReportValidationResult, FLUXResponseMessage fluxResponseMessage) {
    FLUXResponseMessage responseMessage = new FLUXResponseMessage();
    try {//from w  w  w .j av a 2 s  .  c o  m

        FLUXResponseDocument fluxResponseDocument = new FLUXResponseDocument();
        FLUXResponseDocument responseDocument = fluxResponseMessage.getFLUXResponseDocument();
        if (responseDocument != null) {
            fluxResponseDocument.setReferencedID(
                    (CollectionUtils.isNotEmpty(responseDocument.getIDS())) ? responseDocument.getIDS().get(0)
                            : null); // Set Request Id
        }
        setFluxResponseDocument(faReportValidationResult, fluxResponseDocument);
        responseMessage.setFLUXResponseDocument(fluxResponseDocument);

    } catch (DatatypeConfigurationException e) {
        log.error(e.getMessage(), e);
    }
    return responseMessage;
}

From source file:edu.harvard.hms.dbmi.bd2k.irct.ri.i2b2.I2B2XMLResourceImplementation.java

@Override
public Result runQuery(SecureSession session, Query query, Result result) throws ResourceInterfaceException {
    // Initial setup
    HttpClient client = createClient(session);
    result.setResultStatus(ResultStatus.CREATED);
    String projectId = "";

    // Create the query
    ArrayList<PanelType> panels = new ArrayList<PanelType>();
    int panelCount = 1;

    try {/*from w ww  .j av a  2  s.co  m*/
        PanelType currentPanel = createPanel(panelCount);

        for (ClauseAbstract clause : query.getClauses().values()) {
            if (clause instanceof WhereClause) {
                // Get the projectId if it isn't already set
                if (projectId.equals("")) {
                    String[] pathComponents = ((WhereClause) clause).getField().getPui().split("/");
                    projectId = pathComponents[2];
                }
                WhereClause whereClause = (WhereClause) clause;
                ItemType itemType = createItemTypeFromWhereClause(whereClause);

                // FIRST
                if (panels.isEmpty() && currentPanel.getItem().isEmpty()) {
                    currentPanel.getItem().add(itemType);
                } else if (whereClause.getLogicalOperator() == LogicalOperator.AND) {
                    panels.add(currentPanel);
                    currentPanel = createPanel(panelCount++);
                    currentPanel.getItem().add(itemType);
                } else if (whereClause.getLogicalOperator() == LogicalOperator.OR) {
                    currentPanel.getItem().add(itemType);
                } else if (whereClause.getLogicalOperator() == LogicalOperator.NOT) {
                    panels.add(currentPanel);
                    currentPanel = createPanel(panelCount++);
                    currentPanel.getItem().add(itemType);
                    currentPanel.setInvert(1);
                    panels.add(currentPanel);
                    currentPanel = createPanel(panelCount++);
                }
            }
        }
        if (currentPanel.getItem().size() != 0) {
            panels.add(currentPanel);
        }
    } catch (DatatypeConfigurationException e) {
        result.setResultStatus(ResultStatus.ERROR);
        result.setMessage(e.getMessage());
    }

    ResultOutputOptionListType roolt = new ResultOutputOptionListType();
    ResultOutputOptionType root = new ResultOutputOptionType();
    root.setPriorityIndex(10);
    root.setName("PATIENTSET");
    roolt.getResultOutput().add(root);

    try {
        crcCell = createCRCCell(projectId, session.getUser().getName());
        MasterInstanceResultResponseType mirrt = crcCell.runQueryInstanceFromQueryDefinition(client, null, null,
                "IRCT", null, "ANY", 0, roolt, panels.toArray(new PanelType[panels.size()]));

        String resultId = mirrt.getQueryResultInstance().get(0).getResultInstanceId();
        String queryId = mirrt.getQueryResultInstance().get(0).getQueryInstanceId();
        result.setResourceActionId(projectId + "|" + queryId + "|" + resultId);
        result.setResultStatus(ResultStatus.RUNNING);
    } catch (JAXBException | IOException | I2B2InterfaceException e) {
        result.setResultStatus(ResultStatus.ERROR);
        result.setMessage(e.getMessage());
    }
    return result;
}