/** @see EtherstubHelper#createEtherstub(java.lang.String, boolean) */ @Override public void createEtherstub(String name, boolean temporary) throws EtherstubException { int persitent_type = checkPersistenceType(temporary); logger.info("Trying to create etherstub : " + name + ", temporary: " + temporary); int rc = handle.create_etherstub(name, persitent_type); if (rc == XbowStatus.XBOW_STATUS_TOO_LONG_NAME.ordinal()) { throw new TooLongEtherstubNameException( "Etherstub couldn't be created as the name was too long"); } else if (rc == XbowStatus.XBOW_STATUS_INVALID_NAME.ordinal()) { throw new InvalidEtherstubNameException( "Etherstub couldn't be created as the name was incorrect"); } else if (rc != XbowStatus.XBOW_STATUS_OK.ordinal()) { throw new EtherstubException("Etherstub creation failed."); } logger.debug("Etherstub : " + name + " sucessfully created"); }
/** * @see EtherstubHelper#getEtherstubProperty(java.lang.String, * agh.msc.xbowbase.etherstub.enums.EtherstubProperties) */ @Override public void setEtherstubProperty(String name, LinkProperties property, String value) throws EtherstubException { logger.debug( "Trying to set etherstub's : " + name + ", property : " + property + " value : " + value); int returnValue = handle.set_etherstub_property(name, property.toString(), value); if (returnValue == XbowStatus.XBOW_STATUS_OK.ordinal()) { return; } else if (returnValue == XbowStatus.XBOW_STATUS_INVALID_NAME.ordinal()) { throw new InvalidEtherstubNameException("Invalid etherstub name: " + name); } else if (returnValue == XbowStatus.XBOW_STATUS_OPERATION_FAILURE.ordinal()) { throw new EtherstubException("Unable to set property " + property); } else { throw new EtherstubException("Unknown error while setting property " + property); } }
/** @see EtherstubHelper#deleteEtherstub(java.lang.String, boolean) */ @Override public void deleteEtherstub(String name, boolean temporary) throws EtherstubException { int persitent_type = checkPersistenceType(temporary); logger.info("Trying to remove etherstub : " + name + ", temporary: " + temporary); int rc = handle.delete_etherstub(name, persitent_type); if (rc == XbowStatus.XBOW_STATUS_INVALID_NAME.ordinal()) { throw new InvalidEtherstubNameException( "Etherstub couldn't be removed as the name was incorrect"); } else if (rc != XbowStatus.XBOW_STATUS_OK.ordinal()) { throw new EtherstubException("Etherstub deletion failed."); } }