Skip to content

Commit

Permalink
https://issues.apache.org/jira/browse/AMQCPP-511
Browse files Browse the repository at this point in the history
  • Loading branch information
tabish121 committed Oct 24, 2013
1 parent 204deea commit 5be7173
Show file tree
Hide file tree
Showing 22 changed files with 2,299 additions and 127 deletions.
9 changes: 9 additions & 0 deletions activemq-cpp/src/main/Makefile.am
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ cc_sources = \
decaf/internal/net/SocketFileDescriptor.cpp \ decaf/internal/net/SocketFileDescriptor.cpp \
decaf/internal/net/URIEncoderDecoder.cpp \ decaf/internal/net/URIEncoderDecoder.cpp \
decaf/internal/net/URIHelper.cpp \ decaf/internal/net/URIHelper.cpp \
decaf/internal/net/URIType.cpp \
decaf/internal/net/URLType.cpp \
decaf/internal/net/ssl/DefaultSSLContext.cpp \ decaf/internal/net/ssl/DefaultSSLContext.cpp \
decaf/internal/net/ssl/DefaultSSLServerSocketFactory.cpp \ decaf/internal/net/ssl/DefaultSSLServerSocketFactory.cpp \
decaf/internal/net/ssl/DefaultSSLSocketFactory.cpp \ decaf/internal/net/ssl/DefaultSSLSocketFactory.cpp \
Expand Down Expand Up @@ -475,6 +477,8 @@ cc_sources = \
decaf/lang/exceptions/NumberFormatException.cpp \ decaf/lang/exceptions/NumberFormatException.cpp \
decaf/lang/exceptions/OutOfMemoryError.cpp \ decaf/lang/exceptions/OutOfMemoryError.cpp \
decaf/lang/exceptions/RuntimeException.cpp \ decaf/lang/exceptions/RuntimeException.cpp \
decaf/lang/exceptions/SecurityException.cpp \
decaf/lang/exceptions/StringIndexOutOfBoundsException.cpp \
decaf/lang/exceptions/UnsupportedOperationException.cpp \ decaf/lang/exceptions/UnsupportedOperationException.cpp \
decaf/net/BindException.cpp \ decaf/net/BindException.cpp \
decaf/net/ConnectException.cpp \ decaf/net/ConnectException.cpp \
Expand All @@ -491,6 +495,7 @@ cc_sources = \
decaf/net/NoRouteToHostException.cpp \ decaf/net/NoRouteToHostException.cpp \
decaf/net/PortUnreachableException.cpp \ decaf/net/PortUnreachableException.cpp \
decaf/net/ProtocolException.cpp \ decaf/net/ProtocolException.cpp \
decaf/net/Proxy.cpp \
decaf/net/ServerSocket.cpp \ decaf/net/ServerSocket.cpp \
decaf/net/ServerSocketFactory.cpp \ decaf/net/ServerSocketFactory.cpp \
decaf/net/Socket.cpp \ decaf/net/Socket.cpp \
Expand Down Expand Up @@ -1020,6 +1025,7 @@ h_sources = \
decaf/internal/net/URIEncoderDecoder.h \ decaf/internal/net/URIEncoderDecoder.h \
decaf/internal/net/URIHelper.h \ decaf/internal/net/URIHelper.h \
decaf/internal/net/URIType.h \ decaf/internal/net/URIType.h \
decaf/internal/net/URLType.h \
decaf/internal/net/ssl/DefaultSSLContext.h \ decaf/internal/net/ssl/DefaultSSLContext.h \
decaf/internal/net/ssl/DefaultSSLServerSocketFactory.h \ decaf/internal/net/ssl/DefaultSSLServerSocketFactory.h \
decaf/internal/net/ssl/DefaultSSLSocketFactory.h \ decaf/internal/net/ssl/DefaultSSLSocketFactory.h \
Expand Down Expand Up @@ -1152,6 +1158,8 @@ h_sources = \
decaf/lang/exceptions/NumberFormatException.h \ decaf/lang/exceptions/NumberFormatException.h \
decaf/lang/exceptions/OutOfMemoryError.h \ decaf/lang/exceptions/OutOfMemoryError.h \
decaf/lang/exceptions/RuntimeException.h \ decaf/lang/exceptions/RuntimeException.h \
decaf/lang/exceptions/SecurityException.h \
decaf/lang/exceptions/StringIndexOutOfBoundsException.h \
decaf/lang/exceptions/UnsupportedOperationException.h \ decaf/lang/exceptions/UnsupportedOperationException.h \
decaf/net/BindException.h \ decaf/net/BindException.h \
decaf/net/ConnectException.h \ decaf/net/ConnectException.h \
Expand All @@ -1168,6 +1176,7 @@ h_sources = \
decaf/net/NoRouteToHostException.h \ decaf/net/NoRouteToHostException.h \
decaf/net/PortUnreachableException.h \ decaf/net/PortUnreachableException.h \
decaf/net/ProtocolException.h \ decaf/net/ProtocolException.h \
decaf/net/Proxy.h \
decaf/net/ServerSocket.h \ decaf/net/ServerSocket.h \
decaf/net/ServerSocketFactory.h \ decaf/net/ServerSocketFactory.h \
decaf/net/Socket.h \ decaf/net/Socket.h \
Expand Down
61 changes: 61 additions & 0 deletions activemq-cpp/src/main/decaf/internal/net/URIType.cpp
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "URIType.h"

