aboutsummaryrefslogtreecommitdiffstats
path: root/context/context-management
diff options
context:
space:
mode:
Diffstat (limited to 'context/context-management')
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java16
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/AbstractDistributor.java16
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java8
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/jvmlocal/JVMLocalDistributor.java2
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java8
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/SchemaHelperFactory.java2
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java12
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/monitoring/ContextMonitor.java8
-rw-r--r--context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java10
9 files changed, 41 insertions, 41 deletions
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java
index fbaeb2c91..305f14c8d 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/ContextAlbumImpl.java
@@ -290,7 +290,7 @@ public final class ContextAlbumImpl implements ContextAlbum {
public Object get(final Object key) {
if (key == null) {
final String returnString =
- "album \"" + albumDefinition.getID() + "\" null keys are illegal on keys for get()";
+ "album \"" + albumDefinition.getId() + "\" null keys are illegal on keys for get()";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
@@ -365,20 +365,20 @@ public final class ContextAlbumImpl implements ContextAlbum {
public Object put(final String key, final Object incomingValue) {
if (key == null) {
final String returnString =
- "album \"" + albumDefinition.getID() + "\" null keys are illegal on keys for put()";
+ "album \"" + albumDefinition.getId() + "\" null keys are illegal on keys for put()";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
if (incomingValue == null) {
- final String returnString = "album \"" + albumDefinition.getID() + "\" null values are illegal on key \""
+ final String returnString = "album \"" + albumDefinition.getId() + "\" null values are illegal on key \""
+ key + "\" for put()";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
if (!albumDefinition.isWritable()) {
- final String returnString = "album \"" + albumDefinition.getID()
+ final String returnString = "album \"" + albumDefinition.getId()
+ "\" put() not allowed on read only albums for key=\"" + key + "\", value=\"" + incomingValue;
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
@@ -403,7 +403,7 @@ public final class ContextAlbumImpl implements ContextAlbum {
return albumMap.put(key, valueToPut);
} catch (final ContextRuntimeException e) {
final String returnString = "Failed to set context value for key \"" + key + "\" in album \""
- + albumDefinition.getID() + "\": " + e.getMessage();
+ + albumDefinition.getId() + "\": " + e.getMessage();
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString, e);
}
@@ -418,7 +418,7 @@ public final class ContextAlbumImpl implements ContextAlbum {
public void putAll(final Map<? extends String, ? extends Object> incomingContextAlbum) {
if (!albumDefinition.isWritable()) {
final String returnString =
- "album \"" + albumDefinition.getID() + "\" putAll() not allowed on read only albums";
+ "album \"" + albumDefinition.getId() + "\" putAll() not allowed on read only albums";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
@@ -454,7 +454,7 @@ public final class ContextAlbumImpl implements ContextAlbum {
@Override
public Object remove(final Object key) {
if (!albumDefinition.isWritable()) {
- final String returnString = "album \"" + albumDefinition.getID()
+ final String returnString = "album \"" + albumDefinition.getId()
+ "\" remove() not allowed on read only albums for key=\"" + key + "\"";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
@@ -483,7 +483,7 @@ public final class ContextAlbumImpl implements ContextAlbum {
public void clear() {
if (!albumDefinition.isWritable()) {
final String returnString =
- "album \"" + albumDefinition.getID() + "\" clear() not allowed on read only albums";
+ "album \"" + albumDefinition.getId() + "\" clear() not allowed on read only albums";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/AbstractDistributor.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/AbstractDistributor.java
index e5a45b203..e40646d56 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/AbstractDistributor.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/AbstractDistributor.java
@@ -159,7 +159,7 @@ public abstract class AbstractDistributor implements Distributor {
// Get the context album definition
final AxContextAlbum album = ModelService.getModel(AxContextAlbums.class).get(axContextAlbumKey);
if (album == null) {
- final String resultString = "context album " + axContextAlbumKey.getID() + " does not exist";
+ final String resultString = "context album " + axContextAlbumKey.getId() + " does not exist";
LOGGER.warn(resultString);
throw new ContextException(resultString);
}
@@ -168,7 +168,7 @@ public abstract class AbstractDistributor implements Distributor {
final AxValidationResult result = album.validate(new AxValidationResult());
if (!result.isValid()) {
final String resultString =
- "context album definition for " + album.getKey().getID() + " is invalid" + result;
+ "context album definition for " + album.getKey().getId() + " is invalid" + result;
LOGGER.warn(resultString);
throw new ContextException(resultString);
}
@@ -176,8 +176,8 @@ public abstract class AbstractDistributor implements Distributor {
// Get the schema of the context album
final AxContextSchema schema = ModelService.getModel(AxContextSchemas.class).get(album.getItemSchema());
if (schema == null) {
- final String resultString = "schema \"" + album.getItemSchema().getID() + "\" for context album "
- + album.getKey().getID() + " does not exist";
+ final String resultString = "schema \"" + album.getItemSchema().getId() + "\" for context album "
+ + album.getKey().getId() + " does not exist";
LOGGER.warn(resultString);
throw new ContextException(resultString);
}
@@ -266,7 +266,7 @@ public abstract class AbstractDistributor implements Distributor {
@Override
public synchronized void lockForReading(final AxArtifactKey mapKey, final String itemKey) throws ContextException {
// Lock using the lock manager
- lockManager.lockForReading(mapKey.getID(), itemKey);
+ lockManager.lockForReading(mapKey.getId(), itemKey);
}
/*
@@ -277,7 +277,7 @@ public abstract class AbstractDistributor implements Distributor {
@Override
public synchronized void lockForWriting(final AxArtifactKey mapKey, final String itemKey) throws ContextException {
// Lock using the lock manager
- lockManager.lockForWriting(mapKey.getID(), itemKey);
+ lockManager.lockForWriting(mapKey.getId(), itemKey);
}
/*
@@ -288,7 +288,7 @@ public abstract class AbstractDistributor implements Distributor {
@Override
public void unlockForReading(final AxArtifactKey mapKey, final String itemKey) throws ContextException {
// Unlock using the lock manager
- lockManager.unlockForReading(mapKey.getID(), itemKey);
+ lockManager.unlockForReading(mapKey.getId(), itemKey);
}
/*
@@ -299,7 +299,7 @@ public abstract class AbstractDistributor implements Distributor {
@Override
public void unlockForWriting(final AxArtifactKey mapKey, final String itemKey) throws ContextException {
// Unlock using the lock manager
- lockManager.unlockForWriting(mapKey.getID(), itemKey);
+ lockManager.unlockForWriting(mapKey.getId(), itemKey);
}
/*
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java
index 19bb3602e..2c3661822 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java
@@ -68,7 +68,7 @@ public class DistributorFlushTimerTask extends TimerTask {
timer = new Timer(DistributorFlushTimerTask.class.getSimpleName(), true);
timer.schedule(this, period, period);
- LOGGER.debug("context distributor " + contextDistributor.getKey().getID() + " flushing set up with interval: "
+ LOGGER.debug("context distributor " + contextDistributor.getKey().getId() + " flushing set up with interval: "
+ period + "ms");
}
@@ -80,14 +80,14 @@ public class DistributorFlushTimerTask extends TimerTask {
// Increment the flush counter
flushCount++;
- LOGGER.debug("context distributor " + contextDistributor.getKey().getID() + " flushing: period=" + period
+ LOGGER.debug("context distributor " + contextDistributor.getKey().getId() + " flushing: period=" + period
+ ": count=" + flushCount);
try {
contextDistributor.flush();
- LOGGER.debug("context distributor " + contextDistributor.getKey().getID() + " flushed: period=" + period
+ LOGGER.debug("context distributor " + contextDistributor.getKey().getId() + " flushed: period=" + period
+ ": count=" + flushCount);
} catch (final ContextException e) {
- LOGGER.error("flush error on context distributor " + contextDistributor.getKey().getID() + ": period="
+ LOGGER.error("flush error on context distributor " + contextDistributor.getKey().getId() + ": period="
+ period + ": count=" + flushCount, e);
}
}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/jvmlocal/JVMLocalDistributor.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/jvmlocal/JVMLocalDistributor.java
index dc6637227..cb9a77883 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/jvmlocal/JVMLocalDistributor.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/jvmlocal/JVMLocalDistributor.java
@@ -54,7 +54,7 @@ public class JVMLocalDistributor extends AbstractDistributor {
*/
@Override
public Map<String, Object> getContextAlbumMap(final AxArtifactKey contextMapKey) {
- LOGGER.debug("create map: " + contextMapKey.getID());
+ LOGGER.debug("create map: " + contextMapKey.getId());
return Collections.synchronizedMap(new HashMap<String, Object>());
}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java
index 6ce924b0e..5513cc7e6 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java
@@ -124,7 +124,7 @@ public abstract class AbstractSchemaHelper implements SchemaHelper {
public Object createNewInstance() {
if (schemaClass == null) {
final String returnString =
- userKey.getID() + ": could not create an instance, schema class for the schema is null";
+ userKey.getId() + ": could not create an instance, schema class for the schema is null";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
@@ -133,7 +133,7 @@ public abstract class AbstractSchemaHelper implements SchemaHelper {
return schemaClass.newInstance();
} catch (final Exception e) {
final String returnString =
- userKey.getID() + ": could not create an instance of class \"" + schemaClass.getCanonicalName()
+ userKey.getId() + ": could not create an instance of class \"" + schemaClass.getCanonicalName()
+ "\" using the default constructor \"" + schemaClass.getSimpleName() + "()\"";
LOGGER.warn(returnString, e);
throw new ContextRuntimeException(returnString, e);
@@ -149,7 +149,7 @@ public abstract class AbstractSchemaHelper implements SchemaHelper {
public Object createNewInstance(final String stringValue) {
if (schemaClass == null) {
final String returnString =
- userKey.getID() + ": could not create an instance, schema class for the schema is null";
+ userKey.getId() + ": could not create an instance, schema class for the schema is null";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
@@ -162,7 +162,7 @@ public abstract class AbstractSchemaHelper implements SchemaHelper {
return stringConstructor.newInstance(stringValue);
} catch (final Exception e) {
final String returnString =
- userKey.getID() + ": could not create an instance of class \"" + schemaClass.getCanonicalName()
+ userKey.getId() + ": could not create an instance of class \"" + schemaClass.getCanonicalName()
+ "\" using the string constructor \"" + schemaClass.getSimpleName() + "(String)\"";
LOGGER.warn(returnString, e);
throw new ContextRuntimeException(returnString);
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/SchemaHelperFactory.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/SchemaHelperFactory.java
index 84025fc25..c6120c783 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/SchemaHelperFactory.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/SchemaHelperFactory.java
@@ -62,7 +62,7 @@ public class SchemaHelperFactory {
final AxContextSchema schema = ModelService.getModel(AxContextSchemas.class).get(schemaKey);
if (schema == null) {
final String resultString =
- "schema \"" + schemaKey.getID() + "\" for entity " + owningEntityKey.getID() + " does not exist";
+ "schema \"" + schemaKey.getId() + "\" for entity " + owningEntityKey.getId() + " does not exist";
LOGGER.warn(resultString);
throw new ContextRuntimeException(resultString);
}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java
index 1bfe77a45..c6a34e364 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java
@@ -82,8 +82,8 @@ public class JavaSchemaHelper extends AbstractSchemaHelper {
setSchemaClass(TypeBuilder.getJavaTypeClass(schema.getSchema()));
} catch (final IllegalArgumentException e) {
- String resultSting = userKey.getID() + ": class/type " + schema.getSchema() + " for context schema \""
- + schema.getID() + "\" not found.";
+ String resultSting = userKey.getId() + ": class/type " + schema.getSchema() + " for context schema \""
+ + schema.getId() + "\" not found.";
if (JavaSchemaHelper.BUILT_IN_MAP.get(javatype) != null) {
resultSting += " Primitive types are not supported. Use the appropriate Java boxing type instead.";
} else {
@@ -107,7 +107,7 @@ public class JavaSchemaHelper extends AbstractSchemaHelper {
if (getSchemaClass() == null) {
final String returnString =
- getUserKey().getID() + ": could not create an instance, schema class for the schema is null";
+ getUserKey().getId() + ": could not create an instance, schema class for the schema is null";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
@@ -121,7 +121,7 @@ public class JavaSchemaHelper extends AbstractSchemaHelper {
return incomingObject;
}
- final String returnString = getUserKey().getID() + ": the object \"" + incomingObject + "\" of type \""
+ final String returnString = getUserKey().getId() + ": the object \"" + incomingObject + "\" of type \""
+ incomingObject.getClass().getCanonicalName()
+ "\" is not an instance of JsonObject and is not assignable to \""
+ getSchemaClass().getCanonicalName() + "\"";
@@ -173,7 +173,7 @@ public class JavaSchemaHelper extends AbstractSchemaHelper {
// Use Gson to translate the object
return new Gson().toJson(schemaObject);
} else {
- final String returnString = getUserKey().getID() + ": object \"" + schemaObject.toString()
+ final String returnString = getUserKey().getId() + ": object \"" + schemaObject.toString()
+ "\" of class \"" + schemaObject.getClass().getCanonicalName() + "\" not compatible with class \""
+ getSchemaClass().getCanonicalName() + "\"";
LOGGER.warn(returnString);
@@ -232,7 +232,7 @@ public class JavaSchemaHelper extends AbstractSchemaHelper {
final Constructor<?> stringConstructor = getSchemaClass().getConstructor(String.class);
return stringConstructor.newInstance(object.toString());
} catch (final Exception e) {
- final String returnString = getUserKey().getID() + ": object \"" + object.toString() + "\" of class \""
+ final String returnString = getUserKey().getId() + ": object \"" + object.toString() + "\" of class \""
+ object.getClass().getCanonicalName() + "\" not compatible with class \""
+ getSchemaClass().getCanonicalName() + "\"";
LOGGER.warn(returnString);
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/monitoring/ContextMonitor.java b/context/context-management/src/main/java/org/onap/policy/apex/context/monitoring/ContextMonitor.java
index 8e34ecb1b..e3b335697 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/monitoring/ContextMonitor.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/monitoring/ContextMonitor.java
@@ -184,9 +184,9 @@ public class ContextMonitor {
builder.append(',');
}
if (stackKey instanceof AxArtifactKey) {
- builder.append(((AxArtifactKey) stackKey).getID());
+ builder.append(((AxArtifactKey) stackKey).getId());
} else if (stackKey instanceof AxReferenceKey) {
- builder.append(((AxReferenceKey) stackKey).getID());
+ builder.append(((AxReferenceKey) stackKey).getId());
} else {
builder.append(stackKey.toString());
}
@@ -194,9 +194,9 @@ public class ContextMonitor {
}
builder.append("],");
- builder.append(albumKey.getID());
+ builder.append(albumKey.getId());
builder.append(',');
- builder.append(schemaKey.getID());
+ builder.append(schemaKey.getId());
builder.append(',');
builder.append(name);
diff --git a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java
index 5f2b426bd..0208b7a9c 100644
--- a/context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java
+++ b/context/context-management/src/test/java/org/onap/policy/apex/context/impl/ContextAlbumImplTest.java
@@ -155,9 +155,9 @@ public class ContextAlbumImplTest {
ContextAlbum albumRo = new ContextAlbumImpl(axContextAlbumRo, distributor, new LinkedHashMap<String, Object>());
assertEquals("TestContextAlbum", album.getName());
- assertEquals("TestContextAlbum:0.0.1", album.getKey().getID());
- assertEquals("TestContextAlbum:0.0.1", album.getAlbumDefinition().getID());
- assertEquals("SimpleStringSchema:0.0.1", album.getSchemaHelper().getSchema().getID());
+ assertEquals("TestContextAlbum:0.0.1", album.getKey().getId());
+ assertEquals("TestContextAlbum:0.0.1", album.getAlbumDefinition().getId());
+ assertEquals("SimpleStringSchema:0.0.1", album.getSchemaHelper().getSchema().getId());
try {
album.containsKey(null);
@@ -272,8 +272,8 @@ public class ContextAlbumImplTest {
AxConcept[] userArtifactStack = { somePolicyKey, somePolicyState };
album.setUserArtifactStack(userArtifactStack);
- assertEquals("MyPolicy:0.0.1", album.getUserArtifactStack()[0].getID());
- assertEquals("MyPolicy:0.0.1:NULL:SomeState", album.getUserArtifactStack()[1].getID());
+ assertEquals("MyPolicy:0.0.1", album.getUserArtifactStack()[0].getId());
+ assertEquals("MyPolicy:0.0.1:NULL:SomeState", album.getUserArtifactStack()[1].getId());
assertEquals(true, album.keySet().contains("Key0"));
assertEquals(true, album.values().contains("value of Key0"));