Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationOpenInputStream.java')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationOpenInputStream.java52
1 files changed, 52 insertions, 0 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationOpenInputStream.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationOpenInputStream.java
new file mode 100644
index 000000000..8452fef87
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.remote.core/src/org/eclipse/tcf/te/tcf/remote/core/operation/TCFOperationOpenInputStream.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Wind River Systems, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Markus Schorn - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tcf.te.tcf.remote.core.operation;
+
+import java.io.InputStream;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.tcf.protocol.IToken;
+import org.eclipse.tcf.services.IFileSystem;
+import org.eclipse.tcf.services.IFileSystem.DoneOpen;
+import org.eclipse.tcf.services.IFileSystem.FileSystemException;
+import org.eclipse.tcf.services.IFileSystem.IFileHandle;
+import org.eclipse.tcf.te.tcf.remote.core.TCFFileStore;
+import org.eclipse.tcf.te.tcf.remote.core.operation.PeerInfo.DoneGetFileSystem;
+import org.eclipse.tcf.util.TCFFileInputStream;
+
+public class TCFOperationOpenInputStream extends TCFFileStoreOperation<InputStream> {
+
+ public TCFOperationOpenInputStream(TCFFileStore filestore) {
+ super(filestore);
+ }
+
+ @Override
+ protected void doExecute() {
+ getFileSystem(new DoneGetFileSystem() {
+ @Override
+ public void done(final IFileSystem fileSystem, IStatus status) {
+ if (shallAbort(status))
+ return;
+
+ fileSystem.open(getPath(), IFileSystem.TCF_O_READ, null, new DoneOpen() {
+ @SuppressWarnings("resource")
+ @Override
+ public void doneOpen(IToken token, FileSystemException error, IFileHandle handle) {
+ if (shallAbort(error))
+ return;
+ setResult(new TCFFileInputStream(handle));
+ }
+ });
+ }
+ });
+ }
+}

Back to the top