blob: 407e2642a110cb2c63e7d4d1a9bc6879fbf0eef8 [file] [log] [blame]
/**
* Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Florian Pirchner - Initial implementation
*/
package org.eclipse.osbp.vaaclipse.addons.common.event;
import javax.inject.Inject;
import javax.inject.Named;
import org.eclipse.e4.core.di.annotations.Optional;
/**
* Wraps and unwraps the event topics.
*/
public class EventTopicNormalizer {
/** The application instance id. */
@Inject
@Named("e4ApplicationInstanceId")
@Optional
String applicationInstanceId;
/**
* Wrap topic.
*
* @param topic
* the topic
* @return the string
*/
public String wrapTopic(String topic) {
return applicationInstanceId + "/" + topic;
}
/**
* Unwrap topic.
*
* @param topic
* the topic
* @return the string
*/
public String unwrapTopic(String topic) {
return topic.replace(applicationInstanceId + "/", "");
}
}