Adding the suffix '2' to the new security package to easily distinguish it from 
the older code


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/ef66a55c
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/ef66a55c
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/ef66a55c

Branch: refs/heads/rajith-codec
Commit: ef66a55c04a951d4313041d28da95b4df31cdfe8
Parents: 99fa822
Author: Rajith Attapattu <[email protected]>
Authored: Wed May 13 13:07:03 2015 -0400
Committer: Rajith Attapattu <[email protected]>
Committed: Wed May 13 13:07:03 2015 -0400

----------------------------------------------------------------------
 .../qpid/proton/security/SaslChallenge.java     |  88 -------------
 .../apache/qpid/proton/security/SaslCode.java   |  38 ------
 .../apache/qpid/proton/security/SaslInit.java   | 124 -------------------
 .../qpid/proton/security/SaslMechanisms.java    | 105 ----------------
 .../qpid/proton/security/SaslOutcome.java       | 117 -----------------
 .../qpid/proton/security/SaslResponse.java      |  88 -------------
 .../qpid/proton/security2/SaslChallenge.java    |  88 +++++++++++++
 .../apache/qpid/proton/security2/SaslCode.java  |  38 ++++++
 .../apache/qpid/proton/security2/SaslInit.java  | 124 +++++++++++++++++++
 .../qpid/proton/security2/SaslMechanisms.java   | 105 ++++++++++++++++
 .../qpid/proton/security2/SaslOutcome.java      | 117 +++++++++++++++++
 .../qpid/proton/security2/SaslResponse.java     |  88 +++++++++++++
 12 files changed, 560 insertions(+), 560 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ef66a55c/proton-j/src/main/java/org/apache/qpid/proton/security/SaslChallenge.java
