cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r810526 - /cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
Date Wed, 02 Sep 2009 14:35:47 GMT
Author: dkulp
Date: Wed Sep  2 14:35:46 2009
New Revision: 810526

URL: http://svn.apache.org/viewvc?rev=810526&view=rev
Log:
Set eol-style

Modified:
    cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
  (contents, props changed)

Modified: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java?rev=810526&r1=810525&r2=810526&view=diff
==============================================================================
--- cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
(original)
+++ cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
Wed Sep  2 14:35:46 2009
@@ -1,122 +1,122 @@
-/**
- * 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.cxf.maven_plugin;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cxf.helpers.CastUtils;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.project.MavenProject;
-
-/**
- * Manages switching to the classloader needed for creating the java sources and restoring
the old classloader
- * when finished
- */
-public class ClassLoaderSwitcher {
-
-    private Log log;
-    private String origClassPath;
-    private Map<Object, Object> origProps;
-    private ClassLoader origContextClassloader;
-
-    public ClassLoaderSwitcher(Log log) {
-        this.log = log;
-    }
-
-    /**
-     * Create and set the classloader that is needed for creating the java sources from wsdl
-     * 
-     * @param project
-     * @param useCompileClasspath
-     * @param classesDir
-     */
-    public void switchClassLoader(MavenProject project, boolean useCompileClasspath, File
classesDir) {
-        List<URL> urlList = new ArrayList<URL>();
-        StringBuffer buf = new StringBuffer();
-
-        try {
-            urlList.add(classesDir.toURI().toURL());
-            if (!useCompileClasspath) {
-                urlList.add(new File(project.getBuild().getOutputDirectory()).toURI().toURL());
-            }
-        } catch (MalformedURLException e) {
-            // ignore
-        }
-
-        buf.append(classesDir.getAbsolutePath());
-        buf.append(File.pathSeparatorChar);
-        if (!useCompileClasspath) {
-            buf.append(project.getBuild().getOutputDirectory());
-            buf.append(File.pathSeparatorChar);
-        }
-        List<?> artifacts = useCompileClasspath ? project.getCompileArtifacts() : project.getTestArtifacts();
-        for (Artifact a : CastUtils.cast(artifacts, Artifact.class)) {
-            try {
-                if (a.getFile() != null && a.getFile().exists()) {
-                    urlList.add(a.getFile().toURI().toURL());
-                    buf.append(a.getFile().getAbsolutePath());
-                    buf.append(File.pathSeparatorChar);
-                    // System.out.println("     " +
-                    // a.getFile().getAbsolutePath());
-                }
-            } catch (MalformedURLException e) {
-                // ignore
-            }
-        }
-
-        origContextClassloader = Thread.currentThread().getContextClassLoader();
-        URLClassLoader loader = new URLClassLoader(urlList.toArray(new URL[urlList.size()]),
-                                                   origContextClassloader);
-        String newCp = buf.toString();
-
-        log.debug("Classpath: " + urlList.toString());
-
-        origProps = new HashMap<Object, Object>(System.getProperties());
-
-        origClassPath = System.getProperty("java.class.path");
-
-        Thread.currentThread().setContextClassLoader(loader);
-        System.setProperty("java.class.path", newCp);
-    }
-
-    /**
-     * Restore the old classloader
-     */
-    public void restoreClassLoader() {
-        Thread.currentThread().setContextClassLoader(origContextClassloader);
-        System.setProperty("java.class.path", origClassPath);
-
-        Map<Object, Object> newProps = new HashMap<Object, Object>(System.getProperties());
-        for (Object o : newProps.keySet()) {
-            if (!origProps.containsKey(o)) {
-                System.clearProperty(o.toString());
-            }
-        }
-        System.getProperties().putAll(origProps);
-    }
-}
+/**
+ * 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.cxf.maven_plugin;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Manages switching to the classloader needed for creating the java sources and restoring
the old classloader
+ * when finished
+ */
+public class ClassLoaderSwitcher {
+
+    private Log log;
+    private String origClassPath;
+    private Map<Object, Object> origProps;
+    private ClassLoader origContextClassloader;
+
+    public ClassLoaderSwitcher(Log log) {
+        this.log = log;
+    }
+
+    /**
+     * Create and set the classloader that is needed for creating the java sources from wsdl
+     * 
+     * @param project
+     * @param useCompileClasspath
+     * @param classesDir
+     */
+    public void switchClassLoader(MavenProject project, boolean useCompileClasspath, File
classesDir) {
+        List<URL> urlList = new ArrayList<URL>();
+        StringBuffer buf = new StringBuffer();
+
+        try {
+            urlList.add(classesDir.toURI().toURL());
+            if (!useCompileClasspath) {
+                urlList.add(new File(project.getBuild().getOutputDirectory()).toURI().toURL());
+            }
+        } catch (MalformedURLException e) {
+            // ignore
+        }
+
+        buf.append(classesDir.getAbsolutePath());
+        buf.append(File.pathSeparatorChar);
+        if (!useCompileClasspath) {
+            buf.append(project.getBuild().getOutputDirectory());
+            buf.append(File.pathSeparatorChar);
+        }
+        List<?> artifacts = useCompileClasspath ? project.getCompileArtifacts() : project.getTestArtifacts();
+        for (Artifact a : CastUtils.cast(artifacts, Artifact.class)) {
+            try {
+                if (a.getFile() != null && a.getFile().exists()) {
+                    urlList.add(a.getFile().toURI().toURL());
+                    buf.append(a.getFile().getAbsolutePath());
+                    buf.append(File.pathSeparatorChar);
+                    // System.out.println("     " +
+                    // a.getFile().getAbsolutePath());
+                }
+            } catch (MalformedURLException e) {
+                // ignore
+            }
+        }
+
+        origContextClassloader = Thread.currentThread().getContextClassLoader();
+        URLClassLoader loader = new URLClassLoader(urlList.toArray(new URL[urlList.size()]),
+                                                   origContextClassloader);
+        String newCp = buf.toString();
+
+        log.debug("Classpath: " + urlList.toString());
+
+        origProps = new HashMap<Object, Object>(System.getProperties());
+
+        origClassPath = System.getProperty("java.class.path");
+
+        Thread.currentThread().setContextClassLoader(loader);
+        System.setProperty("java.class.path", newCp);
+    }
+
+    /**
+     * Restore the old classloader
+     */
+    public void restoreClassLoader() {
+        Thread.currentThread().setContextClassLoader(origContextClassloader);
+        System.setProperty("java.class.path", origClassPath);
+
+        Map<Object, Object> newProps = new HashMap<Object, Object>(System.getProperties());
+        for (Object o : newProps.keySet()) {
+            if (!origProps.containsKey(o)) {
+                System.clearProperty(o.toString());
+            }
+        }
+        System.getProperties().putAll(origProps);
+    }
+}

Propchange: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message