mirror of
https://github.com/apache/archiva.git
synced 2025-02-07 02:29:23 +00:00
- updated sample xmlrpc client
- added @ServiceBeanField annotations to ManagedRepository and RemoteRepository git-svn-id: https://svn.apache.org/repos/asf/archiva/branches@705500 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f102abb7ea
commit
e54d726cd4
@ -22,6 +22,7 @@
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.atlassian.xmlrpc.ServiceBean;
|
||||
import com.atlassian.xmlrpc.ServiceBeanField;
|
||||
|
||||
@ServiceBean
|
||||
public class ManagedRepository
|
||||
@ -39,6 +40,11 @@ public class ManagedRepository
|
||||
|
||||
private boolean releases = false;
|
||||
|
||||
public ManagedRepository()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ManagedRepository( String id, String name, String url, String layout, boolean snapshots, boolean releases )
|
||||
{
|
||||
this.id = id;
|
||||
@ -108,31 +114,37 @@ public boolean isSnapshots()
|
||||
return this.snapshots;
|
||||
}
|
||||
|
||||
@ServiceBeanField( "id" )
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@ServiceBeanField( "layout" )
|
||||
public void setLayout(String layout)
|
||||
{
|
||||
this.layout = layout;
|
||||
}
|
||||
|
||||
@ServiceBeanField( "name" )
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@ServiceBeanField( "releases" )
|
||||
public void setReleases(boolean releases)
|
||||
{
|
||||
this.releases = releases;
|
||||
}
|
||||
|
||||
@ServiceBeanField( "snapshots" )
|
||||
public void setSnapshots(boolean snapshots)
|
||||
{
|
||||
this.snapshots = snapshots;
|
||||
}
|
||||
|
||||
@ServiceBeanField( "url" )
|
||||
public void setUrl(String url)
|
||||
{
|
||||
this.url = url;
|
||||
|
@ -22,6 +22,7 @@
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.atlassian.xmlrpc.ServiceBean;
|
||||
import com.atlassian.xmlrpc.ServiceBeanField;
|
||||
|
||||
@ServiceBean
|
||||
public class RemoteRepository
|
||||
@ -35,6 +36,11 @@ public class RemoteRepository
|
||||
|
||||
private String layout;
|
||||
|
||||
public RemoteRepository()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public RemoteRepository( String id, String name, String url, String layout )
|
||||
{
|
||||
this.id = id;
|
||||
@ -89,31 +95,27 @@ public int hashCode()
|
||||
return result;
|
||||
}
|
||||
|
||||
@ServiceBeanField( "id" )
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@ServiceBeanField( "layout" )
|
||||
public void setLayout(String layout)
|
||||
{
|
||||
this.layout = layout;
|
||||
}
|
||||
|
||||
@ServiceBeanField( "name" )
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@ServiceBeanField( "url" )
|
||||
public void setUrl(String url)
|
||||
{
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public java.lang.String toString()
|
||||
{
|
||||
StringBuffer buf = new StringBuffer();
|
||||
buf.append( "id = '" );
|
||||
buf.append( getId() + "'" );
|
||||
return buf.toString();
|
||||
}
|
||||
}
|
||||
}
|
@ -35,6 +35,11 @@
|
||||
<artifactId>xmlrpc-client</artifactId>
|
||||
<version>3.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<version>1.8.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
@ -45,13 +50,45 @@
|
||||
<executable>java</executable>
|
||||
<mainClass>org.apache.archiva.web.xmlrpc.client.SampleClient</mainClass>
|
||||
<arguments>
|
||||
<!-- URL ex. http://127.0.0.1:8080/archiva/xmlrpc -->
|
||||
<!--
|
||||
URL: ex. http://127.0.0.1:8080/archiva/xmlrpc
|
||||
USERNAME & PASSWORD: Archiva credentials
|
||||
-->
|
||||
<argument>URL</argument>
|
||||
<argument>USERNAME</argument>
|
||||
<argument>PASSWORD</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- override parent config, commons-logging cannot be excluded from commons-beanutils - NoClassDef error occurs -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>1.0-alpha-3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>enforce</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<rules>
|
||||
<bannedDependencies>
|
||||
<excludes>
|
||||
<exclude>org.codehaus.plexus:plexus-container-default</exclude>
|
||||
<exclude>velocity:velocity-dep</exclude>
|
||||
<exclude>classworlds:classworlds</exclude>
|
||||
<exclude>javax.transaction:jta</exclude>
|
||||
<exclude>javax.sql:jdbc-stdext</exclude>
|
||||
<exclude>ant:ant-optional</exclude>
|
||||
<!-- exclude>org.apache.maven.wagon:wagon-http-lightweight</exclude -->
|
||||
<exclude>xom:xom</exclude>
|
||||
</excludes>
|
||||
</bannedDependencies>
|
||||
</rules>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
@ -19,6 +19,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Iterator;
|
||||
@ -29,6 +30,7 @@
|
||||
import org.apache.archiva.web.xmlrpc.api.AdministrationService;
|
||||
import org.apache.archiva.web.xmlrpc.api.beans.ManagedRepository;
|
||||
import org.apache.archiva.web.xmlrpc.api.beans.RemoteRepository;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
import org.apache.xmlrpc.client.XmlRpcClient;
|
||||
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
|
||||
@ -75,7 +77,19 @@ public static void main( String[] args )
|
||||
for( int i = 0; i < managedRepos.length; i++ )
|
||||
{
|
||||
System.out.println( "=================================" );
|
||||
ManagedRepository managedRepo = (ManagedRepository) managedRepos[i];
|
||||
ManagedRepository managedRepo = new ManagedRepository();
|
||||
try
|
||||
{
|
||||
BeanUtils.populate( managedRepo, (Map)managedRepos[i] );
|
||||
}
|
||||
catch ( IllegalAccessException e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch ( InvocationTargetException e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println( "Id: " + managedRepo.getId() );
|
||||
System.out.println( "Name: " + managedRepo.getName() );
|
||||
System.out.println( "Layout: " + managedRepo.getLayout() );
|
||||
@ -86,14 +100,27 @@ public static void main( String[] args )
|
||||
|
||||
/* remote repositories */
|
||||
params = new Object[]{};
|
||||
Object[] remoteReposObj = (Object[])
|
||||
Object[] remoteRepos = (Object[])
|
||||
client.execute( "AdministrationService.getAllRemoteRepositories", params );
|
||||
|
||||
System.out.println( "\n******** Remote Repositories ********" );
|
||||
for( int i = 0; i < remoteReposObj.length; i++ )
|
||||
for( int i = 0; i < remoteRepos.length; i++ )
|
||||
{
|
||||
System.out.println( "=================================" );
|
||||
RemoteRepository remoteRepo = (RemoteRepository) remoteReposObj[i];
|
||||
RemoteRepository remoteRepo = new RemoteRepository();
|
||||
|
||||
try
|
||||
{
|
||||
BeanUtils.populate( remoteRepo, (Map) remoteRepos[i] );
|
||||
}
|
||||
catch ( IllegalAccessException e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
catch ( InvocationTargetException e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println( "Id: " + remoteRepo.getId() );
|
||||
System.out.println( "Name: " + remoteRepo.getName() );
|
||||
System.out.println( "Layout: " + remoteRepo.getLayout() );
|
||||
|
Loading…
x
Reference in New Issue
Block a user