Add ability to do jetty:run in eclipse

Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/ff7c964a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/ff7c964a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/ff7c964a

Branch: refs/heads/master
Commit: ff7c964a6621cf56d555120e9740dc87cf37b9eb
Parents: 43e4de4
Author: Darren Shepherd <[email protected]>
Authored: Tue Aug 28 09:16:44 2012 -0700
Committer: Darren Shepherd <[email protected]>
Committed: Tue Aug 28 09:16:44 2012 -0700

----------------------------------------------------------------------
 client/WEB-INF/web.xml                             |    6 -
 client/cloudstack-ui.launch                        |   14 +
 client/pom.xml                                     |  235 +++++++++++++++
 server/src/com/cloud/maint/Version.java            |    8 +
 .../src/com/cloud/server/ManagementServerImpl.java |    2 +-
 .../cloud/upgrade/DatabaseIntegrityChecker.java    |    4 +
 .../com/cloud/upgrade/DatabaseUpgradeChecker.java  |    3 +
 utils/src/com/cloud/utils/script/Script.java       |    6 +
 8 files changed, 271 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ff7c964a/client/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/client/WEB-INF/web.xml b/client/WEB-INF/web.xml
index 7972024..50f2455 100644
--- a/client/WEB-INF/web.xml
+++ b/client/WEB-INF/web.xml
@@ -20,12 +20,6 @@
     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
     version="2.5">
     
-    <resource-ref>
-        <description> DB Connection Pooling</description>
-        <res-ref-name> jdbc/VmopsDB</res-ref-name>
-        <res-type> javax.sql.DataSource</res-type>
-        <res-auth> Container</res-auth>
-    </resource-ref>
     
     <servlet>
         <servlet-name>cloudStartupServlet</servlet-name>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ff7c964a/client/cloudstack-ui.launch
