git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube...
authorVásáry Dániel <daniel.vasary@userrendszerhaz.hu>
Thu, 8 Oct 2020 07:01:45 +0000 (07:01 +0000)
committerVásáry Dániel <daniel.vasary@userrendszerhaz.hu>
Thu, 8 Oct 2020 07:01:45 +0000 (07:01 +0000)
server/user.jobengine.osgi.commons/src/user/commons/remotestore/TSMLister.java
server/user.jobengine.osgi.commons/src/user/commons/remotestore/TSMOutputStream.java
server/user.tsm.client/src/user/tsm/client/TSMBufferedClient.java

index b85e146372ec4f2d2cb23940b6344c18c2acab2d..266ace4430d57e0c72d088958e821bd4d017b091 100644 (file)
@@ -17,12 +17,11 @@ import user.tsm.client.TSMBufferedClient;
 \r
 public class TSMLister implements IDirectoryLister {\r
 \r
-       private static final String DELIMITER = "/";\r
+       private static final String DELIMITER = System.getProperty("tsm.delimiter", "/");\r
        private static final String NODENAME = System.getProperty("tsm.nodename", "JOBENGINE");\r
-       private static final String FSNAME = System.getProperty("tsm.fsname", "JOBENGINE");\r
-       private static final String ALTERNATE_FSNAME = System.getProperty("tsm.fsname.alternate", "JOBENGINE");\r
-       private static final String HLNAME = System.getProperty("tsm.hlname", "JOBENGINE");\r
-       private static final String LLNAMEQUALIFIER = System.getProperty("tsm.llname.qualifier", File.separator);\r
+       private static final String FSNAME = System.getProperty("tsm.fsname", "/JOBENGINE");\r
+       private static final String ALTERNATE_FSNAME = System.getProperty("tsm.fsname.alternate");\r
+       private static final String HLNAME = System.getProperty("tsm.hlname", "/JOBENGINE");\r
        private static final Logger logger = LogManager.getLogger();\r
        private TSMBufferedClient client;\r
 \r
@@ -69,12 +68,12 @@ public class TSMLister implements IDirectoryLister {
 \r
                String currentFileName = fileName;\r
                logger.info("Getting {}, {}, {}", FSNAME, HLNAME, currentFileName);\r
-               TSMBackupFileObject backupFileObject = client.getActiveBackupFileObject(FSNAME, DELIMITER, DELIMITER + currentFileName);\r
+               TSMBackupFileObject backupFileObject = client.getActiveBackupFileObject(FSNAME, HLNAME, DELIMITER + currentFileName);\r
 \r
                //probaljuk meg a masik tarbol\r
                if (backupFileObject == null) {\r
                        logger.info("Getting {}, {}, {}", ALTERNATE_FSNAME, HLNAME, currentFileName);\r
-                       backupFileObject = client.getActiveBackupFileObject(ALTERNATE_FSNAME, DELIMITER, DELIMITER + currentFileName);\r
+                       backupFileObject = client.getActiveBackupFileObject(ALTERNATE_FSNAME, HLNAME, DELIMITER + currentFileName);\r
                }\r
 \r
                //probaljuk meg kiterjesztes nelkul is\r
@@ -121,7 +120,7 @@ public class TSMLister implements IDirectoryLister {
                //              } catch (Exception e) {\r
                //                      logger.info(e.getMessage());\r
                //              }\r
-               TSMOutputStream outputStream = new TSMOutputStream(client, FSNAME, DELIMITER, remoteFile);\r
+               TSMOutputStream outputStream = new TSMOutputStream(client, FSNAME, HLNAME, DELIMITER, remoteFile);\r
                outputStream.open();\r
                return outputStream;\r
        }\r
index 03463dab14590aa6fe6d0206766c941577bcb29c..5a8a2541e774fcedab3382b0019513371325595d 100644 (file)
@@ -1,6 +1,7 @@
 package user.commons.remotestore;\r
 \r
 import java.io.FileNotFoundException;\r
+import java.io.IOException;\r
 import java.io.OutputStream;\r
 \r
 import user.commons.RemoteFile;\r
@@ -18,11 +19,11 @@ public class TSMOutputStream extends OutputStream {
        private long sizeEstimate;\r
 \r
        //highLevelName == delimiter\r
-       public TSMOutputStream(TSMBufferedClient client, String filespaceName, String highLevelName, RemoteFile remoteFile) {\r
+       public TSMOutputStream(TSMBufferedClient client, String filespaceName, String highLevelName, String delimiter, RemoteFile remoteFile) {\r
                this.client = client;\r
                this.filespaceName = filespaceName;\r
                this.highLevelName = highLevelName;\r
-               this.fileName = remoteFile.getName();\r
+               this.fileName = delimiter + remoteFile.getName();\r
                this.sizeEstimate = remoteFile.getSize();\r
        }\r
 \r
@@ -37,12 +38,12 @@ public class TSMOutputStream extends OutputStream {
        }\r
 \r
        public void open() throws TSMException, FileNotFoundException {\r
-               backupObject = new TSMBackupFileObject(filespaceName, highLevelName, highLevelName + fileName);\r
+               backupObject = new TSMBackupFileObject(filespaceName, highLevelName, fileName);\r
                backupObject.setSizeEstimate(sizeEstimate);\r
        }\r
 \r
        @Override\r
-       public void write(byte[] buffer, int off, int byteCount) {\r
+       public void write(byte[] buffer, int off, int byteCount) throws IOException {\r
                if (client != null) {\r
                        if (!initialized) {\r
                                client.setBufferSize(byteCount);\r
@@ -52,6 +53,7 @@ public class TSMOutputStream extends OutputStream {
                                client.send(buffer, backupObject, byteCount);\r
                        } catch (Exception e) {\r
                                e.printStackTrace();\r
+                               throw new IOException(e);\r
                        }\r
                }\r
        }\r
index 88845addcee8b3931e0cda5fa0c90d3cb553775e..bebe36288d21c6a0bdf016be5ca122ceade17daa 100644 (file)
@@ -141,6 +141,7 @@ public class TSMBufferedClient extends TSMClient {
                                throw new TSMException(dsmHandle, rc);\r
                        object.bytesWorked(byteCount);\r
                } catch (Exception e) {\r
+\r
                        vote(TSMAPIConstants.DSM_VOTE_ABORT);\r
                        throw e;\r
                }\r
@@ -157,8 +158,14 @@ public class TSMBufferedClient extends TSMClient {
                } catch (Exception e) {\r
                        logger.catching(e);\r
                }\r
-               if (result != TSMAPIConstants.DSM_RC_OK)\r
-                       throw new TSMException(dsmHandle, rc, endTxnExOut.getReason());\r
+\r
+               if (result == TSMAPIConstants.DSM_RC_CHECK_REASON_CODE) {\r
+                       logger.error("dsmEndTxnEx error, reason code {}", endTxnExOut.getReason());\r
+               } else {\r
+                       if (result != TSMAPIConstants.DSM_RC_OK)\r
+                               throw new TSMException(dsmHandle, rc, endTxnExOut.getReason());\r
+               }\r
+\r
                return result;\r
        }\r
 }\r