Search in sources :

Example 51 with Identifier

use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.

the class RMTxStore method createSourceSequence.

public void createSourceSequence(SourceSequence seq) {
    String sequenceIdentifier = seq.getIdentifier().getValue();
    String endpointIdentifier = seq.getEndpointIdentifier();
    String protocolVersion = encodeProtocolVersion(seq.getProtocol());
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Creating source sequence: " + sequenceIdentifier + ", (endpoint: " + endpointIdentifier + ")");
    }
    Connection con = verifyConnection();
    PreparedStatement stmt = null;
    SQLException conex = null;
    try {
        beginTransaction();
        stmt = getStatement(con, CREATE_SRC_SEQUENCE_STMT_STR);
        stmt.setString(1, sequenceIdentifier);
        Date expiry = seq.getExpires();
        stmt.setLong(2, expiry == null ? 0 : expiry.getTime());
        Identifier osid = seq.getOfferingSequenceIdentifier();
        stmt.setString(3, osid == null ? null : osid.getValue());
        stmt.setString(4, endpointIdentifier);
        stmt.setString(5, protocolVersion);
        stmt.execute();
        commit(con);
    } catch (SQLException ex) {
        conex = ex;
        abort(con);
        throw new RMStoreException(ex);
    } finally {
        releaseResources(stmt, null);
        updateConnectionState(con, conex);
    }
}
Also used : RMStoreException(org.apache.cxf.ws.rm.persistence.RMStoreException) Identifier(org.apache.cxf.ws.rm.v200702.Identifier) SQLException(java.sql.SQLException) Connection(java.sql.Connection) PreparedStatement(java.sql.PreparedStatement) Date(java.util.Date)

Example 52 with Identifier

use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.

the class EncoderDecoder10AImpl method buildHeaderFaultObject.

@Override
protected Object buildHeaderFaultObject(SequenceFault sf) {
    org.apache.cxf.ws.rm.v200502wsa15.SequenceFaultType flt = new org.apache.cxf.ws.rm.v200502wsa15.SequenceFaultType();
    flt.setFaultCode(sf.getFaultCode());
    Object detail = sf.getDetail();
    if (detail instanceof Element) {
        flt.getAny().add(detail);
    } else if (detail instanceof Identifier) {
        flt.getAny().add(VersionTransformer.convert200502wsa15((Identifier) detail));
    } else if (detail instanceof SequenceAcknowledgement) {
        flt.getAny().add(VersionTransformer.convert200502wsa15((SequenceAcknowledgement) detail));
    }
    Element data = sf.getExtraDetail();
    if (data != null) {
        flt.getAny().add(data);
    }
    return flt;
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier) JAXBElement(javax.xml.bind.JAXBElement) Element(org.w3c.dom.Element) SequenceAcknowledgement(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement)

Example 53 with Identifier

use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.

the class ManagedRMEndpoint method getSourceSeq.

private SourceSequence getSourceSeq(String sid) {
    Source source = endpoint.getSource();
    Identifier identifier = RMUtils.getWSRMFactory().createIdentifier();
    identifier.setValue(sid);
    return source.getSequence(identifier);
}
Also used : Identifier(org.apache.cxf.ws.rm.v200702.Identifier)

Example 54 with Identifier

use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.

the class ManagedRMEndpoint method getDestinationSequenceAcknowledgedRange.

@ManagedOperation(description = "Destination Sequence Acknowledged Range")
@ManagedOperationParameters({ @ManagedOperationParameter(name = "sequenceId", description = "The sequence identifier") })
public Long[] getDestinationSequenceAcknowledgedRange(String sid) {
    DestinationSequence ds = getDestinationSeq(sid);
    if (null == ds) {
        throw new IllegalArgumentException("no sequence");
    }
    List<Long> list = new ArrayList<>();
    for (AcknowledgementRange r : ds.getAcknowledgment().getAcknowledgementRange()) {
        list.add(r.getLower());
        list.add(r.getUpper());
    }
    return list.toArray(new Long[0]);
}
Also used : ArrayList(java.util.ArrayList) AcknowledgementRange(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement.AcknowledgementRange) ManagedOperationParameters(org.apache.cxf.management.annotation.ManagedOperationParameters) ManagedOperation(org.apache.cxf.management.annotation.ManagedOperation)

Example 55 with Identifier

use of org.apache.cxf.ws.rm.v200702.Identifier in project cxf by apache.

the class ManagedRMEndpoint method getSourceSequenceAcknowledgedRange.

@ManagedOperation(description = "Source Sequence Acknowledged Range")
@ManagedOperationParameters({ @ManagedOperationParameter(name = "sequenceId", description = "The sequence identifier") })
public Long[] getSourceSequenceAcknowledgedRange(String sid) {
    SourceSequence ss = getSourceSeq(sid);
    if (null == ss) {
        throw new IllegalArgumentException("no sequence");
    }
    List<Long> list = new ArrayList<>();
    for (AcknowledgementRange r : ss.getAcknowledgement().getAcknowledgementRange()) {
        list.add(r.getLower());
        list.add(r.getUpper());
    }
    return list.toArray(new Long[0]);
}
Also used : ArrayList(java.util.ArrayList) AcknowledgementRange(org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement.AcknowledgementRange) ManagedOperationParameters(org.apache.cxf.management.annotation.ManagedOperationParameters) ManagedOperation(org.apache.cxf.management.annotation.ManagedOperation)

Aggregations

Identifier (org.apache.cxf.ws.rm.v200702.Identifier)72 Test (org.junit.Test)43 Message (org.apache.cxf.message.Message)13 RMMessage (org.apache.cxf.ws.rm.persistence.RMMessage)13 SequenceAcknowledgement (org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement)13 SourceSequence (org.apache.cxf.ws.rm.SourceSequence)11 Connection (java.sql.Connection)10 ArrayList (java.util.ArrayList)9 AddressingProperties (org.apache.cxf.ws.addressing.AddressingProperties)9 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)9 SQLException (java.sql.SQLException)8 DestinationSequence (org.apache.cxf.ws.rm.DestinationSequence)8 Date (java.util.Date)7 Method (java.lang.reflect.Method)6 Endpoint (org.apache.cxf.endpoint.Endpoint)6 AttributedURIType (org.apache.cxf.ws.addressing.AttributedURIType)6 ProtocolVariation (org.apache.cxf.ws.rm.ProtocolVariation)6 RMStore (org.apache.cxf.ws.rm.persistence.RMStore)6 SequenceType (org.apache.cxf.ws.rm.v200702.SequenceType)6 PreparedStatement (java.sql.PreparedStatement)5