You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ev...@apache.org on 2005/09/30 01:59:21 UTC
svn commit: r292584 - in /maven/continuum/trunk:
continuum-api/src/main/java/org/apache/maven/continuum/configuration/
continuum-core/src/main/java/org/apache/maven/continuum/configuration/
continuum-web/src/main/java/org/apache/maven/continuum/web/act...
Author: evenisse
Date: Thu Sep 29 16:59:07 2005
New Revision: 292584
URL: http://svn.apache.org/viewcvs?rev=292584&view=rev
Log:
Add a configuration screen as the first page of web interface until user configure Continuum.
User can setup all parameter that we have in configurationService and create his login/password (admin account)
Added:
maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/action/InitializationChecker.java (with props)
maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/InitializationCheckerValve.java (with props)
maven/continuum/trunk/continuum-web/src/main/resources/templates/layouts/Configure.vm (with props)
maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Configure.vm (with props)
maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ConfigureEnd.vm (with props)
Modified:
maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java
Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java?rev=292584&r1=292583&r2=292584&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java (original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/configuration/ConfigurationService.java Thu Sep 29 16:59:07 2005
@@ -97,6 +97,12 @@
//
// ----------------------------------------------------------------------
+ File getFile( String filename );
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
void load()
throws ConfigurationLoadingException;
Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java?rev=292584&r1=292583&r2=292584&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java (original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/configuration/DefaultConfigurationService.java Thu Sep 29 16:59:07 2005
@@ -228,6 +228,22 @@
}
// ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ public File getFile( String filename )
+ {
+ File f = new File( filename );
+
+ if ( !f.isAbsolute() )
+ {
+ f = new File( applicationHome, filename );
+ }
+
+ return f;
+ }
+
+ // ----------------------------------------------------------------------
// Process configuration to glean application specific values
// ----------------------------------------------------------------------
@@ -289,14 +305,7 @@
throw new ConfigurationLoadingException( "Missing required element '" + elementName + "'." );
}
- File f = new File( value );
-
- if ( !f.isAbsolute() )
- {
- f = new File( applicationHome, value );
- }
-
- return f;
+ return getFile( value );
}
protected void processOutboundConfiguration()
Added: maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/action/InitializationChecker.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/action/InitializationChecker.java?rev=292584&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/action/InitializationChecker.java (added)
+++ maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/action/InitializationChecker.java Thu Sep 29 16:59:07 2005
@@ -0,0 +1,173 @@
+package org.apache.maven.continuum.web.action;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.continuum.model.system.User;
+import org.apache.maven.continuum.configuration.ConfigurationService;
+import org.apache.maven.continuum.store.ContinuumStore;
+import org.codehaus.plexus.summit.rundata.RunData;
+import org.codehaus.plexus.action.AbstractAction;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
+ * @version $Id$
+ */
+public class InitializationChecker
+ extends AbstractAction
+{
+ /**
+ * @plexus.requirement
+ */
+ private ConfigurationService configuration;
+
+ /**
+ * @plexus.requirement
+ */
+ private ContinuumStore store;
+
+ public void execute( Map map )
+ throws Exception
+ {
+ User adminUser = new User();
+
+ String username = getValue( map, "username" );
+
+ if ( !StringUtils.isEmpty( username) )
+ {
+ adminUser.setUsername( username );
+ }
+ else
+ {
+ throw new Exception( "You must set a username." );
+ }
+
+ String password = getValue( map, "password" );
+
+ if ( !StringUtils.isEmpty( password) && password.equals( getValue( map, "password.two" ) ) )
+ {
+ adminUser.setPassword( getValue( map, "password" ) );
+ }
+ else
+ {
+ throw new Exception( "Your password is incorrect." );
+ }
+
+ String fullName = getValue( map, "fullName" );
+
+ if ( !StringUtils.isEmpty( fullName) )
+ {
+ adminUser.setFullName( fullName );
+ }
+ else
+ {
+ throw new Exception( "You must set a full name." );
+ }
+
+ store.addUser( adminUser );
+
+ String email = getValue( map, "email" );
+
+ if ( !StringUtils.isEmpty( email) )
+ {
+ adminUser.setEmail( email );
+ }
+ else
+ {
+ throw new Exception( "You must set an email." );
+ }
+
+ String workingDirectory = getValue( map, "workingDirectory" );
+
+ if ( !StringUtils.isEmpty( workingDirectory) )
+ {
+ configuration.setWorkingDirectory( configuration.getFile( workingDirectory ) );
+ }
+ else
+ {
+ throw new Exception( "You must set a working directory." );
+ }
+
+ String buildOutputDirectory = getValue( map, "buildOutputDirectory" );
+
+ if ( !StringUtils.isEmpty( buildOutputDirectory) )
+ {
+ configuration.setBuildOutputDirectory( configuration.getFile( buildOutputDirectory ) );
+ }
+ else
+ {
+ throw new Exception( "You must set a build output directory." );
+ }
+
+ String baseUrl = getValue( map, "baseUrl" );
+
+ if ( !StringUtils.isEmpty( baseUrl) )
+ {
+ configuration.setUrl( baseUrl );
+ }
+ else
+ {
+ throw new Exception( "You must set a base Url." );
+ }
+
+ String companyName = getValue( map, "companyName" );
+
+ if ( !StringUtils.isEmpty( companyName) )
+ {
+ configuration.setCompanyName( companyName );
+ }
+
+ String companyLogo = getValue( map, "companyLogo" );
+
+ if ( !StringUtils.isEmpty( companyLogo) )
+ {
+ configuration.setCompanyLogo( companyLogo );
+ }
+
+ String companyUrl = getValue( map, "companyUrl" );
+
+ if ( !StringUtils.isEmpty( companyUrl) )
+ {
+ configuration.setCompanyUrl( companyUrl );
+ }
+
+ configuration.setGuestAccountEnabled( getBooleanValue( map, "guestAccountEnabled" ) );
+
+ configuration.setInitialized( true );
+
+ RunData data = (RunData) map.get( "data" );
+
+ data.setTarget( "ConfigureEnd.vm" );
+ }
+
+ private String getValue( Map map, String param )
+ {
+ return (String) map.get( param );
+ }
+
+ private boolean getBooleanValue( Map map, String param )
+ {
+ if ( "on".equals( (String) map.get( param ) ) )
+ {
+ return true;
+ }
+
+ return false;
+ }
+}
Propchange: maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/action/InitializationChecker.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/action/InitializationChecker.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/InitializationCheckerValve.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/InitializationCheckerValve.java?rev=292584&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/InitializationCheckerValve.java (added)
+++ maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/InitializationCheckerValve.java Thu Sep 29 16:59:07 2005
@@ -0,0 +1,50 @@
+package org.apache.maven.continuum.web.pipeline.valve;
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+import org.apache.maven.continuum.configuration.ConfigurationService;
+import org.codehaus.plexus.summit.pipeline.valve.AbstractValve;
+import org.codehaus.plexus.summit.pipeline.valve.ValveInvocationException;
+import org.codehaus.plexus.summit.rundata.RunData;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
+ * @version $Id$
+ */
+public class InitializationCheckerValve
+ extends AbstractValve
+{
+ /**
+ * @plexus.requirement
+ */
+ private ConfigurationService configuration;
+
+ /**
+ * @see org.codehaus.plexus.summit.pipeline.valve.AbstractValve#invoke(org.codehaus.plexus.summit.rundata.RunData, org.codehaus.plexus.summit.pipeline.valve.ValveContext)
+ */
+ public void invoke(RunData data)
+ throws IOException, ValveInvocationException
+ {
+ if ( !configuration.isInitialized() )
+ {
+ data.setTarget( "Configure.vm" );
+ }
+ }
+}
Propchange: maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/InitializationCheckerValve.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-web/src/main/java/org/apache/maven/continuum/web/pipeline/valve/InitializationCheckerValve.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/trunk/continuum-web/src/main/resources/templates/layouts/Configure.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/layouts/Configure.vm?rev=292584&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/layouts/Configure.vm (added)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/layouts/Configure.vm Thu Sep 29 16:59:07 2005
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+ <head>
+ <title>$page.title</title>
+ <link rel="stylesheet" type="text/css" href="$data.getLink("css/tigris.css")" media="screen" />
+ <link rel="stylesheet" type="text/css" href="$data.getLink("css/print.css")" media="print" />
+
+ <script src="$data.getLink("scripts/tigris.js")" type="text/javascript"></script>
+ </head>
+
+ <body onload="focus()" marginwidth="0" marginheight="0" class="composite">
+
+ #parse("navigations/DefaultTop.vm")
+
+ <table id="main" border="0" cellpadding="4" cellspacing="0" width="100%">
+ <tbody>
+ <tr valign="top">
+ <td>
+ <div id="bodycol">
+ $screenViewContent
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ #parse("navigations/DefaultBottom.vm")
+
+ </body>
+</html>
Propchange: maven/continuum/trunk/continuum-web/src/main/resources/templates/layouts/Configure.vm
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-web/src/main/resources/templates/layouts/Configure.vm
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Configure.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Configure.vm?rev=292584&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Configure.vm (added)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Configure.vm Thu Sep 29 16:59:07 2005
@@ -0,0 +1,81 @@
+$page.setTitle( "Configure Continuum" )
+
+<div class="app">
+ <div id="axial" class="h3">
+ <form method="post" action="$link">
+ #hidden ( "action" "initializationChecker" )
+
+ <h3>Admin account</h3>
+ <div class="axial">
+ <table cellspacing="2" cellpadding="3" width="450">
+ <tr>
+ <td>Username :</td>
+ <td><input type="text" name="username" size="50"></td>
+ </tr>
+ <tr>
+ <td>Password :</td>
+ <td><input type="password" name="password" size="50"></td>
+ </tr>
+ <tr>
+ <td>Re-enter Password :</td>
+ <td><input type="password" name="password.two" size="50"></td>
+ </tr>
+ <tr>
+ <td>Full Name :</td>
+ <td><input type="text" name="fullName" size="50"></td>
+ </tr>
+ <tr>
+ <td>Email :</td>
+ <td><input type="text" name="email" size="50"></td>
+ </tr>
+ </table>
+ </div>
+
+ <h3>Directories</h3>
+ <table cellspacing="2" cellpadding="3" width="450">
+ <tr>
+ <td>Working Directory :</td>
+ <td><input type="text" name="workingDirectory" value="working-directory" size="50"></td>
+ </tr>
+ <tr>
+ <td>Build Output Directory :</td>
+ <td><input type="text" name="buildOutputDirectory" value="build-output-directory" size="50"></td>
+ </tr>
+ </table>
+
+ <h3>Base URL</h3>
+ <table cellspacing="2" cellpadding="3" width="450">
+ <tr>
+ <td>Base URL :</td>
+ <td><input type="text" name="baseUrl" value="http://localhost:8080/continuum/servlet/continuum" size="50"></td>
+ </tr>
+ </table>
+
+ <h3>Company Informations</h3>
+ <table cellspacing="2" cellpadding="3" width="450">
+ <tr>
+ <td>Name :</td>
+ <td><input type="text" name="companyName" size="50"></td>
+ </tr>
+ <tr>
+ <td>Logo :</td>
+ <td><input type="text" name="companyLogo" size="50"></td>
+ </tr>
+ <tr>
+ <td>URL :</td>
+ <td><input type="text" name="companyUrl" size="50"></td>
+ </tr>
+ </table>
+
+ <h3>Guest access</h3>
+ <table cellspacing="2" cellpadding="3" width="450">
+ <tr>
+ <td>Allow Guest :</td>
+ <td><input type="checkbox" name="guestAccountEnabled" checked="checked"></td>
+ </tr>
+ </table>
+
+ #submitBar( "Submit" )
+ </form>
+ </div>
+</div>
Propchange: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Configure.vm
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/Configure.vm
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ConfigureEnd.vm
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ConfigureEnd.vm?rev=292584&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ConfigureEnd.vm (added)
+++ maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ConfigureEnd.vm Thu Sep 29 16:59:07 2005
@@ -0,0 +1,7 @@
+$page.setTitle( "Configure Continuum" )
+
+<div class="app">
+ <div id="axial" class="h3">
+ Continuum is configured.
+ </div>
+</div>
Propchange: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ConfigureEnd.vm
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-web/src/main/resources/templates/screens/ConfigureEnd.vm
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"