Code Review
/
ccsdk
/
sli
/
adaptors.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fix handling of non-OSGi
[ccsdk/sli/adaptors.git]
/
aai-service
/
provider
/
src
/
main
/
java
/
org
/
onap
/
ccsdk
/
sli
/
adaptors
/
aai
/
AAIRequest.java
diff --git
a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java
b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java
index
c66ae06
..
9facab8
100755
(executable)
--- a/
aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java
+++ b/
aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java
@@
-20,7
+20,10
@@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
+/**
+ * @author Rich Tabedzki
+ *
+ */
package org.onap.ccsdk.sli.adaptors.aai;
import java.io.IOException;
package org.onap.ccsdk.sli.adaptors.aai;
import java.io.IOException;
@@
-48,7
+51,7
@@
import java.util.Set;
import java.util.TreeSet;
import org.apache.commons.lang.StringUtils;
import java.util.TreeSet;
import org.apache.commons.lang.StringUtils;
-import org.onap.aai.inventory.v
14
.GenericVnf;
+import org.onap.aai.inventory.v
21
.GenericVnf;
import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@
-114,8
+117,6
@@
public abstract class AAIRequest {
switch(resoource){
case "generic-query":
return new GenericQueryRequest();
switch(resoource){
case "generic-query":
return new GenericQueryRequest();
- case "named-query":
- return new NamedQueryRequest();
case "nodes-query":
return new NodesQueryRequest();
case "custom-query":
case "nodes-query":
return new NodesQueryRequest();
case "custom-query":
@@
-161,8
+162,11
@@
public abstract class AAIRequest {
AAIRequest.configProperties = props;
AAIRequest.aaiService = aaiService;
AAIRequest.configProperties = props;
AAIRequest.aaiService = aaiService;
+ InputStream in = null;
+
try
{
try
{
+ LOG.info("Loading aai-path.properties via OSGi");
URL url = null;
Bundle bundle = FrameworkUtil.getBundle(AAIService.class);
if(bundle != null) {
URL url = null;
Bundle bundle = FrameworkUtil.getBundle(AAIService.class);
if(bundle != null) {
@@
-175,7
+179,19
@@
public abstract class AAIRequest {
url = aaiService.getClass().getResource("/aai-path.properties");
}
url = aaiService.getClass().getResource("/aai-path.properties");
}
- InputStream in = url.openStream();
+ in = url.openStream();
+ }
+ catch (NoClassDefFoundError|Exception e) {
+ LOG.info("Loading aai-path.properties from jar");
+ in = AAIRequest.class.getResourceAsStream("/aai-path.properties");
+
+ }
+
+ if (in == null) {
+ return;
+ }
+
+ try {
Reader reader = new InputStreamReader(in, StandardCharsets.UTF_8);
Properties properties = new Properties();
Reader reader = new InputStreamReader(in, StandardCharsets.UTF_8);
Properties properties = new Properties();
@@
-202,7
+218,7
@@
public abstract class AAIRequest {
bs.set(bitIndex);
}
String path = properties.getProperty(key);
bs.set(bitIndex);
}
String path = properties.getProperty(key);
- LOG.
info
(String.format("bitset %s\t\t%s", bs.toString(), path));
+ LOG.
trace
(String.format("bitset %s\t\t%s", bs.toString(), path));
bitsetPaths.put(bs, path);
}
LOG.info("loaded " + resourceNames.toString());
bitsetPaths.put(bs, path);
}
LOG.info("loaded " + resourceNames.toString());
@@
-472,6
+488,6
@@
public abstract class AAIRequest {
}
public static final String getSupportedAAIVersion() {
}
public static final String getSupportedAAIVersion() {
- return configProperties.getProperty(AAIDeclarations.AAI_VERSION, "/v
14
/");
+ return configProperties.getProperty(AAIDeclarations.AAI_VERSION, "/v
21
/");
}
}
}
}