----------------------------------------------------------------------
diff --git 
a/proton-j/src/main/java/org/apache/qpid/proton/security/SaslChallenge.java 
b/proton-j/src/main/java/org/apache/qpid/proton/security/SaslChallenge.java
deleted file mode 100644
index d4f62e0..0000000
--- a/proton-j/src/main/java/org/apache/qpid/proton/security/SaslChallenge.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-package org.apache.qpid.proton.security;
-
-import java.util.List;
-
-import org.apache.qpid.proton.codec2.DecodeException;
-import org.apache.qpid.proton.codec2.DescribedTypeFactory;
-import org.apache.qpid.proton.codec2.Encodable;
-import org.apache.qpid.proton.codec2.Encoder;
-
-public final class SaslChallenge implements Encodable
-{
-    public final static long DESCRIPTOR_LONG = 0x0000000000000042L;
-
-    public final static String DESCRIPTOR_STRING = "amqp:sasl-challenge:list";
-
-    public final static Factory FACTORY = new Factory();
-
-    private byte[] _challenge;
-
-    public byte[] getChallenge()
-    {
-        return _challenge;
-    }
-
-    public void setChallenge(byte[] challenge)
-    {
-        if (challenge == null)
-        {
-            throw new NullPointerException("the challenge field is mandatory");
-        }
-
-        _challenge = challenge;
-    }
-
-    @Override
-    public void encode(Encoder encoder)
-    {
-        encoder.putDescriptor();
-        encoder.putUlong(DESCRIPTOR_LONG);
-        encoder.putList();
-        encoder.putBinary(_challenge, 0, _challenge.length);
-        encoder.end();
-    }
-
-    public static final class Factory implements DescribedTypeFactory
-    {
-        @SuppressWarnings("unchecked")
-        public Object create(Object in) throws DecodeException
-        {
-            List<Object> l = (List<Object>) in;
-            SaslChallenge saslChallenge = new SaslChallenge();
-
-            if (l.size() > 0)
-            {
-                saslChallenge.setChallenge((byte[]) l.get(0));
-            }
-
-            return saslChallenge;
-        }
-    }
-
-    @Override
-    public String toString()
-    {
-        return "SaslChallenge{" + "challenge=" + _challenge + '}';
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ef66a55c/proton-j/src/main/java/org/apache/qpid/proton/security/SaslCode.java
----------------------------------------------------------------------
diff --git 
a/proton-j/src/main/java/org/apache/qpid/proton/security/SaslCode.java 
b/proton-j/src/main/java/org/apache/qpid/proton/security/SaslCode.java
deleted file mode 100644
index 9d6b055..0000000
--- a/proton-j/src/main/java/org/apache/qpid/proton/security/SaslCode.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-package org.apache.qpid.proton.security;
-
-public enum SaslCode
-{
-    OK, AUTH, SYS, SYS_PERM, SYS_TEMP;
-
-    public byte getValue()
-    {
-        return (byte) ordinal();
-    }
-
-    public static SaslCode valueOf(byte b)
-    {
-        return SaslCode.values()[b];
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ef66a55c/proton-j/src/main/java/org/apache/qpid/proton/security/SaslInit.java
----------------------------------------------------------------------
diff --git 
a/proton-j/src/main/java/org/apache/qpid/proton/security/SaslInit.java 
b/proton-j/src/main/java/org/apache/qpid/proton/security/SaslInit.java
deleted file mode 100644
index f254c51..0000000
--- a/proton-j/src/main/java/org/apache/qpid/proton/security/SaslInit.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-package org.apache.qpid.proton.security;
-
-import java.util.List;
-
-import org.apache.qpid.proton.codec2.DecodeException;
-import org.apache.qpid.proton.codec2.DescribedTypeFactory;
-import org.apache.qpid.proton.codec2.Encodable;
-import org.apache.qpid.proton.codec2.Encoder;
-
-public final class SaslInit implements Encodable
-{
-    public final static long DESCRIPTOR_LONG = 0x0000000000000042L;
-
-    public final static String DESCRIPTOR_STRING = "amqp:sasl-challenge:list";
-
-    public final static Factory FACTORY = new Factory();
-
-    private String _mechanism;
-
-    private byte[] _initialResponse;
-
-    private String _hostname;
-
-    public String getMechanism()
-    {
-        return _mechanism;
-    }
-
-    public void setMechanism(String mechanism)
-    {
-        if (mechanism == null)
-        {
-            throw new NullPointerException("the mechanism field is mandatory");
-        }
-
-        _mechanism = mechanism;
-    }
-
-    public byte[] getInitialResponse()
-    {
-        return _initialResponse;
-    }
-
-    public void setInitialResponse(byte[] initialResponse)
-    {
-        _initialResponse = initialResponse;
-    }
-
-    public String getHostname()
-    {
-        return _hostname;
-    }
-
-    public void setHostname(String hostname)
-    {
-        _hostname = hostname;
-    }
-
-    @Override
-    public void encode(Encoder encoder)
-    {
-        encoder.putDescriptor();
-        encoder.putUlong(DESCRIPTOR_LONG);
-        encoder.putList();
-        encoder.putSymbol(_mechanism);
-        encoder.putBinary(_initialResponse, 0, _initialResponse.length);
-        encoder.putString(_hostname);
-        encoder.end();
-    }
-
-    public static final class Factory implements DescribedTypeFactory
-    {
-        @SuppressWarnings("unchecked")
-        public Object create(Object in) throws DecodeException
-        {
-            List<Object> l = (List<Object>) in;
-            SaslInit saslInit = new SaslInit();
-
-            switch (3 - l.size())
-            {
-
-            case 0:
-                saslInit.setHostname((String) l.get(2));
-            case 1:
-                saslInit.setInitialResponse((byte[]) l.get(1));
-            case 2:
-                saslInit.setMechanism((String) l.get(0));
-            }
-
-            return saslInit;
-        }
-    }
-
-    @Override
-    public String toString()
-    {
-        return "SaslInit{" +
-               "mechanism=" + _mechanism +
-               ", initialResponse=" + _initialResponse +
-               ", hostname='" + _hostname + '\'' +
-               '}';
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ef66a55c/proton-j/src/main/java/org/apache/qpid/proton/security/SaslMechanisms.java
----------------------------------------------------------------------
diff --git 
a/proton-j/src/main/java/org/apache/qpid/proton/security/SaslMechanisms.java 
b/proton-j/src/main/java/org/apache/qpid/proton/security/SaslMechanisms.java
deleted file mode 100644
index 7c06187..0000000
--- a/proton-j/src/main/java/org/apache/qpid/proton/security/SaslMechanisms.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-package org.apache.qpid.proton.security;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.qpid.proton.codec2.DecodeException;
-import org.apache.qpid.proton.codec2.DescribedTypeFactory;
-import org.apache.qpid.proton.codec2.Encodable;
-import org.apache.qpid.proton.codec2.Encoder;
-import org.apache.qpid.proton.codec2.Type;
-
-public final class SaslMechanisms implements Encodable
-{
-    public final static long DESCRIPTOR_LONG = 0x0000000000000040L;
-
-    public final static String DESCRIPTOR_STRING = "amqp:sasl-mechanisms:list";
-
-    public final static Factory FACTORY = new Factory();
-
-    private String[] _saslServerMechanisms;
-
-    public String[] getSaslServerMechanisms()
-    {
-        return _saslServerMechanisms;
-    }
-
-    public void setSaslServerMechanisms(String... saslServerMechanisms)
-    {
-        if (saslServerMechanisms == null)
-        {
-            throw new NullPointerException("the sasl-server-mechanisms field 
is mandatory");
-        }
-
-        _saslServerMechanisms = saslServerMechanisms;
-    }
-
-    @Override
-    public void encode(Encoder encoder)
-    {
-        encoder.putDescriptor();
-        encoder.putUlong(DESCRIPTOR_LONG);
-        encoder.putList();
-        encoder.putArray(Type.SYMBOL);
-        for (String mech : _saslServerMechanisms)
-        {
-            encoder.putSymbol(mech);
-        }
-        encoder.end();
-        encoder.end();
-    }
-
-    public static final class Factory implements DescribedTypeFactory
-    {
-        @SuppressWarnings("unchecked")
-        public Object create(Object in) throws DecodeException
-        {
-            List<Object> l = (List<Object>) in;
-            SaslMechanisms saslMech = new SaslMechanisms();
-
-            if (l.isEmpty())
-            {
-                throw new DecodeException("The sasl-server-mechanisms field 
cannot be omitted");
-            }
-
-            Object val0 = l.get(0);
-            if (val0 == null || val0.getClass().isArray())
-            {
-                saslMech.setSaslServerMechanisms((String[]) val0);
-            }
-            else
-            {
-                saslMech.setSaslServerMechanisms((String) val0);
-            }
-            return saslMech;
-        }
-    }
-
-    @Override
-    public String toString()
-    {
-        return "SaslMechanisms{" + "saslServerMechanisms="
-                + (_saslServerMechanisms == null ? null : 
Arrays.asList(_saslServerMechanisms)) + '}';
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ef66a55c/proton-j/src/main/java/org/apache/qpid/proton/security/SaslOutcome.java
----------------------------------------------------------------------
diff --git 
a/proton-j/src/main/java/org/apache/qpid/proton/security/SaslOutcome.java 
b/proton-j/src/main/java/org/apache/qpid/proton/security/SaslOutcome.java
deleted file mode 100644
index 9458349..0000000
--- a/proton-j/src/main/java/org/apache/qpid/proton/security/SaslOutcome.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-package org.apache.qpid.proton.security;
-
-import java.util.List;
-
-import org.apache.qpid.proton.codec2.DecodeException;
-import org.apache.qpid.proton.codec2.DescribedTypeFactory;
-import org.apache.qpid.proton.codec2.Encodable;
-import org.apache.qpid.proton.codec2.Encoder;
-
-public final class SaslOutcome implements Encodable
-{
-    public final static long DESCRIPTOR_LONG = 0x0000000000000044L;
-
-    public final static String DESCRIPTOR_STRING = 
"amqp:sasl-saslOutcome:list";
-
-    public final static Factory FACTORY = new Factory();
-
-    private SaslCode _code;
-
-    private byte[] _additionalData;
-
-    public SaslCode getCode()
-    {
-        return _code;
-    }
-
-    public void setCode(SaslCode code)
-    {
-        if (code == null)
-        {
-            throw new NullPointerException("the code field is mandatory");
-        }
-
-        _code = code;
-    }
-
-    public byte[] getAdditionalData()
-    {
-        return _additionalData;
-    }
-
-    public void setAdditionalData(byte[] additionalData)
-    {
-        _additionalData = additionalData;
-    }
-
-    @Override
-    public void encode(Encoder encoder)
-    {
-        encoder.putDescriptor();
-        encoder.putUlong(DESCRIPTOR_LONG);
-        encoder.putList();
-        encoder.putUbyte(_code.getValue());
-        if (_additionalData != null)
-        {
-            encoder.putBinary(_additionalData, 0, _additionalData.length);
-        }
-        encoder.end();
-    }
-
-    public static final class Factory implements DescribedTypeFactory
-    {
-        @SuppressWarnings("unchecked")
-        public Object create(Object in) throws DecodeException
-        {
-            List<Object> l = (List<Object>) in;
-            SaslOutcome saslOutcome = new SaslOutcome();
-
-            if(l.isEmpty())
-            {
-                throw new DecodeException("The code field cannot be omitted");
-            }
-
-            switch(2 - l.size())
-            {
-
-                case 0:
-                    saslOutcome.setAdditionalData( (byte[]) l.get( 1 ) );
-                case 1:
-                    saslOutcome.setCode(SaslCode.valueOf((Byte)l.get(0)));
-            }
-
-
-            return saslOutcome;
-        }
-    }
-
-    @Override
-    public String toString()
-    {
-        return "SaslOutcome{" +
-               "_code=" + _code +
-               ", _additionalData=" + _additionalData +
-               '}';
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ef66a55c/proton-j/src/main/java/org/apache/qpid/proton/security/SaslResponse.java
----------------------------------------------------------------------
diff --git 
a/proton-j/src/main/java/org/apache/qpid/proton/security/SaslResponse.java 
b/proton-j/src/main/java/org/apache/qpid/proton/security/SaslResponse.java
deleted file mode 100644
index a398793..0000000
--- a/proton-j/src/main/java/org/apache/qpid/proton/security/SaslResponse.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-package org.apache.qpid.proton.security;
-
-import java.util.List;
-
-import org.apache.qpid.proton.codec2.DecodeException;
-import org.apache.qpid.proton.codec2.DescribedTypeFactory;
-import org.apache.qpid.proton.codec2.Encodable;
-import org.apache.qpid.proton.codec2.Encoder;
-
-public final class SaslResponse implements Encodable
-{
-    public final static long DESCRIPTOR_LONG = 0x0000000000000043L;
-
-    public final static String DESCRIPTOR_STRING = "amqp:sasl-response:list";
-
-    public final static Factory FACTORY = new Factory();
-
-    private byte[] _response;
-
-    public byte[] getResponse()
-    {
-        return _response;
-    }
-
-    public void setResponse(byte[] response)
-    {
-        if (response == null)
-        {
-            throw new NullPointerException("the response field is mandatory");
-        }
-
-        _response = response;
-    }
-
-    @Override
-    public void encode(Encoder encoder)
-    {
-        encoder.putDescriptor();
-        encoder.putUlong(DESCRIPTOR_LONG);
-        encoder.putList();
-        encoder.putBinary(_response, 0, _response.length);
-        encoder.end();
-    }
-
-    public static final class Factory implements DescribedTypeFactory
-    {
-        @SuppressWarnings("unchecked")
-        public Object create(Object in) throws DecodeException
-        {
-            List<Object> l = (List<Object>) in;
-            SaslResponse saslResponse = new SaslResponse();
-
-            if (l.size() > 0)
-            {
-                saslResponse.setResponse((byte[]) l.get(0));
-            }
-
-            return saslResponse;
-        }
-    }
-
-    @Override
-    public String toString()
-    {
-        return "SaslResponse{response=" + _response + '}';
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ef66a55c/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslChallenge.java
----------------------------------------------------------------------
diff --git 
a/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslChallenge.java 
b/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslChallenge.java
new file mode 100644
index 0000000..7240895
--- /dev/null
+++ b/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslChallenge.java
@@ -0,0 +1,88 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+package org.apache.qpid.proton.security2;
+
+import java.util.List;
+
+import org.apache.qpid.proton.codec2.DecodeException;
+import org.apache.qpid.proton.codec2.DescribedTypeFactory;
+import org.apache.qpid.proton.codec2.Encodable;
+import org.apache.qpid.proton.codec2.Encoder;
+
+public final class SaslChallenge implements Encodable
+{
+    public final static long DESCRIPTOR_LONG = 0x0000000000000042L;
+
+    public final static String DESCRIPTOR_STRING = "amqp:sasl-challenge:list";
+
+    public final static Factory FACTORY = new Factory();
+
+    private byte[] _challenge;
+
+    public byte[] getChallenge()
+    {
+        return _challenge;
+    }
+
+    public void setChallenge(byte[] challenge)
+    {
+        if (challenge == null)
+        {
+            throw new NullPointerException("the challenge field is mandatory");
+        }
+
+        _challenge = challenge;
+    }
+
+    @Override
+    public void encode(Encoder encoder)
+    {
+        encoder.putDescriptor();
+        encoder.putUlong(DESCRIPTOR_LONG);
+        encoder.putList();
+        encoder.putBinary(_challenge, 0, _challenge.length);
+        encoder.end();
+    }
+
+    public static final class Factory implements DescribedTypeFactory
+    {
+        @SuppressWarnings("unchecked")
+        public Object create(Object in) throws DecodeException
+        {
+            List<Object> l = (List<Object>) in;
+            SaslChallenge saslChallenge = new SaslChallenge();
+
+            if (l.size() > 0)
+            {
+                saslChallenge.setChallenge((byte[]) l.get(0));
+            }
+
+            return saslChallenge;
+        }
+    }
+
+    @Override
+    public String toString()
+    {
+        return "SaslChallenge{" + "challenge=" + _challenge + '}';
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ef66a55c/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslCode.java
----------------------------------------------------------------------
diff --git 
a/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslCode.java 
b/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslCode.java
new file mode 100644
index 0000000..4758483
--- /dev/null
+++ b/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslCode.java
@@ -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.
+ *
+ */
+
+package org.apache.qpid.proton.security2;
+
+public enum SaslCode
+{
+    OK, AUTH, SYS, SYS_PERM, SYS_TEMP;
+
+    public byte getValue()
+    {
+        return (byte) ordinal();
+    }
+
+    public static SaslCode valueOf(byte b)
+    {
+        return SaslCode.values()[b];
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ef66a55c/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslInit.java
----------------------------------------------------------------------
diff --git 
a/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslInit.java 
b/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslInit.java
new file mode 100644
index 0000000..b0facf9
--- /dev/null
+++ b/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslInit.java
@@ -0,0 +1,124 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+package org.apache.qpid.proton.security2;
+
+import java.util.List;
+
+import org.apache.qpid.proton.codec2.DecodeException;
+import org.apache.qpid.proton.codec2.DescribedTypeFactory;
+import org.apache.qpid.proton.codec2.Encodable;
+import org.apache.qpid.proton.codec2.Encoder;
+
+public final class SaslInit implements Encodable
+{
+    public final static long DESCRIPTOR_LONG = 0x0000000000000042L;
+
+    public final static String DESCRIPTOR_STRING = "amqp:sasl-challenge:list";
+
+    public final static Factory FACTORY = new Factory();
+
+    private String _mechanism;
+
+    private byte[] _initialResponse;
+
+    private String _hostname;
+
+    public String getMechanism()
+    {
+        return _mechanism;
+    }
+
+    public void setMechanism(String mechanism)
+    {
+        if (mechanism == null)
+        {
+            throw new NullPointerException("the mechanism field is mandatory");
+        }
+
+        _mechanism = mechanism;
+    }
+
+    public byte[] getInitialResponse()
+    {
+        return _initialResponse;
+    }
+
+    public void setInitialResponse(byte[] initialResponse)
+    {
+        _initialResponse = initialResponse;
+    }
+
+    public String getHostname()
+    {
+        return _hostname;
+    }
+
+    public void setHostname(String hostname)
+    {
+        _hostname = hostname;
+    }
+
+    @Override
+    public void encode(Encoder encoder)
+    {
+        encoder.putDescriptor();
+        encoder.putUlong(DESCRIPTOR_LONG);
+        encoder.putList();
+        encoder.putSymbol(_mechanism);
+        encoder.putBinary(_initialResponse, 0, _initialResponse.length);
+        encoder.putString(_hostname);
+        encoder.end();
+    }
+
+    public static final class Factory implements DescribedTypeFactory
+    {
+        @SuppressWarnings("unchecked")
+        public Object create(Object in) throws DecodeException
+        {
+            List<Object> l = (List<Object>) in;
+            SaslInit saslInit = new SaslInit();
+
+            switch (3 - l.size())
+            {
+
+            case 0:
+                saslInit.setHostname((String) l.get(2));
+            case 1:
+                saslInit.setInitialResponse((byte[]) l.get(1));
+            case 2:
+                saslInit.setMechanism((String) l.get(0));
+            }
+
+            return saslInit;
+        }
+    }
+
+    @Override
+    public String toString()
+    {
+        return "SaslInit{" +
+               "mechanism=" + _mechanism +
+               ", initialResponse=" + _initialResponse +
+               ", hostname='" + _hostname + '\'' +
+               '}';
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ef66a55c/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslMechanisms.java
----------------------------------------------------------------------
diff --git 
a/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslMechanisms.java 
b/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslMechanisms.java
new file mode 100644
index 0000000..60451d7
--- /dev/null
+++ 
b/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslMechanisms.java
@@ -0,0 +1,105 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+package org.apache.qpid.proton.security2;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.qpid.proton.codec2.DecodeException;
+import org.apache.qpid.proton.codec2.DescribedTypeFactory;
+import org.apache.qpid.proton.codec2.Encodable;
+import org.apache.qpid.proton.codec2.Encoder;
+import org.apache.qpid.proton.codec2.Type;
+
+public final class SaslMechanisms implements Encodable
+{
+    public final static long DESCRIPTOR_LONG = 0x0000000000000040L;
+
+    public final static String DESCRIPTOR_STRING = "amqp:sasl-mechanisms:list";
+
+    public final static Factory FACTORY = new Factory();
+
+    private String[] _saslServerMechanisms;
+
+    public String[] getSaslServerMechanisms()
+    {
+        return _saslServerMechanisms;
+    }
+
+    public void setSaslServerMechanisms(String... saslServerMechanisms)
+    {
+        if (saslServerMechanisms == null)
+        {
+            throw new NullPointerException("the sasl-server-mechanisms field 
is mandatory");
+        }
+
+        _saslServerMechanisms = saslServerMechanisms;
+    }
+
+    @Override
+    public void encode(Encoder encoder)
+    {
+        encoder.putDescriptor();
+        encoder.putUlong(DESCRIPTOR_LONG);
+        encoder.putList();
+        encoder.putArray(Type.SYMBOL);
+        for (String mech : _saslServerMechanisms)
+        {
+            encoder.putSymbol(mech);
+        }
+        encoder.end();
+        encoder.end();
+    }
+
+    public static final class Factory implements DescribedTypeFactory
+    {
+        @SuppressWarnings("unchecked")
+        public Object create(Object in) throws DecodeException
+        {
+            List<Object> l = (List<Object>) in;
+            SaslMechanisms saslMech = new SaslMechanisms();
+
+            if (l.isEmpty())
+            {
+                throw new DecodeException("The sasl-server-mechanisms field 
cannot be omitted");
+            }
+
+            Object val0 = l.get(0);
+            if (val0 == null || val0.getClass().isArray())
+            {
+                saslMech.setSaslServerMechanisms((String[]) val0);
+            }
+            else
+            {
+                saslMech.setSaslServerMechanisms((String) val0);
+            }
+            return saslMech;
+        }
+    }
+
+    @Override
+    public String toString()
+    {
+        return "SaslMechanisms{" + "saslServerMechanisms="
+                + (_saslServerMechanisms == null ? null : 
Arrays.asList(_saslServerMechanisms)) + '}';
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ef66a55c/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslOutcome.java
----------------------------------------------------------------------
diff --git 
a/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslOutcome.java 
b/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslOutcome.java
new file mode 100644
index 0000000..cebb66c
--- /dev/null
+++ b/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslOutcome.java
@@ -0,0 +1,117 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+package org.apache.qpid.proton.security2;
+
+import java.util.List;
+
+import org.apache.qpid.proton.codec2.DecodeException;
+import org.apache.qpid.proton.codec2.DescribedTypeFactory;
+import org.apache.qpid.proton.codec2.Encodable;
+import org.apache.qpid.proton.codec2.Encoder;
+
+public final class SaslOutcome implements Encodable
+{
+    public final static long DESCRIPTOR_LONG = 0x0000000000000044L;
+
+    public final static String DESCRIPTOR_STRING = 
"amqp:sasl-saslOutcome:list";
+
+    public final static Factory FACTORY = new Factory();
+
+    private SaslCode _code;
+
+    private byte[] _additionalData;
+
+    public SaslCode getCode()
+    {
+        return _code;
+    }
+
+    public void setCode(SaslCode code)
+    {
+        if (code == null)
+        {
+            throw new NullPointerException("the code field is mandatory");
+        }
+
+        _code = code;
+    }
+
+    public byte[] getAdditionalData()
+    {
+        return _additionalData;
+    }
+
+    public void setAdditionalData(byte[] additionalData)
+    {
+        _additionalData = additionalData;
+    }
+
+    @Override
+    public void encode(Encoder encoder)
+    {
+        encoder.putDescriptor();
+        encoder.putUlong(DESCRIPTOR_LONG);
+        encoder.putList();
+        encoder.putUbyte(_code.getValue());
+        if (_additionalData != null)
+        {
+            encoder.putBinary(_additionalData, 0, _additionalData.length);
+        }
+        encoder.end();
+    }
+
+    public static final class Factory implements DescribedTypeFactory
+    {
+        @SuppressWarnings("unchecked")
+        public Object create(Object in) throws DecodeException
+        {
+            List<Object> l = (List<Object>) in;
+            SaslOutcome saslOutcome = new SaslOutcome();
+
+            if(l.isEmpty())
+            {
+                throw new DecodeException("The code field cannot be omitted");
+            }
+
+            switch(2 - l.size())
+            {
+
+                case 0:
+                    saslOutcome.setAdditionalData( (byte[]) l.get( 1 ) );
+                case 1:
+                    saslOutcome.setCode(SaslCode.valueOf((Byte)l.get(0)));
+            }
+
+
+            return saslOutcome;
+        }
+    }
+
+    @Override
+    public String toString()
+    {
+        return "SaslOutcome{" +
+               "_code=" + _code +
+               ", _additionalData=" + _additionalData +
+               '}';
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/ef66a55c/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslResponse.java
----------------------------------------------------------------------
diff --git 
a/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslResponse.java 
b/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslResponse.java
new file mode 100644
index 0000000..5d8ff15
--- /dev/null
+++ b/proton-j/src/main/java/org/apache/qpid/proton/security2/SaslResponse.java
@@ -0,0 +1,88 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+package org.apache.qpid.proton.security2;
+
+import java.util.List;
+
+import org.apache.qpid.proton.codec2.DecodeException;
+import org.apache.qpid.proton.codec2.DescribedTypeFactory;
+import org.apache.qpid.proton.codec2.Encodable;
+import org.apache.qpid.proton.codec2.Encoder;
+
+public final class SaslResponse implements Encodable
+{
+    public final static long DESCRIPTOR_LONG = 0x0000000000000043L;
+
+    public final static String DESCRIPTOR_STRING = "amqp:sasl-response:list";
+
+    public final static Factory FACTORY = new Factory();
+
+    private byte[] _response;
+
+    public byte[] getResponse()
+    {
+        return _response;
+    }
+
+    public void setResponse(byte[] response)
+    {
+        if (response == null)
+        {
+            throw new NullPointerException("the response field is mandatory");
+        }
+
+        _response = response;
+    }
+
+    @Override
+    public void encode(Encoder encoder)
+    {
+        encoder.putDescriptor();
+        encoder.putUlong(DESCRIPTOR_LONG);
+        encoder.putList();
+        encoder.putBinary(_response, 0, _response.length);
+        encoder.end();
+    }
+
+    public static final class Factory implements DescribedTypeFactory
+    {
+        @SuppressWarnings("unchecked")
+        public Object create(Object in) throws DecodeException
+        {
+            List<Object> l = (List<Object>) in;
+            SaslResponse saslResponse = new SaslResponse();
+
+            if (l.size() > 0)
+            {
+                saslResponse.setResponse((byte[]) l.get(0));
+            }
+
+            return saslResponse;
+        }
+    }
+
+    @Override
+    public String toString()
+    {
+        return "SaslResponse{response=" + _response + '}';
+    }
+}
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to