You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/05/23 14:44:06 UTC
svn commit: r659521 - in /geronimo/gshell/trunk:
gshell-assembly/src/main/underlay/etc/
gshell-cli/src/main/java/org/apache/geronimo/gshell/cli/
gshell-core/src/main/java/org/apache/geronimo/gshell/application/
gshell-core/src/main/java/org/apache/gero...
Author: jdillon
Date: Fri May 23 05:44:05 2008
New Revision: 659521
URL: http://svn.apache.org/viewvc?rev=659521&view=rev
Log:
Add settings and application locators to abstract to details of finding the descriptors and building the models
Disable some commands and their layout bits for now
Added:
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationLocator.java (contents, props changed)
- copied, changed from r659511, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationContext.java
geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsLocator.java (with props)
Modified:
geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml
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/application/DefaultApplicationManager.java
Modified: geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml?rev=659521&r1=659520&r2=659521&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml (original)
+++ geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml Fri May 23 05:44:05 2008
@@ -57,6 +57,7 @@
<artifactId>gshell-optional</artifactId>
</dependency>
+ <!--
<dependency>
<artifactId>gshell-bsf</artifactId>
</dependency>
@@ -64,6 +65,7 @@
<dependency>
<artifactId>gshell-vfs</artifactId>
</dependency>
+ -->
</dependencyGroup>
</dependencyGroups>
@@ -154,6 +156,7 @@
</nodes>
</group>
+ <!--
<group>
<name>bsf</name>
<nodes>
@@ -193,6 +196,7 @@
</alias>
</nodes>
</group>
+ -->
</nodes>
</layout>
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=659521&r1=659520&r2=659521&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 Fri May 23 05:44:05 2008
@@ -22,6 +22,8 @@
import org.apache.geronimo.gshell.ExitNotification;
import org.apache.geronimo.gshell.GShell;
import org.apache.geronimo.gshell.GShellBuilder;
+import org.apache.geronimo.gshell.settings.SettingsLocator;
+import org.apache.geronimo.gshell.application.ApplicationLocator;
import org.apache.geronimo.gshell.ansi.ANSI;
import org.apache.geronimo.gshell.branding.Branding;
import org.apache.geronimo.gshell.clp.Argument;
@@ -31,6 +33,7 @@
import org.apache.geronimo.gshell.io.IO;
import org.apache.geronimo.gshell.model.application.Application;
import org.apache.geronimo.gshell.model.application.ApplicationMarshaller;
+import org.apache.geronimo.gshell.model.settings.Settings;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.DefaultContainerConfiguration;
import org.codehaus.plexus.DefaultPlexusContainer;
@@ -249,17 +252,18 @@
GShellBuilder builder = new GShellBuilder();
builder.setClassWorld(classWorld);
builder.setIo(io);
- // builder.setSettings();
- // TODO: Move to ApplicationFinder
- ApplicationMarshaller applicationMarshaller = new ApplicationMarshaller();
- URL applicationUrl = getClass().getClassLoader().getResource("application.xml");
- Application application = applicationMarshaller.unmarshal(applicationUrl);
-
- // FIXME: Need to root the local repo's directory to user.home if its relative for now util ${user.home} expansion is supported
-
+ // Find our settings descriptor
+ SettingsLocator settingsLocator = new SettingsLocator();
+ Settings settings = settingsLocator.locate();
+ builder.setSettings(settings);
+
+ // Find our application descriptor
+ ApplicationLocator applicationLocator = new ApplicationLocator();
+ Application application = applicationLocator.locate();
builder.setApplication(application);
+ // Build the shell instance
GShell gshell = builder.build();
// clp gives us a list, but we need an array
Copied: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationLocator.java (from r659511, geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationContext.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationLocator.java?p2=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationLocator.java&p1=geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationContext.java&r1=659511&r2=659521&rev=659521&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationContext.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationLocator.java Fri May 23 05:44:05 2008
@@ -19,22 +19,35 @@
package org.apache.geronimo.gshell.application;
-import org.apache.geronimo.gshell.io.IO;
import org.apache.geronimo.gshell.model.application.Application;
-import org.apache.geronimo.gshell.shell.Environment;
+import org.apache.geronimo.gshell.model.application.ApplicationMarshaller;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.URL;
/**
- * ???
+ * Locates {@link Application} instances.
*
* @version $Rev$ $Date$
*/
-public interface ApplicationContext
+public class ApplicationLocator
{
- IO getIo();
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ private final ApplicationMarshaller marshaller = new ApplicationMarshaller();
+
+ //
+ // FIXME: Need to make this more robust, allow a file override/hint look in META-INF/gshell, etc.
+ //
+
+ public Application locate() throws Exception {
+ log.debug("Locating");
- Environment getEnvironment();
+ URL url = getClass().getClassLoader().getResource("application.xml");
- Application getApplication();
-
- // getContainer();
+ log.debug("Application descriptor URL: {}", url);
+
+ return marshaller.unmarshal(url);
+ }
}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationLocator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationLocator.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/ApplicationLocator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java?rev=659521&r1=659520&r2=659521&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java (original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/application/DefaultApplicationManager.java Fri May 23 05:44:05 2008
@@ -145,6 +145,7 @@
LocalRepository localRepository = application.getLocalRepository();
if (localRepository != null) {
+ // FIXME: Need to root the local repo's directory to user.home if its relative for now util ${user.home} expansion is supported
artifactManager.setLocalRepository(localRepository.getDirectoryFile());
}
Added: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsLocator.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsLocator.java?rev=659521&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsLocator.java (added)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsLocator.java Fri May 23 05:44:05 2008
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.geronimo.gshell.settings;
+
+import org.apache.geronimo.gshell.model.settings.Settings;
+import org.apache.geronimo.gshell.model.settings.SettingsMarshaller;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Locates {@link Settings} instances.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SettingsLocator
+{
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ private final SettingsMarshaller marshaller = new SettingsMarshaller();
+
+ //
+ // FIXME: Need to make this more robust, allow a file override/hint look in META-INF/gshell, user.home, etc.
+ //
+
+ public Settings locate() throws Exception {
+ log.debug("Locating");
+
+ //
+ // TODO: For now we just ignore user settings, but should try to locate a descriptor and unmarshal
+ //
+
+ return null;
+ }
+}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsLocator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsLocator.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/settings/SettingsLocator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain