Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
adityakalia committed Aug 22, 2016
1 parent 371716c commit 5e57970
Show file tree
Hide file tree
Showing 45 changed files with 84 additions and 76 deletions.
Binary file modified libs/smbj-0.0.4-dev.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@
*/
package com.xebialabs.overthere.cifs;

import java.util.Collections;
import java.util.Map;

import com.xebialabs.overthere.ConnectionOptions;
import com.xebialabs.overthere.OverthereConnection;
import com.xebialabs.overthere.cifs.telnet.CifsTelnetConnection;
import com.xebialabs.overthere.cifs.winrm.CifsWinRmConnection;
import com.xebialabs.overthere.cifs.winrs.CifsWinrsConnection;
import com.xebialabs.overthere.smb.ConnectionBuilder;
import com.xebialabs.overthere.spi.AddressPortMapper;
import com.xebialabs.overthere.spi.OverthereConnectionBuilder;
import com.xebialabs.overthere.spi.Protocol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.regex.Pattern;

import com.xebialabs.overthere.RuntimeIOException;
import com.xebialabs.overthere.smb.PathMapper;

import static com.xebialabs.overthere.cifs.CifsConnectionBuilder.CIFS_PORT_DEFAULT;
import static java.lang.String.format;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@

import com.xebialabs.overthere.*;
import com.xebialabs.overthere.cifs.CifsConnection;
import com.xebialabs.overthere.cifs.ConnectionValidator;
import com.xebialabs.overthere.smb.ConnectionValidator;
import com.xebialabs.overthere.smb.telnet.TelnetConnection;
import com.xebialabs.overthere.spi.AddressPortMapper;

import static com.xebialabs.overthere.cifs.CifsConnectionBuilder.CIFS_PROTOCOL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
import com.xebialabs.overthere.Overthere;
import com.xebialabs.overthere.OverthereProcess;
import com.xebialabs.overthere.cifs.CifsConnection;
import com.xebialabs.overthere.cifs.ConnectionValidator;
import com.xebialabs.overthere.smb.ConnectionValidator;
import com.xebialabs.overthere.smb.winrm.WinRmConnection;
import com.xebialabs.overthere.spi.AddressPortMapper;

import static com.xebialabs.overthere.cifs.CifsConnectionBuilder.CIFS_PROTOCOL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@

import com.xebialabs.overthere.*;
import com.xebialabs.overthere.cifs.CifsConnection;
import com.xebialabs.overthere.cifs.ConnectionValidator;
import com.xebialabs.overthere.smb.ConnectionValidator;
import com.xebialabs.overthere.smb.winrs.WinrsConnection;
import com.xebialabs.overthere.spi.AddressPortMapper;

import static com.xebialabs.overthere.OperatingSystemFamily.WINDOWS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs;
package com.xebialabs.overthere.smb;

import java.util.Collections;
import java.util.Map;

import static com.xebialabs.overthere.cifs.WinrmHttpsCertificateTrustStrategy.STRICT;
import static com.xebialabs.overthere.cifs.WinrmHttpsHostnameVerificationStrategy.BROWSER_COMPATIBLE;
import static com.xebialabs.overthere.local.LocalConnection.LOCAL_PROTOCOL;

