You are viewing a plain text version of this content. The canonical link for it is here.
Posted to npanday-commits@incubator.apache.org by lc...@apache.org on 2011/12/05 10:09:33 UTC
svn commit: r1210393 [1/3] - in
/incubator/npanday/branches/1.5.0-azuresupport:
archetypes/maven-archetype-netexecutable/src/main/resources/archetype-resources/src/main/java/
components/ components/dotnet-artifact/src/main/java/npanday/artifact/
compon...
Author: lcorneliussen
Date: Mon Dec 5 10:09:31 2011
New Revision: 1210393
URL: http://svn.apache.org/viewvc?rev=1210393&view=rev
Log:
[NPANDAY-499] Make configuration for compiler-plugins and executable-plugins more flexible
o Refactored repository implementations to reuse code through a common base class
o Refactored how plugins use the repository registry (in progress)
o Introduced dependency to Guava
o Now using Plexus component annotations in /components/
o Refactored RepositoryLoader to use Plexus for instantiation of repositories
o Support multiple sources for repositories in preparation for config-per-module (now dotnet-core holds all configuration for all plugins)
o Refactored SettingsRepository to reload contents on the same instance, instead of providing a new one
Added:
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/impl/AbstractMultisourceRepository.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/resources/META-INF/plexus/components.xml
incubator/npanday/branches/1.5.0-azuresupport/plugins/maven-test-plugin/src/main/resources/
incubator/npanday/branches/1.5.0-azuresupport/plugins/maven-test-plugin/src/main/resources/META-INF/
incubator/npanday/branches/1.5.0-azuresupport/plugins/maven-test-plugin/src/main/resources/META-INF/npanday/
incubator/npanday/branches/1.5.0-azuresupport/plugins/maven-test-plugin/src/main/resources/META-INF/npanday/executable-plugins.xml
- copied, changed from r1207095, incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-core/src/main/resources/META-INF/npanday/executable-plugins.xml
Removed:
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-core/src/main/java/npanday/NPandayRepositoryRegistry.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-core/src/main/java/npanday/impl/NPandayRepositoryRegistryImpl.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-core/src/test/resources/
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/resources/registry.properties
Modified:
incubator/npanday/branches/1.5.0-azuresupport/archetypes/maven-archetype-netexecutable/src/main/resources/archetype-resources/src/main/java/NetExecutableMojo.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-artifact/src/main/java/npanday/artifact/NetDependenciesRepository.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-artifact/src/main/java/npanday/artifact/impl/NetDependenciesRepositoryImpl.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-assembler/src/main/java/npanday/assembler/impl/AssemblyPluginsRepository.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-core/src/main/resources/META-INF/plexus/components.xml
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-dao-project/src/main/java/npanday/dao/impl/ProjectDaoImpl.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/CapabilityMatcherImpl.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerContextImpl.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerPluginsRepository.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/ExecutableContextImpl.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/ExecutablePluginsRepository.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/NetExecutableFactoryImpl.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/RepositoryExecutableContextImpl.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/resources/META-INF/plexus/components.xml
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-plugin/src/main/java/npanday/plugin/impl/ConfigurationAppendersRepository.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/pom.xml
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/ConnectionsRepository.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/DataAccessObject.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/PropertyRepository.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/RegistryLoader.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/Repository.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/RepositoryLoader.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/impl/DataAccessObjectRegistryImpl.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/impl/RepositoryRegistryImpl.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/impl/StandardRegistryLoader.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/impl/StandardRepositoryLoader.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-vendor/src/main/java/npanday/vendor/SettingsUtil.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-vendor/src/main/java/npanday/vendor/impl/SettingsRepository.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-vendor/src/main/java/npanday/vendor/impl/VendorInfoRepositoryImpl.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-vendor/src/main/java/npanday/vendor/impl/VendorInfoTransitionRuleFactory.java
incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-vendor/src/test/java/npanday/vendor/impl/VendorInfoTransitionRuleFactoryTest.java
incubator/npanday/branches/1.5.0-azuresupport/components/pom.xml
incubator/npanday/branches/1.5.0-azuresupport/plugins/maven-aspx-plugin/src/main/java/npanday/plugin/aspx/AspxCompilerMojo.java
incubator/npanday/branches/1.5.0-azuresupport/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AbstractCompilerMojo.java
incubator/npanday/branches/1.5.0-azuresupport/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/AssemblyInfoGeneratorMojo.java
incubator/npanday/branches/1.5.0-azuresupport/plugins/maven-install-plugin/src/main/java/npanday/plugin/install/FileInstallerMojo.java
incubator/npanday/branches/1.5.0-azuresupport/plugins/maven-resgen-plugin/src/main/java/npanday/plugin/resgen/ResourceGeneratorMojo.java
incubator/npanday/branches/1.5.0-azuresupport/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/NetDependencyResolverMojo.java
incubator/npanday/branches/1.5.0-azuresupport/plugins/maven-vsinstaller-plugin/src/main/java/npanday/plugin/vsinstaller/VsInstallerMojo.java
incubator/npanday/branches/1.5.0-azuresupport/plugins/maven-xsd-plugin/src/main/java/npanday/plugin/xsd/XmlToXsdGeneratorMojo.java
incubator/npanday/branches/1.5.0-azuresupport/plugins/maven-xsd-plugin/src/main/java/npanday/plugin/xsd/XsdGeneratorMojo.java
incubator/npanday/branches/1.5.0-azuresupport/plugins/netplugins/NPanday.Plugin.Settings/javabinding/src/main/java/NPanday/Plugin/Settings/SettingsGeneratorMojo.java
Modified: incubator/npanday/branches/1.5.0-azuresupport/archetypes/maven-archetype-netexecutable/src/main/resources/archetype-resources/src/main/java/NetExecutableMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/archetypes/maven-archetype-netexecutable/src/main/resources/archetype-resources/src/main/java/NetExecutableMojo.java?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/archetypes/maven-archetype-netexecutable/src/main/resources/archetype-resources/src/main/java/NetExecutableMojo.java (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/archetypes/maven-archetype-netexecutable/src/main/resources/archetype-resources/src/main/java/NetExecutableMojo.java Mon Dec 5 10:09:31 2011
@@ -54,6 +54,7 @@ import java.util.ArrayList;
* 3) Add any special commands to the getCommands method.
* 4) Recompile the dotnet-core component.
* 5) Rename this class and install this Mojo component.
+ * 6) Rename
*/
public class NetExecutableMojo
extends AbstractMojo
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-artifact/src/main/java/npanday/artifact/NetDependenciesRepository.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-artifact/src/main/java/npanday/artifact/NetDependenciesRepository.java?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-artifact/src/main/java/npanday/artifact/NetDependenciesRepository.java (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-artifact/src/main/java/npanday/artifact/NetDependenciesRepository.java Mon Dec 5 10:09:31 2011
@@ -20,12 +20,9 @@ package npanday.artifact;
import npanday.registry.NPandayRepositoryException;
import npanday.registry.Repository;
-import npanday.registry.RepositoryRegistry;
import org.apache.maven.model.Dependency;
-import java.io.InputStream;
-import java.io.IOException;
-import java.util.Hashtable;
+import java.net.URL;
import java.util.List;
/**
@@ -37,17 +34,12 @@ public interface NetDependenciesReposito
extends Repository
{
/**
- * @see npanday.registry.Repository#load(java.io.InputStream, java.util.Hashtable)
+ * Loads a list of .NET dependencies from a config file or resource.
*/
- void load( InputStream inputStream, Hashtable properties )
+ void load( URL source )
throws NPandayRepositoryException;
/**
- * @see npanday.registry.Repository#setRepositoryRegistry(npanday.registry.RepositoryRegistry)
- */
- void setRepositoryRegistry( RepositoryRegistry repositoryRegistry );
-
- /**
* Returns a list of .NET dependencies as given within the net dependencies config file. This dependency list
* is external to the pom file dependencies. This separation is necessary since some Java Maven plugins
* - which themselves are necessary for building .NET applications - may have .NET executable dependencies that
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-artifact/src/main/java/npanday/artifact/impl/NetDependenciesRepositoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-artifact/src/main/java/npanday/artifact/impl/NetDependenciesRepositoryImpl.java?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-artifact/src/main/java/npanday/artifact/impl/NetDependenciesRepositoryImpl.java (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-artifact/src/main/java/npanday/artifact/impl/NetDependenciesRepositoryImpl.java Mon Dec 5 10:09:31 2011
@@ -18,34 +18,35 @@
*/
package npanday.artifact.impl;
-import npanday.registry.NPandayRepositoryException;
-import npanday.registry.Repository;
-import npanday.registry.RepositoryRegistry;
+import npanday.artifact.NetDependenciesRepository;
+import npanday.artifact.NetDependencyMatchPolicy;
import npanday.model.netdependency.NetDependency;
import npanday.model.netdependency.NetDependencyModel;
import npanday.model.netdependency.io.xpp3.NetDependencyXpp3Reader;
-import npanday.artifact.NetDependenciesRepository;
-import npanday.artifact.NetDependencyMatchPolicy;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import org.apache.maven.model.Dependency;
+import npanday.registry.NPandayRepositoryException;
+import npanday.registry.impl.AbstractMultisourceRepository;
import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.model.Dependency;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import java.util.List;
-import java.util.Hashtable;
-import java.util.ArrayList;
-import java.io.InputStream;
import java.io.IOException;
import java.io.Reader;
-import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
/**
* Provides methods for loading and reading the net dependency config file.
*
* @author Shane Isbell
+ * @author <a href="mailto:lcorneliussen@apache.org">Lars Corneliussen</a>
*/
+@Component(role = NetDependenciesRepositoryImpl.class)
public class NetDependenciesRepositoryImpl
+ extends AbstractMultisourceRepository<NetDependencyModel>
implements NetDependenciesRepository
{
@@ -53,15 +54,13 @@ public class NetDependenciesRepositoryIm
* List of net dependencies. These dependencies are intended to be executed directly from the local Maven repository,
* not to be compiled against.
*/
- private List<NetDependency> netDependencies;
+ private List<NetDependency> netDependencies = new ArrayList<NetDependency>( );
/**
* The artifact factory, used for creating artifacts.
*/
private ArtifactFactory artifactFactory;
- private Hashtable properties;
-
/**
* Constructor. This method is intended to be invoked by the <code>RepositoryRegistry<code>, not by the
@@ -71,64 +70,44 @@ public class NetDependenciesRepositoryIm
{
}
- /**
- * @see Repository#load(java.io.InputStream, java.util.Hashtable)
- */
- public void load( InputStream inputStream, Hashtable properties )
- throws NPandayRepositoryException
+ @Override
+ protected NetDependencyModel loadFromReader( Reader reader, Hashtable properties )
+ throws IOException, XmlPullParserException
{
- this.properties = properties;
NetDependencyXpp3Reader xpp3Reader = new NetDependencyXpp3Reader();
- Reader reader = new InputStreamReader( inputStream );
- NetDependencyModel model;
- try
- {
- model = xpp3Reader.read( reader );
- }
- catch( IOException e )
- {
- throw new NPandayRepositoryException( "NPANDAY-003-000: An error occurred while reading net-dependencies.xml", e );
- }
- catch ( XmlPullParserException e )
- {
- throw new NPandayRepositoryException( "NPANDAY-003-001: Could not read net-dependencies.xml", e );
- }
- netDependencies = model.getNetDependencies();
- String npandayVersion = (String) properties.get( "npanday.version" );
- for ( NetDependency dependency : netDependencies )
+ return xpp3Reader.read( reader );
+ }
+
+ @Override
+ protected void mergeLoadedModel( NetDependencyModel model )
+ throws NPandayRepositoryException
+ {
+ final List<NetDependency> tmpList = model.getNetDependencies();
+
+ String npandayVersion = getProperty( "npanday.version" );
+ for ( NetDependency dependency : tmpList )
{
- if ( dependency.getVersion() == null && dependency.getGroupId().toLowerCase().startsWith( "org.apache.npanday" ) )
+ if ( dependency.getVersion() == null && dependency.getGroupId().toLowerCase().startsWith(
+ "org.apache.npanday" ) )
{
dependency.setVersion( npandayVersion );
}
}
- }
-
- /**
- * @see Repository#setRepositoryRegistry(npanday.registry.RepositoryRegistry)
- */
- public void setRepositoryRegistry( RepositoryRegistry repositoryRegistry )
- {
- }
-
- /**
- * @see Repository#setSourceUri(String)
- */
- public void setSourceUri( String fileUri )
- {
- // not supported
+ netDependencies.addAll( tmpList );
}
/**
- * @see Repository#reload()
+ * Remove all stored values in preparation for a reload.
*/
- public void reload() throws IOException
+ @Override
+ protected void clear()
{
- // not supported
+ netDependencies.clear();
}
/**
+ * TODO: Remove getDependencies?
* Returns a list of .NET dependencies as given within the net dependencies config file. This dependency list
* is external to the pom file dependencies. This separation is necessary since some Java Maven plugins
* - which themselves are necessary for building .NET applications - may have .NET executable dependencies that
@@ -164,7 +143,7 @@ public class NetDependenciesRepositoryIm
public String getProperty( String key )
{
- return (String) properties.get( key );
+ return (String) getProperties().get( key );
}
/**
@@ -212,9 +191,9 @@ public class NetDependenciesRepositoryIm
List<Artifact> artifacts = new ArrayList<Artifact>();
for ( NetDependency netDependency : netDependencies )
{
- if ( netDependency.getGroupId().equals( groupId ) && netDependency.getArtifactId().equals( artifactId ) &&
- ( version == null || netDependency.getVersion().equals( version ) ) &&
- ( type == null || netDependency.getType().equals( type ) ) )
+ if ( netDependency.getGroupId().equals( groupId ) && netDependency.getArtifactId().equals( artifactId )
+ && ( version == null || netDependency.getVersion().equals( version ) ) && ( type == null
+ || netDependency.getType().equals( type ) ) )
{
artifacts.add( netDependencyToArtifact( netDependency ) );
}
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-assembler/src/main/java/npanday/assembler/impl/AssemblyPluginsRepository.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-assembler/src/main/java/npanday/assembler/impl/AssemblyPluginsRepository.java?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-assembler/src/main/java/npanday/assembler/impl/AssemblyPluginsRepository.java (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-assembler/src/main/java/npanday/assembler/impl/AssemblyPluginsRepository.java Mon Dec 5 10:09:31 2011
@@ -18,35 +18,40 @@
*/
package npanday.assembler.impl;
+import npanday.assembler.AssemblyInfoException;
+import npanday.model.assembly.plugins.AssemblyPlugin;
+import npanday.model.assembly.plugins.AssemblyPluginsModel;
+import npanday.model.assembly.plugins.io.xpp3.AssemblyPluginXpp3Reader;
import npanday.registry.NPandayRepositoryException;
import npanday.registry.Repository;
-import npanday.registry.RepositoryRegistry;
+import npanday.registry.impl.AbstractMultisourceRepository;
+import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import java.io.InputStream;
import java.io.IOException;
import java.io.Reader;
-import java.io.InputStreamReader;
-import java.util.*;
-
-import npanday.assembler.AssemblyInfoException;
-import npanday.model.assembly.plugins.AssemblyPlugin;
-import npanday.model.assembly.plugins.AssemblyPluginsModel;
-import npanday.model.assembly.plugins.io.xpp3.AssemblyPluginXpp3Reader;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Set;
/**
* Provides a way for loading the assembly-plugins.xml file and accessing its content.
*
* @author Shane Isbell
+ * @author <a href="mailto:lcorneliussen@apache.org">Lars Corneliussen</a>
*/
+@Component(role = AssemblyPluginsRepository.class)
public final class AssemblyPluginsRepository
+ extends AbstractMultisourceRepository<AssemblyPluginsModel>
implements Repository
{
/**
* List of all assembly plugins within the repository
*/
- private List<AssemblyPlugin> assemblyPlugins;
+ private List<AssemblyPlugin> assemblyPlugins = new ArrayList<AssemblyPlugin>( );
/**
* Constructor. This method is intended to by invoked by the <code>RepositoryRegistry<code>, not by the
@@ -56,62 +61,35 @@ public final class AssemblyPluginsReposi
{
}
- /**
- * Loads the repository.
- *
- * @param inputStream a stream of the repository file (typically from *.xml)
- * @param properties additional user-supplied parameters used to customize the behavior of the repository
- * @throws NPandayRepositoryException if there is a problem loading the repository
- */
- public void load( InputStream inputStream, Hashtable properties )
- throws NPandayRepositoryException
+ @Override
+ protected AssemblyPluginsModel loadFromReader( Reader reader, Hashtable properties )
+ throws IOException, XmlPullParserException
{
AssemblyPluginXpp3Reader xpp3Reader = new AssemblyPluginXpp3Reader();
- Reader reader = new InputStreamReader( inputStream );
- AssemblyPluginsModel plugins = null;
- try
- {
- plugins = xpp3Reader.read( reader );
- }
- catch( IOException e )
- {
- throw new NPandayRepositoryException( "NPANDAY-021-000: An error occurred while reading executable-plugins.xml", e );
- }
- catch ( XmlPullParserException e )
- {
- throw new NPandayRepositoryException( "NPANDAY-021-001: Could not read plugins-compiler.xml", e );
- }
- assemblyPlugins = plugins.getAssemblyPlugins();
+ return xpp3Reader.read( reader );
+ }
+
+ @Override
+ protected void mergeLoadedModel( AssemblyPluginsModel model )
+ throws NPandayRepositoryException
+ {
+ assemblyPlugins.addAll( model.getAssemblyPlugins());
Set languages = getAssemblyPluginLanguages();
if ( languages.size() < assemblyPlugins.size() )
{
throw new NPandayRepositoryException(
- "NPANDAY-021-002: Duplicate language entries in the assembly-plugins.xml: Total Language Count = " +
- languages.size() + ", Total Plugins = " + assemblyPlugins.size() );
+ "NPANDAY-021-002: Duplicate language entries in the assembly-plugins.xml: Total Language Count = "
+ + languages.size() + ", Total Plugins = " + assemblyPlugins.size() );
}
}
/**
- * @see Repository#setRepositoryRegistry(npanday.registry.RepositoryRegistry)
- */
- public void setRepositoryRegistry( RepositoryRegistry repositoryRegistry )
- {
- }
-
- /**
- * @see Repository#setSourceUri(String)
- */
- public void setSourceUri( String fileUri )
- {
- // not supported
- }
-
- /**
- * @see Repository#reload()
+ * Remove all stored values in preparation for a reload.
*/
- public void reload() throws IOException
+ @Override
+ protected void clear()
{
- // not supported
+ assemblyPlugins.clear();
}
/**
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-core/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-core/src/main/resources/META-INF/plexus/components.xml?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-core/src/main/resources/META-INF/plexus/components.xml (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-core/src/main/resources/META-INF/plexus/components.xml Mon Dec 5 10:09:31 2011
@@ -18,14 +18,6 @@ under the License.
-->
<component-set>
<components>
- <component>
- <role>npanday.NPandayRepositoryRegistry</role>
- <implementation>npanday.impl.NPandayRepositoryRegistryImpl</implementation>
- <requirements>
- <requirement>
- <role>npanday.registry.RepositoryRegistry</role>
- </requirement>
- </requirements>
- </component>
+ <!-- use annotations instead -->
</components>
</component-set>
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-dao-project/src/main/java/npanday/dao/impl/ProjectDaoImpl.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-dao-project/src/main/java/npanday/dao/impl/ProjectDaoImpl.java?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-dao-project/src/main/java/npanday/dao/impl/ProjectDaoImpl.java (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-dao-project/src/main/java/npanday/dao/impl/ProjectDaoImpl.java Mon Dec 5 10:09:31 2011
@@ -906,11 +906,6 @@ public final class ProjectDaoImpl
this.rdfRepository = (org.openrdf.repository.Repository) dataStoreObject;
}
- public void setRepositoryRegistry( RepositoryRegistry repositoryRegistry )
- {
-
- }
-
protected void initForUnitTest( Object dataStoreObject, String id, String className,
ArtifactResolver artifactResolver, ArtifactFactory artifactFactory )
{
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/CapabilityMatcherImpl.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/CapabilityMatcherImpl.java?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/CapabilityMatcherImpl.java (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/CapabilityMatcherImpl.java Mon Dec 5 10:09:31 2011
@@ -19,36 +19,33 @@
package npanday.executable.impl;
import npanday.PlatformUnsupportedException;
-import npanday.executable.*;
-import npanday.executable.compiler.*;
+import npanday.executable.CapabilityMatcher;
+import npanday.executable.ExecutableCapability;
+import npanday.executable.ExecutableMatchPolicy;
+import npanday.executable.ExecutableRequirement;
+import npanday.executable.compiler.CompilerCapability;
+import npanday.executable.compiler.CompilerRequirement;
+import npanday.registry.RepositoryRegistry;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
-import java.util.List;
import java.util.ArrayList;
-
-import org.codehaus.plexus.logging.LogEnabled;
-import org.codehaus.plexus.logging.Logger;
-import npanday.registry.RepositoryRegistry;
+import java.util.List;
/**
* Provides an implementation of the <code>CapabilityMatcher</code> interface.
*
* @author Shane Isbell
*/
+@Component( role = CapabilityMatcher.class )
public class CapabilityMatcherImpl
- implements CapabilityMatcher, LogEnabled
+ extends AbstractLogEnabled
+ implements CapabilityMatcher
{
- /**
- * A logger for writing log messages
- */
- private Logger logger;
-
+ @Requirement
private RepositoryRegistry repositoryRegistry;
- public void enableLogging( Logger logger )
- {
- this.logger = logger;
- }
-
public CompilerCapability matchCompilerCapabilityFor( CompilerRequirement compilerRequirement,
List<ExecutableMatchPolicy> matchPolicies )
throws PlatformUnsupportedException
@@ -125,16 +122,17 @@ public class CapabilityMatcherImpl
{
for ( ExecutableCapability executableCapability : executableCapabilities )
{
- logger.debug( "NPANDAY-065-005: Attempting to match capability: " + executableCapability );
+ getLogger().debug( "NPANDAY-065-005: Attempting to match capability: " + executableCapability );
if ( matchExecutableCapability( executableCapability, matchPolicies ) )
{
- logger.debug( "NPANDAY-065-001: Made a Platform Capability Match: " + executableCapability );
+ getLogger().debug( "NPANDAY-065-001: Made a Platform Capability Match: " + executableCapability );
return executableCapability;
}
}
- throw new PlatformUnsupportedException( "NPANDAY-065-002: Could not match platform: OS = " +
- System.getProperty( "os.name" ) + ", Number of Capabilities = " + executableCapabilities.size() +
- ", Number of Policies = " + matchPolicies.size() );
+ throw new PlatformUnsupportedException(
+ "NPANDAY-065-002: Could not match platform: OS = " + System.getProperty( "os.name" )
+ + ", Number of Capabilities = " + executableCapabilities.size() + ", Number of Policies = "
+ + matchPolicies.size() );
}
@@ -146,7 +144,7 @@ public class CapabilityMatcherImpl
boolean match = executableMatchPolicy.match( executableCapability );
if ( !match )
{
- logger.debug( "Failed to match policy: " + executableMatchPolicy );
+ getLogger().debug( "Failed to match policy: " + executableMatchPolicy );
return false;
}
}
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerContextImpl.java?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerContextImpl.java (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerContextImpl.java Mon Dec 5 10:09:31 2011
@@ -18,39 +18,50 @@
*/
package npanday.executable.impl;
+import npanday.ArtifactType;
import npanday.ArtifactTypeHelper;
-import npanday.executable.CommandExecutor;
-import npanday.executable.ExecutionException;
-import npanday.executable.CapabilityMatcher;
-import npanday.executable.CommandFilter;
import npanday.PlatformUnsupportedException;
-import npanday.executable.compiler.*;
+import npanday.RepositoryNotFoundException;
import npanday.artifact.ArtifactContext;
import npanday.artifact.ArtifactException;
-import npanday.ArtifactType;
-import npanday.PathUtil;
-
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.model.Dependency;
+import npanday.executable.CapabilityMatcher;
+import npanday.executable.CommandExecutor;
+import npanday.executable.CommandFilter;
+import npanday.executable.ExecutionException;
+import npanday.executable.compiler.CompilerCapability;
+import npanday.executable.compiler.CompilerConfig;
+import npanday.executable.compiler.CompilerContext;
+import npanday.executable.compiler.CompilerExecutable;
+import npanday.executable.compiler.CompilerRequirement;
+import npanday.executable.compiler.InvalidArtifactException;
+import npanday.executable.compiler.KeyInfo;
import npanday.registry.Repository;
import npanday.registry.RepositoryRegistry;
-import npanday.RepositoryNotFoundException;
import npanday.vendor.Vendor;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.LogEnabled;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.DirectoryScanner;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
-import java.util.*;
import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
/**
* Provides an implementation of the Compiler Context.
*
* @author Shane Isbell
*/
+@Component(role = CompilerContext.class)
public final class CompilerContextImpl
implements CompilerContext, LogEnabled
{
@@ -75,8 +86,10 @@ public final class CompilerContextImpl
private CommandFilter commandFilter;
+ @Requirement
private ArtifactContext artifactContext;
+ @Requirement
private RepositoryRegistry repositoryRegistry;
/**
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerPluginsRepository.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerPluginsRepository.java?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerPluginsRepository.java (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/CompilerPluginsRepository.java Mon Dec 5 10:09:31 2011
@@ -18,86 +18,67 @@
*/
package npanday.executable.impl;
+import npanday.executable.CommandCapability;
+import npanday.executable.ExecutableCapability;
+import npanday.executable.compiler.CompilerCapability;
+import npanday.model.compiler.plugins.CommandFilter;
+import npanday.model.compiler.plugins.CompilerPlugin;
+import npanday.model.compiler.plugins.CompilerPluginsModel;
+import npanday.model.compiler.plugins.Platform;
+import npanday.model.compiler.plugins.io.xpp3.CompilerPluginXpp3Reader;
import npanday.registry.NPandayRepositoryException;
import npanday.registry.Repository;
-import npanday.registry.RepositoryRegistry;
+import npanday.registry.impl.AbstractMultisourceRepository;
+import npanday.vendor.Vendor;
+import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import java.io.*;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.ArrayList;
import java.util.Hashtable;
-import java.util.List;
import java.util.Iterator;
-import java.util.ArrayList;
-
-import npanday.vendor.Vendor;
-import npanday.executable.CommandCapability;
-import npanday.executable.ExecutableCapability;
-import npanday.executable.compiler.CompilerCapability;
-import npanday.model.compiler.plugins.io.xpp3.CompilerPluginXpp3Reader;
-import npanday.model.compiler.plugins.CompilerPluginsModel;
-import npanday.model.compiler.plugins.CompilerPlugin;
-import npanday.model.compiler.plugins.Platform;
-import npanday.model.compiler.plugins.CommandFilter;
+import java.util.List;
/**
* Repository for reading and providing access to the compiler-plugins.xml config file.
*
* @author Shane Isbell
+ * @author <a href="mailto:lcorneliussen@apache.org">Lars Corneliussen</a>
*/
+@Component(role = CompilerPluginsRepository.class)
public final class CompilerPluginsRepository
+ extends AbstractMultisourceRepository<CompilerPluginsModel>
implements Repository
{
/**
- * List<npanday.model.compiler.plugins.CompilerPlugin> of compiler plugins pulled from the
- * compiler-plugins.xml file.
+ * List<npanday.model.compiler.plugins.CompilerPlugin> of compiler plugins pulled from the
+ * various compiler-plugins.xml files.
*/
- private List compilerPlugins;
+ private List compilerPlugins = new ArrayList();
- /**
- * @see Repository#load(java.io.InputStream, java.util.Hashtable)
- */
- public void load( InputStream inputStream, Hashtable properties )
- throws NPandayRepositoryException
+ @Override
+ protected CompilerPluginsModel loadFromReader( Reader reader, Hashtable properties )
+ throws IOException, XmlPullParserException
{
CompilerPluginXpp3Reader xpp3Reader = new CompilerPluginXpp3Reader();
- Reader reader = new InputStreamReader( inputStream );
- CompilerPluginsModel plugins;
- try
- {
- plugins = xpp3Reader.read( reader );
- }
- catch( IOException e )
- {
- throw new NPandayRepositoryException( "NPANDAY-062-000: An error occurred while reading plugins-compiler.xml", e );
- }
- catch ( XmlPullParserException e )
- {
- throw new NPandayRepositoryException( "NPANDAY-062-001: Could not read plugins-compiler.xml", e );
- }
- compilerPlugins = plugins.getCompilerPlugins();
- }
-
- /**
- * @see Repository#setRepositoryRegistry(npanday.registry.RepositoryRegistry)
- */
- public void setRepositoryRegistry( RepositoryRegistry repositoryRegistry )
- {
+ return xpp3Reader.read( reader );
}
- /**
- * @see Repository#setSourceUri(String)
- */
- public void setSourceUri( String fileUri )
+ @Override
+ protected void mergeLoadedModel( CompilerPluginsModel model )
+ throws NPandayRepositoryException
{
- // not supported
+ compilerPlugins.addAll( model.getCompilerPlugins() );
}
/**
- * @see Repository#reload()
+ * Remove all stored values in preparation for a reload.
*/
- public void reload() throws IOException
+ @Override
+ protected void clear()
{
- // not supported
+ compilerPlugins.clear();
}
/**
@@ -143,7 +124,7 @@ public final class CompilerPluginsReposi
CommandFilter filter = plugin.getCommandFilter();
platformCapability.setCoreAssemblies( coreAssemblies );
- platformCapability.setNetDependencyId( plugin.getNetDependencyId());
+ platformCapability.setNetDependencyId( plugin.getNetDependencyId() );
List<String> includes = ( filter != null ) ? filter.getIncludes() : new ArrayList<String>();
List<String> excludes = ( filter != null ) ? filter.getExcludes() : new ArrayList<String>();
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/ExecutableContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/ExecutableContextImpl.java?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/ExecutableContextImpl.java (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/ExecutableContextImpl.java Mon Dec 5 10:09:31 2011
@@ -18,25 +18,36 @@
*/
package npanday.executable.impl;
-import npanday.executable.*;
-import npanday.registry.Repository;
-import npanday.registry.RepositoryRegistry;
import npanday.PlatformUnsupportedException;
import npanday.RepositoryNotFoundException;
-import org.codehaus.plexus.logging.Logger;
+import npanday.executable.CapabilityMatcher;
+import npanday.executable.CommandFilter;
+import npanday.executable.ExecutableCapability;
+import npanday.executable.ExecutableConfig;
+import npanday.executable.ExecutableContext;
+import npanday.executable.ExecutableRequirement;
+import npanday.executable.ExecutionException;
+import npanday.executable.NetExecutable;
+import npanday.registry.Repository;
+import npanday.registry.RepositoryRegistry;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.LogEnabled;
+import org.codehaus.plexus.logging.Logger;
/**
* Provides an implementation of the executable context.
*
* @author Shane Isbell
*/
+@Component(role = ExecutableContext.class)
public class ExecutableContextImpl
implements ExecutableContext, LogEnabled
{
private ExecutableRequirement executableRequirement;
+ @Requirement
private RepositoryRegistry repositoryRegistry;
private ExecutableCapability executableCapability;
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/ExecutablePluginsRepository.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/ExecutablePluginsRepository.java?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/ExecutablePluginsRepository.java (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/ExecutablePluginsRepository.java Mon Dec 5 10:09:31 2011
@@ -18,86 +18,66 @@
*/
package npanday.executable.impl;
+import npanday.executable.CommandCapability;
+import npanday.executable.ExecutableCapability;
+import npanday.model.compiler.plugins.CommandFilter;
+import npanday.model.compiler.plugins.ExecutablePlugin;
+import npanday.model.compiler.plugins.ExecutablePluginsModel;
+import npanday.model.compiler.plugins.Platform;
+import npanday.model.compiler.plugins.io.xpp3.ExecutablePluginXpp3Reader;
import npanday.registry.NPandayRepositoryException;
import npanday.registry.Repository;
-import npanday.registry.RepositoryRegistry;
+import npanday.registry.impl.AbstractMultisourceRepository;
+import npanday.vendor.Vendor;
+import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import java.io.InputStream;
import java.io.IOException;
import java.io.Reader;
-import java.io.InputStreamReader;
-import java.util.Hashtable;
-import java.util.List;
import java.util.ArrayList;
+import java.util.Hashtable;
import java.util.Iterator;
-
-import npanday.model.compiler.plugins.io.xpp3.ExecutablePluginXpp3Reader;
-import npanday.model.compiler.plugins.*;
-import npanday.executable.ExecutableCapability;
-import npanday.executable.CommandCapability;
-import npanday.vendor.Vendor;
+import java.util.List;
/**
* Provides services for accessing the executable information within the executable-plugins.xml file.
*
* @author Shane Isbell
+ * @author <a href="mailto:lcorneliussen@apache.org">Lars Corneliussen</a>
*/
+@Component(role = ExecutablePluginsRepository.class)
public final class ExecutablePluginsRepository
+ extends AbstractMultisourceRepository<ExecutablePluginsModel>
implements Repository
{
/**
* A list of executable capabilities as specified within the executable-plugins.xml file
*/
- private List<ExecutablePlugin> executablePlugins;
+ private List<ExecutablePlugin> executablePlugins = new ArrayList<ExecutablePlugin>( );
- /**
- * Loads the repository
- *
- * @param inputStream a stream of the repository file (typically from *.xml)
- * @param properties additional user-supplied parameters used to customize the behavior of the repository
- * @throws npanday.registry.NPandayRepositoryException if there is a problem loading the repository
- */
- public void load( InputStream inputStream, Hashtable properties )
- throws NPandayRepositoryException
+ @Override
+ protected ExecutablePluginsModel loadFromReader( Reader reader, Hashtable properties )
+ throws IOException, XmlPullParserException
{
ExecutablePluginXpp3Reader xpp3Reader = new ExecutablePluginXpp3Reader();
- Reader reader = new InputStreamReader( inputStream );
- ExecutablePluginsModel plugins = null;
- try
- {
- plugins = xpp3Reader.read( reader );
- }
- catch( IOException e )
- {
- throw new NPandayRepositoryException( "NPANDAY-067-000: An error occurred while reading executable-plugins.xml", e );
- }
- catch ( XmlPullParserException e )
- {
- throw new NPandayRepositoryException( "NPANDAY-067-001: Could not read executable-plugins.xml", e );
- }
- executablePlugins = plugins.getExecutablePlugins();
- }
-
- public void setRepositoryRegistry( RepositoryRegistry repositoryRegistry )
- {
+ return xpp3Reader.read( reader );
}
- /**
- * @see Repository#setSourceUri(String)
- */
- public void setSourceUri( String fileUri )
+ @Override
+ protected void mergeLoadedModel( ExecutablePluginsModel model )
+ throws NPandayRepositoryException
{
- // not supported
+ executablePlugins.addAll( model.getExecutablePlugins() );
}
/**
- * @see Repository#reload()
+ * Remove all stored values in preparation for a reload.
*/
- public void reload() throws IOException
+ @Override
+ protected void clear()
{
- // not supported
+ executablePlugins.clear();
}
/**
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/NetExecutableFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/NetExecutableFactoryImpl.java?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/NetExecutableFactoryImpl.java (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/NetExecutableFactoryImpl.java Mon Dec 5 10:09:31 2011
@@ -18,68 +18,76 @@
*/
package npanday.executable.impl;
-import npanday.executable.*;
-import npanday.executable.compiler.CompilerRequirement;
+import npanday.InitializationException;
+import npanday.PathUtil;
+import npanday.PlatformUnsupportedException;
+import npanday.artifact.ArtifactContext;
+import npanday.executable.CapabilityMatcher;
+import npanday.executable.ExecutableConfig;
+import npanday.executable.ExecutableContext;
+import npanday.executable.ExecutableRequirement;
+import npanday.executable.ExecutionException;
+import npanday.executable.NetExecutable;
+import npanday.executable.NetExecutableFactory;
+import npanday.executable.RepositoryExecutableContext;
import npanday.executable.compiler.CompilerConfig;
import npanday.executable.compiler.CompilerContext;
import npanday.executable.compiler.CompilerExecutable;
-import npanday.vendor.*;
-import npanday.vendor.IllegalStateException;
+import npanday.executable.compiler.CompilerRequirement;
import npanday.registry.RepositoryRegistry;
-import npanday.artifact.ArtifactContext;
-import npanday.PathUtil;
-import npanday.InitializationException;
-import npanday.PlatformUnsupportedException;
-import org.apache.maven.project.MavenProject;
+import npanday.vendor.IllegalStateException;
+import npanday.vendor.StateMachineProcessor;
+import npanday.vendor.Vendor;
+import npanday.vendor.VendorFactory;
+import npanday.vendor.VendorInfo;
+import npanday.vendor.VendorInfoRepository;
import org.apache.maven.artifact.Artifact;
-import org.codehaus.plexus.logging.LogEnabled;
-import org.codehaus.plexus.logging.Logger;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
-import java.util.List;
+import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
-import java.io.File;
+import java.util.List;
/**
* Provides an implementation of <code>NetExecutableFactory</code>.
*
* @author Shane Isbell
+ * @author <a href="mailto:lcorneliussen@apache.org">Lars Corneliussen</a>
*/
+@Component(role = NetExecutableFactory.class)
public class NetExecutableFactoryImpl
- implements NetExecutableFactory, LogEnabled
+ extends AbstractLogEnabled
+ implements NetExecutableFactory
{
- /**
- * The capability matcher
- */
+ @Requirement
private CapabilityMatcher capabilityMatcher;
+ @Requirement
private ArtifactContext artifactContext;
+ @Requirement
private RepositoryExecutableContext repositoryExecutableContext;
+ @Requirement
private ExecutableContext executableContext;
+ @Requirement
private CompilerContext compilerContext;
+ @Requirement
private RepositoryRegistry repositoryRegistry;
+ @Requirement
private VendorInfoRepository vendorInfoRepository;
+ @Requirement
private StateMachineProcessor processor;
- /**
- * A logger for writing log messages
- */
- private Logger logger;
-
- /**
- * @see LogEnabled#enableLogging(org.codehaus.plexus.logging.Logger)
- */
- public void enableLogging( Logger logger )
- {
- this.logger = logger;
- }
/**
* @see NetExecutableFactory#getCompilerExecutableFor(npanday.executable.compiler.CompilerRequirement,
@@ -97,7 +105,8 @@ public class NetExecutableFactoryImpl
vendorInfo.setVendor( compilerRequirement.getVendor() );
try
{
- logger.debug("NPANDAY-066-025 - Try to find executable for vendor:" + vendorInfo + ":processor:" + processor);
+ getLogger().debug(
+ "NPANDAY-066-025 - Try to find executable for vendor:" + vendorInfo + ":processor:" + processor );
processor.process( vendorInfo );
}
catch ( IllegalStateException e )
@@ -110,7 +119,7 @@ public class NetExecutableFactoryImpl
throw new PlatformUnsupportedException( "NPANDAY-066-012: Missing Vendor Information: " + vendorInfo );
}
- logger.info( "NPANDAY-066-013: Found Vendor = " + vendorInfo );
+ getLogger().info( "NPANDAY-066-013: Found Vendor = " + vendorInfo );
compilerRequirement.setVendor( vendorInfo.getVendor() );
compilerRequirement.setVendorVersion( vendorInfo.getVendorVersion() );
compilerRequirement.setFrameworkVersion( vendorInfo.getFrameworkVersion() );
@@ -123,17 +132,19 @@ public class NetExecutableFactoryImpl
compilerContext.getCompilerCapability().setAssemblyPath( assemblyPath.getAbsolutePath() );
}
- List<String> executionPaths = ( compilerConfig.getExecutionPaths() == null ) ? new ArrayList<String>()
+ List<String> executionPaths = ( compilerConfig.getExecutionPaths() == null )
+ ? new ArrayList<String>()
: compilerConfig.getExecutionPaths();
- if (executionPaths == null || executionPaths.size() == 0 )
+ if ( executionPaths == null || executionPaths.size() == 0 )
{
- if (vendorInfo.getExecutablePaths() != null) {
- for(File path : vendorInfo.getExecutablePaths()){
- executionPaths.add(path.getAbsolutePath());
+ if ( vendorInfo.getExecutablePaths() != null )
+ {
+ for ( File path : vendorInfo.getExecutablePaths() )
+ {
+ executionPaths.add( path.getAbsolutePath() );
}
}
-
String netDependencyId = compilerContext.getCompilerCapability().getNetDependencyId();
if ( netDependencyId != null )
@@ -161,17 +172,20 @@ public class NetExecutableFactoryImpl
}
/**
- * @see NetExecutableFactory#getPluginLoaderFor(String,String,npanday.vendor.VendorInfo,String,java.io.File,String)
+ * @see NetExecutableFactory#getPluginLoaderFor(String, String, npanday.vendor.VendorInfo, String, java.io.File, String)
*/
public NetExecutable getPluginLoaderFor( String groupId, String artifactId, VendorInfo vendorInfo,
String localRepository, File parameterFile, String mojoName )
throws PlatformUnsupportedException
{
- Artifact artifact = getArtifactFor(groupId, artifactId);
- return getPluginLoaderFor(artifact, vendorInfo, localRepository, parameterFile, mojoName);
+ Artifact artifact = getArtifactFor( groupId, artifactId );
+ return getPluginLoaderFor( artifact, vendorInfo, localRepository, parameterFile, mojoName );
}
- public NetExecutable getPluginLoaderFor(Artifact artifact, VendorInfo vendorInfo, String localRepository, File parameterFile, String mojoName) throws PlatformUnsupportedException {
+ public NetExecutable getPluginLoaderFor( Artifact artifact, VendorInfo vendorInfo, String localRepository,
+ File parameterFile, String mojoName )
+ throws PlatformUnsupportedException
+ {
//AssemblyRepositoryLayout layout = new AssemblyRepositoryLayout();
File artifactPath = PathUtil.getPrivateApplicationBaseFileFor( artifact, new File( localRepository ) );
@@ -181,7 +195,8 @@ public class NetExecutableFactoryImpl
commands.add( "mojoName=" + mojoName );//ArtifactId = namespace
Artifact pluginLoaderArtifact =
- artifactContext.getArtifactsFor( "org.apache.npanday.plugins", "NPanday.Plugin.Loader", null, null ).get( 0 );
+ artifactContext.getArtifactsFor( "org.apache.npanday.plugins", "NPanday.Plugin.Loader", null, null ).get(
+ 0 );
artifactPath = PathUtil.getPrivateApplicationBaseFileFor( pluginLoaderArtifact, new File( localRepository ) );
commands.add( "startProcessAssembly=" + artifactPath.getAbsolutePath() );
@@ -189,13 +204,15 @@ public class NetExecutableFactoryImpl
new File( localRepository ), commands, false );
}
- public Artifact getArtifactFor(String groupId, String artifactId) throws PlatformUnsupportedException {
+ public Artifact getArtifactFor( String groupId, String artifactId )
+ throws PlatformUnsupportedException
+ {
List<Artifact> artifacts = artifactContext.getArtifactsFor( groupId, artifactId, null, null );
if ( artifacts.size() == 0 )
{
throw new PlatformUnsupportedException(
- "NPANDAY-066-023: Could not locate the plugin - missing entry in the net-dependencies.xml file: GroupId = " +
- groupId + ", ArtifactId = " + artifactId );
+ "NPANDAY-066-023: Could not locate the plugin - missing entry in the net-dependencies.xml file: GroupId = "
+ + groupId + ", ArtifactId = " + artifactId );
}
Artifact artifact = artifacts.get( 0 );
@@ -218,15 +235,16 @@ public class NetExecutableFactoryImpl
if ( artifacts.size() == 0 )
{
throw new PlatformUnsupportedException(
- "NPANDAY-066-024: Could not locate the executable - missing entry in the net-dependencies.xml file: GroupId = " +
- groupId + ", ArtifactId = " + artifactId );
+ "NPANDAY-066-024: Could not locate the executable - missing entry in the net-dependencies.xml file: GroupId = "
+ + groupId + ", ArtifactId = " + artifactId );
}
Artifact artifact = artifacts.get( 0 );
if ( artifact == null )
{
- throw new PlatformUnsupportedException( "NPANDAY-066-025: Could not locate the executable: GroupId = " +
- groupId + ", ArtifactId = " + artifactId );
+ throw new PlatformUnsupportedException(
+ "NPANDAY-066-025: Could not locate the executable: GroupId = " + groupId + ", ArtifactId = "
+ + artifactId );
}
File artifactPath = PathUtil.getPrivateApplicationBaseFileFor( artifact, localRepository );
@@ -237,8 +255,8 @@ public class NetExecutableFactoryImpl
localRepository ).getAbsolutePath();
commands.add( "pluginArtifactPath=" + pluginArtifactPath );
- return getNetExecutableFromRepository( "org.apache.npanday.plugins", "NPanday.Plugin.Runner", vendorInfo, localRepository,
- commands, false );
+ return getNetExecutableFromRepository( "org.apache.npanday.plugins", "NPanday.Plugin.Runner", vendorInfo,
+ localRepository, commands, false );
}
if ( commands == null )
@@ -263,14 +281,14 @@ public class NetExecutableFactoryImpl
if ( artifacts.size() == 0 )
{
throw new PlatformUnsupportedException(
- "NPANDAY-066-022: Could not locate the executable- missing entry in the net-dependencies.xml: GroupId = " +
- groupId + ", ArtifactId = " + artifactId );
+ "NPANDAY-066-022: Could not locate the executable- missing entry in the net-dependencies.xml: GroupId = "
+ + groupId + ", ArtifactId = " + artifactId );
}
Artifact artifact = artifacts.get( 0 );
- logger.debug( "NPANDAY-066-003: Found Vendor: " + vendorInfo );
+ getLogger().debug( "NPANDAY-066-003: Found Vendor: " + vendorInfo );
- File artifactPath = PathUtil.getPrivateApplicationBaseFileFor( artifact, localRepository );
+ File artifactPath = PathUtil.getPrivateApplicationBaseFileFor( artifact, localRepository );
List<String> modifiedCommands = new ArrayList<String>();
String exe = null;
if ( vendorInfo.getVendor().equals( Vendor.MONO ) )
@@ -291,9 +309,9 @@ public class NetExecutableFactoryImpl
if ( exe == null )
{
- logger.info(
- "NPANDAY-066-005: Executable path for mono does not exist. Will attempt to execute MONO using" +
- " the main PATH variable." );
+ getLogger().info(
+ "NPANDAY-066-005: Executable path for mono does not exist. Will attempt to execute MONO using"
+ + " the main PATH variable." );
exe = "mono";
commands.add( "vendor=MONO" );//if forked process, it needs to know.
}
@@ -351,8 +369,8 @@ public class NetExecutableFactoryImpl
throw new PlatformUnsupportedException( "NPANDAY-066-010: Illegal State: Vendor Info = " + vendorInfo, e );
}
- if ( vendorInfo.getVendor() == null || vendorInfo.getFrameworkVersion() == null ||
- vendorInfo.getVendorVersion() == null )
+ if ( vendorInfo.getVendor() == null || vendorInfo.getFrameworkVersion() == null
+ || vendorInfo.getVendorVersion() == null )
{
throw new PlatformUnsupportedException( "NPANDAY-066-018: Missing Vendor Information: " + vendorInfo );
}
@@ -410,7 +428,7 @@ public class NetExecutableFactoryImpl
throw new PlatformUnsupportedException( "NPANDAY-066-019: Missing Vendor Information: " + vendorInfo );
}
- logger.debug( "NPANDAY-066-003: Found Vendor: " + vendorInfo );
+ getLogger().debug( "NPANDAY-066-003: Found Vendor: " + vendorInfo );
ExecutableRequirement executableRequirement =
ExecutableRequirement.Factory.createDefaultExecutableRequirement();
executableRequirement.setVendor( vendorInfo.getVendor() );
@@ -421,11 +439,12 @@ public class NetExecutableFactoryImpl
ExecutableConfig executableConfig = ExecutableConfig.Factory.createDefaultExecutableConfig();
executableConfig.setCommands( commands );
- List<String> executablePaths = ( executableConfig.getExecutionPaths() == null ) ? new ArrayList<String>()
+ List<String> executablePaths = ( executableConfig.getExecutionPaths() == null )
+ ? new ArrayList<String>()
: executableConfig.getExecutionPaths();
if ( netHome != null )
{
- logger.info( "NPANDAY-066-014: Found executable path in pom: Path = " + netHome.getAbsolutePath() );
+ getLogger().info( "NPANDAY-066-014: Found executable path in pom: Path = " + netHome.getAbsolutePath() );
executablePaths.add( netHome.getAbsolutePath() );
}
@@ -438,9 +457,9 @@ public class NetExecutableFactoryImpl
}
}
- if (executablePaths.isEmpty())
+ if ( executablePaths.isEmpty() )
{
- logger.info( "NPANDAY-066-016: Did not find executable path, will try system path" );
+ getLogger().info( "NPANDAY-066-016: Did not find executable path, will try system path" );
}
executableConfig.setExecutionPaths( executablePaths );
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/RepositoryExecutableContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/RepositoryExecutableContextImpl.java?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/RepositoryExecutableContextImpl.java (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/java/npanday/executable/impl/RepositoryExecutableContextImpl.java Mon Dec 5 10:09:31 2011
@@ -18,24 +18,31 @@
*/
package npanday.executable.impl;
-import npanday.executable.*;
-import npanday.executable.ExecutionException;
-import npanday.RepositoryNotFoundException;
import npanday.InitializationException;
+import npanday.RepositoryNotFoundException;
+import npanday.executable.ExecutableConfig;
+import npanday.executable.ExecutionException;
+import npanday.executable.NetExecutable;
+import npanday.executable.RepositoryExecutableContext;
+import npanday.registry.Repository;
+import npanday.registry.RepositoryRegistry;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.LogEnabled;
import org.codehaus.plexus.logging.Logger;
-import npanday.registry.RepositoryRegistry;
-import npanday.registry.Repository;
/**
* Provides an implementation of the repository executable context.
*
* @author Shane Isbell
*/
+
+@Component(role = RepositoryExecutableContext.class)
public class RepositoryExecutableContextImpl
implements RepositoryExecutableContext, LogEnabled
{
+ @Requirement
private RepositoryRegistry repositoryRegistry;
private NetExecutable netExecutable;
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/resources/META-INF/plexus/components.xml?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/resources/META-INF/plexus/components.xml (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-executable/src/main/resources/META-INF/plexus/components.xml Mon Dec 5 10:09:31 2011
@@ -17,75 +17,7 @@ specific language governing permissions
under the License.
-->
<component-set>
- <components>
- <component>
- <role>npanday.executable.compiler.CompilerContext</role>
- <implementation>npanday.executable.impl.CompilerContextImpl</implementation>
- <requirements>
- <requirement>
- <role>npanday.artifact.ArtifactContext</role>
- </requirement>
- <requirement>
- <role>npanday.registry.RepositoryRegistry</role>
- </requirement>
- </requirements>
- </component>
- <component>
- <role>npanday.executable.ExecutableContext</role>
- <implementation>npanday.executable.impl.ExecutableContextImpl</implementation>
- <requirements>
- <requirement>
- <role>npanday.registry.RepositoryRegistry</role>
- </requirement>
- </requirements>
- </component>
- <component>
- <role>npanday.executable.RepositoryExecutableContext</role>
- <implementation>npanday.executable.impl.RepositoryExecutableContextImpl</implementation>
- <requirements>
- <requirement>
- <role>npanday.registry.RepositoryRegistry</role>
- </requirement>
- </requirements>
- </component>
- <component>
- <role>npanday.executable.NetExecutableFactory</role>
- <implementation>npanday.executable.impl.NetExecutableFactoryImpl</implementation>
- <requirements>
- <requirement>
- <role>npanday.vendor.StateMachineProcessor</role>
- </requirement>
- <requirement>
- <role>npanday.registry.RepositoryRegistry</role>
- </requirement>
- <requirement>
- <role>npanday.vendor.VendorInfoRepository</role>
- </requirement>
- <requirement>
- <role>npanday.executable.CapabilityMatcher</role>
- </requirement>
- <requirement>
- <role>npanday.executable.RepositoryExecutableContext</role>
- </requirement>
- <requirement>
- <role>npanday.executable.ExecutableContext</role>
- </requirement>
- <requirement>
- <role>npanday.executable.compiler.CompilerContext</role>
- </requirement>
- <requirement>
- <role>npanday.artifact.ArtifactContext</role>
- </requirement>
- </requirements>
- </component>
- <component>
- <role>npanday.executable.CapabilityMatcher</role>
- <implementation>npanday.executable.impl.CapabilityMatcherImpl</implementation>
- <requirements>
- <requirement>
- <role>npanday.registry.RepositoryRegistry</role>
- </requirement>
- </requirements>
- </component>
- </components>
+ <components>
+ <!-- created through annotations -->
+ </components>
</component-set>
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-plugin/src/main/java/npanday/plugin/impl/ConfigurationAppendersRepository.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-plugin/src/main/java/npanday/plugin/impl/ConfigurationAppendersRepository.java?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-plugin/src/main/java/npanday/plugin/impl/ConfigurationAppendersRepository.java (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-plugin/src/main/java/npanday/plugin/impl/ConfigurationAppendersRepository.java Mon Dec 5 10:09:31 2011
@@ -18,48 +18,48 @@
*/
package npanday.plugin.impl;
+import npanday.model.configurationappenders.ConfigurationAppender;
+import npanday.model.configurationappenders.ConfigurationAppenderModel;
+import npanday.model.configurationappenders.io.xpp3.ConfigurationAppendersXpp3Reader;
import npanday.registry.NPandayRepositoryException;
import npanday.registry.Repository;
-import npanday.registry.RepositoryRegistry;
-import npanday.model.configurationappenders.io.xpp3.ConfigurationAppendersXpp3Reader;
-import npanday.model.configurationappenders.ConfigurationAppenderModel;
-import npanday.model.configurationappenders.ConfigurationAppender;
+import npanday.registry.impl.AbstractMultisourceRepository;
+import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import java.io.InputStream;
import java.io.IOException;
import java.io.Reader;
-import java.io.InputStreamReader;
+import java.util.HashSet;
import java.util.Hashtable;
import java.util.List;
import java.util.Set;
-import java.util.HashSet;
-public class ConfigurationAppendersRepository implements Repository
+/**
+ * @author Shane Isbell
+ * @author <a href="mailto:lcorneliussen@apache.org">Lars Corneliussen</a>
+ */
+@Component(role = ConfigurationAppendersRepository.class)
+public class ConfigurationAppendersRepository
+ extends AbstractMultisourceRepository<ConfigurationAppenderModel>
+ implements Repository
{
- private Set<Class> appenderClasses;
+ private Set<Class> appenderClasses = new HashSet<Class>();
- public void load( InputStream inputStream, Hashtable properties )
- throws NPandayRepositoryException
+ @Override
+ protected ConfigurationAppenderModel loadFromReader( Reader reader, Hashtable properties )
+ throws IOException, XmlPullParserException
{
ConfigurationAppendersXpp3Reader xpp3Reader = new ConfigurationAppendersXpp3Reader();
- Reader reader = new InputStreamReader( inputStream );
- ConfigurationAppenderModel model;
- try
- {
- model = xpp3Reader.read( reader );
- }
- catch( IOException e )
- {
- throw new NPandayRepositoryException( "NPANDAY-062-000: An error occurred while reading plugins-compiler.xml", e );
- }
- catch ( XmlPullParserException e )
- {
- throw new NPandayRepositoryException( "NPANDAY-062-001: Could not read plugins-compiler.xml", e );
- }
+
+ return xpp3Reader.read( reader );
+ }
+
+ @Override
+ protected void mergeLoadedModel( ConfigurationAppenderModel model )
+ throws NPandayRepositoryException
+ {
List<ConfigurationAppender> appenders = model.getConfigurationAppenders();
- appenderClasses = new HashSet<Class>();
for(ConfigurationAppender appender : appenders)
{
try
@@ -71,7 +71,6 @@ public class ConfigurationAppendersRepos
throw new NPandayRepositoryException("NPANDAY-xxx-000: Could not load class appender: Name = " + appender.getName(), e );
}
}
-
}
public Set<Class> getAppenderClasses()
@@ -79,24 +78,12 @@ public class ConfigurationAppendersRepos
return appenderClasses;
}
- public void setRepositoryRegistry( RepositoryRegistry repositoryRegistry )
- {
-
- }
-
- /**
- * @see Repository#setSourceUri(String)
- */
- public void setSourceUri( String fileUri )
- {
- // not supported
- }
-
/**
- * @see Repository#reload()
+ * Remove all stored values in preparation for a reload.
*/
- public void reload() throws IOException
+ @Override
+ protected void clear()
{
- // not supported
+ appenderClasses.clear();
}
}
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/pom.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/pom.xml?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/pom.xml (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/pom.xml Mon Dec 5 10:09:31 2011
@@ -53,9 +53,15 @@ under the License.
<dependency>
<groupId>org.openrdf</groupId>
<artifactId>openrdf-sail-memory</artifactId>
- <version>2.0-beta5</version>
- </dependency>
- </dependencies>
+ <version>2.0-beta5</version>
+ </dependency>
+ <dependency>
+ <groupId>org.reflections</groupId>
+ <artifactId>reflections</artifactId>
+ <version>0.9.5</version>
+ </dependency>
+ </dependencies>
+
<reporting>
<plugins>
<plugin>
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/ConnectionsRepository.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/ConnectionsRepository.java?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/ConnectionsRepository.java (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/ConnectionsRepository.java Mon Dec 5 10:09:31 2011
@@ -18,32 +18,31 @@
*/
package npanday.registry;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.codehaus.plexus.component.annotations.Component;
import org.openrdf.repository.RepositoryException;
import org.openrdf.repository.sail.SailRepository;
import org.openrdf.sail.memory.MemoryStore;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-
-import java.io.InputStream;
-import java.io.IOException;
+import javax.naming.OperationNotSupportedException;
import java.io.File;
+import java.net.URL;
+import java.util.Collections;
+import java.util.HashSet;
import java.util.Hashtable;
import java.util.Set;
-import java.util.HashSet;
-import java.util.Collections;
import java.util.logging.Logger;
/**
* Repository for obtaining sets of DAOs.
*/
+@Component(role = ConnectionsRepository.class)
public class ConnectionsRepository
implements Repository
{
private static Logger logger = Logger.getAnonymousLogger();
- private RepositoryRegistry registry;
-
private Set<DataAccessObject> daos = new HashSet<DataAccessObject>();
private Hashtable properties;
@@ -96,7 +95,6 @@ public class ConnectionsRepository
DataAccessObject dao = (DataAccessObject) o;
dao.init( rdfRepository, keyName, daoClassName );
- dao.setRepositoryRegistry( registry );
daos.add( dao );
logger.finest( "NPANDAY-080-001: Adding data access object: Class Name = " + daoClassName );
}
@@ -115,38 +113,34 @@ public class ConnectionsRepository
logger.finest( "NPANDAY-080-004: Connection Start Up: Time = " + ( System.currentTimeMillis() - start ) );
}
- /**
- * @see Repository#load(java.io.InputStream, java.util.Hashtable)
- */
- public void load( InputStream inputStream, Hashtable properties )
+ public void load( URL source )
throws NPandayRepositoryException
{
- this.properties = properties;
+
}
- /**
- * @see Repository#setRepositoryRegistry(RepositoryRegistry)
- */
- public void setRepositoryRegistry( RepositoryRegistry repositoryRegistry )
+ public void clearAll()
+ throws OperationNotSupportedException
{
- this.registry = repositoryRegistry;
+ throw new OperationNotSupportedException( );
}
/**
- * @see Repository#setSourceUri(String)
+ * @see Repository#reloadAll()
*/
- public void setSourceUri( String fileUri )
+ public void reloadAll()
+ throws OperationNotSupportedException
{
- // not supported
+ throw new OperationNotSupportedException( );
}
/**
- * @see Repository#reload()
+ * The properties configured in the registry.
*/
- public void reload()
+ public void setProperties( Hashtable props )
{
- // not supported
- }
+ properties = props;
+ }
/**
* Returns unmodifiable set of all data access objects.
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/DataAccessObject.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/DataAccessObject.java?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/DataAccessObject.java (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/DataAccessObject.java Mon Dec 5 10:09:31 2011
@@ -43,6 +43,4 @@ public interface DataAccessObject
* @throws IllegalArgumentException
*/
void init(Object dataStoreObject, String id, String className ) throws IllegalArgumentException;
-
- void setRepositoryRegistry(RepositoryRegistry repositoryRegistry);
}
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/PropertyRepository.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/PropertyRepository.java?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/PropertyRepository.java (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/PropertyRepository.java Mon Dec 5 10:09:31 2011
@@ -18,10 +18,13 @@
*/
package npanday.registry;
-import java.util.Properties;
-import java.util.Hashtable;
-import java.io.InputStream;
+import org.codehaus.plexus.component.annotations.Component;
+
+import javax.naming.OperationNotSupportedException;
import java.io.IOException;
+import java.net.URL;
+import java.util.Hashtable;
+import java.util.Properties;
/**
* This class is a simple facade for <code>java.util.properties</code>. Repositories that use an underlying properties
@@ -36,8 +39,9 @@ import java.io.IOException;
* </pre>
*
* @author Shane Isbell
+ * @author <a href="mailto:lcorneliussen@apache.org">Lars Corneliussen</a>
*/
-
+@Component(role = PropertyRepository.class)
public class PropertyRepository
implements Repository
{
@@ -48,11 +52,6 @@ public class PropertyRepository
protected Properties properties = new Properties();
/**
- * Internal reference for repositoryRegistry
- */
- protected RepositoryRegistry repositoryRegistry;
-
- /**
* Accessor for properties
*
* @param name the name of the property
@@ -64,44 +63,44 @@ public class PropertyRepository
}
/**
- * @see npanday.registry.Repository#load(InputStream inputStream, Hashtable prop)
+ * @see #load(java.util.Hashtable)
*/
- public void load( InputStream inputStream, Hashtable prop )
+ public void load( URL source )
throws NPandayRepositoryException
{
try
{
- properties.load( inputStream );
+ properties.load( source.openStream() );
}
catch( IOException e )
{
- throw new NPandayRepositoryException( "NPANDAY-088-000: Unable to load properties file.", e);
+ throw new NPandayRepositoryException( "NPANDAY-088-000: Unable to load properties file from " + source, e);
}
}
- /**
- * Mutator for <code>RepositoryRegistry</code>
- *
- * @param repositoryRegistry
+ /**
+ * @see Repository#clearAll()
*/
- public void setRepositoryRegistry( RepositoryRegistry repositoryRegistry )
+ public void clearAll()
+ throws OperationNotSupportedException
{
- this.repositoryRegistry = repositoryRegistry;
+ throw new OperationNotSupportedException( );
}
/**
- * @see Repository#setSourceUri(String)
+ * @see Repository#reloadAll()
*/
- public void setSourceUri( String fileUri )
+ public void reloadAll()
+ throws IOException, OperationNotSupportedException
{
- // not supported
+ throw new OperationNotSupportedException( );
}
/**
- * @see Repository#reload()
+ * The properties configured in the registry.
*/
- public void reload() throws IOException
+ public void setProperties( Hashtable props )
{
- // not supported
+ // we don't need any props
}
}
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/RegistryLoader.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/RegistryLoader.java?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/RegistryLoader.java (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/RegistryLoader.java Mon Dec 5 10:09:31 2011
@@ -48,11 +48,5 @@ public interface RegistryLoader
*/
Hashtable getRepositories();
- /**
- * Sets the repository loader
- *
- * @param repositoryLoader the repository loader
- */
void setRepositoryLoader( RepositoryLoader repositoryLoader );
-
}
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/Repository.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/Repository.java?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/Repository.java (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/Repository.java Mon Dec 5 10:09:31 2011
@@ -18,8 +18,9 @@
*/
package npanday.registry;
-import java.io.InputStream;
+import javax.naming.OperationNotSupportedException;
import java.io.IOException;
+import java.net.URL;
import java.util.Hashtable;
/**
@@ -31,10 +32,9 @@ import java.util.Hashtable;
public interface Repository
{
-
/**
- * Loads the configuration file and configuration properties. In the case below, the <code>inputStream</code>
- * contains the adapters.txt file and the <code>properties</code> holds the init-params. The init params should be
+ * Loads a configuration file or resource. In the case below, the <code>source</code>
+ * contains the <code>Uri</code> for a file or resource and the <code>properties</code> holds the init-params. The init params should be
* used to specialize the repository configuration. The example below shows that you can add new properties
* to <code>MyRepository</code> but not delete them.
* <pre>
@@ -57,31 +57,29 @@ public interface Repository
* </registry-config>
* </pre>
* <p/>
- * Since this method uses an <code>InputStream</code> parameter, the configuration file can be loaded off of the
- * local file system or from a specific URL located at an HTTP address.
*
- * @param inputStream the configuration file
- * @param properties the properties used to configure the repository
+ * @param source
* @throws NPandayRepositoryException thrown on interrupted I/O. Implementing class may also use this exception to throw
- * other exceptions like invalid properties.
+ * other exceptions like invalid properties.
*/
- void load( InputStream inputStream, Hashtable properties )
+ void load( URL source )
throws NPandayRepositoryException;
/**
- * @param repositoryRegistry
+ * Removes all added sources and clears out the contents.
+ * @throws OperationNotSupportedException
*/
- void setRepositoryRegistry( RepositoryRegistry repositoryRegistry );
-
+ void clearAll()
+ throws OperationNotSupportedException;
+
/**
- * Sets the URI of the file used to initialize the repository.
- * @param fileUri
+ * Reloads this repository based on all provided sources.
*/
- void setSourceUri( String fileUri );
+ void reloadAll()
+ throws IOException, NPandayRepositoryException, OperationNotSupportedException;
/**
- * Reloads this repository based on the file uri.
+ * The properties configured in the registry.
*/
- void reload() throws IOException, NPandayRepositoryException;
-
+ void setProperties( Hashtable props );
}
\ No newline at end of file
Modified: incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/RepositoryLoader.java
URL: http://svn.apache.org/viewvc/incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/RepositoryLoader.java?rev=1210393&r1=1210392&r2=1210393&view=diff
==============================================================================
--- incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/RepositoryLoader.java (original)
+++ incubator/npanday/branches/1.5.0-azuresupport/components/dotnet-registry/src/main/java/npanday/registry/RepositoryLoader.java Mon Dec 5 10:09:31 2011
@@ -30,19 +30,7 @@ import java.io.IOException;
public interface RepositoryLoader
{
- /**
- * Takes information from the registry-config file and dynamically builds a <code>Repository</code>
- *
- * @param fileUri name of the repository's configuration file. It may be located on the file system
- * or within a jar.
- * @param repositoryClass name of the repository class
- * @param initParams <code>Hashtable</code> containing the repository's configuration parameters.
- * @return instance of repository
- * @throws IOException
- * @throws NPandayRepositoryException
- */
-
- Repository loadRepository( String fileUri, String repositoryClass, Hashtable initParams )
+ Repository loadRepository( String location, String repositoryClass, Hashtable initParams )
throws IOException, NPandayRepositoryException;
/**