Big honkin' merge from head. Sheesh!

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3617 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-08-27 01:01:30 +00:00
parent e2c66899cc
commit 8031cc6574
322 changed files with 20776 additions and 6550 deletions

View File

@@ -25,17 +25,22 @@
#include <vector>
#include <algorithm>
#include "util\Exception.h"
#include "util\String.h"
#include "util\DataBuffer.h"
#include "alfresco\Desktop.hpp"
// Classes defined in this header file
namespace Alfresco {
class AlfrescoInterface;
class AlfrescoFileInfo;
class AlfrescoFileInfoList;
class AlfrescoActionInfo;
typedef std::auto_ptr<AlfrescoFileInfo> PTR_AlfrescoFileInfo;
typedef std::auto_ptr<AlfrescoActionInfo> PTR_AlfrescoActionInfo;
}
// Constants
@@ -44,10 +49,12 @@ namespace Alfresco {
// Alfresco I/O control codes
#define FSCTL_ALFRESCO_PROBE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define FSCTL_ALFRESCO_FILESTS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x801, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define FSCTL_ALFRESCO_CHECKOUT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x802, METHOD_BUFFERED, FILE_WRITE_DATA)
#define FSCTL_ALFRESCO_CHECKIN CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x803, METHOD_BUFFERED, FILE_WRITE_DATA)
#define FSCTL_ALFRESCO_PROBE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define FSCTL_ALFRESCO_FILESTS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x801, METHOD_BUFFERED, FILE_ANY_ACCESS)
// Version 1 FSCTL_ALFRESCO_CHECKOUT - 0x802
// Version 1 FSCTL_ALFRESCO_CHECKIN - 0x803
#define FSCTL_ALFRESCO_GETACTIONINFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x804, METHOD_BUFFERED, FILE_WRITE_DATA)
#define FSCTL_ALFRESCO_RUNACTION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0x805, METHOD_BUFFERED, FILE_WRITE_DATA)
// Request signature bytes
@@ -68,6 +75,9 @@ namespace Alfresco {
#define StsAccessDenied 3
#define StsBadParameter 4
#define StsNotWorkingCopy 5
#define StsNoSuchAction 6
#define StsLaunchURL 7
#define StsCommandLine 8
// Boolean field values
@@ -86,6 +96,27 @@ namespace Alfresco {
#define LockNone 0
#define LockRead 1
#define LockWrite 2
// Desktop action attributes
#define AttrTargetFiles 0x0001
#define AttrTargetFolders 0x0002
#define AttrClientFiles 0x0004
#define AttrClientFolders 0x0008
#define AttrAlfrescoFiles 0x0010
#define AttrAlfrescoFolders 0x0020
#define AttrMultiplePaths 0x0040
#define AttrAllowNoParams 0x0080
#define AttrAnyFiles (AttrTargetFiles + AttrClientFiles + AttrAlfrescoFiles)
#define AttrAnyFolders (AttrTargetFolders + AttrClientFolders + AttrAlfrescoFolders)
#define AttrAnyFilesFolders (AttrAnyFiles + AttrAnyFolders)
// Desktop action pre-processing actions
#define PreCopyToTarget 0x0001
#define PreConfirmAction 0x0002
#define PreLocalToWorkingCopy 0x0004
}
// Define Alfresco interface exceptions
@@ -122,17 +153,21 @@ public:
bool isAlfrescoFolder( void);
// Return the protocol version of the server
inline const unsigned int isProtocolVersion( void) const { return m_protocolVersion; }
// Return the Alfresco file information for a file/folder within the current folder
PTR_AlfrescoFileInfo getFileInformation(const wchar_t* fileName);
// Check in a working copy file
// Get action information, map the executable name to a server action
void checkIn( const wchar_t* fileName, bool keepCheckedOut = false);
AlfrescoActionInfo getActionInformation(const wchar_t* exeName);
// Check out a file
// Run a desktop action and return the server response
void checkOut( const wchar_t* fileName, String& workingCopy);
DesktopResponse runAction(AlfrescoActionInfo& action, DesktopParams& params);
private:
// Send an I/O control request, receive and validate the response
@@ -160,6 +195,9 @@ private:
HANDLE m_handle;
// Protocol version
unsigned int m_protocolVersion;
};
/**
@@ -292,4 +330,86 @@ private:
std::vector<AlfrescoFileInfo*> m_list;
};
/**
* Alfresco Action Info Class
*/
class Alfresco::AlfrescoActionInfo {
public:
// Default constructor
AlfrescoActionInfo(void);
// Class constructor
AlfrescoActionInfo( const String& name, const unsigned int attr, const unsigned int preActions);
// Return the action name, pseudo file name
inline const String& getName(void) const { return m_name; }
inline const String& getPseudoName(void) const { return m_pseudoName; }
// Return the action attributes, action pre-processing flags
inline unsigned int getAttributes(void) const { return m_attributes; }
inline unsigned int getPreProcessActions(void) const { return m_clientPreActions; }
// Check if the action has the specifed attribute/pre-processing action
inline bool hasAttribute(const unsigned int attr) const { return (m_attributes & attr) != 0 ? true : false; }
inline bool hasPreProcessAction(const unsigned int pre) const { return (m_clientPreActions & pre) != 0 ? true : false; }
// Check if the confirmation message is valid, return the confirmation message
inline bool hasConfirmationMessage(void) const { return m_confirmMsg.length() > 0 ? true : false; }
inline const String& getConfirmationMessage(void) const { return m_confirmMsg; }
// Check if the action supports file or folder paths
inline bool supportsFiles(void) const { return hasAttribute(AttrTargetFiles+AttrClientFiles+AttrAlfrescoFiles); }
inline bool supportsFolders(void) const { return hasAttribute(AttrTargetFolders+AttrClientFolders+AttrAlfrescoFolders); }
// Check if the action allows no parameters
inline bool allowsNoParameters(void) const { return hasAttribute(AttrAllowNoParams) || hasAttribute(AttrAnyFilesFolders) == false; }
// Set the action name, pseudo name, set the confirmation message
inline void setName(const String& name) { m_name = name; }
inline void setPseudoName(const String& pseudo) { m_pseudoName = pseudo; }
inline void setConfirmationMessage(const String& msg) { m_confirmMsg = msg; }
// Set the action attributes and pre-processing actions
inline void setAttributes(const unsigned int attr) { m_attributes = attr; }
inline void setPreProcessActions(const unsigned int pre) { m_clientPreActions = pre; }
// Return the action information as a string
const String toString(void) const;
// Assignment operator
AlfrescoActionInfo& operator=( const AlfrescoActionInfo& actionInfo);
private:
// Instance variables
//
// Action name
String m_name;
// Pseudo file name
String m_pseudoName;
// Action attributes and pre-processing flags
unsigned int m_attributes;
unsigned int m_clientPreActions;
// Action confirmation message
String m_confirmMsg;
};
#endif

View File

@@ -0,0 +1,179 @@
/*
* Copyright (C) 2005-2006 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
#ifndef _Desktop_H
#define _Desktop_H
// Includes
#include <windows.h>
#include <vector>
#include <algorithm>
#include "util\Exception.h"
#include "util\String.h"
#include "util\DataBuffer.h"
// Classes defined in this header file
namespace Alfresco {
class DesktopTarget;
class DesktopParams;
class DesktopResponse;
typedef std::auto_ptr<DesktopTarget> PTR_DesktopTarget;
typedef std::auto_ptr<DesktopParams> PTR_DesktopParams;
typedef std::auto_ptr<DesktopResponse> PTR_DesktopResponse;
}
// Constants
namespace Alfresco {
// Desktop target types
#define TargetFile 0
#define TargetFolder 1
#define TargetCopiedFile 2
#define TargetCopiedFolder 3
#define TargetNodeRef 4
}
// Define desktop action exceptions
DEFINE_EXCEPTION(Alfresco, DesktopActionException);
/**
* Desktop Target Class
*
* Contains the details of a target for a desktop action.
*/
class Alfresco::DesktopTarget {
public:
// Class constructors
DesktopTarget(int typ, String& path);
// Class destructor
~DesktopTarget();
// Return the target type, target path/id
inline unsigned int isType(void) const { return m_type; }
inline const String& getTarget(void) const { return m_target; }
// Return the target type as a string
const String getTypeAsString( void) const;
// Return the target details as a string
const String toString( void) const;
// Operators
bool operator==( const DesktopTarget& target);
bool operator<( const DesktopTarget& target);
private:
// Hide the copy constructor
DesktopTarget(const DesktopTarget& target) {};
private:
// Instance variables
//
// Target type and path/id
unsigned int m_type;
String m_target;
};
/**
* Desktop Params Class
*
* Contains the parameters for a desktop action request.
*/
class Alfresco::DesktopParams {
public:
// Class constructors
DesktopParams(void) {}
// Return the number of targets
inline size_t numberOfTargets(void) const { return m_list.size(); }
// Return a target from the list
const DesktopTarget* getTarget(const unsigned int idx) const;
// Add a desktop target
inline void addTarget(DesktopTarget* pTarget) { m_list.push_back(pTarget); }
// Clear the target list
inline void clearTargets( void) { m_list.clear(); }
// Return the desktop parameters as a string
const String toString(void) const;
private:
// Instance variables
//
// List of file/folder/node targets for the action
std::vector<DesktopTarget*> m_list;
};
/**
* Desktop Response Class
*
* Contains the result of calling a server side desktop action.
*/
class Alfresco::DesktopResponse {
public:
// class constructors
DesktopResponse( const unsigned int sts, const wchar_t* msg = NULL);
// Return the status code
inline unsigned int getStatus( void) const { return m_status; }
// Check if there is a status message, return the status message
inline bool hasStatusMessage(void) const { return m_statusMsg.length() > 0; }
inline const String& getStatusMessage(void) const { return m_statusMsg; }
// Assignment operator
DesktopResponse& operator=( const DesktopResponse& response);
private:
// Instance variables
//
// Status code and message
unsigned int m_status;
String m_statusMsg;
};
#endif