Skip to content
Open
6 changes: 3 additions & 3 deletions CMakeCPack.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ SET(CPACK_PACKAGE_VERSION_MAJOR ${LIBAWS_MAJOR_VERSION})
SET(CPACK_PACKAGE_VERSION_MINOR ${LIBAWS_MINOR_VERSION})
SET(CPACK_PACKAGE_VERSION_PATCH ${LIBAWS_PATCH_VERSION})

SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.txt")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/README.txt")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "libaws - A Amazon Web Services C++ Library")
SET(CPACK_PACKAGE_EXECUTABLES "s3")
SET(CPACK_PACKAGE_NAME "libaws")
SET(CPACK_PACKAGE_CONTACT "[email protected]")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.txt")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/README.txt")
SET(CPACK_PACKAGE_VENDOR "28msec, Inc.")
SET(CPACK_PACKAGE_VERSION "${LIBAWS_MAJOR_VERSION}.${LIBAWS_MINOR_VERSION}.${LIBAWS_PATCH_VERSION}")
SET(CPACK_PACKAGE_FILE_NAME "libaws-${LIBAWS_MAJOR_VERSION}.${LIBAWS_MINOR_VERSION}.${LIBAWS_PATCH_VERSION}")
Expand All @@ -30,7 +30,7 @@ SET(CPACK_PACKAGE_VERSION_MINOR "${CPACK_PACKAGE_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "libaws ${LIBAWS_MAJOR_VERSION}.${LIBAWS_MINOR_VERSION}")
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "libaws ${CPACK_PACKAGE_VERSION}")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.txt")
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE.txt")

SET(CPACK_DEBIAN_PACKAGE_NAME "libaws")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libcurl3-dev, libcurl4-openssl-dev, libxml2-dev")
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/CMakeUninstall.cmake")

# configure the cmake script to create a source package
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/CPackSourceConfig.cmake.in
${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake)
MESSAGE(STATUS "configured ${CMAKE_SOURCE_DIR}/CPackSourceConfig.cmake.in --> ${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake")

Expand All @@ -135,6 +135,6 @@ INCLUDE(CMakeExportBuildSettings)
CMAKE_EXPORT_BUILD_SETTINGS(${CMAKE_BINARY_DIR}/LIBAWSBuildSettings.cmake)
EXPORT_LIBRARY_DEPENDENCIES(${CMAKE_BINARY_DIR}/LIBAWSDepends.cmake)

CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/LIBAWSConfig.cmake.in ${CMAKE_BINARY_DIR}/LIBAWSConfig.cmake)
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/LIBAWSConfig.cmake.in ${CMAKE_BINARY_DIR}/LIBAWSConfig.cmake)

INCLUDE(CMakeCPack.cmake)
1 change: 1 addition & 0 deletions bin/s3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <unistd.h>
#include <libaws/aws.h>

using namespace aws;
Expand Down
1 change: 1 addition & 0 deletions bin/sdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <unistd.h>
#include <libaws/aws.h>

using namespace aws;
Expand Down
1 change: 1 addition & 0 deletions bin/sqs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <unistd.h>
#include <libaws/aws.h>

using namespace aws;
Expand Down
2 changes: 1 addition & 1 deletion doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
INCLUDE(${CMAKE_SOURCE_DIR}/cmake_modules/CMakeUseDoxygen.cmake)
INCLUDE(${PROJECT_SOURCE_DIR}/cmake_modules/CMakeUseDoxygen.cmake)

#install the documentation
IF(DOXYGEN_FOUND)
Expand Down
1 change: 1 addition & 0 deletions fuse/s3fs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include <cassert>
#include <stdio.h>
#include <unistd.h>
#include <stddef.h>

