001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *  
010 *    https://www.apache.org/licenses/LICENSE-2.0
011 *  
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License. 
018 *  
019 */
020package org.apache.directory.api.ldap.extras.extended.startTransaction;
021
022
023import org.apache.directory.api.ldap.model.message.AbstractExtendedRequest;
024
025
026/**
027 * Implement the extended Start Transaction Request as described in RFC 5805.
028 * 
029 * It's grammar is :
030 * <pre>
031 * StartTransactionRequest ::= [APPLICATION 23] SEQUENCE {
032 *              requestName      [0] LDAPOID
033 * }
034 * </pre>
035 * 
036 * where 'requestName' is 1.3.6.1.1.21.1 and requestValue is absent.
037 *
038 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
039 */
040public class StartTransactionRequestImpl extends AbstractExtendedRequest implements StartTransactionRequest
041{
042    /**
043     * Creates a new instance of StartTransactionRequestImpl.
044     *
045     * @param messageId the message id
046     */
047    public StartTransactionRequestImpl( int messageId )
048    {
049        super( messageId );
050        setRequestName( EXTENSION_OID );
051    }
052
053
054    /**
055     * Creates a new instance of StartTransactionRequestImpl.
056     */
057    public StartTransactionRequestImpl()
058    {
059        setRequestName( EXTENSION_OID );
060    }
061
062
063    /**
064     * {@inheritDoc}
065     */
066    @Override
067    public StartTransactionResponse getResultResponse()
068    {
069        if ( getResponse() == null )
070        {
071            setResponse( new StartTransactionResponseImpl() );
072        }
073
074        return ( StartTransactionResponse ) getResponse();
075    }
076
077
078    /**
079     * @see Object#toString()
080     */
081    @Override
082    public String toString()
083    {
084        return "StartTransactionRequest";
085    }
086}