Hello all , I have to filter out properties for replication. I used below logic . it is working fine in local machines but accepts(Property prop) is not getting called in cloud environment. Here is piece of logic.
@component(service = ReplicationContentFilter.class)
public class ReplicationContentFilterImpl implements ReplicationContentFilter {
Logger logger = LoggerFactory.getLogger(getClass());
static boolean Approver = false;
public static List<String> refList = new ArrayList<String>();
public boolean accepts(Node node) {
// TODO Auto-generated method stub
logger.info("accepts(node) is trigerred and is he approver : {}", Approver);
if(Approver) {
logger.info("inside if approver node");
try {
return !node.getPath().startsWith("/conf");
} catch (RepositoryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return true;
}
public boolean accepts(Property property) {
// TODO Auto-generated method stub
logger.info("inside accepts(prop) {}",property);
if(Approver) {
try {
logger.info("inside approver condition accepts property");
if(property.getType()!=PropertyType.STRING) return true;
logger.info("string prop value");
if(property.isMultiple()) {
Value[] values = property.getValues();
for(Value value : values) {
if(value.getString().startsWith("/conf")) {
return false;
}
}
return true;
}
logger.info("not multi");
String value = property.getValue().toString();
logger.info("prop value : {}",value);
if(value.startsWith("/conf")) {
logger.info("inside value conf: {}", value);
return false;
}
String path = property.getPath();
String refNode[] = value.split("/");
String node[] = path.split("/");
logger.info("prop value is {}",value);
if(refNode.length>4 && node.length>3 && refNode[4].equals(node[3])) {
logger.info("path : {} refNode : {},node : {}",path,refNode[4],node[3]);
if(!refNode[5].equals(node[4])) {
logger.info("refs are adding {}",value);
refList.add(value);
return false;
}
}
} catch (IllegalStateException | RepositoryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return true;
}
public boolean allowsDescent(Node node) {
// TODO Auto-generated method stub
logger.info("descendent");
return accepts(node);
}
public List<String> getFilteredPaths() {
// TODO Auto-generated method stub
return null;
}
}
I think there is nothing wrong in code . why only in cloud environment it is not processing accpts(property) method ?
by the way i knew this method not getting called through logs.
I am eagerly waiting for answer