use of org.candlepin.audit.Event.Target in project candlepin by candlepin.
the class QpidConnection method buildAllTopicPublishers.
/**
* We create all the topic publishers in advance and reuse them for sending.
* @param pm
* @throws JMSException
* @throws NamingException
*/
private void buildAllTopicPublishers(Map<Target, Map<Type, TopicPublisher>> pm) throws JMSException, NamingException {
for (Target target : Target.values()) {
Map<Type, TopicPublisher> typeToTpMap = new HashMap<>();
for (Type type : Type.values()) {
storeTopicProducer(type, target, typeToTpMap);
}
pm.put(target, typeToTpMap);
}
}
use of org.candlepin.audit.Event.Target in project candlepin by candlepin.
the class QpidConfigBuilder method buildConfigurationProperties.
/**
* Qpid JMS client needs to be configured using both properties (method buildBrokerDetails is used)
* but also needs configuration in JNDI. This method provides the Properties object that is
* used to configure the Qpid through JNDI. Besides other things, it also must state in advance
* which Queues (JMS notion) is mapped to which binding keys (AMQP notion)
* @return Properties object for JNDI
*/
public Properties buildConfigurationProperties() {
Properties properties = new Properties();
properties.put("java.naming.factory.initial", "org.apache.qpid.jndi.PropertiesFileInitialContextFactory");
properties.put("connectionfactory.qpidConnectionfactory", "amqp://guest:guest@localhost/test?sync_publish='persistent'&brokerlist='" + config.getString(ConfigProperties.AMQP_CONNECT_STRING) + "'");
for (Target target : Target.values()) {
for (Type type : Type.values()) {
// topic name is the internal key used to find the
// AMQP topic.
String name = getTopicName(type, target);
// this represents the destination
String destination = getDestination(type, target);
properties.put("destination." + name, "event/" + destination);
}
}
return properties;
}
use of org.candlepin.audit.Event.Target in project candlepin by candlepin.
the class AtomFeedResourceTest method getEvents.
private List<Event> getEvents(int count) {
List<Event> list = new ArrayList<>(count);
Target[] targets = Target.values();
Type[] types = Type.values();
for (int i = 0; i < count; i++) {
Event e = new Event();
e.setTarget(targets[i % targets.length]);
e.setType(types[i % types.length]);
e.setTimestamp(new Date());
e.setPrincipal(new PrincipalData());
list.add(e);
}
return list;
}
use of org.candlepin.audit.Event.Target in project candlepin by candlepin.
the class EventFilter method fillEventTypeAndTargetFromConfig.
/**
* Parses the toupes type-target from the config file.
*
* @param includes2
* @param includesConfig
*/
private void fillEventTypeAndTargetFromConfig(Set<EventTypeAndTarget> set, List<String> stringList) {
for (String item : stringList) {
if (item.trim().equals("")) {
continue;
}
String[] split = item.split("-");
if (split.length != 2) {
throw new IllegalArgumentException("Invalid include/exclude rule: " + item + "Each filter auditing" + "include/exclude must be in format TYPE-TARGET. For example MODIFIED-CONSUMER.");
}
try {
Type type = Enum.valueOf(Type.class, split[0].trim());
Target target = Enum.valueOf(Target.class, split[1].trim());
set.add(new EventTypeAndTarget(type, target));
} catch (Exception ex) {
throw new IllegalArgumentException("Invalid filtering tuple: " + item + " . Please use only enum values of Type and Target enums, e.g. MODIFIED-CONSUMER");
}
}
}
Aggregations