1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

[227406][api][dstore] need apis for getting buffer size in IDataStoreProvider

This commit is contained in:
David McKnight 2008-04-23 19:35:57 +00:00
parent 5dc02c645f
commit f597062442
6 changed files with 51 additions and 50 deletions

View file

@ -20,21 +20,4 @@ package org.eclipse.dstore.core.model;
public interface IDataStoreProvider
{
public DataStore getDataStore();
/**
* Returns the upload buffer size preference. To be used by Dstore
* services to determine buffer size when uploading.
*
* @since 3.0
*/
public int getBufferUploadSize();
/**
* Returns the download buffer size preference. To be used by
* Dstore services to determine buffer size when downloading.
*
* @since 3.0
*/
public int getBufferDownloadSize();
}

View file

@ -12,8 +12,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.dstore.core;bundle-version="[3.0.0,4.0.0)",
org.eclipse.dstore.extra;bundle-version="[2.1.0,3.0.0)",
org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)",
org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)",
org.eclipse.rse.subsystems.files.core;bundle-version="3.0.0"
org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)"
Bundle-ActivationPolicy: lazy
Eclipse-LazyStart: true
Export-Package:

View file

@ -82,7 +82,6 @@ import org.eclipse.rse.internal.connectorservice.dstore.Activator;
import org.eclipse.rse.internal.connectorservice.dstore.ConnectorServiceResources;
import org.eclipse.rse.internal.connectorservice.dstore.IConnectorServiceMessageIds;
import org.eclipse.rse.internal.connectorservice.dstore.RexecDstoreServer;
import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
import org.eclipse.rse.internal.ui.SystemPropertyResources;
import org.eclipse.rse.services.clientserver.messages.CommonMessages;
import org.eclipse.rse.services.clientserver.messages.ICommonMessageIds;
@ -1461,25 +1460,5 @@ public class DStoreConnectorService extends StandardConnectorService implements
return new SimpleSystemMessage(Activator.PLUGIN_ID, msgId, severity, msg, msgDetails);
}
public int getBufferUploadSize()
{
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
int value = store.getInt(ISystemFilePreferencesConstants.UPLOAD_BUFFER_SIZE) * IUniversalDataStoreConstants.KB_IN_BYTES;
if (value == 0)
value = IUniversalDataStoreConstants.BUFFER_SIZE;
return value;
}
public int getBufferDownloadSize()
{
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
int value = store.getInt(ISystemFilePreferencesConstants.DOWNLOAD_BUFFER_SIZE) * IUniversalDataStoreConstants.KB_IN_BYTES;
if (value == 0)
value = IUniversalDataStoreConstants.BUFFER_SIZE;
return value;
}
}

View file

@ -106,6 +106,10 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
protected org.eclipse.dstore.core.model.DataElement _uploadLogElement = null;
protected Map _fileElementMap;
protected Map _dstoreFileMap;
private int _bufferUploadSize = IUniversalDataStoreConstants.BUFFER_SIZE;
private int _bufferDownloadSize = IUniversalDataStoreConstants.BUFFER_SIZE;
protected ISystemFileTypes _fileTypeRegistry;
private String remoteEncoding;
@ -151,31 +155,29 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
/**
* Set the buffer upload size
* @param size the new size
*
* @deprecated no longer used - instead using the IDataStoreProvider
*/
public void setBufferUploadSize(int size)
{
_bufferUploadSize = size;
}
/**
* Set the buffer download size
* @param size the new size
*
* @deprecated no longer used - instead using the IDataStoreProvider
*/
public void setBufferDownloadSize(int size)
{
_bufferDownloadSize = size;
}
protected int getBufferUploadSize()
{
return _dataStoreProvider.getBufferUploadSize();
return _bufferUploadSize;
}
protected int getBufferDownloadSize()
{
return _dataStoreProvider.getBufferDownloadSize();
return _bufferDownloadSize;
}
protected String getMinerId()
@ -710,7 +712,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
argList.add(bufferSizeElement);
DataElement subject = ds.createObject(universaltemp, de.getType(), remotePath, String.valueOf(mode));
long t1 = System.currentTimeMillis();
//long t1 = System.currentTimeMillis();
DataElement status = ds.command(queryCmd, argList, subject);
if (status == null)
{
@ -743,7 +745,7 @@ long t1 = System.currentTimeMillis();
return false;
}
long t2 = System.currentTimeMillis();
//long t2 = System.currentTimeMillis();
// System.out.println("time="+(t2 - t1)/1000);
// now wait till we have all the bytes local
long localBytes = localFile.length();

