summaryrefslogtreecommitdiffstats
path: root/aai-core
diff options
context:
space:
mode:
Diffstat (limited to 'aai-core')
-rw-r--r--aai-core/src/main/java/org/onap/aai/db/schema/AuditOXM.java11
-rw-r--r--aai-core/src/main/java/org/onap/aai/introspection/Introspector.java6
-rw-r--r--aai-core/src/main/java/org/onap/aai/introspection/JSONStrategy.java5
-rw-r--r--aai-core/src/main/java/org/onap/aai/introspection/MoxyStrategy.java96
-rw-r--r--aai-core/src/main/java/org/onap/aai/introspection/PojoInjestor.java6
-rw-r--r--aai-core/src/main/java/org/onap/aai/introspection/PojoStrategy.java18
-rw-r--r--aai-core/src/main/java/org/onap/aai/introspection/tools/InjectKeysFromURI.java5
-rw-r--r--aai-core/src/main/java/org/onap/aai/logging/CNName.java6
-rw-r--r--aai-core/src/main/java/org/onap/aai/parsers/uri/URIToObject.java5
-rw-r--r--aai-core/src/main/java/org/onap/aai/util/HttpsAuthClient.java2
10 files changed, 89 insertions, 71 deletions
diff --git a/aai-core/src/main/java/org/onap/aai/db/schema/AuditOXM.java b/aai-core/src/main/java/org/onap/aai/db/schema/AuditOXM.java
index 0a3650fa..5ebfeb20 100644
--- a/aai-core/src/main/java/org/onap/aai/db/schema/AuditOXM.java
+++ b/aai-core/src/main/java/org/onap/aai/db/schema/AuditOXM.java
@@ -106,15 +106,8 @@ public class AuditOXM extends Auditor {
for (int i = 0; i < list.getLength(); i++) {
result.add(list.item(i).getAttributes().getNamedItem("name").getNodeValue());
}
- } catch (ParserConfigurationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (SAXException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ } catch (ParserConfigurationException | SAXException | IOException e) {
+ LOGGER.error(e.getMessage());
}
result.remove("EdgePropNames");
diff --git a/aai-core/src/main/java/org/onap/aai/introspection/Introspector.java b/aai-core/src/main/java/org/onap/aai/introspection/Introspector.java
index fa8be863..16680a84 100644
--- a/aai-core/src/main/java/org/onap/aai/introspection/Introspector.java
+++ b/aai-core/src/main/java/org/onap/aai/introspection/Introspector.java
@@ -82,7 +82,7 @@ public abstract class Introspector implements Cloneable {
this.set(convertedName, clazz.newInstance());
result = this.get(convertedName);
} catch (DynamicException | InstantiationException | IllegalAccessException e) {
-
+ LOGGER.warn(e.getMessage(),e);
}
}
@@ -106,7 +106,7 @@ public abstract class Introspector implements Cloneable {
this.set(convertedName, clazz.newInstance());
value = this.get(convertedName);
} catch (DynamicException | InstantiationException | IllegalAccessException e) {
-
+ LOGGER.warn(e.getMessage(),e);
}
}
if (value != null) {
@@ -138,7 +138,7 @@ public abstract class Introspector implements Cloneable {
this.set(convertedName, clazz.newInstance());
value = this.get(convertedName);
} catch (DynamicException | InstantiationException | IllegalAccessException e) {
-
+ LOGGER.warn(e.getMessage(),e);
}
}
diff --git a/aai-core/src/main/java/org/onap/aai/introspection/JSONStrategy.java b/aai-core/src/main/java/org/onap/aai/introspection/JSONStrategy.java
index db8a7d06..d36e39b7 100644
--- a/aai-core/src/main/java/org/onap/aai/introspection/JSONStrategy.java
+++ b/aai-core/src/main/java/org/onap/aai/introspection/JSONStrategy.java
@@ -21,6 +21,8 @@
*/
package org.onap.aai.introspection;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.json.simple.JSONObject;
import org.onap.aai.schema.enums.ObjectMetadata;
import org.onap.aai.schema.enums.PropertyMetadata;
@@ -32,6 +34,7 @@ import java.util.Set;
import java.util.UUID;
public class JSONStrategy extends Introspector {
+ private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(JSONStrategy.class);
private JSONObject json = null;
private String namedType = "";
@@ -158,6 +161,7 @@ public class JSONStrategy extends Introspector {
try {
return this.getClass(name).newInstance();
} catch (InstantiationException | IllegalAccessException e) {
+ LOGGER.error(e.getMessage(),e);
return null;
}
}
@@ -167,6 +171,7 @@ public class JSONStrategy extends Introspector {
try {
return this.getGenericTypeClass(name).newInstance();
} catch (InstantiationException | IllegalAccessException e) {
+ LOGGER.error(e.getMessage(),e);
return null;
}
}
diff --git a/aai-core/src/main/java/org/onap/aai/introspection/MoxyStrategy.java b/aai-core/src/main/java/org/onap/aai/introspection/MoxyStrategy.java
index c5f4570d..235df0cc 100644
--- a/aai-core/src/main/java/org/onap/aai/introspection/MoxyStrategy.java
+++ b/aai-core/src/main/java/org/onap/aai/introspection/MoxyStrategy.java
@@ -21,6 +21,8 @@
*/
package org.onap.aai.introspection;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import com.google.common.base.CaseFormat;
import com.google.common.base.Joiner;
import org.eclipse.persistence.descriptors.ClassDescriptor;
@@ -49,7 +51,9 @@ import java.util.*;
import java.util.Map.Entry;
public class MoxyStrategy extends Introspector {
-
+
+ private static final EELFLogger LOGGER2 = EELFManager.getInstance().getLogger(MoxyStrategy.class);
+
private DynamicEntity internalObject = null;
private DynamicType internalType = null;
private DynamicJAXBContext jaxbContext = null;
@@ -62,7 +66,7 @@ public class MoxyStrategy extends Introspector {
private Set<String> requiredProperties = null;
private boolean isInitialized = false;
-
+
protected MoxyStrategy(Object obj) {
super(obj);
/* must look up the correct jaxbcontext for this object */
@@ -79,11 +83,11 @@ public class MoxyStrategy extends Introspector {
marshaller = jaxbContext.createMarshaller();
unmarshaller = jaxbContext.createUnmarshaller();
} catch (JAXBException e) {
-
+ LOGGER2.error(e.getMessage(),e);
}
}
-
+
private void init() {
isInitialized = true;
@@ -94,13 +98,13 @@ public class MoxyStrategy extends Introspector {
}
props = Collections.unmodifiableSet(props);
this.properties = props;
-
+
Set<String> requiredProps = new LinkedHashSet<>();
requiredProps = new LinkedHashSet<>();
for (DatabaseMapping dm : cd.getMappings()) {
- if (dm.getField() instanceof XMLField) {
+ if (dm.getField() instanceof XMLField) {
XMLField x = (XMLField)dm.getField();
- if (x != null) {
+ if (x != null) {
if (x.isRequired()) {
requiredProps.add(this.removeXPathDescriptor(x.getName()));
}
@@ -109,25 +113,25 @@ public class MoxyStrategy extends Introspector {
}
requiredProps = Collections.unmodifiableSet(requiredProps);
this.requiredProperties = requiredProps;
-
+
Set<String> keys = new LinkedHashSet<>();
-
+
for (String name : internalType.getDescriptor().getPrimaryKeyFieldNames()) {
keys.add(this.removeXPathDescriptor(name));
}
keys = Collections.unmodifiableSet(keys);
this.keys = keys;
-
-
+
+
}
-
+
@Override
public boolean hasProperty(String name) {
String convertedName = convertPropertyName(name);
- return internalType.containsProperty(convertedName);
+ return internalType.containsProperty(convertedName);
}
-
+
@Override
public Object get(String name) {
return internalObject.get(name);
@@ -135,7 +139,7 @@ public class MoxyStrategy extends Introspector {
@Override
public void set(String name, Object obj) throws IllegalArgumentException {
-
+
internalObject.set(name, obj);
}
@@ -147,7 +151,7 @@ public class MoxyStrategy extends Introspector {
}
return this.properties;
-
+
}
@Override
@@ -169,7 +173,7 @@ public class MoxyStrategy extends Introspector {
return this.keys;
}
-
+
@Override
public Map<PropertyMetadata, String> getPropertyMetadata(String prop) {
String propName = this.convertPropertyName(prop);
@@ -182,7 +186,7 @@ public class MoxyStrategy extends Introspector {
PropertyMetadata.valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, (String)entry.getKey())), (String)entry.getValue());
}
}
-
+
return result;
}
@@ -190,8 +194,8 @@ public class MoxyStrategy extends Introspector {
public String getJavaClassName() {
return internalObject.getClass().getName();
}
-
-
+
+
@Override
public Class<?> getClass(String name) {
@@ -201,7 +205,7 @@ public class MoxyStrategy extends Introspector {
if (internalType.getPropertyType(name) == null) {
if (cd.getMappingForAttributeName(name) instanceof XMLCompositeDirectCollectionMapping) {
resultClass = cd.getMappingForAttributeName(name).getContainerPolicy().getContainerClass();
-
+
} else if (cd.getMappingForAttributeName(name) instanceof XMLCompositeCollectionMapping) {
resultClass = cd.getMappingForAttributeName(name).getContainerPolicy().getContainerClass();
} else {
@@ -217,6 +221,7 @@ public class MoxyStrategy extends Introspector {
}
} catch (DynamicException e) {
//property doesn't exist
+ LOGGER2.error(e.getMessage(),e);
}
return resultClass;
}
@@ -233,7 +238,7 @@ public class MoxyStrategy extends Introspector {
resultClass = cd.getMappingForAttributeName(name).getReferenceDescriptor().getJavaClass();
}
}
-
+
return resultClass;
}
@@ -241,20 +246,20 @@ public class MoxyStrategy extends Introspector {
public Object getUnderlyingObject() {
return this.internalObject;
}
-
+
@Override
public String getChildName() {
-
+
String className = internalObject.getClass().getSimpleName();
String lowerHyphen = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, className);
-
+
if (this.isContainer()) {
lowerHyphen = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN,this.getGenericTypeClass(this.getProperties().iterator().next()).getSimpleName());
}
-
+
return lowerHyphen;
}
-
+
@Override
public String getName() {
String className = internalObject.getClass().getSimpleName();
@@ -263,11 +268,11 @@ public class MoxyStrategy extends Introspector {
if (this.isContainer()) {
lowerHyphen = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN,this.getGenericTypeClass(this.getProperties().get(0)).getSimpleName());
}*/
-
+
return lowerHyphen;
}
-
+
@Override
public String getObjectId() throws UnsupportedEncodingException {
String result = "";
@@ -275,17 +280,17 @@ public class MoxyStrategy extends Introspector {
if (this.isContainer()) {
result += "/" + this.getName();
} else {
-
+
if (container != null) {
result += "/" + container;
}
result += "/" + this.getDbName() + "/" + this.findKey();
-
+
}
-
+
return result;
}
-
+
@Override
protected String findKey() throws UnsupportedEncodingException {
Set<String> keys = null;
@@ -295,10 +300,10 @@ public class MoxyStrategy extends Introspector {
String value = UriUtils.encode(this.getValue(key).toString(), "UTF-8");
results.add(value);
}
-
+
return Joiner.on("/").join(results);
}
-
+
@Override
public String preProcessKey (String key) {
String result = "";
@@ -306,19 +311,19 @@ public class MoxyStrategy extends Introspector {
String[] split = key.split("/");
int i = 0;
for (i = split.length-1; i >= 0; i--) {
-
+
if (jaxbContext.getDynamicType(split[i]) != null) {
break;
-
+
}
-
+
}
result = Joiner.on("/").join(Arrays.copyOfRange(split, 0, i));
-
+
return result;
-
+
}
-
+
@Override
public String marshal(MarshallerProperties properties) {
StringWriter result = new StringWriter();
@@ -332,12 +337,12 @@ public class MoxyStrategy extends Introspector {
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, properties.getFormatted());
marshaller.marshal(this.internalObject, result);
} catch (JAXBException e) {
- //e.printStackTrace();
+ LOGGER2.error(e.getMessage(),e);
}
return result.toString();
}
-
+
@Override
public Object clone() {
Object result = null;
@@ -347,11 +352,10 @@ public class MoxyStrategy extends Introspector {
unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, "application/json");
unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, false);
unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME, true);
-
+
result = unmarshaller.unmarshal(new StreamSource(new StringReader(this.marshal(true))), this.internalObject.getClass()).getValue();
} catch (JAXBException e) {
- // TODO Auto-generated catch block
- //e.printStackTrace();
+ LOGGER2.error(e.getMessage(),e);
}
result = IntrospectorFactory.newInstance(getModelType(), result);
return result;
diff --git a/aai-core/src/main/java/org/onap/aai/introspection/PojoInjestor.java b/aai-core/src/main/java/org/onap/aai/introspection/PojoInjestor.java
index 5de9c748..4a805d46 100644
--- a/aai-core/src/main/java/org/onap/aai/introspection/PojoInjestor.java
+++ b/aai-core/src/main/java/org/onap/aai/introspection/PojoInjestor.java
@@ -21,6 +21,8 @@
*/
package org.onap.aai.introspection;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.eclipse.persistence.jaxb.JAXBContextFactory;
import org.onap.aai.db.props.AAIProperties;
@@ -30,6 +32,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class PojoInjestor {
+ private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(PojoInjestor.class);
private String POJO_CLASSPATH = "org.onap.aai.domain.yang";
private final Pattern classNamePattern = Pattern.compile("\\.(v\\d+)\\.");
@@ -45,8 +48,7 @@ public class PojoInjestor {
}
context = JAXBContextFactory.createContext(POJO_CLASSPATH, this.getClass().getClassLoader());
} catch (JAXBException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ LOGGER.error(e.getMessage(),e);
}
return context;
diff --git a/aai-core/src/main/java/org/onap/aai/introspection/PojoStrategy.java b/aai-core/src/main/java/org/onap/aai/introspection/PojoStrategy.java
index 6e29729d..9a8c4487 100644
--- a/aai-core/src/main/java/org/onap/aai/introspection/PojoStrategy.java
+++ b/aai-core/src/main/java/org/onap/aai/introspection/PojoStrategy.java
@@ -21,6 +21,8 @@
*/
package org.onap.aai.introspection;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import com.google.common.base.CaseFormat;
import com.google.common.base.Joiner;
import com.google.common.collect.Multimap;
@@ -43,6 +45,7 @@ import java.lang.reflect.*;
import java.util.*;
public class PojoStrategy extends Introspector {
+ private static final EELFLogger LOGGER2 = EELFManager.getInstance().getLogger(PojoStrategy.class);
private Object internalObject = null;
private PojoInjestor injestor = null;
@@ -72,7 +75,7 @@ public class PojoStrategy extends Introspector {
marshaller = jaxbContext.createMarshaller();
unmarshaller = jaxbContext.createUnmarshaller();
} catch (JAXBException e) {
-
+ LOGGER2.error(e.getMessage(),e);
}
}
@@ -133,6 +136,7 @@ public class PojoStrategy extends Introspector {
try {
return this.internalObject.getClass().getDeclaredMethod(getMethodName).invoke(this.internalObject);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
+ LOGGER2.error(e.getMessage(),e);
return null;
}
}
@@ -181,7 +185,7 @@ public class PojoStrategy extends Introspector {
try {
field = this.internalObject.getClass().getDeclaredField(CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, name));
} catch (NoSuchFieldException | SecurityException e) {
-
+ LOGGER2.error(e.getMessage(),e);
return null;
}
@@ -202,6 +206,7 @@ public class PojoStrategy extends Introspector {
}
} catch (Exception e) {
+ LOGGER2.error(e.getMessage(),e);
return null;
}
}
@@ -252,7 +257,7 @@ public class PojoStrategy extends Introspector {
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, properties.getFormatted());
marshaller.marshal(this.internalObject, result);
} catch (JAXBException e) {
- //e.printStackTrace();
+ LOGGER2.error(e.getMessage(),e);
}
return result.toString();
@@ -270,8 +275,7 @@ public class PojoStrategy extends Introspector {
result = unmarshaller.unmarshal(new StreamSource(new StringReader(this.marshal(true))), this.internalObject.getClass()).getValue();
} catch (JAXBException e) {
- // TODO Auto-generated catch block
- //e.printStackTrace();
+ LOGGER2.error(e.getMessage(),e);
}
result = IntrospectorFactory.newInstance(getModelType(), result);
return result;
@@ -336,7 +340,7 @@ public class PojoStrategy extends Introspector {
}
}
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
- // TODO Auto-generated catch block
+ LOGGER2.error(e.getMessage(),e);
}
return result;
@@ -363,7 +367,7 @@ public class PojoStrategy extends Introspector {
try {
value = (String)this.classLevelMetadata.getClass().getMethod(methodName).invoke(classLevelMetadata);
} catch (IllegalArgumentException | IllegalAccessException | SecurityException | InvocationTargetException | NoSuchMethodException e) {
- //TODO
+ LOGGER2.error(e.getMessage(),e);
}
return value;
diff --git a/aai-core/src/main/java/org/onap/aai/introspection/tools/InjectKeysFromURI.java b/aai-core/src/main/java/org/onap/aai/introspection/tools/InjectKeysFromURI.java
index e7d86273..f109a62f 100644
--- a/aai-core/src/main/java/org/onap/aai/introspection/tools/InjectKeysFromURI.java
+++ b/aai-core/src/main/java/org/onap/aai/introspection/tools/InjectKeysFromURI.java
@@ -21,6 +21,8 @@
*/
package org.onap.aai.introspection.tools;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
import org.onap.aai.parsers.uri.URIToObject;
@@ -28,6 +30,7 @@ import org.onap.aai.parsers.uri.URIToObject;
import java.net.URI;
public class InjectKeysFromURI implements IssueResolver {
+ private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(InjectKeysFromURI.class);
private URI uri = null;
private Loader loader = null;
@@ -59,7 +62,7 @@ public class InjectKeysFromURI implements IssueResolver {
result = true;
}
} catch (Exception e) {
- //log something probably
+ LOGGER.error(e.getMessage(),e);
result = false;
}
}
diff --git a/aai-core/src/main/java/org/onap/aai/logging/CNName.java b/aai-core/src/main/java/org/onap/aai/logging/CNName.java
index 7adbe87a..de5e99e5 100644
--- a/aai-core/src/main/java/org/onap/aai/logging/CNName.java
+++ b/aai-core/src/main/java/org/onap/aai/logging/CNName.java
@@ -23,6 +23,8 @@ package org.onap.aai.logging;
import ch.qos.logback.access.pattern.AccessConverter;
import ch.qos.logback.access.spi.IAccessEvent;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import javax.security.auth.x500.X500Principal;
import javax.servlet.http.HttpServletRequest;
@@ -31,6 +33,7 @@ import java.security.cert.X509Certificate;
import static java.util.Base64.getDecoder;
public class CNName extends AccessConverter {
+ private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(CNName.class);
/**
* Converts access events to String response codes
@@ -83,7 +86,8 @@ public class CNName extends AccessConverter {
authUser = subjectDN.toString();
return authUser;
}
- } catch(Exception ex){
+ } catch(Exception e){
+ LOGGER.error(e.getMessage(),e);
return "-";
}
} else {
diff --git a/aai-core/src/main/java/org/onap/aai/parsers/uri/URIToObject.java b/aai-core/src/main/java/org/onap/aai/parsers/uri/URIToObject.java
index cae5c2e8..6d5d98ae 100644
--- a/aai-core/src/main/java/org/onap/aai/parsers/uri/URIToObject.java
+++ b/aai-core/src/main/java/org/onap/aai/parsers/uri/URIToObject.java
@@ -21,6 +21,8 @@
*/
package org.onap.aai.parsers.uri;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
@@ -44,7 +46,7 @@ import java.util.List;
*
*/
public class URIToObject implements Parsable {
-
+ private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(URIToObject.class);
private Introspector topEntity = null;
@@ -203,6 +205,7 @@ public class URIToObject implements Parsable {
}
}
} catch (UnsupportedEncodingException e) {
+ LOGGER.error(e.getMessage(),e);
}
this.previous = entity;
}
diff --git a/aai-core/src/main/java/org/onap/aai/util/HttpsAuthClient.java b/aai-core/src/main/java/org/onap/aai/util/HttpsAuthClient.java
index 5deb48ae..9d15f095 100644
--- a/aai-core/src/main/java/org/onap/aai/util/HttpsAuthClient.java
+++ b/aai-core/src/main/java/org/onap/aai/util/HttpsAuthClient.java
@@ -106,13 +106,13 @@ public class HttpsAuthClient{
char[] pwd = keystore_password.toCharArray();
ks.load(fin, pwd);
kmf.init(ks, pwd);
+ ctx.init(kmf.getKeyManagers(), null, null);
} catch (Exception e) {
System.out.println("Error setting up kmf: exiting");
e.printStackTrace();
System.exit(1);
}
- ctx.init(kmf.getKeyManagers(), null, null);
config.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
new HTTPSProperties( new HostnameVerifier() {
@Override