import java.io.File;
import java.io.FileFilter;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.file.Files;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.filefilter.WildcardFileFilter;
private static String pdpURL = null;
private static Boolean notificationFlag = false;
- public void check(PDPStatus newStatus,HashMap<String, PolicyDef> policyContainer) {
+ public void check(PDPStatus newStatus,Map<String, PolicyDef> policyContainer) {
boolean updated = false;
boolean removed = false;
Notification notification = new Notification();
notificationJSON= record(notification);
}catch(Exception e){
LOGGER.error(e);
- // TODO:EELF Cleanup - Remove LOGGER
- //PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "");
}
NotificationServer.setUpdate(notificationJSON);
ManualNotificationUpdateThread.setUpdate(notificationJSON);
} catch (JsonProcessingException e) {
- LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e.getMessage());
- // TODO:EELF Cleanup - Remove LOGGER
- //PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "");
+ LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e.getMessage() +e);
}
}
}
try {
NotificationServer.sendNotification(notificationJSON, propNotificationType, pdpURL);
} catch (Exception e) {
- LOGGER.info(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error in sending the Event Notification: "+ e.getMessage());
+ LOGGER.info(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error in sending the Event Notification: "+ e.getMessage() + e);
}
notificationFlag = false;
}
private void sendremove(PDPPolicy oldPolicy) {
removed = new Removed();
// Want to know what is removed ?
- // LOGGER.info("The Policy removed is: " + oldPolicy.getId());
- // LOGGER.info("The version no. is: " + oldPolicy.getVersion());
LOGGER.info("Policy removed: " + oldPolicy.getId()+ " with version number: " + oldPolicy.getVersion());
removed.setPolicyName(oldPolicy.getId());
removed.setVersionNo(oldPolicy.getVersion());
removeFile(oldPolicy);
}
- private void sendUpdate(PDPPolicy newPolicy,HashMap<String, PolicyDef> policyContainer) {
+ private void sendUpdate(PDPPolicy newPolicy,Map<String, PolicyDef> policyContainer) {
updated = new Updated();
// Want to know what is new ?
LOGGER.info("The new Policy is: " + newPolicy.getId());
try {
json = om.writeValueAsString(record);
} catch (JsonProcessingException e) {
- LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e.getMessage());
- // TODO:EELF Cleanup - Remove LOGGER
- //PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "");
+ LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e.getMessage() + e);
}
LOGGER.info(json);
return json;
delete = true;
dir = new File(XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_WEBAPPS)+File.separator+"Action");
}
- if(delete && dir!=null){
+ if(delete){
FileFilter fileFilter = new WildcardFileFilter(oldPolicy.getId().substring(0, oldPolicy.getId().lastIndexOf("."))+".*");
File[] configFile = dir.listFiles(fileFilter);
if(configFile.length==1){
}
}
}catch(Exception e){
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Couldn't remove the policy/config file " + oldPolicy.getName());
- // TODO:EELF Cleanup - Remove LOGGER
- //PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "Couldn't remove the policy file " + oldPolicy.getName());
+ LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Couldn't remove the policy/config file " + oldPolicy.getName() + e);
}
}
IOUtils.copy(is, os);
break;
}
- } catch (MalformedURLException e) {
- LOGGER.error(e + e.getMessage());
- } catch(FileNotFoundException e){
- LOGGER.error(e + e.getMessage());
- } catch (IOException e) {
+ } catch (Exception e) {
LOGGER.error(e + e.getMessage());
}
papUrls.getNext();