----------------------------------------------------------------------
diff --git a/client/cloudstack-ui.launch b/client/cloudstack-ui.launch
new file mode 100644
index 0000000..153eaa1
--- /dev/null
+++ b/client/cloudstack-ui.launch
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
+<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
+<stringAttribute key="M2_GOALS" value="jetty:run"/>
+<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
+<booleanAttribute key="M2_OFFLINE" value="false"/>
+<stringAttribute key="M2_PROFILES" value=""/>
+<listAttribute key="M2_PROPERTIES"/>
+<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
+<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
+<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
+<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" 
value="/home/darren/src/temp/incubator-cloudstack/client"/>
+</launchConfiguration>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ff7c964a/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
new file mode 100644
index 0000000..c537110
--- /dev/null
+++ b/client/pom.xml
@@ -0,0 +1,235 @@
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>cloud-client-ui</artifactId>
+  <name>Apache CloudStack Client UI</name>
+  <packaging>war</packaging>
+  <parent>
+    <groupId>org.apache.cloudstack</groupId>
+    <artifactId>cloudstack</artifactId>
+    <version>4.0.0-SNAPSHOT</version>
+  </parent>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-server</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-user-authenticator-ldap</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-user-authenticator-md5</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-user-authenticator-plaintext</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-network-nvp</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-network-ovs</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-network-elb</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-hypervisor-xen</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-hypervisor-ovm</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-storage-allocator-random</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-planner-user-dispersing</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-planner-user-concentrated-pod</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-host-allocator-random</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>mysql</groupId>
+      <artifactId>mysql-connector-java</artifactId>
+      <version>5.1.21</version>
+      <scope>runtime</scope>
+    </dependency>
+    <!-- Non-OSS deps -->
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-hypervisor-vmware</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-network-srx</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-hypervisor-kvm</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-netapp</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-network-f5</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-network-netscaler</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+  <build>
+    <defaultGoal>install</defaultGoal>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-war-plugin</artifactId>
+        <version>2.2</version>
+        <configuration>
+          <webXml>./WEB-INF/web.xml</webXml>
+          <warSourceDirectory>./target/generated-webapp</warSourceDirectory>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.mortbay.jetty</groupId>
+        <artifactId>maven-jetty-plugin</artifactId>
+        <version>6.1.26</version>
+        <configuration>
+          <connectors>
+            <connector 
implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+              <port>8080</port>
+              <maxIdleTime>60000</maxIdleTime>
+            </connector>
+          </connectors>
+          <contextPath>/client</contextPath>
+          <webXml>./WEB-INF/web.xml</webXml>
+          
<webAppSourceDirectory>./target/generated-webapp</webAppSourceDirectory>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <version>1.7</version>
+        <executions>
+          <execution>
+            <phase>generate-resources</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <target>
+                <copy 
todir="${basedir}/target/generated-webapp/WEB-INF/classes" >
+                  <fileset dir="${basedir}/WEB-INF/classes" >
+                    <include name="resources/**/*" />
+                  </fileset>
+                </copy>
+                <copy 
todir="${basedir}/target/generated-webapp/WEB-INF/classes/scripts" >
+                  <fileset dir="${basedir}/../scripts" />
+                </copy>
+                <copy todir="${basedir}/target/generated-webapp" >
+                  <fileset dir="${basedir}/../ui" />
+                </copy>
+                <copy overwrite="true" 
todir="${basedir}/target/generated-webapp/WEB-INF/classes">
+                  <fileset dir="${basedir}/tomcatconf">
+                    <include name="*.in" />
+                  </fileset>
+                  <globmapper from="*.in" to="*" />
+                  <filterchain>
+                    <filterreader 
classname="org.apache.tools.ant.filters.ReplaceTokens">
+                      <param type="propertiesfile" 
value="${basedir}/../build/replace.properties" />
+                    </filterreader>
+                  </filterchain>
+                </copy>
+              </target>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+    <pluginManagement>
+      <plugins>
+        <!--This plugin's configuration is used to store Eclipse m2e settings 
only. It has no influence on the Maven build itself.-->
+        <plugin>
+          <groupId>org.eclipse.m2e</groupId>
+          <artifactId>lifecycle-mapping</artifactId>
+          <version>1.0.0</version>
+          <configuration>
+            <lifecycleMappingMetadata>
+              <pluginExecutions>
+                <pluginExecution>
+                  <pluginExecutionFilter>
+                    <groupId>
+                      org.apache.maven.plugins
+                    </groupId>
+                    <artifactId>
+                      maven-antrun-plugin
+                    </artifactId>
+                    <versionRange>[1.7,)</versionRange>
+                    <goals>
+                      <goal>run</goal>
+                    </goals>
+                  </pluginExecutionFilter>
+                  <action>
+                    <ignore></ignore>
+                  </action>
+                </pluginExecution>
+              </pluginExecutions>
+            </lifecycleMappingMetadata>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ff7c964a/server/src/com/cloud/maint/Version.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/maint/Version.java 
b/server/src/com/cloud/maint/Version.java
index 184b9a6..7317547 100644
--- a/server/src/com/cloud/maint/Version.java
+++ b/server/src/com/cloud/maint/Version.java
@@ -47,7 +47,15 @@ public class Version {
     }
     
     public static String trimToPatch(String version) {
+       int index = version.indexOf("-");
+       
+       if ( index > 0 )
+               version = version.substring(0, index);
+
         String[] tokens = version.split("[.]");
+
+        if ( tokens.length < 3  )
+               return "0";
         return tokens[0] + "." + tokens[1]+ "." + tokens[2];
     }
     

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ff7c964a/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java 
b/server/src/com/cloud/server/ManagementServerImpl.java
index 3873499..9cd2b48 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -3165,7 +3165,7 @@ public class ManagementServerImpl implements 
ManagementServer {
     public String getVersion() {
         final Class<?> c = ManagementServer.class;
         String fullVersion = c.getPackage().getImplementationVersion();
-        if (fullVersion.length() > 0) {
+        if (fullVersion != null && fullVersion.length() > 0) {
             return fullVersion;
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ff7c964a/server/src/com/cloud/upgrade/DatabaseIntegrityChecker.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/upgrade/DatabaseIntegrityChecker.java 
b/server/src/com/cloud/upgrade/DatabaseIntegrityChecker.java
index 2d0ce5c..24f6aeb 100755
--- a/server/src/com/cloud/upgrade/DatabaseIntegrityChecker.java
+++ b/server/src/com/cloud/upgrade/DatabaseIntegrityChecker.java
@@ -167,6 +167,10 @@ public class DatabaseIntegrityChecker implements 
SystemIntegrityChecker {
                txn.start();
                try {
                    String dbVersion = _dao.getCurrentVersion();
+
+                   if ( dbVersion == null )
+                       return false;
+
                    if (Version.compare(Version.trimToPatch(dbVersion), 
Version.trimToPatch("2.2.8")) != 0) {
                        return true;
                    }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ff7c964a/server/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/upgrade/DatabaseUpgradeChecker.java 
b/server/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
index 4759746..047bb3e 100755
--- a/server/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
+++ b/server/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
@@ -334,6 +334,9 @@ public class DatabaseUpgradeChecker implements 
SystemIntegrityChecker {
                     currentVersion = 
this.getClass().getSuperclass().getPackage().getImplementationVersion();
                 }
 
+                if ( currentVersion == null )
+                       return;
+                
                 s_logger.info("DB version = " + dbVersion + " Code Version = " 
+ currentVersion);
 
                 if (Version.compare(Version.trimToPatch(dbVersion), 
Version.trimToPatch(currentVersion)) > 0) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ff7c964a/utils/src/com/cloud/utils/script/Script.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/script/Script.java 
b/utils/src/com/cloud/utils/script/Script.java
index a9b48b4..0662e61 100755
--- a/utils/src/com/cloud/utils/script/Script.java
+++ b/utils/src/com/cloud/utils/script/Script.java
@@ -343,6 +343,12 @@ public class Script implements Callable<String> {
             return file.getAbsolutePath();
         }
 
+        url = Script.class.getClassLoader().getResource(path);
+        if (url != null) {
+            file = new File(url.getFile());
+            return file.getAbsolutePath();
+        }
+        
         if (path.endsWith(File.separator)) {
             path = path.substring(0, path.lastIndexOf(File.separator));
         }

Reply via email to