Merged 1.4 to HEAD

svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4192 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4197 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4205 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4206 .
   svn resolved root\projects\repository\source\java\org\alfresco\filesys\server\config\ServerConfiguration.java
   svn revert root\projects\repository\config\alfresco\version.properties
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4219 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4224 .


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4631 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-12-18 11:58:55 +00:00
parent df4fd38e52
commit ff07ea1e7d
18 changed files with 1411 additions and 149 deletions

Binary file not shown.

View File

@@ -12,4 +12,4 @@ hibernate.cache.use_second_level_cache=true
hibernate.default_batch_fetch_size=1 hibernate.default_batch_fetch_size=1
hibernate.jdbc.batch_size=32 hibernate.jdbc.batch_size=32
hibernate.connection.release_mode=auto hibernate.connection.release_mode=auto
hibernate.connection.isolation=4 hibernate.connection.isolation=2

View File

@@ -40,7 +40,6 @@
<property name="scheduler"> <property name="scheduler">
<ref bean="schedulerFactory" /> <ref bean="schedulerFactory" />
</property> </property>
<!-- Try and do some indexing every minute after starting up -->
<property name="startDelayMinutes"> <property name="startDelayMinutes">
<value>1</value> <value>1</value>
</property> </property>
@@ -49,38 +48,6 @@
</property> </property>
</bean> </bean>
<!-- Forces the reindexing of nodes where content may have been missing before -->
<!--
This component can be triggered at intervals where asynchronous content sharing
between clustered servers has been set up
-->
<bean id="missingContentReindexTrigger" class="org.alfresco.util.TriggerBean">
<property name="jobDetail">
<bean class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass">
<value>org.alfresco.repo.node.index.IndexRecoveryJob</value>
</property>
<property name="jobDataAsMap">
<map>
<entry key="indexRecoveryComponent">
<ref bean="missingContentReindexComponent" />
</entry>
</map>
</property>
</bean>
</property>
<property name="scheduler">
<ref bean="schedulerFactory" />
</property>
<!-- Give the server 5 minutes and then check for missing content -->
<property name="startDelayMinutes">
<value>5</value>
</property>
<property name="repeatCount">
<value>0</value>
</property>
</bean>
<bean id="indexRecoveryTrigger" class="org.alfresco.util.TriggerBean"> <bean id="indexRecoveryTrigger" class="org.alfresco.util.TriggerBean">
<property name="jobDetail"> <property name="jobDetail">
<bean class="org.springframework.scheduling.quartz.JobDetailBean"> <bean class="org.springframework.scheduling.quartz.JobDetailBean">

View File

@@ -6,14 +6,7 @@
<start-state name="start"> <start-state name="start">
<task name="wf:submitParallelReviewTask" swimlane="initiator" /> <task name="wf:submitParallelReviewTask" swimlane="initiator" />
<transition name="" to="startreview"> <transition name="" to="startreview"/>
<script>
<variable name="wf_approveCount" access="write" />
<expression>
wf_approveCount = 0;
</expression>
</script>
</transition>
</start-state> </start-state>
<node name="startreview"> <node name="startreview">
@@ -21,6 +14,14 @@
<foreach>#{bpm_assignees}</foreach> <foreach>#{bpm_assignees}</foreach>
<var>reviewer</var> <var>reviewer</var>
</action> </action>
<event type="node-enter">
<script>
<variable name="wf_approveCount" access="write" />
<expression>
wf_approveCount = 0;
</expression>
</script>
</event>
<transition name="review" to="review" /> <transition name="review" to="review" />
</node> </node>

View File

@@ -13,6 +13,10 @@ wf_workflowmodel.type.wf_submitReviewTask.title=Start Review
wf_workflowmodel.type.wf_submitReviewTask.description=Submit documents for review & approval wf_workflowmodel.type.wf_submitReviewTask.description=Submit documents for review & approval
wf_workflowmodel.type.wf_reviewTask.title=Review wf_workflowmodel.type.wf_reviewTask.title=Review
wf_workflowmodel.type.wf_reviewTask.description=Review Documents to Approve or Reject them wf_workflowmodel.type.wf_reviewTask.description=Review Documents to Approve or Reject them
wf_workflowmodel.type.wf_rejectedTask.title=Rejected
wf_workflowmodel.type.wf_rejectedTask.description=Rejected
wf_workflowmodel.type.wf_approvedTask.title=Approved
wf_workflowmodel.type.wf_approvedTask.description=Approved
# Review & Approve Process Definitions # Review & Approve Process Definitions

View File

