geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r661217 - in /geronimo/gshell/trunk: gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/ gshell-core/src/main/java/org/apache/geronimo/gshell/ gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/
Date Thu, 29 May 2008 05:41:40 GMT
Author: jdillon
Date: Wed May 28 22:41:39 2008
New Revision: 661217

URL: http://svn.apache.org/viewvc?rev=661217&view=rev
Log:
Revert the *File() related bits in the branding, just complicates the api
Removed version from Branding, its already in Application

Modified:
    geronimo/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Branding.java

Modified: geronimo/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java?rev=661217&r1=661216&r2=661217&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
(original)
+++ geronimo/gshell/trunk/gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/Main.java
Wed May 28 22:41:39 2008
@@ -30,7 +30,6 @@
 import org.apache.geronimo.gshell.clp.Printer;
 import org.apache.geronimo.gshell.io.IO;
 import org.apache.geronimo.gshell.model.application.Application;
-import org.apache.geronimo.gshell.model.application.Branding;
 import org.apache.geronimo.gshell.model.settings.Settings;
 import org.apache.geronimo.gshell.settings.SettingsLocator;
 import org.codehaus.plexus.classworlds.ClassWorld;
@@ -219,21 +218,19 @@
             builder.setApplication(application);
 
             //
-            // HACK: --help and --version need access to the application's branding information,
so we have to handle these options late
+            // HACK: --help and --version need access to the application's information, so
we have to handle these options late
             //
+            
             if (help|version) {
-                Branding branding = application.getBranding();
-
                 if (help) {
-                    io.out.println(branding.getProgramName() + " [options] <command>
[args]");
+                    io.out.println(application.getBranding().getProgramName() + " [options]
<command> [args]");
                     io.out.println();
 
                     Printer printer = new Printer(clp);
                     printer.printUsage(io.out);
                 }
-
-                if (version) {
-                    io.out.println(branding.getVersion());
+                else if (version) {
+                    io.out.println(application.getVersion());
                 }
 
                 io.out.println();

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java?rev=661217&r1=661216&r2=661217&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShell.java
Wed May 28 22:41:39 2008
@@ -56,7 +56,7 @@
 public class DefaultShell
     implements InteractiveShell, Initializable
 {
-    private Logger log = LoggerFactory.getLogger(getClass());
+    private final Logger log = LoggerFactory.getLogger(getClass());
 
     @Requirement
     private ApplicationManager applicationManager;
@@ -156,7 +156,7 @@
         log.debug("Starting interactive console; args: {}", args);
 
         assert branding != null;
-        loadUserScript(branding.getInteractiveScriptFile());
+        loadUserScript(branding.getInteractiveScriptName());
 
         // Setup 2 final refs to allow our executor to pass stuff back to us
         final AtomicReference<ExitNotification> exitNotifHolder = new AtomicReference<ExitNotification>();
@@ -340,8 +340,8 @@
         assert branding != null;
 
         // Load profile scripts if they exist
-        loadSharedScript(branding.getSharedProfileScriptFile());
-        loadUserScript(branding.getUserProfileScriptFile());
+        loadSharedScript(branding.getProfileScriptName());
+        loadUserScript(branding.getProfileScriptName());
     }
 
     private void loadScript(final File file) throws Exception {
@@ -366,8 +366,10 @@
         }
     }
 
-    private void loadUserScript(final File file) throws Exception {
-        assert file != null;
+    private void loadUserScript(final String fileName) throws Exception {
+        assert fileName != null;
+
+        File file = new File(branding.getUserDirectory(), fileName);
 
         if (file.exists()) {
             log.debug("Loading user-script: {}", file);
@@ -379,8 +381,10 @@
         }
     }
 
-    private void loadSharedScript(final File file) throws Exception {
-        assert file != null;
+    private void loadSharedScript(final String fileName) throws Exception {
+        assert fileName != null;
+
+        File file = new File(branding.getUserDirectory(), fileName);
 
         if (file.exists()) {
             log.debug("Loading shared-script: {}", file);
@@ -391,5 +395,4 @@
             log.debug("Shared script is not present: {}", file);
         }
     }
-
 }
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Branding.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Branding.java?rev=661217&r1=661216&r2=661217&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Branding.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Branding.java
Wed May 28 22:41:39 2008
@@ -35,22 +35,20 @@
 public class Branding
     extends ModelElement
 {
-    //
-    // TODO: Provide some linkage to parent
-    //
-
     private transient Application parent;
 
     private Properties properties;
 
+    //
+    // FIXME: Probably need to move some of these up to the Application descriptor?
+    //
+    
     private String name;
 
     private String displayName;
 
     private String programName;
 
-    private String version;
-
     private String userDirectory;
 
     private String sharedDirectory;
@@ -115,22 +113,6 @@
         this.programName = programName;
     }
 
-    public String getVersion() {
-        if (version == null) {
-            return getParent().getVersion();
-        }
-
-        return version;
-    }
-
-    public void setVersion(final String version) {
-        this.version = version;
-    }
-
-    //
-    // TODO: Add type File accessors, need to rename these, so the accessor can be *File
or *Directory
-    //
-
     public String getUserDirectory() {
         if (userDirectory == null) {
             File userHome = new File(System.getProperty("user.home"));
@@ -166,14 +148,6 @@
         return profileScriptName;
     }
 
-    public File getUserProfileScriptFile() {
-        return new File(getUserDirectory(), getProfileScriptName());
-    }
-
-    public File getSharedProfileScriptFile() {
-        return new File(getSharedDirectory(), getProfileScriptName());
-    }
-
     public void setProfileScriptName(final String profileScriptName) {
         this.profileScriptName = profileScriptName;
     }
@@ -202,10 +176,6 @@
         return interactiveScriptName;
     }
 
-    public File getInteractiveScriptFile() {
-        return new File(getUserDirectory(), getInteractiveScriptName());
-    }
-
     public void setInteractiveScriptName(final String interactiveScriptName) {
         this.interactiveScriptName = interactiveScriptName;
     }



Mime
View raw message