incubator-nmaven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r575139 [1/4] - in /incubator/nmaven/trunk: ./ assemblies/ assemblies/NMaven.Artifact/ assemblies/NMaven.Artifact/src/main/csharp/ assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/ assemblies/NMaven.IDE/src/main/csharp/ assemblies...
Date Thu, 13 Sep 2007 01:54:15 GMT
Author: sisbell
Date: Wed Sep 12 18:54:12 2007
New Revision: 575139

URL: http://svn.apache.org/viewvc?rev=575139&view=rev
Log:
Support for IDE-1 and IDE-3

Added:
    incubator/nmaven/trunk/assemblies/NMaven/
    incubator/nmaven/trunk/assemblies/NMaven.IDE/src/main/csharp/Properties/
    incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/
    incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/pom.xml   (with props)
    incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/src/
    incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/src/main/
    incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/src/main/csharp/
    incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/src/main/csharp/Settings.cs
    incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/src/main/csharp/SettingsUtil.cs
    incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/src/main/xsd/
    incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/src/main/xsd/Settings.xsd   (with props)
    incubator/nmaven/trunk/assemblies/NMaven.VisualStudio.Addin/NMaven.VisualStudio.AddIn.AddIn   (with props)
    incubator/nmaven/trunk/assemblies/NMaven.VisualStudio.Addin/NMaven.VisualStudio.Addin.sln
    incubator/nmaven/trunk/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven.VisualStudio.AddIn.AddIn   (with props)
    incubator/nmaven/trunk/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven.VisualStudio.Addin.csproj
    incubator/nmaven/trunk/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/ConfigureMavenRepositoryForm.Designer.cs
    incubator/nmaven/trunk/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/ConfigureMavenRepositoryForm.cs
    incubator/nmaven/trunk/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/ConfigureMavenRepositoryForm.resx
    incubator/nmaven/trunk/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/Connect.cs.orig
    incubator/nmaven/trunk/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/MainFormTest.cs
    incubator/nmaven/trunk/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/app.config   (with props)
    incubator/nmaven/trunk/assemblies/NMaven.VisualStudio/NMaven.VisualStudio.sln
    incubator/nmaven/trunk/assemblies/NMaven.VisualStudio/src/main/csharp/NMaven.VisualStudio.csproj
    incubator/nmaven/trunk/assemblies/NMaven/NMaven.sln
    incubator/nmaven/trunk/components/dotnet-executable/src/main/java/org/apache/maven/dotnet/executable/compiler/impl/JavaCompiler.java   (with props)
    incubator/nmaven/trunk/components/dotnet-repository/src/main/java/org/apache/maven/dotnet/repository/DotnetArtifactMetadata.java   (with props)
    incubator/nmaven/trunk/plugins/maven-repository-plugin/src/main/java/org/apache/maven/dotnet/plugin/repository/ArtifactManagerMojo.java   (with props)
    incubator/nmaven/trunk/thirdparty/org.apache.ws/
    incubator/nmaven/trunk/thirdparty/org.apache.ws/XmlSchema-1.1.jar   (with props)
    incubator/nmaven/trunk/thirdparty/org.apache.ws/XmlSchema-1.1.pom   (with props)
Modified:
    incubator/nmaven/trunk/assemblies/NMaven.Artifact/pom.xml
    incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven.Artifact.csproj
    incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/Artifact.cs
    incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/ArtifactContext.cs
    incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/ArtifactRepository.cs
    incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/IArtifactContext.cs
    incubator/nmaven/trunk/assemblies/NMaven.IDE/src/main/csharp/NMaven.IDE.csproj
    incubator/nmaven/trunk/assemblies/NMaven.Plugin.MojoGenerator/src/main/csharp/NMaven.Plugin.MojoGenerator.csproj
    incubator/nmaven/trunk/assemblies/NMaven.Plugin.MojoGenerator/src/main/csharp/NMaven/Plugin/MojoGenerator/Generator.cs
    incubator/nmaven/trunk/assemblies/NMaven.Plugin/src/main/csharp/NMaven.Plugin.csproj
    incubator/nmaven/trunk/assemblies/NMaven.Plugin/src/main/csharp/NMaven/Plugin/Injector/Impl/MavenProjectInjector.cs
    incubator/nmaven/trunk/assemblies/NMaven.Service/Embedder/src/main/csharp/NMaven.Service.Embedder.csproj
    incubator/nmaven/trunk/assemblies/NMaven.Solution/IProjectGenerator.cs
    incubator/nmaven/trunk/assemblies/NMaven.Solution/NMaven.Solution.csproj
    incubator/nmaven/trunk/assemblies/NMaven.Solution/ProjectGeneratorImpl.cs
    incubator/nmaven/trunk/assemblies/NMaven.VisualStudio.Addin/pom.xml
    incubator/nmaven/trunk/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/AddArtifactsForm.Designer.cs
    incubator/nmaven/trunk/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/AddArtifactsForm.cs
    incubator/nmaven/trunk/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/AddArtifactsForm.resx
    incubator/nmaven/trunk/assemblies/NMaven.VisualStudio.Addin/src/main/csharp/NMaven/VisualStudio/Addin/Connect.cs
    incubator/nmaven/trunk/assemblies/NMaven.VisualStudio.ProjectWizard/src/main/csharp/ArchetypeProjectWizard.cs
    incubator/nmaven/trunk/assemblies/NMaven.VisualStudio.ProjectWizard/src/main/csharp/WindowsApplication2.suo
    incubator/nmaven/trunk/assemblies/pom.xml
    incubator/nmaven/trunk/components/dotnet-artifact/src/main/java/org/apache/maven/dotnet/artifact/impl/ArtifactInstallerImpl.java
    incubator/nmaven/trunk/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectDao.java
    incubator/nmaven/trunk/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/ProjectFactory.java
    incubator/nmaven/trunk/components/dotnet-dao/project/src/main/java/org/apache/maven/dotnet/dao/impl/ProjectDaoImpl.java
    incubator/nmaven/trunk/components/pom.xml
    incubator/nmaven/trunk/plugins/maven-xsd-plugin/src/main/java/org/apache/maven/dotnet/plugin/xsd/XsdGeneratorMojo.java
    incubator/nmaven/trunk/plugins/netplugins/NMaven.Plugin.Addin/src/main/csharp/NMaven/Plugin/Addin/AutomationExtensibilityMojo.cs
    incubator/nmaven/trunk/plugins/netplugins/NMaven.Plugin.Settings/pom.xml
    incubator/nmaven/trunk/plugins/netplugins/NMaven.Plugin.Solution/src/main/csharp/NMaven/Plugin/Solution/SolutionMojo.cs
    incubator/nmaven/trunk/pom-dotnet.xml
    incubator/nmaven/trunk/pom.xml

Modified: incubator/nmaven/trunk/assemblies/NMaven.Artifact/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/assemblies/NMaven.Artifact/pom.xml?rev=575139&r1=575138&r2=575139&view=diff
==============================================================================
--- incubator/nmaven/trunk/assemblies/NMaven.Artifact/pom.xml (original)
+++ incubator/nmaven/trunk/assemblies/NMaven.Artifact/pom.xml Wed Sep 12 18:54:12 2007
@@ -36,6 +36,12 @@
       <version>0.14-SNAPSHOT</version>
     </dependency>
     <dependency>
+      <groupId>NMaven.Model</groupId>
+      <artifactId>NMaven.Model.Settings</artifactId>
+      <type>library</type>
+      <version>0.14-SNAPSHOT</version>
+    </dependency>
+    <dependency>
       <groupId>NUnit</groupId>
       <artifactId>NUnit.Framework</artifactId>
       <type>library</type>

Modified: incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven.Artifact.csproj
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven.Artifact.csproj?rev=575139&r1=575138&r2=575139&view=diff
==============================================================================
--- incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven.Artifact.csproj (original)
+++ incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven.Artifact.csproj Wed Sep 12 18:54:12 2007
@@ -12,9 +12,14 @@
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="NMaven.Model.Pom" />
+    <Reference Include="NMaven.Model.Settings, Version=0.14.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\..\..\..\.m2\uac\gac_msil\NMaven.Model.Settings\0.14-SNAPSHOT__NMaven.Model\NMaven.Model.Settings.dll</HintPath>
+    </Reference>
     <Reference Include="NUnit.Framework" />
     <Reference Include="System" />
     <Reference Include="System.Data" />
+    <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xml" />
     <Reference Include="System.Xml" />
   </ItemGroup>

Modified: incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/Artifact.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/Artifact.cs?rev=575139&r1=575138&r2=575139&view=diff
==============================================================================
--- incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/Artifact.cs (original)
+++ incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/Artifact.cs Wed Sep 12 18:54:12 2007
@@ -17,6 +17,14 @@
 
         private string extension;
 
