You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ep...@apache.org on 2006/02/09 08:41:45 UTC

svn commit: r376214 - in /maven/repository-manager/trunk/maven-repository-proxy/src/site: ./ apt/ apt/how-to.apt

Author: epunzalan
Date: Wed Feb  8 23:41:43 2006
New Revision: 376214

URL: http://svn.apache.org/viewcvs?rev=376214&view=rev
Log:
PR: MRM-43

Added how-to apt

Added:
    maven/repository-manager/trunk/maven-repository-proxy/src/site/
    maven/repository-manager/trunk/maven-repository-proxy/src/site/apt/
    maven/repository-manager/trunk/maven-repository-proxy/src/site/apt/how-to.apt

Added: maven/repository-manager/trunk/maven-repository-proxy/src/site/apt/how-to.apt
URL: http://svn.apache.org/viewcvs/maven/repository-manager/trunk/maven-repository-proxy/src/site/apt/how-to.apt?rev=376214&view=auto
==============================================================================
--- maven/repository-manager/trunk/maven-repository-proxy/src/site/apt/how-to.apt (added)
+++ maven/repository-manager/trunk/maven-repository-proxy/src/site/apt/how-to.apt Wed Feb  8 23:41:43 2006
@@ -0,0 +1,73 @@
+ProxyManager
+
+  The ProxyManager is designed to be used as a simple object or bean for use by
+  a command-line application or web application.
+
+Configuration
+
+  An instance of a ProxyManager requires a configuration object that will
+  define its behavior called ProxyConfiguration.  The ProxyConfiguration is a
+  plexus and can be looked up to get an instance of it.  Below is a sample
+  plexus lookup statement:
+
+----------
+  ProxyConfiguration config = (ProxyConfiguration) container.lookup( ProxyConfiguration.ROLE );
+----------
+
+  Currently, a ProxyConfiguration lookup will return an empty instance of the 
+  ProxyConfiguration which means it doesn't have any default definitions yet on
+  how the ProxyManager should behave.  So the next step is to explicitly define
+  its behavior.
+
+----------
+  ProxyConfiguration config = (ProxyConfiguration) container.lookup( ProxyConfiguration.ROLE );
+
+  config.setRepositoryCachePath( "/user/proxy-cache" );
+
+  ArtifactRepositoryLayout defLayout = new DefaultRepositoryLayout();
+
+  File repo1File = new File( "src/test/remote-repo1" );
+
+  ProxyRepository repo1 = new ProxyRepository( "central", "http://www.ibiblio.org/maven2", defLayout );
+
+  config.addRepository( repo1 );
+----------
+
+  The above statements sets up the ProxyConfiguration to use the directory 
+  <<</user/proxy-cache>>> as the location of the proxy's repository cache.
+  Then it creates a ProxyRepository instance with an id of <<<central>>> to
+  look for remote files in ibiblio.org.
+
+Instantiation
+
+  To create or retrieve an instance of a ProxyManager, one will need to use the
+  ProxyManagerFactory.
+
+----------
+  ProxyManagerFactory factory = (ProxyManagerFactory) container.lookup( ProxyManagerFactory.ROLE );
+  proxy = factory.getProxyManager( "default", config );
+----------
+
+  The factory requires two parameters.  The first parameter is the proxy_type
+  that you will want to use. And the second parameter is the ProxyConfiguration
+  which we already did above.  The proxy_type defines the client that the
+  ProxyManager is expected to service.  Currently, only <<<default>>>
+  ProxyManager type is available and is defined to be for Maven 2.x clients.
+
+Usage
+
+* The get() method
+
+  The ProxyManager get( target ) method is used to retrieve a path file.  This
+  method first looks into the cache if the target exists.  If it does not, then
+  the ProxyManager will search all the ProxyRepositories present in its
+  ProxyConfiguration.  When the target path is found, the ProxyManager creates
+  a copy of it in its cache and returns a File instance of the cached copy.
+
+* The getRemoteFile() method
+
+  The ProxyManager getRemoteFile( path ) method is used to force the
+  ProxyManager to ignore the contents of its cache and search all the
+  ProxyRepository objects for the specified path and retrieve it when
+  available.  When successful, the ProxyManager creates a copy of the remote
+  file in its cache and then returns a File instance of the cached copy.
\ No newline at end of file