public abstract class ConnectionBuilder {
Expand Down Expand Up @@ -89,7 +87,7 @@ public abstract class ConnectionBuilder {
/**
* See <a href="https://github.com/xebialabs/overthere/blob/master/README.md#cifs_winrmHttpsCertificateTrustStrategy">the online documentation</a>
*/
public static final WinrmHttpsCertificateTrustStrategy WINRM_HTTPS_CERTIFICATE_TRUST_STRATEGY_DEFAULT = STRICT;
public static final WinrmHttpsCertificateTrustStrategy WINRM_HTTPS_CERTIFICATE_TRUST_STRATEGY_DEFAULT = WinrmHttpsCertificateTrustStrategy.STRICT;

/**
* See <a href="https://github.com/xebialabs/overthere/blob/master/README.md#cifs_winrmHttpsHostnameVerificationStrategy">the online documentation</a>
Expand All @@ -99,7 +97,7 @@ public abstract class ConnectionBuilder {
/**
* See <a href="https://github.com/xebialabs/overthere/blob/master/README.md#cifs_winrmHttpsHostnameVerificationStrategy">the online documentation</a>
*/
public static final WinrmHttpsHostnameVerificationStrategy WINRM_HTTPS_HOSTNAME_VERIFICATION_STRATEGY_DEFAULT = BROWSER_COMPATIBLE;
public static final WinrmHttpsHostnameVerificationStrategy WINRM_HTTPS_HOSTNAME_VERIFICATION_STRATEGY_DEFAULT = WinrmHttpsHostnameVerificationStrategy.BROWSER_COMPATIBLE;

/**
* See <a href="https://github.com/xebialabs/overthere/blob/master/README.md#cifs_winrmKerberosDebug">the online documentation</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs;
package com.xebialabs.overthere.smb;

import com.xebialabs.overthere.OperatingSystemFamily;
import com.xebialabs.overthere.cifs.CifsConnectionType;
import com.xebialabs.overthere.spi.AddressPortMapper;
import com.xebialabs.overthere.util.DefaultAddressPortMapper;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs;
package com.xebialabs.overthere.smb;

import java.util.*;
import java.util.Map.Entry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs;
package com.xebialabs.overthere.smb;

import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs;
package com.xebialabs.overthere.smb;

import org.apache.http.conn.ssl.DefaultHostnameVerifier;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.telnet;
package com.xebialabs.overthere.smb.telnet;

import com.xebialabs.overthere.*;
import com.xebialabs.overthere.cifs.CifsConnectionType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.winrm;
package com.xebialabs.overthere.smb.winrm;

import java.util.HashMap;
import javax.security.auth.login.AppConfigurationEntry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.winrm;
package com.xebialabs.overthere.smb.winrm;

import java.util.HashMap;
import javax.security.auth.login.AppConfigurationEntry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.winrm;
package com.xebialabs.overthere.smb.winrm;

import org.dom4j.Namespace;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.winrm;
package com.xebialabs.overthere.smb.winrm;

import java.io.IOException;
import javax.security.auth.callback.Callback;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.winrm;
package com.xebialabs.overthere.smb.winrm;

import org.dom4j.DocumentHelper;
import org.dom4j.Namespace;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.winrm;
package com.xebialabs.overthere.smb.winrm;

import com.xebialabs.overthere.cifs.WinrmHttpsCertificateTrustStrategy;
import com.xebialabs.overthere.cifs.WinrmHttpsHostnameVerificationStrategy;
import com.xebialabs.overthere.cifs.winrm.soap.*;
import com.xebialabs.overthere.smb.WinrmHttpsCertificateTrustStrategy;
import com.xebialabs.overthere.smb.WinrmHttpsHostnameVerificationStrategy;
import com.xebialabs.overthere.smb.winrm.soap.*;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.winrm;
package com.xebialabs.overthere.smb.winrm;

import com.xebialabs.overthere.*;
import com.xebialabs.overthere.cifs.CifsConnectionType;
import com.xebialabs.overthere.cifs.WinrmHttpsCertificateTrustStrategy;
import com.xebialabs.overthere.cifs.WinrmHttpsHostnameVerificationStrategy;
import com.xebialabs.overthere.cifs.winrm.CifsWinRmConnection;
import com.xebialabs.overthere.smb.WinrmHttpsCertificateTrustStrategy;
import com.xebialabs.overthere.smb.WinrmHttpsHostnameVerificationStrategy;
import com.xebialabs.overthere.spi.AddressPortMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.winrm;
package com.xebialabs.overthere.smb.winrm;

import java.io.IOException;
import java.io.StringWriter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.winrm;
package com.xebialabs.overthere.smb.winrm;

import org.apache.http.auth.Credentials;
import org.apache.http.auth.KerberosCredentials;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.winrm;
package com.xebialabs.overthere.smb.winrm;

import org.apache.http.auth.AuthScheme;
import org.apache.http.impl.auth.KerberosSchemeFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.winrm;
package com.xebialabs.overthere.smb.winrm;

import org.apache.http.auth.Credentials;
import org.apache.http.auth.KerberosCredentials;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.winrm;
package com.xebialabs.overthere.smb.winrm;

import org.apache.http.auth.AuthScheme;
import org.apache.http.impl.auth.SPNegoSchemeFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.winrm.soap;
package com.xebialabs.overthere.smb.winrm.soap;

import java.net.URI;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.winrm.soap;
package com.xebialabs.overthere.smb.winrm.soap;

import org.dom4j.Element;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,16 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.winrm.soap;
package com.xebialabs.overthere.smb.winrm.soap;

import java.net.URI;
import java.util.List;
import org.dom4j.Element;
import org.dom4j.QName;

import static com.xebialabs.overthere.cifs.winrm.Namespaces.NS_ADDRESSING;
import static com.xebialabs.overthere.cifs.winrm.Namespaces.NS_WSMAN_DMTF;
import static com.xebialabs.overthere.cifs.winrm.Namespaces.NS_WSMAN_MSFT;
import static com.xebialabs.overthere.cifs.winrm.soap.Soapy.mustUnderstand;
import static com.xebialabs.overthere.cifs.winrm.soap.Soapy.needNotUnderstand;
import static com.xebialabs.overthere.smb.winrm.Namespaces.NS_ADDRESSING;
import static com.xebialabs.overthere.smb.winrm.Namespaces.NS_WSMAN_DMTF;
import static com.xebialabs.overthere.smb.winrm.Namespaces.NS_WSMAN_MSFT;

public class HeaderBuilder {
private Element header;
Expand All @@ -47,12 +45,12 @@ public HeaderBuilder to(URI address) {

public HeaderBuilder replyTo(URI address) {
final Element replyTo = header.addElement(QName.get("ReplyTo", NS_ADDRESSING));
mustUnderstand(replyTo.addElement(QName.get("Address", NS_ADDRESSING))).addText(address.toString());
Soapy.mustUnderstand(replyTo.addElement(QName.get("Address", NS_ADDRESSING))).addText(address.toString());
return this;
}

public HeaderBuilder maxEnvelopeSize(int size) {
mustUnderstand(header.addElement(QName.get("MaxEnvelopeSize", NS_WSMAN_DMTF))).addText("" + size);
Soapy.mustUnderstand(header.addElement(QName.get("MaxEnvelopeSize", NS_WSMAN_DMTF))).addText("" + size);
return this;
}

Expand All @@ -62,8 +60,8 @@ public HeaderBuilder withId(String id) {
}

public HeaderBuilder withLocale(String locale) {
needNotUnderstand(header.addElement(QName.get("Locale", NS_WSMAN_DMTF))).addAttribute("xml:lang", locale);
needNotUnderstand(header.addElement(QName.get("DataLocale", NS_WSMAN_MSFT))).addAttribute("xml:lang", locale);
Soapy.needNotUnderstand(header.addElement(QName.get("Locale", NS_WSMAN_DMTF))).addAttribute("xml:lang", locale);
Soapy.needNotUnderstand(header.addElement(QName.get("DataLocale", NS_WSMAN_MSFT))).addAttribute("xml:lang", locale);
return this;
}

Expand All @@ -73,7 +71,7 @@ public HeaderBuilder withTimeout(String timeout) {
}

public HeaderBuilder withAction(URI uri) {
mustUnderstand(header.addElement(QName.get("Action", NS_ADDRESSING))).addText(uri.toString());
Soapy.mustUnderstand(header.addElement(QName.get("Action", NS_ADDRESSING))).addText(uri.toString());
return this;
}

Expand All @@ -85,7 +83,7 @@ public HeaderBuilder withShellId(String shellId) {
}

public HeaderBuilder withResourceURI(URI uri) {
mustUnderstand(header.addElement(QName.get("ResourceURI", NS_WSMAN_DMTF))).addText(uri.toString());
Soapy.mustUnderstand(header.addElement(QName.get("ResourceURI", NS_WSMAN_DMTF))).addText(uri.toString());
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.winrm.soap;
package com.xebialabs.overthere.smb.winrm.soap;

public class KeyValuePair {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.winrm.soap;
package com.xebialabs.overthere.smb.winrm.soap;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.winrm.soap;
package com.xebialabs.overthere.smb.winrm.soap;

import java.net.URI;
import java.net.URISyntaxException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.winrm.soap;
package com.xebialabs.overthere.smb.winrm.soap;

public enum SoapAction {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
package com.xebialabs.overthere.cifs.winrm.soap;
package com.xebialabs.overthere.smb.winrm.soap;

import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.QName;

import static com.xebialabs.overthere.cifs.winrm.Namespaces.NS_SOAP_ENV;
import static com.xebialabs.overthere.smb.winrm.Namespaces.NS_SOAP_ENV;

public class SoapMessageBuilder {

Expand Down
Loading

0 comments on commit 5e57970

Please sign in to comment.