+        private String remotePath;
+
+        public String RemotePath
+        {
+            get { return remotePath; }
+            set { this.remotePath = value; }
+        }
+
         public string Extension
         {
             get { return extension; }

Modified: incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/ArtifactContext.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/ArtifactContext.cs?rev=575139&r1=575138&r2=575139&view=diff
==============================================================================
--- incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/ArtifactContext.cs (original)
+++ incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/ArtifactContext.cs Wed Sep 12 18:54:12 2007
@@ -3,7 +3,7 @@
 using System.Collections.Generic;
 using System.Text;
 
-using NMaven.Model;
+using NMaven.Model.Setting;
 
 namespace NMaven.Artifact
 {
@@ -13,11 +13,11 @@
         public ArtifactRepository GetArtifactRepository()
         {
             ArtifactRepository artifactRepository = new ArtifactRepository();
-            artifactRepository.Init(this, new DirectoryInfo(@"C:\Documents and Settings\shane\.m2\repository"));
+            artifactRepository.Init(this, new FileInfo(SettingsUtil.GetLocalRepositoryPath()).Directory);
             return artifactRepository;
         }
 
-        public Artifact GetArtifactFor(NMaven.Model.Model model)
+        public Artifact GetArtifactFor(NMaven.Model.Pom.Model model)
         {
             Artifact artifact = new Artifact();
             artifact.ArtifactId = model.artifactId;

Modified: incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/ArtifactRepository.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/ArtifactRepository.cs?rev=575139&r1=575138&r2=575139&view=diff
==============================================================================
--- incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/ArtifactRepository.cs (original)
+++ incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/ArtifactRepository.cs Wed Sep 12 18:54:12 2007
@@ -9,9 +9,57 @@
 {
     public sealed class ArtifactRepository
     {
-        public List<Artifact> GetArtifactsFor()
+        public Artifact GetArtifactFor(String uri)
         {
-            return (GetArtifactsFromDirectories(localRepository.GetDirectories()));
+            DirectoryInfo uac = new DirectoryInfo(localRepository.FullName + @"\uac\gac_msil\");
+
+            String[] tokens = uri.Split("/".ToCharArray());
+            int size = tokens.Length;
+            if (size < 3)
+            {
+                throw new IOException("Invalid Artifact Path = " + uri);
+            }
+            Artifact artifact = new Artifact();
+            artifact.ArtifactId = tokens[size - 3];
+            StringBuilder buffer = new StringBuilder();
+            for (int i = 0; i < size - 3; i++)
+            {
+                buffer.Append(tokens[i]);
+                if (i != size - 4)
+                {
+                    buffer.Append(".");
+                }
+            }
+            artifact.GroupId = buffer.ToString();
+            artifact.Version = tokens[size - 2];
+            artifact.Extension = tokens[size - 1].Split(".".ToCharArray())[1];
+            artifact.FileInfo = new FileInfo(uac.FullName + artifact.ArtifactId + @"\" +
+                artifact.Version + "__" + artifact.GroupId + @"\" + artifact.ArtifactId + ".dll" );
+            return artifact;
+        }
+
+        public List<Artifact> GetArtifacts()
+        {
+            List<Artifact> artifacts = new List<Artifact>();
+            DirectoryInfo uac = new DirectoryInfo(localRepository.FullName + @"\uac\gac_msil\");
+            int directoryStartPosition = uac.FullName.Length;
+
+            List<FileInfo> fileInfos = GetArtifactsFromDirectory(uac);
+
+            foreach (FileInfo fileInfo in fileInfos)
+            {
+                Artifact artifact = new Artifact();
+                String relativePath = fileInfo.FullName.Substring(directoryStartPosition,
+                    (fileInfo.FullName.Length - directoryStartPosition));
+                String[] tokens = relativePath.Split(new char[1] { '\\' });
+                artifact.ArtifactId = tokens[0];
+                String[] tokens2 = tokens[1].Split(new char[2]{'_', '_'});
+                artifact.Version = tokens2[0];
+                artifact.GroupId = tokens2[2];
+                artifact.FileInfo = fileInfo;
+                artifacts.Add(artifact);
+            }
+            return artifacts;
         }
 
         public void Init(ArtifactContext artifactContext, DirectoryInfo localRepository)
@@ -20,31 +68,19 @@
             this.localRepository = localRepository;
         }
 
-        private List<Artifact> GetArtifactsFromDirectories(DirectoryInfo[] directories)
+        private List<FileInfo> GetArtifactsFromDirectory(DirectoryInfo baseDirectoryInfo)
         {
-            List<Artifact> artifacts = new List<Artifact>();
+            DirectoryInfo[] directories = baseDirectoryInfo.GetDirectories();
+            List<FileInfo> fileInfos = new List<FileInfo>();
             foreach (DirectoryInfo directoryInfo in directories)
             {
-                foreach(FileInfo fileInfo in directoryInfo.GetFiles())
+                foreach (FileInfo fileInfo in directoryInfo.GetFiles())
                 {
-                    if (fileInfo.Name.EndsWith("pom"))
-                    {
-                        XmlReader reader = XmlReader.Create(fileInfo.FullName);
-		                XmlSerializer serializer = new XmlSerializer(typeof(NMaven.Model.Model));
-                        if (serializer.CanDeserialize(reader))
-                        {
-                            Artifact artifact = artifactContext.GetArtifactFor(
-                                (NMaven.Model.Model)serializer.Deserialize(reader));
-                            if (artifact.Extension.Equals("dll"))
-                            {
-                                artifacts.Add(artifact);
-                            }                           
-                        }
-                    }
+                    fileInfos.Add(fileInfo);                 
                 }
-                artifacts.AddRange(GetArtifactsFromDirectories(directoryInfo.GetDirectories()));
+                fileInfos.AddRange(GetArtifactsFromDirectory(directoryInfo));
             }
-            return artifacts;
+            return fileInfos;
         }
 
         private ArtifactContext artifactContext;

Modified: incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/IArtifactContext.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/IArtifactContext.cs?rev=575139&r1=575138&r2=575139&view=diff
==============================================================================
--- incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/IArtifactContext.cs (original)
+++ incubator/nmaven/trunk/assemblies/NMaven.Artifact/src/main/csharp/NMaven/Artifact/IArtifactContext.cs Wed Sep 12 18:54:12 2007
@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
+using NMaven.Model.Pom;
 
 namespace NMaven.Artifact
 {
@@ -8,7 +9,7 @@
     {
         ArtifactRepository GetArtifactRepository();
 
-        Artifact GetArtifactFor(NMaven.Model.Model model);
+        Artifact GetArtifactFor(NMaven.Model.Pom.Model model);
 
         Artifact CreateArtifact(String groupId, String artifactId, String version, String packaging);
 

Modified: incubator/nmaven/trunk/assemblies/NMaven.IDE/src/main/csharp/NMaven.IDE.csproj
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/assemblies/NMaven.IDE/src/main/csharp/NMaven.IDE.csproj?rev=575139&r1=575138&r2=575139&view=diff
==============================================================================
--- incubator/nmaven/trunk/assemblies/NMaven.IDE/src/main/csharp/NMaven.IDE.csproj (original)
+++ incubator/nmaven/trunk/assemblies/NMaven.IDE/src/main/csharp/NMaven.IDE.csproj Wed Sep 12 18:54:12 2007
@@ -1,4 +1,4 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
     <ProjectGuid>{31C18EC5-6876-4306-BF4E-A85A308C502E}</ProjectGuid>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -13,16 +13,6 @@
   <ItemGroup>
     <Reference Include="EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
     <Reference Include="EnvDTE80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
-    <Reference Include="NMaven.Artifact, Version=0.14.0.0, Culture=neutral, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\..\..\..\..\..\.m2\repository\NMaven\Artifact\NMaven.Artifact\0.14\NMaven.Artifact.dll</HintPath>
-    </Reference>
-    <Reference Include="NMaven.Logging">
-      <HintPath>C:\Documents and Settings\shane\.m2\repository\NMaven\Logging\NMaven.Logging\0.14\NMaven.Logging.dll</HintPath>
-    </Reference>
-    <Reference Include="NMaven.Service.Embedder">
-      <HintPath>C:\Documents and Settings\shane\.m2\repository\NMaven\Service\NMaven.Service.Embedder\0.14\NMaven.Service.Embedder.dll</HintPath>
-    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Drawing" />
     <Reference Include="System.Web.Services" />
@@ -42,23 +32,21 @@
       <SubType>Form</SubType>
     </Compile>
     <Compile Include="NMaven\IDE\View\MainForm.Designer.cs" />
-    <Compile Include="Properties\Resources.Designer.cs">
-      <AutoGen>True</AutoGen>
-      <DesignTime>True</DesignTime>
-      <DependentUpon>Resources.resx</DependentUpon>
-    </Compile>
   </ItemGroup>
   <ItemGroup />
   <ItemGroup>
-    <EmbeddedResource Include="NMaven\IDE\Controls\MavenBuildControl.resx">
-      <SubType>Designer</SubType>
-      <DependentUpon>MavenBuildControl.cs</DependentUpon>
-    </EmbeddedResource>
-    <EmbeddedResource Include="Properties\Resources.resx">
-      <SubType>Designer</SubType>
-      <Generator>ResXFileCodeGenerator</Generator>
-      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
-    </EmbeddedResource>
+    <ProjectReference Include="..\..\..\..\NMaven.Artifact\src\main\csharp\NMaven.Artifact.csproj">
+      <Project>{701803D4-90F5-44D7-919D-4844FEB7F936}</Project>
+      <Name>NMaven.Artifact</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\..\NMaven.Logging\src\main\csharp\NMaven.Logging.csproj">
+      <Project>{C511B03B-8AB7-4E61-9F6E-5E6F9F65E8CE}</Project>
+      <Name>NMaven.Logging</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\..\..\NMaven.Service\Embedder\src\main\csharp\NMaven.Service.Embedder.csproj">
+      <Project>{DF06BE45-AF6C-4DA4-8844-EA114F094C5F}</Project>
+      <Name>NMaven.Service.Embedder</Name>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
 </Project>

Added: incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/pom.xml?rev=575139&view=auto
==============================================================================
--- incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/pom.xml (added)
+++ incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/pom.xml Wed Sep 12 18:54:12 2007
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?><!--
+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">
+  <parent>
+    <groupId>NMaven</groupId>
+    <version>0.14-SNAPSHOT</version>
+    <artifactId>NMaven.Assemblies</artifactId>
+    <relativePath>..\..\pom.xml</relativePath>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>NMaven.Model</groupId>
+  <artifactId>NMaven.Model.Settings</artifactId>
+  <packaging>library</packaging>
+  <version>0.14-SNAPSHOT</version>
+  <name>NMaven.Model.Settings</name>
+  <build>
+    <sourceDirectory>src/main/csharp</sourceDirectory>
+    <plugins>
+      <!--
+       <plugin>
+         <groupId>org.apache.maven.dotnet.plugins</groupId>
+         <artifactId>maven-xsd-plugin</artifactId>
+         <executions>
+           <execution>
+             <goals>
+               <goal>xsd</goal>
+             </goals>
+           </execution>
+         </executions>
+         <configuration>
+           <xsdFile>${basedir}/src/main/xsd/Settings.xsd</xsdFile>
+         </configuration>
+       </plugin>
+     -->
+    </plugins>
+  </build>
+</project>
\ No newline at end of file

Propchange: incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/src/main/csharp/Settings.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/src/main/csharp/Settings.cs?rev=575139&view=auto
==============================================================================
--- incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/src/main/csharp/Settings.cs (added)
+++ incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/src/main/csharp/Settings.cs Wed Sep 12 18:54:12 2007
@@ -0,0 +1,886 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:2.0.50727.832
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+// 
+// This source code was auto-generated by xsd, Version=2.0.50727.42.
+// 
+namespace NMaven.Model.Setting {
+    using System.Xml.Serialization;
+    
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="")]
+    [System.Xml.Serialization.XmlRootAttribute("settings", Namespace="", IsNullable=false)]
+    public partial class Settings {
+        
+        private string localRepositoryField;
+        
+        private bool interactiveModeField;
+        
+        private bool usePluginRegistryField;
+        
+        private bool offlineField;
+        
+        private Proxy[] proxiesField;
+        
+        private Server[] serversField;
+        
+        private Mirror[] mirrorsField;
+        
+        private Profile[] profilesField;
+        
+        private string[] activeProfilesField;
+        
+        private string[] pluginGroupsField;
+        
+        public Settings() {
+            this.interactiveModeField = true;
+            this.usePluginRegistryField = false;
+            this.offlineField = false;
+        }
+        
+        /// <remarks/>
+        public string localRepository {
+            get {
+                return this.localRepositoryField;
+            }
+            set {
+                this.localRepositoryField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.ComponentModel.DefaultValueAttribute(true)]
+        public bool interactiveMode {
+            get {
+                return this.interactiveModeField;
+            }
+            set {
+                this.interactiveModeField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.ComponentModel.DefaultValueAttribute(false)]
+        public bool usePluginRegistry {
+            get {
+                return this.usePluginRegistryField;
+            }
+            set {
+                this.usePluginRegistryField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.ComponentModel.DefaultValueAttribute(false)]
+        public bool offline {
+            get {
+                return this.offlineField;
+            }
+            set {
+                this.offlineField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlArrayItemAttribute("proxy", IsNullable=false)]
+        public Proxy[] proxies {
+            get {
+                return this.proxiesField;
+            }
+            set {
+                this.proxiesField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlArrayItemAttribute("server", IsNullable=false)]
+        public Server[] servers {
+            get {
+                return this.serversField;
+            }
+            set {
+                this.serversField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlArrayItemAttribute("mirror", IsNullable=false)]
+        public Mirror[] mirrors {
+            get {
+                return this.mirrorsField;
+            }
+            set {
+                this.mirrorsField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlArrayItemAttribute("profile", IsNullable=false)]
+        public Profile[] profiles {
+            get {
+                return this.profilesField;
+            }
+            set {
+                this.profilesField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlArrayItemAttribute("activeProfile", IsNullable=false)]
+        public string[] activeProfiles {
+            get {
+                return this.activeProfilesField;
+            }
+            set {
+                this.activeProfilesField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlArrayItemAttribute("pluginGroup", IsNullable=false)]
+        public string[] pluginGroups {
+            get {
+                return this.pluginGroupsField;
+            }
+            set {
+                this.pluginGroupsField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="")]
+    public partial class Proxy {
+        
+        private bool activeField;
+        
+        private string protocolField;
+        
+        private string usernameField;
+        
+        private string passwordField;
+        
+        private int portField;
+        
+        private string hostField;
+        
+        private string nonProxyHostsField;
+        
+        private string idField;
+        
+        public Proxy() {
+            this.activeField = false;
+            this.protocolField = "http";
+            this.portField = 8080;
+        }
+        
+        /// <remarks/>
+        [System.ComponentModel.DefaultValueAttribute(false)]
+        public bool active {
+            get {
+                return this.activeField;
+            }
+            set {
+                this.activeField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.ComponentModel.DefaultValueAttribute("http")]
+        public string protocol {
+            get {
+                return this.protocolField;
+            }
+            set {
+                this.protocolField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string username {
+            get {
+                return this.usernameField;
+            }
+            set {
+                this.usernameField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string password {
+            get {
+                return this.passwordField;
+            }
+            set {
+                this.passwordField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.ComponentModel.DefaultValueAttribute(8080)]
+        public int port {
+            get {
+                return this.portField;
+            }
+            set {
+                this.portField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string host {
+            get {
+                return this.hostField;
+            }
+            set {
+                this.hostField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string nonProxyHosts {
+            get {
+                return this.nonProxyHostsField;
+            }
+            set {
+                this.nonProxyHostsField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string id {
+            get {
+                return this.idField;
+            }
+            set {
+                this.idField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="")]
+    public partial class RepositoryPolicy {
+        
+        private bool enabledField;
+        
+        private string updatePolicyField;
+        
+        private string checksumPolicyField;
+        
+        public RepositoryPolicy() {
+            this.enabledField = true;
+        }
+        
+        /// <remarks/>
+        [System.ComponentModel.DefaultValueAttribute(true)]
+        public bool enabled {
+            get {
+                return this.enabledField;
+            }
+            set {
+                this.enabledField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string updatePolicy {
+            get {
+                return this.updatePolicyField;
+            }
+            set {
+                this.updatePolicyField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string checksumPolicy {
+            get {
+                return this.checksumPolicyField;
+            }
+            set {
+                this.checksumPolicyField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="")]
+    public partial class Repository {
+        
+        private RepositoryPolicy releasesField;
+        
+        private RepositoryPolicy snapshotsField;
+        
+        private string idField;
+        
+        private string nameField;
+        
+        private string urlField;
+        
+        private string layoutField;
+        
+        public Repository() {
+            this.layoutField = "default";
+        }
+        
+        /// <remarks/>
+        public RepositoryPolicy releases {
+            get {
+                return this.releasesField;
+            }
+            set {
+                this.releasesField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public RepositoryPolicy snapshots {
+            get {
+                return this.snapshotsField;
+            }
+            set {
+                this.snapshotsField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string id {
+            get {
+                return this.idField;
+            }
+            set {
+                this.idField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string name {
+            get {
+                return this.nameField;
+            }
+            set {
+                this.nameField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string url {
+            get {
+                return this.urlField;
+            }
+            set {
+                this.urlField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.ComponentModel.DefaultValueAttribute("default")]
+        public string layout {
+            get {
+                return this.layoutField;
+            }
+            set {
+                this.layoutField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="")]
+    public partial class ActivationFile {
+        
+        private string missingField;
+        
+        private string existsField;
+        
+        /// <remarks/>
+        public string missing {
+            get {
+                return this.missingField;
+            }
+            set {
+                this.missingField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string exists {
+            get {
+                return this.existsField;
+            }
+            set {
+                this.existsField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="")]
+    public partial class ActivationProperty {
+        
+        private string nameField;
+        
+        private string valueField;
+        
+        /// <remarks/>
+        public string name {
+            get {
+                return this.nameField;
+            }
+            set {
+                this.nameField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string value {
+            get {
+                return this.valueField;
+            }
+            set {
+                this.valueField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="")]
+    public partial class ActivationOS {
+        
+        private string nameField;
+        
+        private string familyField;
+        
+        private string archField;
+        
+        private string versionField;
+        
+        /// <remarks/>
+        public string name {
+            get {
+                return this.nameField;
+            }
+            set {
+                this.nameField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string family {
+            get {
+                return this.familyField;
+            }
+            set {
+                this.familyField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string arch {
+            get {
+                return this.archField;
+            }
+            set {
+                this.archField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string version {
+            get {
+                return this.versionField;
+            }
+            set {
+                this.versionField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="")]
+    public partial class Activation {
+        
+        private bool activeByDefaultField;
+        
+        private string jdkField;
+        
+        private ActivationOS osField;
+        
+        private ActivationProperty propertyField;
+        
+        private ActivationFile fileField;
+        
+        public Activation() {
+            this.activeByDefaultField = false;
+        }
+        
+        /// <remarks/>
+        [System.ComponentModel.DefaultValueAttribute(false)]
+        public bool activeByDefault {
+            get {
+                return this.activeByDefaultField;
+            }
+            set {
+                this.activeByDefaultField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string jdk {
+            get {
+                return this.jdkField;
+            }
+            set {
+                this.jdkField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public ActivationOS os {
+            get {
+                return this.osField;
+            }
+            set {
+                this.osField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public ActivationProperty property {
+            get {
+                return this.propertyField;
+            }
+            set {
+                this.propertyField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public ActivationFile file {
+            get {
+                return this.fileField;
+            }
+            set {
+                this.fileField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="")]
+    public partial class Profile {
+        
+        private Activation activationField;
+        
+        private ProfileProperties propertiesField;
+        
+        private Repository[] repositoriesField;
+        
+        private Repository[] pluginRepositoriesField;
+        
+        private string idField;
+        
+        /// <remarks/>
+        public Activation activation {
+            get {
+                return this.activationField;
+            }
+            set {
+                this.activationField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public ProfileProperties properties {
+            get {
+                return this.propertiesField;
+            }
+            set {
+                this.propertiesField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlArrayItemAttribute("repository", IsNullable=false)]
+        public Repository[] repositories {
+            get {
+                return this.repositoriesField;
+            }
+            set {
+                this.repositoriesField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlArrayItemAttribute("pluginRepository", IsNullable=false)]
+        public Repository[] pluginRepositories {
+            get {
+                return this.pluginRepositoriesField;
+            }
+            set {
+                this.pluginRepositoriesField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string id {
+            get {
+                return this.idField;
+            }
+            set {
+                this.idField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="")]
+    public partial class ProfileProperties {
+        
+        private System.Xml.XmlElement[] anyField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlAnyElementAttribute()]
+        public System.Xml.XmlElement[] Any {
+            get {
+                return this.anyField;
+            }
+            set {
+                this.anyField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="")]
+    public partial class Mirror {
+        
+        private string mirrorOfField;
+        
+        private string nameField;
+        
+        private string urlField;
+        
+        private string idField;
+        
+        /// <remarks/>
+        public string mirrorOf {
+            get {
+                return this.mirrorOfField;
+            }
+            set {
+                this.mirrorOfField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string name {
+            get {
+                return this.nameField;
+            }
+            set {
+                this.nameField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string url {
+            get {
+                return this.urlField;
+            }
+            set {
+                this.urlField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string id {
+            get {
+                return this.idField;
+            }
+            set {
+                this.idField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="")]
+    public partial class Server {
+        
+        private string usernameField;
+        
+        private string passwordField;
+        
+        private string privateKeyField;
+        
+        private string passphraseField;
+        
+        private string filePermissionsField;
+        
+        private string directoryPermissionsField;
+        
+        private ServerConfiguration configurationField;
+        
+        private string idField;
+        
+        /// <remarks/>
+        public string username {
+            get {
+                return this.usernameField;
+            }
+            set {
+                this.usernameField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string password {
+            get {
+                return this.passwordField;
+            }
+            set {
+                this.passwordField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string privateKey {
+            get {
+                return this.privateKeyField;
+            }
+            set {
+                this.privateKeyField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string passphrase {
+            get {
+                return this.passphraseField;
+            }
+            set {
+                this.passphraseField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string filePermissions {
+            get {
+                return this.filePermissionsField;
+            }
+            set {
+                this.filePermissionsField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string directoryPermissions {
+            get {
+                return this.directoryPermissionsField;
+            }
+            set {
+                this.directoryPermissionsField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public ServerConfiguration configuration {
+            get {
+                return this.configurationField;
+            }
+            set {
+                this.configurationField = value;
+            }
+        }
+        
+        /// <remarks/>
+        public string id {
+            get {
+                return this.idField;
+            }
+            set {
+                this.idField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="")]
+    public partial class ServerConfiguration {
+        
+        private System.Xml.XmlElement[] anyField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlAnyElementAttribute()]
+        public System.Xml.XmlElement[] Any {
+            get {
+                return this.anyField;
+            }
+            set {
+                this.anyField = value;
+            }
+        }
+    }
+}
\ No newline at end of file

Added: incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/src/main/csharp/SettingsUtil.cs
URL: http://svn.apache.org/viewvc/incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/src/main/csharp/SettingsUtil.cs?rev=575139&view=auto
==============================================================================
--- incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/src/main/csharp/SettingsUtil.cs (added)
+++ incubator/nmaven/trunk/assemblies/NMaven.Model/Settings/src/main/csharp/SettingsUtil.cs Wed Sep 12 18:54:12 2007
@@ -0,0 +1,215 @@
+#region licence
+/*
+ * 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.
+ */
+#endregion
+
+#region Using
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Xml;
+using System.Xml.Serialization;
+using NMaven.Model;
+#endregion
+
+namespace NMaven.Model.Setting
+{
+    #region SettingsUtil
+
+    public static class SettingsUtil
+    {
+        #region GetDefaultSettingsPath()
+        /// <summary>
+        /// Gets the default settings path.
+        /// </summary>
+        /// <returns>
+        /// The default settings path.
+        /// </returns>
+        public static string GetDefaultSettingsPath()
+        {
+            string m2Dir = Environment.GetEnvironmentVariable("M2_HOME");
+
+            if ((!string.IsNullOrEmpty(m2Dir)) && Directory.Exists(m2Dir))
+            {
+                string confDir = m2Dir + @"\conf";
+
+                if (Directory.Exists(confDir))
+                {
+                    string settingsPath = confDir + @"\settings.xml";
+
+                    if (File.Exists(settingsPath))
+                    {
+                        return settingsPath;
+                    }
+                }
+            }
+
+            return null;
+        } 
+        #endregion
+
+        #region GetUserSettingsPath()
+        /// <summary>
+        /// Gets the user settings path.
+        /// </summary>
+        /// <returns>
+        /// The user settings path.
+        /// </returns>
+        public static string GetUserSettingsPath()
+        {
+            string profileDir = Environment.GetEnvironmentVariable("USERPROFILE");
+
+            if ((!string.IsNullOrEmpty(profileDir)) && Directory.Exists(profileDir))
+            {
+                string m2Dir = profileDir + @"\.m2";
+
+                if (Directory.Exists(m2Dir))
+                {
+                    string settingsPath = m2Dir + @"\settings.xml";
+
+                    if (File.Exists(settingsPath))
+                    {
+                        return settingsPath;
+                    }
+                }
+            }
+
+            return null;
+        }
+        #endregion
+
+        #region GetLocalRepositoryPath()
+        /// <summary>
+        /// Gets the local repository path.
+        /// </summary>
+        /// <returns>
+        /// The local repository path
+        /// </returns>
+        public static string GetLocalRepositoryPath()
+        {
+            string path = null;
+            string userSettingsPath = GetUserSettingsPath();
+
+            if (!string.IsNullOrEmpty(userSettingsPath))
+            {
+                try
+                {
+                    Settings settings = ReadSettings(userSettingsPath);
+
+                    if (settings != null)
+                    {
+                        path = settings.localRepository;
+                    }
+                }
+                catch
+                {
+                }
+
+                if (!string.IsNullOrEmpty(path))
+                {
+                    return path;
+                } 
+            }
+
+            string defaultSettingsPath = GetDefaultSettingsPath();
+
+            if (!string.IsNullOrEmpty(defaultSettingsPath))
+            {
+                try
+                {
+                    Settings settings = ReadSettings(defaultSettingsPath);
+
+                    if (settings != null)
+                    {
+                        path = settings.localRepository;
+                    }
+                }
+                catch
+                {
+                }
+
+                if (!string.IsNullOrEmpty(path))
+                {
+                    return path;
+                } 
+            }
+
+            string profileDir = Environment.GetEnvironmentVariable("USERPROFILE");
+
+            return profileDir + @"\.m2\repository";
+        } 
+        #endregion
+
+        public static Settings ReadSettings(string path)
+        {
+            if (path == null)
+            {
+                throw new ArgumentNullException("path");
+            }
+
+            path = path.Trim();
+
+            if (path.Length == 0)
+            {
+                throw new ArgumentException("Value is empty", "path");
+            }
+
+            return ReadSettings(new FileInfo(path));
+        }
+
+        #region ReadSettings(FileInfo)
+        /// <summary>
+        /// Reads the settings.
+        /// </summary>
+        /// <param name="fileInfo">The file info.</param>
+        /// <returns>
+        /// The settings read from the file
+        /// </returns>
+        public static Settings ReadSettings(FileInfo fileInfo)
+        {
+            if (fileInfo == null)
+            {
+                throw new ArgumentNullException("fileInfo");
+            }
+
+            XmlReader reader = null;
+            try
+            {
+                reader = XmlReader.Create(fileInfo.FullName);
+                XmlSerializer serializer = new XmlSerializer(typeof(Settings));
+
+                return (serializer.CanDeserialize(reader))
+                    ? (Settings)serializer.Deserialize(reader)
+                    : null;
+            }
+            finally
+            {
+                if(reader != null)
+                {
+                    reader.Close();
+                }
+            }
+        }
+        #endregion
+    }
+
+    #endregion
+}
+



Mime
View raw message