Commit 369c022a authored by Steven Murray's avatar Steven Murray
Browse files

Removed further code from the tapeserver directory that is not related to tapeserverd

parent 73973d2a
# This file is part of the Castor project.
# See http://castor.web.cern.ch/castor
#
# Copyright (C) 2003 CERN
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
# @author Castor Dev team, castor-dev@cern.ch
#
cmake_minimum_required (VERSION 2.6)
add_subdirectory (legacymsg)
add_subdirectory (mediachanger)
add_subdirectory (utils)
add_subdirectory (messages)
add_subdirectory (log)
add_subdirectory (server)
add_subdirectory (tape)
if (${COMPILE_SERVER} STREQUAL "1")
add_subdirectory (messages)
add_subdirectory (db)
add_subdirectory (gc)
add_subdirectory (log)
add_subdirectory (rh)
add_subdirectory (scheduler)
add_subdirectory (server)
add_subdirectory (stager/daemon)
add_subdirectory (tape)
add_subdirectory (vdqm)
add_subdirectory (acs)
endif (${COMPILE_SERVER} STREQUAL "1")
################################################################################
# Rules to build and install libcastorclient.so
################################################################################
set (CLIENT_LIB_SRC_FILES
BaseAddress.cpp
VectorAddress.cpp
......@@ -57,12 +25,6 @@ set (CLIENT_LIB_SRC_FILES
ObjectSet.cpp
Services.cpp
System.cpp
bwlist/Privilege.cpp
bwlist/ChangePrivilege.cpp
bwlist/ListPrivileges.cpp
bwlist/ListPrivilegesResponse.cpp
bwlist/BWUser.cpp
bwlist/RequestType.cpp
client/BaseClient.cpp
client/BasicResponseHandler.cpp
client/VectorResponseHandler.cpp
......@@ -132,275 +94,12 @@ set (CLIENT_LIB_SRC_FILES
io/StreamBWUserCnv.cpp
io/StreamRequestTypeCnv.cpp
io/StreamNsFileIdCnv.cpp
query/DiskPoolQueryResponse.cpp
query/FileSystemDescription.cpp
query/DiskServerDescription.cpp
query/DiskPoolQuery.cpp
query/DiskPoolQueryType.cpp
query/VersionQuery.cpp
query/VersionResponse.cpp
replier/ClientConnection.cpp
replier/RequestReplier.cpp
rh/Client.cpp
rh/EndResponse.cpp
rh/FileResponse.cpp
rh/GCFilesResponse.cpp
rh/Response.cpp
rh/StringResponse.cpp
rh/AbortResponse.cpp
rh/FileQryResponse.cpp
rh/IOResponse.cpp
rh/BasicResponse.cpp
stager/CastorFile.cpp
stager/DiskCopyInfo.cpp
stager/DiskCopyForRecall.cpp
stager/DiskCopyStatusCodes.cpp
stager/DiskFile.cpp
stager/DiskServerStatusCode.cpp
stager/FileSystemStatusCodes.cpp
stager/DLFInit.cpp
stager/FileClass.cpp
stager/FileRequest.cpp
stager/ErrorFileRequest.cpp
stager/Files2Delete.cpp
stager/FilesDeleted.cpp
stager/NsFilesDeleted.cpp
stager/NsFilesDeletedResponse.cpp
stager/StgFilesDeleted.cpp
stager/StgFilesDeletedResponse.cpp
stager/FilesDeletionFailed.cpp
stager/GCLocalFile.cpp
stager/GCFile.cpp
stager/GCFileList.cpp
stager/QryRequest.cpp
stager/Request.cpp
stager/RequestQueryType.cpp
stager/RemoteGCSvc.cpp
stager/SvcClass.cpp
stager/QueryParameter.cpp
stager/SetFileGCWeight.cpp
stager/StageAbortRequest.cpp
stager/StageFileQueryRequest.cpp
stager/StageGetRequest.cpp
stager/StagePrepareToGetRequest.cpp
stager/StagePrepareToPutRequest.cpp
stager/StagePutDoneRequest.cpp
stager/StagePutRequest.cpp
stager/StageQueryResult.cpp
stager/StageRmRequest.cpp
stager/SubRequest.cpp
stager/SubRequestStatusCodes.cpp
stager/SubRequestGetNextStatusCodes.cpp
stager/TapeVid.cpp
stager/NsFileId.cpp
stager/BulkRequestResult.cpp
stager/FileResult.cpp
vdqm/ClientIdentification.cpp
vdqm/TapeDrive.cpp
vdqm/DeviceGroupName.cpp
vdqm/TapeAccessSpecification.cpp
vdqm/TapeDriveCompatibility.cpp
vdqm/TapeDriveDedication.cpp
vdqm/TapeDriveStatusCodes.cpp
vdqm/TapeRequest.cpp
vdqm/TapeRequestStatusCodes.cpp
vdqm/TapeServer.cpp
vdqm/TapeServerStatusCodes.cpp
vdqm/VdqmTape.cpp
../client/src/stager/stager_client_api_common.cpp
../client/src/stager/stager_client_commandline.cpp
../client/src/stager/stager_client_changePrivilege.c
../client/src/stager/stager_client_api_get.cpp
../client/src/stager/stager_client_api_put.cpp
../client/src/stager/stager_client_api_open.cpp
../client/src/stager/stager_client_api_query.cpp
../client/src/stager/stager_client_api_rm.cpp
../client/src/stager/stager_client_api_setFileGCWeight.cpp
../client/src/stager/stager_client_api_version.cpp
../client/src/stager/stager_client_api_changePrivilege.cpp
../client/src/stager/stager_client_api_listPrivileges.cpp
../client/src/stager/stager_errmsg.c
../client/src/stager/stager_mapper.c)
add_library (castorclient SHARED
${CLIENT_LIB_SRC_FILES}
${CLIENT_LIB_PROC_CAP_SRC_FILES})
${CLIENT_LIB_SRC_FILES})
# Relax compilation of old code full of pointer casting. Funnily enough,
# the compiler only complains in -O2 mode (RelWithDebInfo in cmake).
set_property(SOURCE ../client/src/stager/stager_errmsg.c APPEND PROPERTY COMPILE_FLAGS -fno-strict-aliasing)
CastorSetLibraryVersions (castorclient)
target_link_libraries (castorclient castordlf castorutils)
install (TARGETS castorclient DESTINATION ${CASTOR_DEST_LIB_DIR})
if (${COMPILE_SERVER} STREQUAL "1")
CastorInstallExample (castor.conf /etc/castor)
CastorInstallExample (rsyslog.conf.client /etc/castor)
CastorInstallExample (rsyslog.conf.server /etc/castor)
################################################################################
# Installation of header files for package castor-build-headers
################################################################################
# Required by xrootd-xcastor2fs and castor-srmv2
install(FILES
BaseObject.hpp
Constants.hpp
IObject.hpp
IService.hpp
Services.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}
PERMISSIONS ${CASTOR_HEADER_PERMS})
install(FILES
client/BaseClient.hpp
client/IResponseHandler.hpp
client/VectorResponseHandler.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}/client
PERMISSIONS ${CASTOR_HEADER_PERMS})
install(FILES
dlf/Dlf.hpp
dlf/IPAddress.hpp
dlf/Message.hpp
dlf/Param.hpp
dlf/TimeStamp.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}/dlf
PERMISSIONS ${CASTOR_HEADER_PERMS})
install(FILES
exception/AcceptConnectionInterrupted.hpp
exception/AlreadyInitialized.hpp
exception/Backtrace.hpp
exception/BadAlloc.hpp
exception/BadMessage.hpp
exception/CommandLineNotParsed.hpp
exception/Communication.hpp
exception/Exception.hpp
exception/InvalidArgument.hpp
exception/InvalidNbArguments.hpp
exception/NoEntry.hpp
exception/NotAnOwner.hpp
exception/OutOfMemory.hpp
exception/SQLError.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}/exception
PERMISSIONS ${CASTOR_HEADER_PERMS})
install(FILES
io/ServerSocket.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}/io
PERMISSIONS ${CASTOR_HEADER_PERMS})
install(FILES
rh/Client.hpp
rh/FileResponse.hpp
rh/IOResponse.hpp
rh/Response.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}/rh
PERMISSIONS ${CASTOR_HEADER_PERMS})
install(FILES
stager/DiskCopyStatusCodes.hpp
stager/FileRequest.hpp
stager/ICommonSvc.hpp
stager/Request.hpp
stager/StageGetRequest.hpp
stager/StagePrepareToGetRequest.hpp
stager/StagePrepareToPutRequest.hpp
stager/StagePutRequest.hpp
stager/SubRequestGetNextStatusCodes.hpp
stager/SubRequest.hpp
stager/SubRequestStatusCodes.hpp
stager/TapeVid.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}/stager
PERMISSIONS ${CASTOR_HEADER_PERMS})
# Required by xrootd-xcastor2fs
install(FILES io/AbstractSocket.hpp
io/AbstractTCPSocket.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}/io
PERMISSIONS ${CASTOR_HEADER_PERMS})
# Required by castor-srmv2
install(FILES
BaseAddress.hpp
BaseCnvSvc.hpp
BaseSvc.hpp
CnvFactory.hpp
Converters.hpp
Factories.hpp
IAddress.hpp
IClient.hpp
ICnvFactory.hpp
ICnvSvc.hpp
IConverter.hpp
IFactory.hpp
ISvcFactory.hpp
MessageAck.hpp
ObjectSet.hpp
SvcFactory.hpp
System.hpp
VectorAddress.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}
PERMISSIONS ${CASTOR_HEADER_PERMS})
install(FILES
db/DbBaseObj.hpp
db/DbCnvSvc.hpp
db/DbParamsSvc.hpp
db/IDbResultSet.hpp
db/IDbStatement.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}/db
PERMISSIONS ${CASTOR_HEADER_PERMS})
install(FILES
db/cnv/DbBaseCnv.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}/db/cnv
PERMISSIONS ${CASTOR_HEADER_PERMS})
install(FILES
db/ora/OraCnvSvc.hpp
db/ora/OraCommonSvc.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}/db/ora
PERMISSIONS ${CASTOR_HEADER_PERMS})
install(FILES
io/ClientSocket.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}/io
PERMISSIONS ${CASTOR_HEADER_PERMS})
install(FILES
query/DiskPoolQueryType.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}/query
PERMISSIONS ${CASTOR_HEADER_PERMS})
install(FILES
rh/FileQryResponse.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}/rh
PERMISSIONS ${CASTOR_HEADER_PERMS})
install(FILES
server/BaseThreadPool.hpp
server/DynamicThreadPool.hpp
server/IThread.hpp
server/ListenerThreadPool.hpp
server/Mutex.hpp
server/NotifierThread.hpp
server/Queue.hpp
server/SelectProcessThread.hpp
server/SignalThreadPool.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}/server
PERMISSIONS ${CASTOR_HEADER_PERMS})
install(FILES
stager/NsFileId.hpp
stager/QryRequest.hpp
stager/QueryParameter.hpp
stager/RequestQueryType.hpp
stager/StageAbortRequest.hpp
stager/StageFileQueryRequest.hpp
stager/StageRmRequest.hpp
stager/SvcClass.hpp
DESTINATION ${CASTOR_DEST_CPP_HEADERS_DIR}/stager
PERMISSIONS ${CASTOR_HEADER_PERMS})
endif (${COMPILE_SERVER} STREQUAL "1")
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 CERN
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*
*
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#include "castor/tape/tapegateway/BoolFunctor.hpp"
//-----------------------------------------------------------------------------
// destructor
//-----------------------------------------------------------------------------
castor::tape::tapegateway::BoolFunctor::~BoolFunctor() throw() {
// Do nothing
}
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 CERN
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*
*
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#pragma once
namespace castor {
namespace tape {
namespace tapegateway {
/**
* Abstract class specifiying the interface to be followed by functors that
* take no parameters and return a boolean.
*/
class BoolFunctor {
public:
/**
* operator() which takes no parameters and returns a boolean.
*/
virtual bool operator()() const = 0;
/**
* Virtual destructor.
*/
virtual ~BoolFunctor() throw();
}; // class BoolFunctor
} // namespace tapegateway
} // namespace tape
} // namespace castor
#
# castor/tape/tapegateway/CMakeLists.txt
#
# This file is part of the Castor project.
# See http://castor.web.cern.ch/castor
#
# Copyright (C) 2003 CERN
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
# Steven.Murray@cern.ch
#
cmake_minimum_required (VERSION 2.6)
################################################################################
# Rules to build and install tapegatewayd
################################################################################
set (TAPEGATEWAY_SRC_FILES
BoolFunctor.cpp
ScopedTransaction.cpp
ShutdownBoolFunctor.cpp
TapeGatewayDlfMessageStrings.cpp
daemon/NsTapeGatewayHelper.cpp
daemon/TapeGatewayDaemon.cpp
daemon/TapeGatewayMain.cpp
daemon/TapeMigrationMountLinkerThread.cpp
daemon/VdqmRequestsCheckerThread.cpp
daemon/VdqmRequestsProducerThread.cpp
daemon/VdqmTapeGatewayHelper.cpp
daemon/VmgrTapeGatewayHelper.cpp
daemon/WorkerThread.cpp
daemon/ora/OraTapeGatewaySvc.cpp
)
add_executable (tapegatewayd ${TAPEGATEWAY_SRC_FILES})
set_target_properties (tapegatewayd PROPERTIES
COMPILE_FLAGS ${ORACLE_CPPFLAGS}
LINK_FLAGS "-L${ORACLE_LIBDIR} -locci -lclntsh")
target_link_libraries (tapegatewayd
castorclient
castorcnvs
castorcommon
castorcommonora
castorlog
castorns
castortapegatewayprotocol
castorvdqm
castorvmgr
castorserver)
install (TARGETS tapegatewayd DESTINATION ${CASTOR_DEST_BIN_DIR})
CastorInstallAdmManPage (tapegatewayd)
CastorInstallLogrotate (castor-tapegateway-server)
CastorInstallSysconfigExample (tapegatewayd)
CastorInstallInitScript (tapegatewayd)
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 CERN
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Helper object for writing safe code with respect to DB transactions
* Basically calls rollback in the destructor if commit was not called
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#include "ScopedTransaction.hpp"
#include "castor/dlf/Dlf.hpp"
namespace castor {
namespace tape {
namespace tapegateway {
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
ScopedTransaction::~ScopedTransaction() {
// Rollback in case of no previous explicit transaction commit or rollback
// Intercept any exceptions
try {
if (!m_transactionClosed) m_OraSvc->rollback();
} catch (...) {
// "Failed to rollback"
castor::dlf::Param params[] = {
castor::dlf::Param("Message", "Failed to rollback in ScopedTransaction::~ScopedTransaction")
};
castor::dlf::dlf_writep(nullCuuid, DLF_LVL_ERROR, DLF_BASE_ORACLELIB + 26, 1, params);
}
};
// Explicit commit, disengaging the destructor's mechanism
void ScopedTransaction::commit() {
m_OraSvc->commit();
m_transactionClosed = true;
}
// Explicit rollback, disengaging the destructor's mechanism
void ScopedTransaction::rollback() {
m_OraSvc->rollback();
m_transactionClosed = true;
}
} // namespace tapegateway
} // namespace tape
} // namespace castor
/******************************************************************************
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 CERN
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Helper object for writing safe code with respect to DB transactions
* Basically calls rollback in the destructor if commit was not called
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#pragma once
#include "castor/tape/tapegateway/daemon/ITapeGatewaySvc.hpp"
namespace castor {
namespace tape {
namespace tapegateway {
/*
* Helper object for writing safe code with respect to DB transactions
* Basically calls rollback in the destructor if commit was not called
* XXX This should be generalized to any object implementing some
* XXX transaction interface (to be defined).
*/
class ScopedTransaction {
public:
/* constructor
* @param OraSvc the underlying ITapeGatewaySvc
*/
ScopedTransaction(castor::tape::tapegateway::ITapeGatewaySvc * OraSvc):
m_OraSvc(OraSvc), m_transactionClosed(false) {};
/* destructor */
virtual ~ScopedTransaction();
/* commits the transaction */
void commit() ;
/* explicitely rollbacks the transaction */
void rollback() ;
private:
/* the underlying ITapeGatewaySvc object */
castor::tape::tapegateway::ITapeGatewaySvc * m_OraSvc;
/* whether the transaction was closed */
bool m_transactionClosed;