Humongous merge. It is incomplete, however; faces-config-navigation.xml and ClientConfigElement

were both beyond me, and are just the raw conflict merge data.  If Kev can't figure out how they should
go together by tomorrow AM (for me) I'll dig back in.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4306 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-11-08 05:17:40 +00:00
parent 2c20af6d2b
commit b2f9df29d1
140 changed files with 20060 additions and 16456 deletions

View File

@@ -18,6 +18,7 @@ package org.alfresco.filesys.smb.server.repo;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.InetAddress;
import java.util.List;
import javax.transaction.UserTransaction;
@@ -58,7 +59,6 @@ import org.alfresco.filesys.util.WildCard;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
import org.alfresco.service.cmr.lock.NodeLockedException;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -66,6 +66,7 @@ import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.security.AccessStatus;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.transaction.TransactionService;
@@ -91,6 +92,10 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
private static final String KEY_ROOT_PATH = "rootPath";
private static final String KEY_RELATIVE_PATH = "relativePath";
// Token name to substitute current servers DNS name or TCP/IP address into the webapp URL
private static final String TokenLocalName = "${localname}";
// Services and helpers
private CifsHelper cifsHelper;
@@ -102,6 +107,7 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
private PermissionService permissionService;
private AuthenticationComponent authComponent;
private AuthenticationService authService;
// Service registry for desktop actions
@@ -127,6 +133,16 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
return this.cifsHelper;
}
/**
* Return the authentication service
*
* @return AuthenticationService
*/
public final AuthenticationService getAuthenticationService()
{
return authService;
}
/**
* Return the transaction service
*
@@ -185,7 +201,7 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
{
return this.serviceRegistry;
}
/**
* @param contentService the content service
*/
@@ -255,6 +271,16 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
{
this.authComponent = authComponent;
}
/**
* Set the authentication service
*
* @param authService AuthenticationService
*/
public void setAuthenticationService(AuthenticationService authService)
{
this.authService = authService;
}
/**
* Parse and validate the parameter string and create a device context object for this instance
@@ -418,7 +444,39 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
if ( pseudoName.getValue().endsWith(".url") == false)
throw new DeviceContextException("URL link file must end with .url, " + pseudoName.getValue());
// Set the URL link file name and web path
// Check if the URL path name contains the local name token
int pos = path.indexOf(TokenLocalName);
if (pos != -1)
{
// Get the local server name
String srvName = "localhost";
try
{
srvName = InetAddress.getLocalHost().getHostName();
}
catch ( Exception ex)
{
}
// Rebuild the host name substituting the token with the local server name
StringBuilder hostStr = new StringBuilder();
hostStr.append( path.substring(0, pos));
hostStr.append(srvName);
pos += TokenLocalName.length();
if (pos < path.length())
hostStr.append( path.substring(pos));
path = hostStr.toString();
}
// Set the URL link file name and web path
context.setURLFileName( pseudoName.getValue());
context.setURLPrefix( path);

View File

@@ -19,6 +19,7 @@ package org.alfresco.filesys.smb.server.repo;
import java.io.FileNotFoundException;
import org.alfresco.filesys.server.SrvSession;
import org.alfresco.filesys.server.auth.ClientInfo;
import org.alfresco.filesys.server.filesys.IOControlNotImplementedException;
import org.alfresco.filesys.server.filesys.NetworkFile;
import org.alfresco.filesys.server.filesys.TreeConnection;
@@ -30,10 +31,12 @@ import org.alfresco.filesys.smb.server.repo.ContentDiskDriver;
import org.alfresco.filesys.smb.server.repo.IOControlHandler;
import org.alfresco.filesys.util.DataBuffer;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationException;
import org.alfresco.service.cmr.lock.LockType;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.service.transaction.TransactionService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -85,6 +88,16 @@ public class ContentIOControlHandler implements IOControlHandler
return contentDriver.getCifsHelper();
}
/**
* Return the authentication service
*
* @return AuthenticationService
*/
public final AuthenticationService getAuthenticationService()
{
return contentDriver.getAuthenticationService();
}
/**
* Return the transaction service
*
@@ -511,6 +524,11 @@ public class ContentIOControlHandler implements IOControlHandler
// Start a transaction
sess.beginTransaction( getTransactionService(), true);
// Get an authentication ticket for the client, or validate the existing ticket. The ticket can be used when
// generating URLs for the client-side application so that the user does not have to re-authenticate
getTicketForClient( sess);
// Get the list of targets for the action
@@ -624,4 +642,65 @@ public class ContentIOControlHandler implements IOControlHandler
return respBuf;
}
/**
* Get, or validate, an authentication ticket for the client
*
* @param sess SrvSession
*/
private final void getTicketForClient(SrvSession sess)
{
// Get the client information and check if there is a ticket allocated
ClientInfo cInfo = sess.getClientInformation();
if ( cInfo == null)
return;
boolean needTicket = true;
if ( cInfo.hasAuthenticationTicket())
{
// Validate the existing ticket, it may have expired
try
{
// Validate the existing ticket
getAuthenticationService().validate( cInfo.getAuthenticationTicket());
needTicket = false;
}
catch ( AuthenticationException ex)
{
// Invalidate the current ticket
try
{
getAuthenticationService().invalidateTicket( cInfo.getAuthenticationTicket());
cInfo.setAuthenticationTicket( null);
}
catch (Exception ex2)
{
// DEBUG
if ( logger.isDebugEnabled())
logger.debug("Error during invalidate ticket", ex2);
}
// DEBUG
if ( logger.isDebugEnabled())
logger.debug("Auth ticket expired or invalid");
}
}
// Check if a ticket needs to be allocated
if ( needTicket == true)
{
// Allocate a new ticket and store in the client information for this session
String ticket = getAuthenticationService().getCurrentTicket();
cInfo.setAuthenticationTicket( ticket);
}
}
}

