use of com.zimbra.common.soap.Element.XMLElement in project zm-mailbox by Zimbra.
the class SoapProvisioning method getAllXMPPComponents.
@Override
public List<XMPPComponent> getAllXMPPComponents() throws ServiceException {
XMLElement req = new XMLElement(AdminConstants.GET_ALL_XMPPCOMPONENTS_REQUEST);
Element response = invoke(req);
List<XMPPComponent> toRet = new ArrayList<XMPPComponent>();
for (Element e : response.listElements(AdminConstants.E_XMPP_COMPONENT)) {
toRet.add(new SoapXMPPComponent(e, this));
}
return toRet;
}
use of com.zimbra.common.soap.Element.XMLElement in project zm-mailbox by Zimbra.
the class SoapProvisioning method getAllDataSources.
@Override
public List<DataSource> getAllDataSources(Account account) throws ServiceException {
List<DataSource> result = new ArrayList<DataSource>();
XMLElement req = new XMLElement(AdminConstants.GET_DATA_SOURCES_REQUEST);
req.addElement(AdminConstants.E_ID).setText(account.getId());
Element resp = invoke(req);
for (Element dataSource : resp.listElements(AccountConstants.E_DATA_SOURCE)) {
result.add(new SoapDataSource(account, dataSource, this));
}
return result;
}
use of com.zimbra.common.soap.Element.XMLElement in project zm-mailbox by Zimbra.
the class SoapProvisioning method soapAdminAuthenticate.
/**
* used to authenticate via admin AuthRequest. can only be called after setting the URI with setURI.
*
* @param name
* @param password
* @throws ServiceException
* @throws IOException
*/
public void soapAdminAuthenticate(String name, String password) throws ServiceException {
if (mTransport == null)
throw ZClientException.CLIENT_ERROR("must call setURI before calling adminAuthenticate", null);
// TODO: Need to resolve issues with AuthToken support before we can
// migrate to JAXB?
// The ZAuthToken constructor below ends up invoking :
// ZAuthToken.fromSoap(Element eAuthToken, boolean isAdmin)
// which expects <authToken> to have a value but also optional
// <a> sub-elements. Would probably need @XmlMixed to support
// that as @XmlElement and @XmlValue are mutually exclusive
XMLElement req = new XMLElement(AdminConstants.AUTH_REQUEST);
req.addElement(AdminConstants.E_NAME).setText(name);
req.addElement(AdminConstants.E_PASSWORD).setText(password);
Element response = invoke(req);
mAuthToken = new ZAuthToken(response.getElement(AdminConstants.E_AUTH_TOKEN), true);
mAuthTokenLifetime = response.getAttributeLong(AdminConstants.E_LIFETIME);
mAuthTokenExpiration = System.currentTimeMillis() + mAuthTokenLifetime;
mTransport.setAuthToken(mAuthToken);
mTransport.setVoidOnExpired(true);
}
use of com.zimbra.common.soap.Element.XMLElement in project zm-mailbox by Zimbra.
the class SoapProvisioning method getConfigSMIMEConfig.
@Override
public Map<String, Map<String, Object>> getConfigSMIMEConfig(String configName) throws ServiceException {
XMLElement req = new XMLElement(AdminConstants.GET_SMIME_CONFIG_REQUEST);
if (configName != null) {
Element eConfig = req.addElement(AdminConstants.E_CONFIG);
eConfig.addAttribute(AdminConstants.A_NAME, configName);
}
Element resp = invoke(req);
Map<String, Map<String, Object>> result = new HashMap<String, Map<String, Object>>();
for (Element eConfig : resp.listElements(AdminConstants.E_CONFIG)) {
result.put(eConfig.getAttribute(AdminConstants.A_NAME), getAttrs(eConfig));
}
return result;
}
use of com.zimbra.common.soap.Element.XMLElement in project zm-mailbox by Zimbra.
the class SoapProvisioning method createDataSource.
@Override
public DataSource createDataSource(Account account, DataSourceType dsType, String dsName, Map<String, Object> attrs) throws ServiceException {
XMLElement req = new XMLElement(AdminConstants.CREATE_DATA_SOURCE_REQUEST);
req.addElement(AdminConstants.E_ID).setText(account.getId());
Element ds = req.addElement(AccountConstants.E_DATA_SOURCE);
ds.addAttribute(AccountConstants.A_NAME, dsName);
ds.addAttribute(AccountConstants.A_TYPE, dsType.name());
addAttrElements(ds, attrs);
Element response = invoke(req).getElement(AccountConstants.E_DATA_SOURCE);
return new SoapDataSource(account, response, this);
}
Aggregations