org.overlord.sramp.governance.shell.commands
Class Pkg2SrampCommand

java.lang.Object
  extended by org.overlord.sramp.shell.api.AbstractShellCommand
      extended by org.overlord.sramp.governance.shell.commands.Pkg2SrampCommand
All Implemented Interfaces:
ShellCommand

public class Pkg2SrampCommand
extends AbstractShellCommand

BRMS command that will copy a package out of BRMS and push it into the S-RAMP repository.

Author:
eric.wittmann@redhat.com

Constructor Summary
Pkg2SrampCommand()
          Constructor.
 
Method Summary
protected  void applyAuth(HttpURLConnection connection, String user, String password)
          Applies basic auth to the given HTTP URL connection.
 void execute()
           
protected  org.overlord.sramp.atom.services.brms.assets.Assets getAssetsFromBrms(String brmsBaseUrl, String pkgName)
          Gets the assets from BRMS.
protected  String getAssetsStringFromBrms(String brmsBaseUrl, String pkgName)
          Gets the assets XML as a string.
 org.jboss.resteasy.client.ClientResponse<InputStream> getInputStream(String url)
          Gets the input stream at the given URL.
protected  Map<String,org.overlord.sramp.atom.services.brms.packages.Packages.Package> getPkgsFromBrms(String brmsBaseUrl)
          Gets the packages from BRMS at the given URL.
static void main(String[] args)
          Main entry point - for use outside the interactive shell.
 void printHelp()
           
 void printUsage()
           
 void uploadBrmsPackage(String brmsBaseUrl, String pkgName, String tag, String userId, String password, SrampAtomApiClient client)
          Uploads the BMRS package.
 boolean urlExists(String checkUrl, String user, String password)
          Returns true if the given URL can be accessed.
 
Methods inherited from class org.overlord.sramp.shell.api.AbstractShellCommand
getArguments, getContext, optionalArgument, optionalArgument, print, requiredArgument, setArguments, setContext, setOutput, tabCompletion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pkg2SrampCommand

public Pkg2SrampCommand()
Constructor.

Method Detail

main

public static void main(String[] args)
                 throws Exception
Main entry point - for use outside the interactive shell.

Parameters:
args -
Throws:
Exception

printUsage

public void printUsage()
See Also:
shell.ShellCommand

printHelp

public void printHelp()
See Also:
shell.ShellCommand

execute

public void execute()
             throws Exception
Throws:
Exception
See Also:
shell.ShellCommand

urlExists

public boolean urlExists(String checkUrl,
                         String user,
                         String password)
Returns true if the given URL can be accessed.

Parameters:
checkUrl -
user -
password -

applyAuth

protected void applyAuth(HttpURLConnection connection,
                         String user,
                         String password)
Applies basic auth to the given HTTP URL connection.

Parameters:
connection -
user -
password -

uploadBrmsPackage

public void uploadBrmsPackage(String brmsBaseUrl,
                              String pkgName,
                              String tag,
                              String userId,
                              String password,
                              SrampAtomApiClient client)
                       throws Exception
Uploads the BMRS package.

Parameters:
brmsBaseUrl -
pkgName -
tag -
userId -
password -
client -
Throws:
Exception

getPkgsFromBrms

protected Map<String,org.overlord.sramp.atom.services.brms.packages.Packages.Package> getPkgsFromBrms(String brmsBaseUrl)
                                                                                               throws Exception
Gets the packages from BRMS at the given URL.

Parameters:
brmsBaseUrl -
Throws:
Exception

getAssetsStringFromBrms

protected String getAssetsStringFromBrms(String brmsBaseUrl,
                                         String pkgName)
                                  throws Exception
Gets the assets XML as a string.

Parameters:
brmsBaseUrl -
pkgName -
Throws:
Exception

getAssetsFromBrms

protected org.overlord.sramp.atom.services.brms.assets.Assets getAssetsFromBrms(String brmsBaseUrl,
                                                                                String pkgName)
                                                                         throws Exception
Gets the assets from BRMS.

Parameters:
brmsBaseUrl -
pkgName -
Throws:
Exception

getInputStream

public org.jboss.resteasy.client.ClientResponse<InputStream> getInputStream(String url)
                                                                     throws Exception
Gets the input stream at the given URL.

Parameters:
url -
Throws:
Exception


Copyright © 2011-2013 JBoss, a division of Red Hat. All Rights Reserved.