Skip to content

Commit

Permalink
Added ExpathCryptoErrorCode.
Browse files Browse the repository at this point in the history
  • Loading branch information
claudius108 committed Nov 9, 2018
1 parent 31e67a3 commit baebcc0
Show file tree
Hide file tree
Showing 58 changed files with 275 additions and 249 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
<Description>${project.description}</Description>
<Implementation-URL>${project.url}</Implementation-URL>

<!-- following is needed by kuberam-expath-plugin to successfully generate its components.xml -->
<!-- following is needed by Claudius Teodorescu-expath-plugin to successfully generate its components.xml -->
<ModuleNamespace>${crypto.module.namespace}</ModuleNamespace>
</manifestEntries>
</archive>
Expand Down
39 changes: 0 additions & 39 deletions src/main/java/org/expath/exist/crypto/CryptoException.java

This file was deleted.

37 changes: 37 additions & 0 deletions src/main/java/org/expath/exist/crypto/EXpathCryptoException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.expath.exist.crypto;

import org.exist.xquery.ErrorCodes.ErrorCode;
import org.exist.xquery.Expression;
import org.exist.xquery.XPathException;

/**
* eXist-db EXPath Cryptographic library eXist-db wrapper for EXPath
* Cryptographic Java library Copyright (C) 2018 Claudius Teodorescu
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

public class EXpathCryptoException extends XPathException {

private static final long serialVersionUID = -6789727720893604433L;

public EXpathCryptoException(Expression expr, ErrorCode errorCode) {
super(expr, errorCode, errorCode.getDescription());
}

public EXpathCryptoException(Expression expr, ErrorCode errorCode, String expathCryptoErrorDescription) {
super(expr, errorCode, expathCryptoErrorDescription);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* eXist-db EXPath Cryptographic library
* eXist-db wrapper for EXPath Cryptographic Java library
* Copyright (C) 2016 Kuberam
* Copyright (C) 2016 Claudius Teodorescu
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
Expand Down Expand Up @@ -36,6 +36,7 @@
import org.expath.exist.crypto.digitalSignature.ValidateSignatureFunction;
import org.expath.exist.crypto.encrypt.EncryptionFunctions;

import ro.kuberam.libs.java.crypto.CryptoError;
import ro.kuberam.libs.java.crypto.ExpathCryptoModule;

import static org.exist.xquery.FunctionDSL.functionDefs;
Expand All @@ -54,7 +55,7 @@ public class ExistExpathCryptoModule extends AbstractInternalModule {
public final static String INCLUSION_DATE = "2011-03-24";
public final static String RELEASED_IN_VERSION = "eXist-1.5";

public final static ErrorCode EXXQDYFT0001 = new ExpathCryptoErrorCode("EXXQDYFT0001", "Permission denied.");
public final static ErrorCode NO_FUNCTION = new ExpathCryptoErrorCode("NO_FUNCTION", "No function");

private final static FunctionDef[] functions = functionDefs(functionDefs(HashFunction.class, HashFunction.FS_HASH),
functionDefs(HmacFunction.class, HmacFunction.FS_HMAC),
Expand Down Expand Up @@ -97,11 +98,11 @@ public static FunctionSignature[] functionSignatures(final String name, final St
variableParamTypes);
}

protected final static class ExpathCryptoErrorCode extends ErrorCode {
public static ExpathCryptoErrorCode getErrorCode(CryptoError cryptoError) {
return new ExpathCryptoErrorCode(cryptoError);
}

public ExpathCryptoErrorCode(String code, String description) {
super(new QName(code, NAMESPACE_URI, PREFIX), description);
}
public final static class ExpathCryptoErrorCode extends ErrorCode {

}
}
16 changes: 16 additions & 0 deletions src/main/java/org/expath/exist/crypto/ExpathCryptoErrorCode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.expath.exist.crypto;

import org.exist.dom.QName;
import org.exist.xquery.ErrorCodes.ErrorCode;

import ro.kuberam.libs.java.crypto.CryptoError;

public class ExpathCryptoErrorCode extends ErrorCode {
public ExpathCryptoErrorCode(String code, String description) {
super(new QName(code, ExistExpathCryptoModule.NAMESPACE_URI, ExistExpathCryptoModule.PREFIX), description);
}

public ExpathCryptoErrorCode(CryptoError cryptoError) {
super(new QName(cryptoError.getCode(), ExistExpathCryptoModule.NAMESPACE_URI, ExistExpathCryptoModule.PREFIX), cryptoError.getDescription());
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* eXist-db EXPath Cryptographic library
* eXist-db wrapper for EXPath Cryptographic Java library
* Copyright (C) 2016 Kuberam
* Copyright (C) 2016 Claudius Teodorescu
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* eXist-db EXPath Cryptographic library
* eXist-db wrapper for EXPath Cryptographic Java library
* Copyright (C) 2016 Kuberam
* Copyright (C) 2016 Claudius Teodorescu
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* eXist-db EXPath Cryptographic library
* eXist-db wrapper for EXPath Cryptographic Java library
* Copyright (C) 2016 Kuberam
* Copyright (C) 2016 Claudius Teodorescu
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* eXist-db EXPath Cryptographic library
* eXist-db wrapper for EXPath Cryptographic Java library
* Copyright (C) 2016 Kuberam
* Copyright (C) 2016 Claudius Teodorescu
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* eXist-db EXPath Cryptographic library
* eXist-db wrapper for EXPath Cryptographic Java library
* Copyright (C) 2016 Kuberam
* Copyright (C) 2016 Claudius Teodorescu
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
Expand Down
Loading

0 comments on commit baebcc0

Please sign in to comment.