1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | package Torello.Java.Build; import Torello.Java.GSUTIL; import Torello.Java.OSResponse; import Torello.Java.Additional.AppendableSafe; import Torello.Java.Additional.BiAppendable; import static Torello.Java.C.*; import java.io.IOException; import java.io.File; /** * This is the last Build-Stage, and it is part of the synchronization of a project with Google * Cloud Platform Stroage Buckets. This class relies heavily on the GCP Shell-Command * {@code 'gsutil'} and it's Java implementation - {@link GSUTIL Torello.Java.GSUTIL}. * * <BR /><BR />This class' synchronization-efforts involve setting a simple Browser * {@code 'CACHE-CONTROL'} configuration for all Java-Documentation Files on the relevant Google * Cloud Server Storage-Bucket. The setting prevents browsers from caching Java-Doc Web-Pages so * that development efforts where classes and their members are changing frequently won't be cached * by the browser (and, therefore, won't impede developer-progress)! * * <EMBED CLASS='external-html' DATA-FILE-ID=S08_SET_MAX_AGE> */ @Torello.JavaDoc.StaticFunctional public class S08_SetMaxAge { // Completely irrelevant, and the 'private' modifier keeps it off of JavaDoc private S08_SetMaxAge() { } public static void set(Builder builder) throws IOException { builder.timers.startStage08(); Printing.startStep(8); StringBuilder logOnly = new StringBuilder(); final AppendableSafe logAndScreen = new AppendableSafe( new BiAppendable(System.out, logOnly), AppendableSafe.USE_APPENDABLE_ERROR ); // Uses Shell-Contructor: // (outputAppendable, commandStrAppendable, standardOutput, errorOutput) // GSUTIL gsutil = new GSUTIL(logOnly, logAndScreen, null, null); builder.cloudSync.initStage08(logOnly, logAndScreen); OSResponse osr = null; if (builder.stage8GCSDirs == null) // osr = gsutil.SMA(builder.cli.GCS_DIR + "**", 120); osr = builder.cloudSync.setMaxAgeAll(); else { logAndScreen.append(BGREEN + "Set Max Age (Browser-Cache):\n\n" + RESET); for (String gcsDir : builder.stage8GCSDirs) logAndScreen.append('\t' + gcsDir + "\n"); logAndScreen.append('\n'); // osr = gsutil.SMA(builder.stage8GCSDirs, 120); osr = builder.cloudSync.setMaxAgeSome(); } Util.HALT_ON_ERROR(osr); builder.logs.write_S08_LOG(logOnly.toString()); builder.cloudSync.endStage08(); builder.timers.endStage08(); } } |