using namespace decaf;
using namespace decaf::internal;
using namespace decaf::internal::net;

////////////////////////////////////////////////////////////////////////////////
URIType::URIType(const std::string& source) : source(source),
scheme(),
schemeSpecificPart(),
authority(),
userinfo(),
host(),
port(-1),
path(),
query(),
fragment(),
opaque(false),
absolute(false),
serverAuthority(false),
valid(false),
hashCode(-1) {
}

////////////////////////////////////////////////////////////////////////////////
URIType::URIType() : source(),
scheme(),
schemeSpecificPart(),
authority(),
userinfo(),
host(),
port( -1 ),
path(),
query(),
fragment(),
opaque(false),
absolute(false),
serverAuthority(false),
valid(false),
hashCode(-1) {
}

////////////////////////////////////////////////////////////////////////////////
URIType::~URIType() {}
82 changes: 36 additions & 46 deletions activemq-cpp/src/main/decaf/internal/net/URIType.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -45,42 +45,14 @@ namespace net {
bool absolute; bool absolute;
bool serverAuthority; bool serverAuthority;
bool valid; bool valid;
int hashCode;


public: public:


URIType( const std::string& source ) : source( source ), URIType();
scheme(), URIType(const std::string& source);
schemeSpecificPart(),
authority(),
userinfo(),
host(),
port( -1 ),
path(),
query(),
fragment(),
opaque( false ),
absolute( false ),
serverAuthority( false ),
valid( false ) {
}

URIType() : source(),
scheme(),
schemeSpecificPart(),
authority(),
userinfo(),
host(),
port( -1 ),
path(),
query(),
fragment(),
opaque( false ),
absolute( false ),
serverAuthority( false ),
valid( false ) {
}


virtual ~URIType() {} virtual ~URIType();


/** /**
* Gets the source URI string that was parsed to obtain this URIType * Gets the source URI string that was parsed to obtain this URIType
Expand All @@ -96,7 +68,7 @@ namespace net {
* instance and the resulting data, * instance and the resulting data,
* @param source - the source URI string * @param source - the source URI string
*/ */
void setSource( const std::string& source ) { void setSource(const std::string& source) {
this->source = source; this->source = source;
} }


Expand All @@ -112,7 +84,7 @@ namespace net {
* Sets the Scheme of the URI, e.g. scheme ("http"/"ftp"/...). * Sets the Scheme of the URI, e.g. scheme ("http"/"ftp"/...).
* @param scheme - scheme part string. * @param scheme - scheme part string.
*/ */
void setScheme( const std::string& scheme ) { void setScheme(const std::string& scheme) {
this->scheme = scheme; this->scheme = scheme;
} }


Expand All @@ -128,7 +100,7 @@ namespace net {
* Sets the Scheme Specific Part of the URI. * Sets the Scheme Specific Part of the URI.
* @param schemeSpecificPart - scheme specific part string. * @param schemeSpecificPart - scheme specific part string.
*/ */
void setSchemeSpecificPart( const std::string& schemeSpecificPart ) { void setSchemeSpecificPart(const std::string& schemeSpecificPart) {
this->schemeSpecificPart = schemeSpecificPart; this->schemeSpecificPart = schemeSpecificPart;
} }


Expand All @@ -144,7 +116,7 @@ namespace net {
* Sets the Authority of the URI. * Sets the Authority of the URI.
* @param authority Authority part string. * @param authority Authority part string.
*/ */
void setAuthority( const std::string& authority ) { void setAuthority(const std::string& authority) {
this->authority = authority; this->authority = authority;
} }


Expand All @@ -162,7 +134,7 @@ namespace net {
* http://user:passwd@host:port/ * http://user:passwd@host:port/
* @param userinfo - user info part string. * @param userinfo - user info part string.
*/ */
void setUserInfo( const std::string& userinfo ) { void setUserInfo(const std::string& userinfo) {
this->userinfo = userinfo; this->userinfo = userinfo;
} }


Expand All @@ -178,7 +150,7 @@ namespace net {
* Sets the Host name part of the URI. * Sets the Host name part of the URI.
* @param host - Host name part string. * @param host - Host name part string.
*/ */
void setHost( const std::string& host ) { void setHost(const std::string& host) {
this->host = host; this->host = host;
} }


Expand All @@ -194,7 +166,7 @@ namespace net {
* Sets the port part of the URI. * Sets the port part of the URI.
* @param port - port part string, -1 if not set. * @param port - port part string, -1 if not set.
*/ */
void setPort( int port ) { void setPort(int port) {
this->port = port; this->port = port;
} }


Expand All @@ -210,7 +182,7 @@ namespace net {
* Sets the Path part of the URI. * Sets the Path part of the URI.
* @param path - Path part string. * @param path - Path part string.
*/ */
void setPath( const std::string& path ) { void setPath(const std::string& path) {
this->path = path; this->path = path;
} }


Expand All @@ -226,7 +198,7 @@ namespace net {
* Sets the Query part of the URI. * Sets the Query part of the URI.
* @param query - Query part string. * @param query - Query part string.
*/ */
void setQuery( const std::string& query ) { void setQuery(const std::string& query) {
this->query = query; this->query = query;
} }


Expand All @@ -242,7 +214,7 @@ namespace net {
* Sets the Fragment part of the URI. * Sets the Fragment part of the URI.
* @param fragment - Fragment part string. * @param fragment - Fragment part string.
*/ */
void setFragment( const std::string& fragment ) { void setFragment(const std::string& fragment) {
this->fragment = fragment; this->fragment = fragment;
} }


Expand All @@ -258,7 +230,7 @@ namespace net {
* Sets if the URI is Opaque. * Sets if the URI is Opaque.
* @param opaque true if opaque. * @param opaque true if opaque.
*/ */
void setOpaque( bool opaque ) { void setOpaque(bool opaque) {
this->opaque = opaque; this->opaque = opaque;
} }


Expand All @@ -274,7 +246,7 @@ namespace net {
* Sets if the URI is Absolute. * Sets if the URI is Absolute.
* @param absolute - true if Absolute. * @param absolute - true if Absolute.
*/ */
void setAbsolute( bool absolute ) { void setAbsolute(bool absolute) {
this->absolute = absolute; this->absolute = absolute;
} }


Expand All @@ -290,7 +262,7 @@ namespace net {
* Sets if the URI is a Server Authority. * Sets if the URI is a Server Authority.
* @param serverAuthority - true if Server Authority. * @param serverAuthority - true if Server Authority.
*/ */
void setServerAuthority( bool serverAuthority ) { void setServerAuthority(bool serverAuthority) {
this->serverAuthority = serverAuthority; this->serverAuthority = serverAuthority;
} }


Expand All @@ -308,10 +280,28 @@ namespace net {
* parsed and all relevant data fields have been set. * parsed and all relevant data fields have been set.
* @param valid - true if the URIType contains valid data. * @param valid - true if the URIType contains valid data.
*/ */
void setValid( bool valid ) { void setValid(bool valid) {
this->valid = valid; this->valid = valid;
} }


/**
* Gets the computed hashCode for this URIType or return -1 if non is set
*
* @returns the hash code for this URIType instance or -1 if not set.
*/
int getHashCode() const {
return this->hashCode;
}

/**
* Sets the hash code for this URIType instance.
*
* @param hashCode
* The new hash code that's been computed for this URIType instance.
*/
void setHashCode(int hashCode) {
this->hashCode = hashCode;
}
}; };


}}} }}}
Expand Down
38 changes: 38 additions & 0 deletions activemq-cpp/src/main/decaf/internal/net/URLType.cpp
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "URLType.h"

using namespace decaf;
using namespace decaf::internal;
using namespace decaf::internal::net;

////////////////////////////////////////////////////////////////////////////////
URLType::URLType() : file(),
protocol(),
host(),
port(-1),
authority(),
userInfo(),
path(),
query(),
ref(),
hashCode(-1) {
}

////////////////////////////////////////////////////////////////////////////////
URLType::~URLType() {}
Loading

0 comments on commit 5be7173

Please sign in to comment.