@@ -25,6 +25,7 @@
#include "util\DataBuffer.h" #include "util\DataBuffer.h"
#include "util\FileName.h" #include "util\FileName.h"
#include "util\Integer.h" #include "util\Integer.h"
#include "util\Debug.h"
#include <shellapi.h> #include <shellapi.h>
@@ -68,6 +69,22 @@ BOOL CAlfrescoApp::InitInstance()
CWinApp::InitInstance(); CWinApp::InitInstance();
AfxEnableControlContainer(); AfxEnableControlContainer();
// Check if debug logging is enabled
char dbgLogName[MAX_PATH];
size_t dbgLogSize;
if ( getenv_s( &dbgLogSize, dbgLogName, sizeof( dbgLogName), "ALFDEBUG") == 0) {
// Enable debug output
Debug::openLog( dbgLogName);
// Log the application startup
DBGOUT_TS << "---------- Desktop client app started ----------" << endl;
}
// Get the application path // Get the application path
String appPath = __wargv[0]; String appPath = __wargv[0];
@@ -76,6 +93,7 @@ BOOL CAlfrescoApp::InitInstance()
if ( pos < 0) { if ( pos < 0) {
AfxMessageBox( L"Invalid application path", MB_OK | MB_ICONSTOP); AfxMessageBox( L"Invalid application path", MB_OK | MB_ICONSTOP);
DBGOUT_TS << "Error, bad application path, " << appPath << endl;
return 1; return 1;
} }
@@ -91,10 +109,29 @@ BOOL CAlfrescoApp::InitInstance()
try { try {
// DEBUG
DBGOUT_TS << "Using folder " << folderPath << endl;
// Get the action information // Get the action information
AlfrescoActionInfo actionInfo = alfresco.getActionInformation(exeName); AlfrescoActionInfo actionInfo = alfresco.getActionInformation(exeName);
// DEBUG
if ( HAS_DEBUG) {
DBGOUT_TS << "Action " << actionInfo.getName() << endl;
DBGOUT_TS << " PreProcess: ";
if ( actionInfo.hasPreProcessAction( PreConfirmAction))
DBGOUT << "Confirm ";
if ( actionInfo.hasPreProcessAction( PreCopyToTarget))
DBGOUT << "CopyToTarget ";
if ( actionInfo.hasPreProcessAction( PreLocalToWorkingCopy))
DBGOUT << "LocalToWorkingCopy";
DBGOUT << endl;
}
// Check if the action should be confirmed // Check if the action should be confirmed
if ( actionInfo.hasPreProcessAction(PreConfirmAction)) { if ( actionInfo.hasPreProcessAction(PreConfirmAction)) {
@@ -105,10 +142,16 @@ BOOL CAlfrescoApp::InitInstance()
if ( confirmMsg.length() == 0) if ( confirmMsg.length() == 0)
confirmMsg = L"Run action ?"; confirmMsg = L"Run action ?";
// DEBUG
DBGOUT_TS << "Confirm action, message = " << confirmMsg << endl;
// Display a confirmation dialog // Display a confirmation dialog
if ( AfxMessageBox( confirmMsg, MB_OKCANCEL | MB_ICONQUESTION) == IDCANCEL) if ( AfxMessageBox( confirmMsg, MB_OKCANCEL | MB_ICONQUESTION) == IDCANCEL) {
DBGOUT_TS << "User cancelled action" << endl;
return FALSE; return FALSE;
}
} }
// Check if the action supports multiple paths, if not then call the action once for each supplied path // Check if the action supports multiple paths, if not then call the action once for each supplied path
@@ -164,6 +207,7 @@ BOOL CAlfrescoApp::InitInstance()
} }
else { else {
AfxMessageBox( L"Not a valid Alfresco CIFS folder", MB_OK | MB_ICONSTOP); AfxMessageBox( L"Not a valid Alfresco CIFS folder", MB_OK | MB_ICONSTOP);
DBGOUT_TS << "Error, not a valid Alfresco CIFS folder, " << folderPath << endl;
return 1; return 1;
} }
@@ -198,6 +242,10 @@ bool CAlfrescoApp::buildDesktopParameters( AlfrescoInterface& alfresco, StringLi
String curFile = paths.getStringAt( i); String curFile = paths.getStringAt( i);
// DEBUG
DBGOUT_TS << "Parameter: " << curFile << endl;
// Check if the path is on an Alfresco mapped drive // Check if the path is on an Alfresco mapped drive
if ( alfresco.isMappedDrive() && curFile.startsWithIgnoreCase( alfresco.getDrivePath())) { if ( alfresco.isMappedDrive() && curFile.startsWithIgnoreCase( alfresco.getDrivePath())) {
@@ -223,10 +271,12 @@ bool CAlfrescoApp::buildDesktopParameters( AlfrescoInterface& alfresco, StringLi
if ( isDir && actionInfo.supportsFolders() == false) { if ( isDir && actionInfo.supportsFolders() == false) {
AfxMessageBox(L"Action does not support folders", MB_OK | MB_ICONSTOP); AfxMessageBox(L"Action does not support folders", MB_OK | MB_ICONSTOP);
DBGOUT_TS << "Error, action does not support folders" << endl;
return false; return false;
} }
else if ( actionInfo.supportsFiles() == false) { else if ( actionInfo.supportsFiles() == false) {
AfxMessageBox(L"Action does not support files", MB_OK | MB_ICONSTOP); AfxMessageBox(L"Action does not support files", MB_OK | MB_ICONSTOP);
DBGOUT_TS << "Error, action does not support files" << endl;
return false; return false;
} }
@@ -244,10 +294,12 @@ bool CAlfrescoApp::buildDesktopParameters( AlfrescoInterface& alfresco, StringLi
if ( isDir == false && actionInfo.hasAttribute(AttrClientFiles) == false) { if ( isDir == false && actionInfo.hasAttribute(AttrClientFiles) == false) {
AfxMessageBox(L"Action does not support local files", MB_OK | MB_ICONSTOP); AfxMessageBox(L"Action does not support local files", MB_OK | MB_ICONSTOP);
DBGOUT_TS << "Error, action does not support local files" << endl;
return false; return false;
} }
else if ( isDir == true && actionInfo.hasAttribute(AttrClientFolders) == false) { else if ( isDir == true && actionInfo.hasAttribute(AttrClientFolders) == false) {
AfxMessageBox(L"Action does not support local folders", MB_OK | MB_ICONSTOP); AfxMessageBox(L"Action does not support local folders", MB_OK | MB_ICONSTOP);
DBGOUT_TS << "Error, action does not support local folders" << endl;
return false; return false;
} }
@@ -260,10 +312,12 @@ bool CAlfrescoApp::buildDesktopParameters( AlfrescoInterface& alfresco, StringLi
if ( fInfo->getLockType() != LockNone) { if ( fInfo->getLockType() != LockNone) {
AfxMessageBox( L"Cannot copy file to Alfresco folder, destination file is locked", MB_OK | MB_ICONEXCLAMATION); AfxMessageBox( L"Cannot copy file to Alfresco folder, destination file is locked", MB_OK | MB_ICONEXCLAMATION);
DBGOUT_TS << "Error, cannot copy to Alfresco folder, destination file is locked" << endl;
return false; return false;
} }
else if ( actionInfo.hasPreProcessAction(PreLocalToWorkingCopy) == true && fInfo->isWorkingCopy() == false) { else if ( actionInfo.hasPreProcessAction(PreLocalToWorkingCopy) == true && fInfo->isWorkingCopy() == false) {
AfxMessageBox( L"Cannot copy to Alfresco folder, destination must overwrite a working copy", MB_OK | MB_ICONEXCLAMATION); AfxMessageBox( L"Cannot copy to Alfresco folder, destination must overwrite a working copy", MB_OK | MB_ICONEXCLAMATION);
DBGOUT_TS << "Error, cannot copy to Alfresco folder, destination must overwrite a working copy" << endl;
return false; return false;
} }
} }
@@ -274,6 +328,7 @@ bool CAlfrescoApp::buildDesktopParameters( AlfrescoInterface& alfresco, StringLi
CString msg; CString msg;
msg.FormatMessage( L"No matching working copy for %1", curName.data()); msg.FormatMessage( L"No matching working copy for %1", curName.data());
AfxMessageBox( msg, MB_OK | MB_ICONEXCLAMATION); AfxMessageBox( msg, MB_OK | MB_ICONEXCLAMATION);
DBGOUT_TS << "Error, no matching working copy for " << curName << endl;
return false; return false;
} }
@@ -293,6 +348,7 @@ bool CAlfrescoApp::buildDesktopParameters( AlfrescoInterface& alfresco, StringLi
msg.FormatMessage( isDir ? L"Failed to copy folder %1" : L"Failed to copy file %1", curFile.data()); msg.FormatMessage( isDir ? L"Failed to copy folder %1" : L"Failed to copy file %1", curFile.data());
AfxMessageBox( msg, MB_OK | MB_ICONSTOP); AfxMessageBox( msg, MB_OK | MB_ICONSTOP);
DBGOUT_TS << "Error, copy failed for " << curName << endl;
return false; return false;
} }
else { else {
@@ -302,10 +358,15 @@ bool CAlfrescoApp::buildDesktopParameters( AlfrescoInterface& alfresco, StringLi
CString msg; CString msg;
msg.FormatMessage( L"Copy aborted for %1", curFile.data()); msg.FormatMessage( L"Copy aborted for %1", curFile.data());
AfxMessageBox( msg, MB_OK | MB_ICONSTOP); AfxMessageBox( msg, MB_OK | MB_ICONSTOP);
DBGOUT_TS << "Error, copy aborted by user, " << curName << endl;
return false; return false;
} }
} }
// DEBUG
DBGOUT_TS << "Added target " << curName << endl;
// Add a desktop target for the copied file // Add a desktop target for the copied file
params.addTarget( new DesktopTarget(isDir ? TargetCopiedFolder : TargetCopiedFile, curName)); params.addTarget( new DesktopTarget(isDir ? TargetCopiedFolder : TargetCopiedFile, curName));
@@ -355,6 +416,7 @@ bool CAlfrescoApp::buildDesktopParameters( AlfrescoInterface& alfresco, StringLi
msg.FormatMessage( isDir ? L"Failed to copy folder %1" : L"Failed to copy file %1", curFile.data()); msg.FormatMessage( isDir ? L"Failed to copy folder %1" : L"Failed to copy file %1", curFile.data());
AfxMessageBox( msg, MB_OK | MB_ICONSTOP); AfxMessageBox( msg, MB_OK | MB_ICONSTOP);
DBGOUT_TS << "Error, copy failed for " << curName << endl;
return false; return false;
} }
else { else {
@@ -364,6 +426,7 @@ bool CAlfrescoApp::buildDesktopParameters( AlfrescoInterface& alfresco, StringLi
CString msg; CString msg;
msg.FormatMessage( L"Copy aborted for %1", curFile.data()); msg.FormatMessage( L"Copy aborted for %1", curFile.data());
AfxMessageBox( msg, MB_OK | MB_ICONSTOP); AfxMessageBox( msg, MB_OK | MB_ICONSTOP);
DBGOUT_TS << "Error, copy aborted for " << curName << endl;
return false; return false;
} }
} }
@@ -381,6 +444,10 @@ bool CAlfrescoApp::buildDesktopParameters( AlfrescoInterface& alfresco, StringLi
} }
} }
// DEBUG
DBGOUT_TS << "Added target " << pTarget->getTarget() << endl;
// Add the desktop target // Add the desktop target
params.addTarget( pTarget); params.addTarget( pTarget);
@@ -403,6 +470,10 @@ bool CAlfrescoApp::buildDesktopParameters( AlfrescoInterface& alfresco, StringLi
*/ */
bool CAlfrescoApp::copyFilesUsingShell(const String& fromFileFolder, const String& toFolder, bool& aborted) { bool CAlfrescoApp::copyFilesUsingShell(const String& fromFileFolder, const String& toFolder, bool& aborted) {
// DEBUG
DBGOUT_TS << "Copy from " << fromFileFolder << " to " << toFolder << endl;
// Build the from/to paths, must be double null terminated // Build the from/to paths, must be double null terminated
wchar_t fromPath[MAX_PATH + 1]; wchar_t fromPath[MAX_PATH + 1];
@@ -469,6 +540,7 @@ bool CAlfrescoApp::runAction( AlfrescoInterface& alfresco, StringList& pathList,
if ( actionInfo.allowsNoParameters() == false && desktopParams.numberOfTargets() == 0) { if ( actionInfo.allowsNoParameters() == false && desktopParams.numberOfTargets() == 0) {
AfxMessageBox( L"No parameters for action", MB_OK | MB_ICONEXCLAMATION); AfxMessageBox( L"No parameters for action", MB_OK | MB_ICONEXCLAMATION);
DBGOUT_TS << "Error, no parameters for action" << endl;
return false; return false;
} }
@@ -484,6 +556,10 @@ bool CAlfrescoApp::runAction( AlfrescoInterface& alfresco, StringList& pathList,
if ( response.getStatus() == StsCommandLine) { if ( response.getStatus() == StsCommandLine) {
// DEBUG
DBGOUT_TS << "Action returned command line, " << response.getStatusMessage() << endl;
// Launch a process using the command line // Launch a process using the command line
sts = doCommandLine( alfresco, response.getStatusMessage()); sts = doCommandLine( alfresco, response.getStatusMessage());
@@ -493,6 +569,10 @@ bool CAlfrescoApp::runAction( AlfrescoInterface& alfresco, StringList& pathList,
else if ( response.getStatus() == StsLaunchURL) { else if ( response.getStatus() == StsLaunchURL) {
// DEBUG
DBGOUT_TS << "Action returned URL, " << response.getStatusMessage() << endl;
// Use the Windows shell to open the URL // Use the Windows shell to open the URL
sts = doURL( alfresco, response.getStatusMessage()); sts = doURL( alfresco, response.getStatusMessage());
@@ -534,6 +614,8 @@ bool CAlfrescoApp::runAction( AlfrescoInterface& alfresco, StringList& pathList,
msg = errMsg.data(); msg = errMsg.data();
AfxMessageBox( msg, MB_OK | MB_ICONERROR); AfxMessageBox( msg, MB_OK | MB_ICONERROR);
DBGOUT_TS << "Action returned error status, " << msg << endl;
} }
} }
else if ( response.hasStatusMessage()) { else if ( response.hasStatusMessage()) {
@@ -543,6 +625,8 @@ bool CAlfrescoApp::runAction( AlfrescoInterface& alfresco, StringList& pathList,
CString msg; CString msg;
msg.FormatMessage( L"Action returned message\n\n%1", response.getStatusMessage().data()); msg.FormatMessage( L"Action returned message\n\n%1", response.getStatusMessage().data());
AfxMessageBox( msg, MB_OK | MB_ICONINFORMATION); AfxMessageBox( msg, MB_OK | MB_ICONINFORMATION);
DBGOUT_TS << "Action returned error message, " << msg << endl;
} }
} }
@@ -684,6 +768,10 @@ bool CAlfrescoApp::doCommandLine( AlfrescoInterface& alfresco, const String& cmd
CString msg; CString msg;
msg.FormatMessage( L"Failed to launch command line\n\n%1\n\nError %2!d!", cmdLine.data(), GetLastError()); msg.FormatMessage( L"Failed to launch command line\n\n%1\n\nError %2!d!", cmdLine.data(), GetLastError());
AfxMessageBox( msg, MB_OK | MB_ICONERROR); AfxMessageBox( msg, MB_OK | MB_ICONERROR);
// DEBUG
DBGOUT_TS << "Error, failed to launch command line, status " << GetLastError() << endl;
} }
else else
sts = true; sts = true;

View File

@@ -0,0 +1,74 @@
/*
* 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 _Debug_H
#define _Debug_H
// Includes
#include "util\String.h"
#include <ostream>
#include <fstream>
// Classes defined in this header file
namespace Alfresco {
class Debug;
// Macro to access to the debug output stream
#define HAS_DEBUG Debug::hasOutputStream() == true
#define DBGOUT if ( Debug::hasOutputStream()) Debug::getOutputStream()
#define TIMESTAMP Debug::timeStamp();
#define DBGOUT_TS TIMESTAMP DBGOUT
}
/**
* Debug Logging Class
*
* Outputs debugging information to a file on the local filesystem.
*/
class Alfresco::Debug {
public:
// Open/close the debug log
static void openLog( const char* logName, bool append = true);
static void closeLog( void);
// Check if the output stream is valid, return the output stream
static bool hasOutputStream( void) { return _debugOut.is_open() ? true : false; }
static std::ofstream& getOutputStream( void) { return _debugOut; }
// Output a timestamp to the debug log
static void timeStamp( void);
private:
// Debug output log file
static std::ofstream _debugOut;
private:
// Hide constructors, static only class
Debug( void) {};
Debug( const Debug& dbg) {};
};
#endif

View File

@@ -0,0 +1,83 @@
/*
* 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.
*/
#include <time.h>
#include "util\Debug.h"
using namespace std;
using namespace Alfresco;
// Global debug output stream
ofstream Debug::_debugOut;
/**
* Open the debug output file
*
* @param logName const char*
* @param append bool
*/
void Debug::openLog(const char *logName, bool append) {
// Check if the log is already open
if ( Debug::hasOutputStream())
Debug::closeLog();
// Open the debug log file
unsigned int openMode = append ? ios::app : ios::out;
_debugOut.open( logName, openMode);
}
/**
* Close the debug output file
*/
void Debug::closeLog( void) {
// Close the debug log
if ( Debug::hasOutputStream()) {
// Close the debug log file
_debugOut.close();
}
}
/**
* Output the current date/time to the debug log
*/
void Debug::timeStamp( void) {
if ( Debug::hasOutputStream()) {
// Get the time in seconds and convert to a structure
char timeBuf[32];
__time32_t timeNow;
struct tm timeTm;
_time32( &timeNow);
_localtime32_s( &timeTm, &timeNow);
sprintf_s( timeBuf, sizeof( timeBuf), "%02d/%02d/%04d %02d:%02d:%02d ",
timeTm.tm_mday, timeTm.tm_mon, timeTm.tm_year + 1900, timeTm.tm_hour, timeTm.tm_min, timeTm.tm_sec);
Debug::getOutputStream() << timeBuf;
}
}

View File

@@ -68,8 +68,10 @@ public class FTPCommand
public final static int XRmd = 39; public final static int XRmd = 39;
public final static int XCup = 40; public final static int XCup = 40;
public final static int XCwd = 41; public final static int XCwd = 41;
public final static int MLst = 42;
public final static int MLsd = 43;
public final static int MaxId = 41; public final static int MaxId = 43;
public final static int InvalidCmd = -1; public final static int InvalidCmd = -1;
@@ -78,7 +80,7 @@ public class FTPCommand
private static final String[] _cmds = { "USER", "PASS", "ACCT", "CWD", "CDUP", "SMNT", "REIN", "QUIT", "PORT", private static final String[] _cmds = { "USER", "PASS", "ACCT", "CWD", "CDUP", "SMNT", "REIN", "QUIT", "PORT",
"PASV", "TYPE", "STRU", "MODE", "RETR", "STOR", "STOU", "APPE", "ALLO", "REST", "RNFR", "RNTO", "ABOR", "PASV", "TYPE", "STRU", "MODE", "RETR", "STOR", "STOU", "APPE", "ALLO", "REST", "RNFR", "RNTO", "ABOR",
"DELE", "RMD", "MKD", "PWD", "LIST", "NLST", "SITE", "SYST", "STAT", "HELP", "NOOP", "MDTM", "SIZE", "DELE", "RMD", "MKD", "PWD", "LIST", "NLST", "SITE", "SYST", "STAT", "HELP", "NOOP", "MDTM", "SIZE",
"OPTS", "FEAT", "XPWD", "XMKD", "XRMD", "XCUP", "XCWD" }; "OPTS", "FEAT", "XPWD", "XMKD", "XRMD", "XCUP", "XCWD", "MLST", "MLSD" };
/** /**
* Convert an FTP command to an id * Convert an FTP command to an id

View File

@@ -16,6 +16,7 @@
*/ */
package org.alfresco.filesys.ftp; package org.alfresco.filesys.ftp;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
/** /**
@@ -37,6 +38,11 @@ public class FTPDate
protected final static String[] _months = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", protected final static String[] _months = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
"Nov", "Dec" }; "Nov", "Dec" };
// Machine listing date/time formatters
protected final static SimpleDateFormat _mlstFormat = new SimpleDateFormat( "yyyyMMddHHmmss");
protected final static SimpleDateFormat _mlstFormatLong = new SimpleDateFormat( "yyyyMMddHHmmss.SSS");
/** /**
* Pack a date string in Unix format The format is 'Mmm dd hh:mm' if the file is less than six * Pack a date string in Unix format The format is 'Mmm dd hh:mm' if the file is less than six
* months old, else the format is 'Mmm dd yyyy'. * months old, else the format is 'Mmm dd yyyy'.
@@ -104,4 +110,26 @@ public class FTPDate
buf.append(min); buf.append(min);
} }
} }
/**
* Return a machine listing date/time, in the format 'YYYYMMDDHHSS'.
*
* @param dateTime long
* @return String
*/
public final static String packMlstDateTime( long dateTime)
{
return _mlstFormat.format( new Date( dateTime));
}
/**
* Return a machine listing date/time, in the format 'YYYYMMDDHHSS.sss'.
*
* @param dateTime long
* @return String
*/
public final static String packMlstDateTimeLong( long dateTime)
{
return _mlstFormatLong.format( new Date( dateTime));
}
} }

View File

@@ -21,6 +21,7 @@ import java.net.InetAddress;
import java.net.ServerSocket; import java.net.ServerSocket;
import java.net.Socket; import java.net.Socket;
import java.net.SocketException; import java.net.SocketException;
import java.nio.charset.Charset;
import java.util.Enumeration; import java.util.Enumeration;
import org.alfresco.filesys.server.ServerListener; import org.alfresco.filesys.server.ServerListener;
@@ -46,8 +47,8 @@ public class FTPNetworkServer extends NetworkFileServer implements Runnable
// Constants // Constants
// //
// Session Thread group // Session Thread group
private static final ThreadGroup THREAD_GROUP_SESSION = new ThreadGroup("FTP_SESSION_GROUP"); private static final ThreadGroup THREAD_GROUP_SESSION = new ThreadGroup("FTP_SESSION_GROUP");
// Listen backlog for the server socket // Listen backlog for the server socket
@@ -86,6 +87,14 @@ public class FTPNetworkServer extends NetworkFileServer implements Runnable
private String m_localFTPaddress; private String m_localFTPaddress;
// SITE command interface
private FTPSiteInterface m_siteInterface;
// Default character encoding to use for file names
private String m_charSet;
/** /**
* Class constructor * Class constructor
* *
@@ -122,6 +131,12 @@ public class FTPNetworkServer extends NetworkFileServer implements Runnable
logger.error(ex); logger.error(ex);
} }
} }
// Set the default character set
m_charSet = config.getFTPCharacterSet();
if ( m_charSet == null)
m_charSet = Charset.defaultCharset().name();
} }
/** /**
@@ -333,6 +348,16 @@ public class FTPNetworkServer extends NetworkFileServer implements Runnable
return m_rootPath; return m_rootPath;
} }
/**
* Get the character set to use for file name encoding/decoding
*
* @return String
*/
public final String getCharacterSet()
{
return m_charSet;
}
/** /**
* Notify the server that a user has logged on. * Notify the server that a user has logged on.
* *
@@ -357,6 +382,8 @@ public class FTPNetworkServer extends NetworkFileServer implements Runnable
if (logger.isDebugEnabled() && hasDebug()) if (logger.isDebugEnabled() && hasDebug())
{ {
logger.debug("FTP Server starting on port " + getPort()); logger.debug("FTP Server starting on port " + getPort());
if ( getCharacterSet() != null)
logger.debug( "Using character set " + getCharacterSet());
} }
// Create a server socket to listen for incoming FTP session requests // Create a server socket to listen for incoming FTP session requests
@@ -582,4 +609,34 @@ public class FTPNetworkServer extends NetworkFileServer implements Runnable
fireServerEvent(ServerListener.ServerStartup); fireServerEvent(ServerListener.ServerStartup);
} }
/**
* Check if the site interface is valid
*
* @return boolean
*/
public final boolean hasSiteInterface()
{
return m_siteInterface != null ? true : false;
}
/**
* Return the site interface
*
* @return FTPSiteInterface
*/
public final FTPSiteInterface getSiteInterface()
{
return m_siteInterface;
}
/**
* Set the site specific commands interface
*
* @param siteInterface FTPSiteInterface
*/
public final void setSiteInterface( FTPSiteInterface siteInterface)
{
m_siteInterface = siteInterface;
}
} }

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2005 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.
*/
package org.alfresco.filesys.ftp;
/**
* FTP SITE Command Interface
*
* <p>Optional interface that is used to provide processing for the FTP SITE command.
*/
public interface FTPSiteInterface {
/**
* Process an FTP SITE specific command
*
* @param sess FTPSrvSession
* @param req FTPRequest
*/
void processFTPSiteCommand( FTPSrvSession sess, FTPRequest req);
}

File diff suppressed because it is too large Load Diff

View File

@@ -23,6 +23,9 @@ import java.net.NetworkInterface;
import java.net.Socket; import java.net.Socket;
import java.net.SocketException; import java.net.SocketException;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
import java.nio.charset.UnsupportedCharsetException;
import java.security.Provider; import java.security.Provider;
import java.security.Security; import java.security.Security;
import java.util.ArrayList; import java.util.ArrayList;
@@ -315,6 +318,10 @@ public class ServerConfiguration extends AbstractLifecycleBean
private int m_ftpDebug; private int m_ftpDebug;
// FTP character set
private String m_ftpCharSet;
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// NFS specific configuration parameters // NFS specific configuration parameters
// //
@@ -1660,6 +1667,29 @@ public class ServerConfiguration extends AbstractLifecycleBean
setFTPDebug(ftpDbg); setFTPDebug(ftpDbg);
} }
// Check if a character set has been specified
elem = config.getConfigElement( "charSet");
if ( elem != null) {
try {
// Validate the character set name
Charset.forName( elem.getValue());
// Set the FTP character set
setFTPCharacterSet( elem.getValue());
}
catch ( IllegalCharsetNameException ex) {
throw new AlfrescoRuntimeException("Illegal character set name, " + elem.getValue());
}
catch ( UnsupportedCharsetException ex) {
throw new AlfrescoRuntimeException("Unsupported character set name, " + elem.getValue());
}
}
} }
/** /**
@@ -3639,6 +3669,16 @@ public class ServerConfiguration extends AbstractLifecycleBean
m_ftpBindAddress = addr; m_ftpBindAddress = addr;
} }
/**
* Return the FTP character set
*
* @return String
*/
public final String getFTPCharacterSet()
{
return m_ftpCharSet;
}
/** /**
* Set the FTP server port to use for incoming connections, -1 indicates disable the FTP server * Set the FTP server port to use for incoming connections, -1 indicates disable the FTP server
* *
@@ -3689,6 +3729,16 @@ public class ServerConfiguration extends AbstractLifecycleBean
m_ftpDebug = dbg; m_ftpDebug = dbg;
} }
/**
* Set the FTP character set
*
* @param charSet String
*/
public final void setFTPCharacterSet( String charSet)
{
m_ftpCharSet = charSet;
}
/** /**
* Check if the NFS server is enabled * Check if the NFS server is enabled
* *

View File

@@ -69,7 +69,7 @@ public class JavaScriptDesktopAction extends DesktopAction {
*/ */
public JavaScriptDesktopAction() public JavaScriptDesktopAction()
{ {
super( DesktopAction.AttrAnyFiles, DesktopAction.PreConfirmAction + DesktopAction.PreCopyToTarget); super( 0, 0);
} }
/** /**
@@ -209,28 +209,29 @@ public class JavaScriptDesktopAction extends DesktopAction {
{ {
// Check if the pre-process string is empty // Check if the pre-process string is empty
if ( elem.getValue().length() == 0)
throw new DesktopActionException("Empty desktop action pre-processing flags");
// Parse the pre-process string
int pre = 0; int pre = 0;
StringTokenizer tokens = new StringTokenizer( elem.getValue(), ",");
while ( tokens.hasMoreTokens()) if ( elem.getValue() != null && elem.getValue().length() > 0)
{ {
// Get the current pre-process token and validate // Parse the pre-process string
String token = tokens.nextToken().trim(); StringTokenizer tokens = new StringTokenizer( elem.getValue(), ",");
if ( token.equalsIgnoreCase( "copyToTarget")) while ( tokens.hasMoreTokens())
pre |= PreCopyToTarget; {
else if ( token.equalsIgnoreCase( "confirm")) // Get the current pre-process token and validate
pre |= PreConfirmAction;
else if ( token.equalsIgnoreCase( "localToWorkingCopy")) String token = tokens.nextToken().trim();
pre |= PreLocalToWorkingCopy;
else if ( token.equalsIgnoreCase( "copyToTarget"))
throw new DesktopActionException("Unknown pre-processing flag, " + token); pre |= PreCopyToTarget;
else if ( token.equalsIgnoreCase( "confirm"))
pre |= PreConfirmAction;
else if ( token.equalsIgnoreCase( "localToWorkingCopy"))
pre |= PreLocalToWorkingCopy;
else
throw new DesktopActionException("Unknown pre-processing flag, " + token);
}
} }
// Set the action pre-processing flags // Set the action pre-processing flags

View File

@@ -645,12 +645,17 @@ public abstract class BaseNodeServiceTest extends BaseSpringTest
// control checks // control checks
assertEquals("n6 not present", 1, countNodesByReference(n6Ref)); assertEquals("n6 not present", 1, countNodesByReference(n6Ref));
assertEquals("n8 not present", 1, countNodesByReference(n8Ref)); assertEquals("n8 not present", 1, countNodesByReference(n8Ref));
assertTrue("n8 exists failure", nodeService.exists(n8Ref));
assertEquals("n6 primary parent association not present on n3", 1, countChildrenOfNode(n3Ref)); assertEquals("n6 primary parent association not present on n3", 1, countChildrenOfNode(n3Ref));
assertEquals("n6 secondary parent association not present on n4", 1, countChildrenOfNode(n4Ref)); assertEquals("n6 secondary parent association not present on n4", 1, countChildrenOfNode(n4Ref));
assertEquals("n8 secondary parent association not present on n7", 1, countChildrenOfNode(n7Ref)); assertEquals("n8 secondary parent association not present on n7", 1, countChildrenOfNode(n7Ref));
// delete n6 // delete n6
nodeService.deleteNode(n6Ref); nodeService.deleteNode(n6Ref);
// ensure that we can't see cascaded nodes in-transaction
assertFalse("n8 not cascade deleted in-transaction", nodeService.exists(n8Ref));
// commit to check // commit to check
setComplete(); setComplete();
endTransaction(); endTransaction();

View File

@@ -48,7 +48,7 @@ public class NodeSearchResultsMap extends BaseSearchResultsMap
if (key != null) if (key != null)
{ {
String ref = key.toString().replace(":", "\\:"); String ref = key.toString().replace(":", "\\:");
ref = ref.replace("/", "\\/"); ref = "ID:" + ref.replace("/", "\\/");
List<TemplateNode> results = query(ref); List<TemplateNode> results = query(ref);

View File

@@ -112,6 +112,7 @@ public class VersionCounterServiceTest extends TestCase
public void testConcurrentVersionNumber() throws Throwable public void testConcurrentVersionNumber() throws Throwable
{ {
counter.currentVersionNumber(storeRef1);
VersionCounterThread[] threads = new VersionCounterThread[threadCount]; VersionCounterThread[] threads = new VersionCounterThread[threadCount];
for (int i = 0; i < threadCount; i++) for (int i = 0; i < threadCount; i++)
{ {