#include <libaws/aws.h>
#include "properties.h"
Expand Down
3 changes: 3 additions & 0 deletions include/libaws/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ namespace aws {
class DeleteMessageResponse;
typedef SmartPtr<DeleteMessageResponse> DeleteMessageResponsePtr;

class GetQueueAttributesResponse;
typedef SmartPtr<GetQueueAttributesResponse> GetQueueAttributesResponsePtr;

/**
* SDB stuff
*/
Expand Down
3 changes: 3 additions & 0 deletions include/libaws/sqsconnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ namespace aws {

virtual DeleteMessageResponsePtr
deleteMessage(const std::string &aQueueUrl, const std::string &aReceiptHandle) = 0;

virtual GetQueueAttributesResponsePtr
getQueueAttributes( const std::string &aQueueUrl ) = 0;

}; /* class SQSConnection */

Expand Down
9 changes: 9 additions & 0 deletions include/libaws/sqsexception.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ namespace aws {
CreateQueueException(const QueryErrorResponse&);
};

class GetQueueAttributesException : public SQSException
{
public:
virtual ~GetQueueAttributesException() throw();
private:
friend class sqs::SQSConnection;
GetQueueAttributesException(const QueryErrorResponse&);
};

class DeleteQueueException : public SQSException
{
public:
Expand Down
17 changes: 17 additions & 0 deletions include/libaws/sqsresponse.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ namespace aws {
class SendMessageResponse;
class ReceiveMessageResponse;
class DeleteMessageResponse;
class GetQueueAttributesResponse;
} /* namespace sqs */

template <class T>
Expand Down Expand Up @@ -109,6 +110,21 @@ namespace aws {

SendMessageResponse(sqs::SendMessageResponse*);
};

class GetQueueAttributesResponse : public SQSResponse<sqs::GetQueueAttributesResponse>
{
public:
~GetQueueAttributesResponse() {}
int getNumberOfMessages();
int getNumberOfNotVisibleMessages();
time_t getLastModifiedTime();
time_t getCreateTime();
int getMessageRetentionPeriod();

protected:
friend class SQSConnectionImpl;
GetQueueAttributesResponse(sqs::GetQueueAttributesResponse*);
};

class ReceiveMessageResponse : public SQSResponse<sqs::ReceiveMessageResponse>
{
Expand All @@ -123,6 +139,7 @@ namespace aws {
std::string message_id;
uint64_t meta_data;
std::string receipt_handle;
uint64_t approximate_count;
};

void
Expand Down
2 changes: 1 addition & 1 deletion src/api/connectionpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace aws {
theSize(size)
{
for(unsigned int i=1;i<=size;i++){
push(createConnection(theAccessKeyId, theSecretAccessKey));
std::queue<T>::push(createConnection(theAccessKeyId, theSecretAccessKey));
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/api/sqsconnectionimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ namespace aws {
return new DeleteMessageResponse(theConnection->deleteMessage(aQueueUrl, aReceiptHandle));
}

GetQueueAttributesResponsePtr
SQSConnectionImpl::getQueueAttributes(const std::string& aQueueUrl)
{
return new GetQueueAttributesResponse(theConnection->getQueueAttributes(aQueueUrl));
}

SQSConnectionImpl::SQSConnectionImpl(const std::string& aAccessKeyId,
const std::string& aSecretAccessKey,
const std::string& aCustomHost)
Expand Down
3 changes: 3 additions & 0 deletions src/api/sqsconnectionimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ namespace aws {
virtual DeleteMessageResponsePtr
deleteMessage(const std::string &aQueueUrl, const std::string &aReceiptHandle);

virtual GetQueueAttributesResponsePtr
getQueueAttributes( const std::string &aQueueUrl );

protected:
// only the factory can create us
friend class AWSConnectionFactoryImpl;
Expand Down
32 changes: 32 additions & 0 deletions src/api/sqsresponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,38 @@ namespace aws {
DeleteQueueResponse::DeleteQueueResponse(sqs::DeleteQueueResponse* r)
: SQSResponse<sqs::DeleteQueueResponse>(r) {}

GetQueueAttributesResponse::GetQueueAttributesResponse(sqs::GetQueueAttributesResponse* r)
: SQSResponse<sqs::GetQueueAttributesResponse>(r) {}

int
GetQueueAttributesResponse::getNumberOfMessages()
{
return theSQSResponse->getNumberOfMessages();
}

int
GetQueueAttributesResponse::getNumberOfNotVisibleMessages()
{
return theSQSResponse->getNumberOfNotVisibleMessages();
}

time_t
GetQueueAttributesResponse::getLastModifiedTime()
{
return theSQSResponse->getLastModifiedTime();
}

time_t
GetQueueAttributesResponse::getCreateTime()
{
return theSQSResponse->getCreateTime();
}
int
GetQueueAttributesResponse::getMessageRetentionPeriod()
{
return theSQSResponse->getMessageRetentionPeriod();
}

/**
* ListQueuesResponse
*/
Expand Down
3 changes: 0 additions & 3 deletions src/awsqueryconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,8 @@ namespace aws {
// can possibly be removed with a newer curl version
// because it will always copy
std::string lUrlString = lUrl.str();

LOG_INFO("Send request:" << lUrlString);



//std::cout << lUrlString << std::endl;
// set the request url
curl_easy_setopt ( theCurl, CURLOPT_URL, lUrlString.c_str() );
Expand Down
2 changes: 1 addition & 1 deletion src/s3/s3handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ ListBucketHandler::charactersSAXFunc(void * ctx,

#endif
#ifndef NDEBUG
assert(lEndValue=='\0');
assert(**lEndValue=='\0');
#endif
} else if (lHandler->isSet(CommonPrefixes) && lHandler->isSet(Prefix)) {
lRes->theCommonPrefixes.push_back(std::string((const char*)value, len));
Expand Down
19 changes: 18 additions & 1 deletion src/sqs/sqsconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ namespace aws { namespace sqs {
s << aVisibilityTimeout;
lMap.insert (ParameterPair ("VisibilityTimeout", s.str()));
}

lMap.insert (ParameterPair ("AttributeName", "All"));
lMap.insert (ParameterPair ("Version", "2009-02-01"));
return receiveMessage (aQueueUrl, lMap, aDecode);
}

Expand All @@ -170,6 +171,22 @@ namespace aws { namespace sqs {
}
}

GetQueueAttributesResponse*
SQSConnection::getQueueAttributes(const std::string& aQueueUrl)
{
ParameterMap lMap;
lMap.insert( ParameterPair ("AttributeName.1", "All"));
lMap.insert( ParameterPair ("Version", "2012-11-05"));
GetQueueAttributesHandler lHandler;
makeQueryRequest(aQueueUrl, "GetQueueAttributes", &lMap, &lHandler);
if (lHandler.isSuccessful()) {
setCommons(lHandler, lHandler.theGetQueueAttributesResponse);
return lHandler.theGetQueueAttributesResponse;
} else {
throw GetQueueAttributesException (lHandler.getQueryErrorResponse());
}
}

DeleteMessageResponse*
SQSConnection::deleteMessage(const std::string &aQueueUrl, const std::string &aReceiptHandle)
{
Expand Down
4 changes: 4 additions & 0 deletions src/sqs/sqsconnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ namespace aws {
class SendMessageResponse;
class ReceiveMessageResponse;
class DeleteMessageResponse;
class GetQueueAttributesResponse;

class SQSConnection : public AWSQueryConnection
{
Expand All @@ -51,6 +52,9 @@ namespace aws {
int aPort,
bool aIsSecure);

virtual GetQueueAttributesResponse*
getQueueAttributes( const std::string &aQueueUrl );

virtual CreateQueueResponse*
createQueue ( const std::string &aQueueName, int aDefaultVisibilityTimeout );

Expand Down
5 changes: 5 additions & 0 deletions src/sqs/sqsexception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ namespace aws {

CreateQueueException::~CreateQueueException() throw() {}

GetQueueAttributesException::GetQueueAttributesException (const QueryErrorResponse& aError)
: SQSException (aError) {}

GetQueueAttributesException::~GetQueueAttributesException() throw() {}

ListQueuesException::ListQueuesException (const QueryErrorResponse& aError)
: SQSException (aError) {}

Expand Down
Loading