View file

@ -350,7 +350,7 @@ public class DStoreHostFile implements IHostFile, IHostFilePermissionsContainer
return 0;
}
protected static String getAttribute(String attributes, int index)
protected static String getAttribute(String attributes, int index)
{
if (attributes != null)
{

View file

@ -21,13 +21,19 @@
package org.eclipse.rse.subsystems.files.dstore;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.rse.connectorservice.dstore.DStoreConnectorService;
import org.eclipse.rse.connectorservice.dstore.DStoreConnectorServiceManager;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.dstore.universal.miners.IUniversalDataStoreConstants;
import org.eclipse.rse.internal.services.dstore.files.DStoreFileService;
import org.eclipse.rse.internal.services.dstore.search.DStoreSearchService;
import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
import org.eclipse.rse.internal.subsystems.files.dstore.DStoreFileAdapter;
import org.eclipse.rse.internal.subsystems.files.dstore.DStoreFileSubSystemSearchResultConfiguration;
import org.eclipse.rse.internal.subsystems.files.dstore.DStoreLanguageUtilityFactory;
@ -43,6 +49,7 @@ import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSyst
import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystemConfiguration;
import org.eclipse.rse.subsystems.files.core.subsystems.IHostFileToRemoteFileAdapter;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
import org.eclipse.rse.ui.RSEUIPlugin;
public class DStoreFileSubSystemConfiguration extends FileServiceSubSystemConfiguration
{
@ -128,10 +135,41 @@ public class DStoreFileSubSystemConfiguration extends FileServiceSubSystemConfig
public IFileService createFileService(IHost host)
{
final IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
DStoreConnectorService connectorService = (DStoreConnectorService)getConnectorService(host);
DStoreFileService service = new DStoreFileService(connectorService, RemoteFileUtility.getSystemFileTransferModeRegistry());
final DStoreFileService service = new DStoreFileService(connectorService, RemoteFileUtility.getSystemFileTransferModeRegistry());
service.setIsUnixStyle(isUnixStyle());
int dvalue = store.getInt(ISystemFilePreferencesConstants.DOWNLOAD_BUFFER_SIZE) * IUniversalDataStoreConstants.KB_IN_BYTES;
if (dvalue == 0)
dvalue = IUniversalDataStoreConstants.BUFFER_SIZE;
service.setBufferDownloadSize(dvalue);
int uvalue = store.getInt(ISystemFilePreferencesConstants.UPLOAD_BUFFER_SIZE) * IUniversalDataStoreConstants.KB_IN_BYTES;
if (uvalue == 0)
uvalue = IUniversalDataStoreConstants.BUFFER_SIZE;
service.setBufferUploadSize(uvalue);
// Listen to preference changes
IPropertyChangeListener preferenceListener = new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event){
String propertyName = event.getProperty();
if (propertyName.equals(ISystemFilePreferencesConstants.DOWNLOAD_BUFFER_SIZE)){
int value = Integer.parseInt((String)event.getNewValue());
service.setBufferDownloadSize(value);
}
else if (propertyName.equals(ISystemFilePreferencesConstants.UPLOAD_BUFFER_SIZE)){
int value = Integer.parseInt((String)event.getNewValue());
service.setBufferDownloadSize(value);
}
}
};
Preferences pstore = RSEUIPlugin.getDefault().getPluginPreferences();
pstore.addPropertyChangeListener(preferenceListener);
return service;
}