Refactor cloud-utils project into Maven default structure

This commit is contained in:
Miguel Ferreira 2015-08-23 16:03:11 +02:00
parent 3d27e9ed12
commit 83fd8f60f3
176 changed files with 26 additions and 102 deletions

View File

@ -18,7 +18,8 @@
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">
<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-utils</artifactId>
<name>Apache CloudStack Utils</name>
@ -96,8 +97,8 @@
<artifactId>ejb-api</artifactId>
</dependency>
<dependency>
<groupId>com.googlecode.java-ipv6</groupId>
<artifactId>java-ipv6</artifactId>
<groupId>com.googlecode.java-ipv6</groupId>
<artifactId>java-ipv6</artifactId>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
@ -115,10 +116,10 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<scope>provided</scope>
<version>${cs.commons-io.version}</version>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<scope>provided</scope>
<version>${cs.commons-io.version}</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
@ -154,9 +155,9 @@
<version>${cs.opensaml.version}</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.3</version>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.3</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
@ -169,6 +170,20 @@
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<outputDirectory>target/classes</outputDirectory>
<testOutputDirectory>target/test-classes</testOutputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -191,15 +206,9 @@
<exclude>com/cloud/utils/testcase/NioTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugin>
</plugins>
<resources>
<resource>
<directory>certs</directory>
</resource>
</resources>
</build>
<profiles>
<profile>
<id>integration</id>
@ -221,5 +230,4 @@
</build>
</profile>
</profiles>
</project>

View File

@ -1,84 +0,0 @@
//
// 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 com.cloud.utils.log;
import java.io.PrintWriter;
import java.util.ArrayList;
import org.apache.log4j.spi.ThrowableRenderer;
/**
* This renderer removes all the Cglib generated methods from the call
*
* Unfortunately, I had to copy out the EnhancedThrowableRenderer from
* the apach libraries because EnhancedThrowableRenderer is a final class.
* simply override doRender. Not sure what the developers are thinking there
* making it final.
*
* <throwableRenderer class="com.cloud.utils.log.CglibThrowableRenderer"/>
* into log4j.xml.
*
*/
public class CglibThrowableRenderer implements ThrowableRenderer {
/**
* Construct new instance.
*/
public CglibThrowableRenderer() {
super();
}
@Override
public String[] doRender(final Throwable th) {
try {
ArrayList<String> lines = new ArrayList<String>();
Throwable throwable = th;
lines.add(throwable.toString());
int start = 0;
do {
StackTraceElement[] elements = throwable.getStackTrace();
for (int i = 0; i < elements.length - start; i++) {
StackTraceElement element = elements[i];
String filename = element.getFileName();
String method = element.getMethodName();
if ((filename != null && filename.equals("<generated>")) || (method != null && method.equals("invokeSuper"))) {
continue;
}
lines.add("\tat " + element.toString());
}
if (start != 0) {
lines.add("\t... " + start + " more");
}
throwable = throwable.getCause();
if (throwable != null) {
lines.add("Caused by: " + throwable.toString());
start = elements.length - 1;
}
} while (throwable != null);
return lines.toArray(new String[lines.size()]);
} catch (Exception ex) {
PrintWriter pw = new PrintWriter(System.err);
ex.printStackTrace(pw);
pw = new PrintWriter(System.out);
ex.printStackTrace(pw);
ex.printStackTrace();
return null;
}
}
}

Some files were not shown because too many files have changed in this diff Show More