View File

@@ -19,10 +19,12 @@ package org.alfresco.filesys.smb.server.repo;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.net.URL;
import java.net.URLDecoder;
import org.alfresco.config.ConfigElement;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.filesys.server.filesys.DiskSharedDevice;
import org.alfresco.filesys.smb.server.repo.pseudo.LocalPseudoFile;
import org.alfresco.filesys.smb.server.repo.pseudo.PseudoFile;
@@ -88,7 +90,11 @@ public abstract class DesktopAction {
public static final int StsLaunchURL = 7;
public static final int StsCommandLine = 8;
// Action name
// Token name to substitute current servers DNS name or TCP/IP address into the webapp URL
private static final String TokenLocalName = "${localname}";
// Action name
private String m_name;
@@ -109,6 +115,10 @@ public abstract class DesktopAction {
private ContentDiskDriver m_contentDriver;
private ContentContext m_contentContext;
// Webapp URL
private String m_webappURL;
// Debug enable flag
private boolean m_debug;
@@ -254,6 +264,26 @@ public abstract class DesktopAction {
return m_debug;
}
/**
* Check if the webapp URL is set
*
* @return boolean
*/
public final boolean hasWebappURL()
{
return m_webappURL != null ? true : false;
}
/**
* Return the webapp URL
*
* @return String
*/
public final String getWebappURL()
{
return m_webappURL;
}
/**
* Initialize the desktop action
*
@@ -348,7 +378,50 @@ public abstract class DesktopAction {
if ( findConfigElement("noConfirm", global, config) != null && hasPreProcessAction(PreConfirmAction))
setPreProcessActions(getPreProcessActions() - PreConfirmAction);
// Check if the webapp URL has been specified
ConfigElement webURL = findConfigElement("webpath", global, config);
if ( webURL != null)
{
// Check if the path name contains the local name token
String webPath = webURL.getValue();
if ( webPath.endsWith("/") == false)
webPath = webPath + "/";
int pos = webPath.indexOf(TokenLocalName);
if (pos != -1)
{
// Get the local server name
String srvName = "localhost";
try
{
srvName = InetAddress.getLocalHost().getHostName();
}
catch ( Exception ex)
{
}
// Rebuild the host name substituting the token with the local server name
StringBuilder hostStr = new StringBuilder();
hostStr.append(webPath.substring(0, pos));
hostStr.append(srvName);
pos += TokenLocalName.length();
if (pos < webPath.length())
hostStr.append(webPath.substring(pos));
webPath = hostStr.toString();
setWebappURL( webPath);
}
}
// Check if debug output is enabled for the action
ConfigElement debug = findConfigElement("debug", global, config);
@@ -511,6 +584,16 @@ public abstract class DesktopAction {
m_debug = ena;
}
/**
* Set the webapp URL
*
* @param urlStr String
*/
public final void setWebappURL(String urlStr)
{
m_webappURL = urlStr;
}
/**
* Equality check
*

View File

@@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.List;
import org.alfresco.filesys.server.SrvSession;
import org.alfresco.filesys.server.auth.ClientInfo;
import org.alfresco.filesys.server.filesys.NetworkFile;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -88,6 +89,19 @@ public class DesktopParams {
{
return m_session;
}
/**
* Return the authentication ticket for the user/session
*
* @return String
*/
public final String getTicket()
{
ClientInfo cInfo = m_session.getClientInformation();
if ( cInfo != null)
return cInfo.getAuthenticationTicket();
return null;
}
/**
* Return the working directory node

View File

@@ -284,6 +284,11 @@ public class JavaScriptDesktopAction extends DesktopAction {
model.put("deskParams", params);
model.put("out", System.out);
// Add the webapp URL, if valid
if ( hasWebappURL())
model.put("webURL", getWebappURL());
// Start a transaction
params.getSession().beginTransaction(getTransactionService(), false);

View File

@@ -16,6 +16,9 @@
*/
package org.alfresco.filesys.smb.server.repo.desk;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.alfresco.filesys.smb.server.repo.DesktopAction;
import org.alfresco.filesys.smb.server.repo.DesktopParams;
import org.alfresco.filesys.smb.server.repo.DesktopResponse;
@@ -45,8 +48,29 @@ public class URLDesktopAction extends DesktopAction {
@Override
public DesktopResponse runAction(DesktopParams params) {
// Return a URL in the status message
// Get the local IP address
return new DesktopResponse(StsLaunchURL, "http://www.alfresco.com");
String ipAddr = null;
try
{
ipAddr = InetAddress.getLocalHost().getHostAddress();
}
catch (UnknownHostException ex)
{
}
// Return a URL in the status message to browse to the folder node
StringBuilder urlStr = new StringBuilder();
urlStr.append( "http://");
urlStr.append(ipAddr);
urlStr.append(":8080/alfresco/navigate/browse/workspace/SpacesStore/");
urlStr.append( params.getFolderNode().getId());
urlStr.append("?ticket=");
urlStr.append(params.getTicket());
return new DesktopResponse(StsLaunchURL, urlStr.toString());
}
}

View File

@@ -19,7 +19,6 @@ package org.alfresco.filesys.smb.server.repo.pseudo;
import java.io.IOException;
import org.alfresco.filesys.server.filesys.AccessDeniedException;
import org.alfresco.filesys.server.filesys.FileInfo;
import org.alfresco.filesys.server.filesys.NetworkFile;
import org.alfresco.filesys.smb.SeekType;
@@ -222,9 +221,7 @@ public class MemoryNetworkFile extends NetworkFile
*/
public void truncateFile(long siz) throws IOException
{
// Do not allow the file to be written to
throw new AccessDeniedException("Cannot truncate pseudo file");
// Allow the truncate, do not alter the pseduo file data
}
/**
@@ -236,9 +233,7 @@ public class MemoryNetworkFile extends NetworkFile
*/
public void writeFile(byte[] buf, int len, int pos) throws java.io.IOException
{
// Do not allow the file to be written to
throw new AccessDeniedException("Cannot write to pseudo file");
// Allow the write, just do not do anything
}
/**
@@ -252,8 +247,6 @@ public class MemoryNetworkFile extends NetworkFile
*/
public void writeFile(byte[] buf, int len, int pos, long offset) throws java.io.IOException
{
// Do not allow the file to be written to
throw new AccessDeniedException("Cannot write to pseudo file");
// Allow the write, just do not do anything
}
}

View File

@@ -21,7 +21,6 @@ import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import org.alfresco.filesys.server.filesys.AccessDeniedException;
import org.alfresco.filesys.server.filesys.NetworkFile;
import org.alfresco.filesys.smb.SeekType;
@@ -272,9 +271,7 @@ public class PseudoNetworkFile extends NetworkFile
*/
public void truncateFile(long siz) throws IOException
{
// Do not allow the file to be written to
throw new AccessDeniedException("Cannot truncate pseudo file");
// Allow the truncate, just do not do anything
}
/**
@@ -286,9 +283,7 @@ public class PseudoNetworkFile extends NetworkFile
*/
public void writeFile(byte[] buf, int len, int pos) throws java.io.IOException
{
// Do not allow the file to be written to
throw new AccessDeniedException("Cannot write to pseudo file");
// Allow the write, just do not do anything
}
/**
@@ -302,8 +297,6 @@ public class PseudoNetworkFile extends NetworkFile
*/
public void writeFile(byte[] buf, int len, int pos, long offset) throws java.io.IOException
{
// Do not allow the file to be written to
throw new AccessDeniedException("Cannot write to pseudo file");
// Allow the write, just do not do anything
}
}