本文整理了Java中io.cattle.platform.eventing.model.Event.getName()
方法的一些代码示例,展示了Event.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.getName()
方法的具体详情如下:
包路径:io.cattle.platform.eventing.model.Event
类名称:Event
方法名:getName
暂无
代码示例来源:origin: stackoverflow.com
for (Event e : events) {
if (!eventsByName.containsKey(e.getName())) {
// create new set by name
eventsByName.put(e.getName(), new HashSet<Event>());
}
// add event to existing Set.
// duplicates will be dropped since it's a `Set`
eventsByName.get(e.getName()).add(e);
}
代码示例来源:origin: stackoverflow.com
while(it.hasNext()) {
Event event = (Event) it.next();
System.out.println(aperson.getLastname()+" is registerd to the" + event.getName());
}
代码示例来源:origin: rancher/cattle
protected boolean isServiceEvent(Event event) {
String eventName = event.getName();
if (eventName == null) {
return false;
}
return SERVICE_PATTERN.matcher(eventName).matches();
}
代码示例来源:origin: stackoverflow.com
// create different comparison mechanism
Comparator<Event> comparator = new EventByRandomDefinitionComparator();
for (Event e : events) {
if (!eventsByName.containsKey(e.getName())) {
// create new set by name
// changed Set implementation to use new comparator
eventsByName.put(e.getName(), new TreeSet<Event>(comparator)));
}
// add event to existing Set.
// duplicates will be dropped since it's a `Set`
eventsByName.get(e.getName()).add(e);
}
代码示例来源:origin: rancher/cattle
protected String metricName(Event event, String prefix) {
String name = event.getName();
if (name.startsWith(REPLY_PREFIX)) {
return null;
}
return "event." + prefix + "." + StringUtils.substringBefore(name, EVENT_SEP).replace('.', '_');
}
代码示例来源:origin: stackoverflow.com
List<Event> allEvents = // fill with your events.
List<Event> noRepeat = new ArrayList<Event>();
for (Event event : allEvents) {
boolean isFound = false;
// check if the event name exists in noRepeat
for (Event e : noRepeat) {
if (e.getName().equals(event.getName() || e.equals(event))
isFound = true;
break;
}
if (!isFound) noRepeat.add(event);
}
代码示例来源:origin: rancher/cattle
@Override
public Event handle(AgentConnectionSimulator simulator, Event event) throws IOException {
if (!IaasEvents.CONFIG_UPDATE.equals(event.getName())) {
return null;
}
return handle(simulator.getAgent(), event);
}
代码示例来源:origin: stackoverflow.com
public class EventItemViewHolder implements ItemViewHolder<Event> {
...
@Override
public void setViewFields(Event event, View convertView) {
name.setText(event.getName());
amount.setText(event.getTotalAmount().toString());
if (event.isChecked()) {
convertView.setBackgroundColor(checkedColor);
} else {
convertView.setBackgroundColor(uncheckedColor);
}
}
}
代码示例来源:origin: rancher/cattle
@Override
public void log(Logger log) {
Object name = null;
if (event != null) {
name = event.getPreviousNames();
if (name == null) {
name = event.getName();
}
}
log.error("Agent error for [{}]: {}", name, getMessage());
}
代码示例来源:origin: rancher/cattle
protected Executor getExecutor(Event event, EventListener listener) {
Executor executor = null;
if (listener instanceof PoolSpecificListener) {
executor = executorServices.get(((PoolSpecificListener) listener).getPoolKey());
}
String eventName = event.getName();
if (executor == null && eventName != null) {
if (eventName.startsWith(Event.REPLY_PREFIX)) {
executor = executorServices.get("reply");
} else if (eventName.endsWith(Event.REPLY_SUFFIX)) {
executor = executorServices.get("reply");
}
}
if (executor == null) {
executor = getDefaultExecutor();
}
return executor;
}
代码示例来源:origin: rancher/cattle
@Override
public Event handle(AgentConnectionSimulator simulator, Event event) throws Exception {
if (!ContainerEventCreate.INSTANCE_INSPECT_EVENT_NAME.equals(event.getName())) {
return null;
}
Map<String, Object> inner = new HashMap<String, Object>();
inner.put("instanceInspect", null);
return EventVO.reply(event).withData(CollectionUtils.asMap("data", inner));
}
代码示例来源:origin: stackoverflow.com
public static int insertEventToDb(Context context, Event event, int calendarId) {
ContentValues values = new ContentValues();
values.put(Events.CALENDAR_ID, calendarId);
values.put(Events.TITLE, event.getName());
values.put(Events.EVENT_LOCATION, event.getLocation());
values.put(Events.DTSTART, event.getStartDate().getTime());
values.put(Events.DTEND, event.getEndDate().getTime());
values.put(Events.DESCRIPTION, event.getDescription());
values.put(Events.EVENT_TIMEZONE, TimeZone.getTimeZone("GMT+1").getID());
Uri result = context.getContentResolver().insert(Events.CONTENT_URI, values);
int eventId = Integer.valueOf(result.getPathSegments().get(1));
return eventId;
}
代码示例来源:origin: rancher/cattle
@Override
public Event handle(AgentConnectionSimulator simulator, Event event) throws Exception {
if (!IaasEvents.CONSOLE_ACCESS.equals(event.getName())) {
return null;
}
return EventVO.reply(event).withData(CollectionUtils.asMap("kind", "fake", "url", "http://localhost/console"));
}
代码示例来源:origin: rancher/cattle
@Override
public Event handle(AgentConnectionSimulator simulator, Event event) throws Exception {
String name = event.getName();
String eventString = jsonMapper.writeValueAsString(event);
if (eventString.contains(name + "::fail")) {
return EventVO.reply(event).withTransitioningMessage("Failing [" + name + "]").withTransitioning(Event.TRANSITIONING_ERROR);
}
return null;
}
代码示例来源:origin: rancher/cattle
protected Event buildEvent(Event request) {
Event event = null;
Object payload = request.getData();
if (payload instanceof Event) {
event = new EventVO<>((Event)payload).withReplyTo(((Event)payload).getName() + Event.REPLY_SUFFIX);
}
if (delegate) {
event = new DelegateEvent(instanceData, event);
}
return new EventVO<>(event).withName(IaasEvents.appendAgent(event.getName(), agentId));
}
代码示例来源:origin: rancher/cattle
protected <T> T getReply(Event inputEvent, Event resultEvent, Class<T> reply) {
if (resultEvent.getData() == null) {
return null;
}
T commandReply = jsonMapper.convertValue(resultEvent.getData(), reply);
if (FRIENDLY_REPLY.contains(inputEvent.getName())) {
EventVO<?> publishEvent = null;
if (commandReply instanceof EventVO) {
publishEvent = (EventVO<?>) commandReply;
} else {
publishEvent = jsonMapper.convertValue(resultEvent.getData(), EventVO.class);
}
publishEvent.setName(inputEvent.getName() + Event.REPLY_SUFFIX);
rawEventService.publish(publishEvent);
}
return commandReply;
}
代码示例来源:origin: rancher/cattle
@Override
public Event handle(AgentConnectionSimulator simulator, Event event) throws Exception {
if (!FrameworkEvents.PING.equals(event.getName()))
return null;
Agent agent = simulator.getAgent();
Ping ping = jsonMapper.convertValue(event, Ping.class);
Ping pong = jsonMapper.convertValue(EventVO.reply(event).withData(ping.getData()), Ping.class);
if (ping.getOption(Ping.RESOURCES) && !agent.getUri().startsWith("delegate://")) {
addResources(pong, agent);
}
if (ping.getOption(Ping.INSTANCES) && !agent.getUri().startsWith("delegate://")) {
addInstances(simulator, pong, agent);
}
return pong;
}
代码示例来源:origin: rancher/cattle
@Override
protected Object createInternal(String type, ApiRequest request) {
Publish publish = request.proxyRequestObject(Publish.class);
Event event = createEvent(publish);
if (isServiceEvent(event)) {
eventService.publish(EventVO.newEvent(FrameworkEvents.SERVICE_EVENT)
.withData(event)
.withResourceId(Long.toString(ApiUtils.getPolicy().getAccountId())));
return publish;
}
if (SubscriptionUtils.getSubscriptionStyle(ApiUtils.getPolicy()) != SubscriptionStyle.RAW && !event.getName().startsWith(Event.REPLY_PREFIX)) {
throw new ClientVisibleException(ResponseCodes.FORBIDDEN);
}
eventService.publish(event);
return publish;
}
代码示例来源:origin: rancher/cattle
public static EventVO<Object> reply(Event request) {
String[] previousIds = request.getPreviousIds();
if (previousIds != null && previousIds.length > 0) {
String[] newIds = new String[previousIds.length + 1];
System.arraycopy(previousIds, 0, newIds, 1, previousIds.length);
newIds[0] = request.getId();
previousIds = newIds;
} else {
previousIds = new String[] { request.getId() };
}
EventVO<Object> event = new EventVO<Object>();
event.setName(request.getReplyTo());
event.setPreviousNames(prepend(request.getPreviousNames(), request.getName()));
event.setPreviousIds(prepend(request.getPreviousIds(), request.getId()));
event.setResourceId(request.getResourceId());
event.setResourceType(request.getResourceType());
return event;
}
代码示例来源:origin: rancher/cattle
@SuppressWarnings("unchecked")
public EventVO(Event event, String replyTo) {
this.replyTo = replyTo;
this.id = event.getId();
this.name = event.getName();
this.previousIds = event.getPreviousIds();
this.previousNames = event.getPreviousNames();
this.data = (T) event.getData();
this.time = event.getTime();
this.publisher = event.getPublisher();
this.resourceId = event.getResourceId();
this.resourceType = event.getResourceType();
this.transitioning = event.getTransitioning();
this.transitioningMessage = event.getTransitioningMessage();
this.transitioningInternalMessage = event.getTransitioningInternalMessage();
this.transitioningProgress = event.getTransitioningProgress();
this.context = event.getContext();
this.timeoutMillis = event.getTimeoutMillis();
}
内容来源于网络,如有侵权,请联系作者删除!