本文整理汇总了Java中org.apache.felix.dm.Component.getServiceProperties方法的典型用法代码示例。如果您正苦于以下问题:Java Component.getServiceProperties方法的具体用法?Java Component.getServiceProperties怎么用?Java Component.getServiceProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.felix.dm.Component
的用法示例。
在下文中一共展示了Component.getServiceProperties方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Function called by the dependency manager when all the required
* dependencies are satisfied
*
*/
void init(Component c) {
Dictionary props = c.getServiceProperties();
if (props != null) {
this.containerName = (String) props.get("containerName");
logger.debug("Running containerName: {}", this.containerName);
} else {
// In the Global instance case the containerName is empty
this.containerName = "";
}
if (this.clusterService != null) {
this.coordinatorChangeListener = new ListenCoordinatorChange();
try {
this.clusterService
.listenRoleChange(this.coordinatorChangeListener);
logger.debug("Coordinator change handler registered");
} catch (ListenRoleChangeAddException ex) {
logger.error("Could not register coordinator change");
}
}
}
示例2: init
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Function called by the dependency manager when all the required
* dependencies are satisfied
*
*/
void init(Component c) {
allocateCaches();
retrieveCaches();
String containerName = null;
Dictionary<?, ?> props = c.getServiceProperties();
if (props != null) {
containerName = (String) props.get("containerName");
} else {
// In the Global instance case the containerName is empty
containerName = "UNKNOWN";
}
userLinksFileName = ROOT + "userTopology_" + containerName + ".conf";
registerWithOSGIConsole();
loadConfiguration();
}
示例3: init
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Function called by the dependency manager when all the required
* dependencies are satisfied
*
*/
@SuppressWarnings("rawtypes")
void init(Component c) {
logger.trace("INIT called!");
Dictionary props = c.getServiceProperties();
if (props != null) {
containerName = (String) props.get("containerName");
if (containerName != null) {
isDefaultContainer = containerName.equals(GlobalConstants.DEFAULT
.toString());
}
}
nodeProps = new ConcurrentHashMap<Node, Map<String, Property>>();
nodeConnectorProps = new ConcurrentHashMap<NodeConnector, Map<String, Property>>();
pluginOutInventoryServices = new CopyOnWriteArraySet<IPluginOutInventoryService>();
}
示例4: init
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Function called by the dependency manager when all the required
* dependencies are satisfied
*
*/
void init(Component c) {
String containerName = null;
Dictionary props = c.getServiceProperties();
if (props != null) {
containerName = (String) props.get("containerName");
} else {
// In the Global instance case the containerName is empty
containerName = "";
}
staticRoutesFileName = ROOT + "staticRouting_" + containerName
+ ".conf";
log.debug("forwarding.staticrouting starting on container {}",
containerName);
//staticRoutes = new ConcurrentHashMap<String, StaticRoute>();
allocateCaches();
retrieveCaches();
this.executor = Executors.newFixedThreadPool(1);
if (staticRouteConfigs.isEmpty())
loadConfiguration();
/*
* Slow probe to identify any gateway that might have silently appeared
* after the Static Routing Configuration.
*/
gatewayProbeTimer = new Timer();
gatewayProbeTimer.schedule(new TimerTask() {
@Override
public void run() {
for (StaticRoute s : staticRoutes.values()) {
if ((s.getType() == StaticRoute.NextHopType.IPADDRESS)
&& s.getHost() == null) {
checkAndUpdateListeners(s, true);
}
}
}
}, 60 * 1000, 60 * 1000);
}
示例5: init
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Function called by the dependency manager when all the required
* dependencies are satisfied
*
*/
void init(Component c) {
Dictionary<?, ?> props = c.getServiceProperties();
if (props != null) {
this.containerName = (String) props.get("containerName");
}
}
示例6: init
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Function called by the dependency manager when all the required
* dependencies are satisfied
*
*/
void init(Component c) {
Dictionary props = c.getServiceProperties();
if (props != null) {
this.containerName = (String) props.get("containerName");
logger.debug("Running containerName: {}", this.containerName);
} else {
// In the Global instance case the containerName is empty
this.containerName = "";
}
}
示例7: init
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Function called by the dependency manager when all the required
* dependencies are satisfied
*
*/
void init(Component c) {
Dictionary<?, ?> props = c.getServiceProperties();
if (props != null) {
this.containerName = (String) props.get("containerName");
log.trace("Running containerName: {}", this.containerName);
} else {
// In the Global instance case the containerName is empty
this.containerName = "";
}
isDefaultContainer = containerName.equals(GlobalConstants.DEFAULT
.toString());
startUp();
}
示例8: init
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Function called by the dependency manager when all the required
* dependencies are satisfied
*
*/
void init(Component c) {
Dictionary<?, ?> props = c.getServiceProperties();
if (props != null) {
this.containerName = (String) props.get("containerName");
logger.debug("Running containerName: {}", this.containerName);
} else {
// In the Global instance case the containerName is empty
this.containerName = "";
}
startUp();
}
示例9: init
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Function called by the dependency manager when all the required
* dependencies are satisfied
*
*/
@SuppressWarnings("unchecked")
void init(Component c) {
Dictionary<Object, Object> props = c.getServiceProperties();
containerName = (props != null) ? (String) props.get("containerName")
: null;
pluginOutReadServices = new CopyOnWriteArraySet<IPluginOutReadService>();
}
示例10: init
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Function called by the dependency manager when all the required
* dependencies are satisfied
*
*/
@SuppressWarnings("unchecked")
void init(Component c) {
logger.trace("INIT called!");
Dictionary<Object, Object> props = c.getServiceProperties();
containerName = (props != null) ? (String) props.get("containerName")
: null;
}
示例11: init
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Function called by the dependency manager when all the required
* dependencies are satisfied
*
*/
void init(Component c) {
Dictionary<?, ?> props = c.getServiceProperties();
if (props != null) {
this.containerName = (String) props.get("containerName");
lbsLogger.info("Running container name:" + this.containerName);
}else {
// In the Global instance case the containerName is empty
this.containerName = "";
}
lbsLogger.info(configManager.toString());
}
示例12: containerCreate
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Method of IContainerAware called when a new container is available
*
* @param containerName Container being created
*/
@Override
public void containerCreate(String containerName) {
try {
Object[] imps = getImplementations();
logger.trace("Creating instance {}", containerName);
if (imps != null) {
for (int i = 0; i < imps.length; i++) {
ImmutablePair<String, Object> key = new ImmutablePair<String, Object>(
containerName, imps[i]);
Component c = this.dbInstances.get(key);
if (c == null) {
c = this.dm.createComponent();
c.addStateListener(new ListenerComponentStates());
// Now let the derived class to configure the
// dependencies it wants
configureInstance(c, imps[i], containerName);
// Set the implementation so the component can manage
// its lifecycle
if (c.getService() == null) {
logger.trace("Setting implementation to: {}",
imps[i]);
c.setImplementation(imps[i]);
}
//Set the service properties to include the containerName
//in the service, that is fundamental for supporting
//multiple services just distinguished via a container
Dictionary<String, String> serviceProps = c
.getServiceProperties();
if (serviceProps != null) {
logger.trace("Adding new property for container");
serviceProps.put("containerName", containerName);
} else {
logger
.trace("Create a new properties for the service");
serviceProps = new Hashtable<String, String>();
serviceProps.put("containerName", containerName);
}
c.setServiceProperties(serviceProps);
// Now add the component to the dependency Manager
// which will immediately start tracking the dependencies
this.dm.add(c);
//Now lets keep track in our shadow database of the
//association
this.dbInstances.put(key, c);
} else {
logger
.error("I have been asked again to create an instance "
+ "on: "
+ containerName
+ "for object: "
+ imps[i]
+ "when i already have it!!");
}
}
}
} catch (Exception ex) {
logger
.error("During containerDestroy invocation caught exception: "
+ ex
+ "\nStacktrace:"
+ stackToString(ex.getStackTrace()));
}
}