List of usage examples for java.util Dictionary remove
public abstract V remove(Object key);
From source file:org.energy_home.jemma.ah.internal.hac.lib.HacService.java
/** * Creates a factory configuration object if it doesn't exist, yet * //from w w w . ja va 2s . c o m * @param type * @param pid * @param props */ protected void createConfiguration(String factoryPid, String pid, Dictionary props) { if (pid == null) pid = generatePid(); Configuration c = null; LOG.debug("adding configuration for appliance " + pid); try { Configuration[] configurations = getApplianceCAConfigurations(pid); if (configurations == null) { c = this.configAdmin.createFactoryConfiguration(factoryPid, null); // remove old property service.pid props.remove(Constants.SERVICE_PID); props.put("appliance.pid", pid); LOG.debug("created configuration for appliance.pid " + pid); c.update(props); } } catch (Exception e) { LOG.warn(e.getMessage(), e); } }
From source file:org.energy_home.jemma.ah.internal.hac.lib.HacService.java
protected void deleteConfiguration(String type, String pid) { LOG.debug("delete configuration for device " + pid); Dictionary configurations = getAvailableConfigurations(type); if (configurations != null) { configurations.remove(pid); }// w ww . jav a 2s .c om }
From source file:org.energy_home.jemma.ah.internal.hac.lib.HacService.java
public void installAppliance(String appliancePid, Dictionary props) throws HacException { synchronized (lockHacService) { IManagedAppliance appliance = (IManagedAppliance) this.pid2appliance.get(appliancePid); if (appliance == null) { throw new HacException("an appliance can be installed only if has been already created"); }/*from w w w . j ava2 s .co m*/ if (!this.installingAppliances.contains(appliance)) { throw new HacException("an appliance can be installed only if has been already created"); } String factoryPid = (String) props.get(IAppliance.APPLIANCE_TYPE_PROPERTY); IApplianceFactory applianceFactory = this.getApplianceFactory(factoryPid); if (applianceFactory == null) { throw new HacException("unable to find a factory"); } try { Configuration c = this.getApplianceCAConfiguration(appliancePid); if (c == null) { c = this.configAdmin.createFactoryConfiguration(factoryPid, null); // FIXME: la seguente riga deve essere scommentata? // overwrite // any property service.pid // props.remove(Constants.SERVICE_PID); props.put("appliance.pid", appliancePid); LOG.debug("created configuration for appliance.pid " + appliancePid); } // remove the ah.status properties to force appliance // installation props.remove("ah.status"); c.update(props); this.installingAppliances.remove(appliance); } catch (Exception e) { LOG.debug(e.getMessage()); throw new HacException("unable to install appliance"); } } }
From source file:org.energy_home.jemma.ah.internal.hac.lib.HacService.java
public void installAppliance(String appliancePid) throws HacException { synchronized (lockHacService) { IManagedAppliance appliance = (IManagedAppliance) this.pid2appliance.get(appliancePid); if (appliance == null) { throw new HacException("an appliance can be installed only if has been already created"); }/*from www .j a v a2 s .c o m*/ if (!this.installingAppliances.contains(appliance)) { throw new HacException("an appliance can be installed only if has been already created"); } try { Configuration c = this.getApplianceCAConfiguration(appliancePid); if (c == null) { throw new HacException("an appliance can be installed only if has been already created"); } Dictionary props = c.getProperties(); // remove the ah.status properties to force appliance // installation props.remove("ah.status"); c.update(props); this.installingAppliances.remove(appliance); } catch (Exception e) { LOG.debug(e.getMessage()); throw new HacException("unable to install appliance"); } } }