use of com.zimbra.cs.account.XMPPComponent in project zm-mailbox by Zimbra.
the class LdapProvisioning method getAllXMPPComponents.
@Override
public List<XMPPComponent> getAllXMPPComponents() throws ServiceException {
List<XMPPComponent> result = new ArrayList<XMPPComponent>();
try {
String base = mDIT.xmppcomponentBaseDN();
ZLdapFilter filter = filterFactory.allXMPPComponents();
ZSearchResultEnumeration ne = helper.searchDir(base, filter, ZSearchControls.SEARCH_CTLS_SUBTREE());
while (ne.hasMore()) {
ZSearchResultEntry sr = ne.next();
LdapXMPPComponent x = new LdapXMPPComponent(sr.getDN(), sr.getAttributes(), this);
result.add(x);
}
ne.close();
} catch (ServiceException e) {
throw ServiceException.FAILURE("unable to list all XMPPComponents", e);
}
if (result.size() > 0) {
xmppComponentCache.put(result, true);
}
Collections.sort(result);
return result;
}
use of com.zimbra.cs.account.XMPPComponent in project zm-mailbox by Zimbra.
the class LdapProvisioning method extendLifeInCacheOrFlush.
public void extendLifeInCacheOrFlush(Entry entry) {
if (entry instanceof Account) {
accountCache.replace((Account) entry);
} else if (entry instanceof LdapCos) {
cosCache.replace((LdapCos) entry);
} else if (entry instanceof Domain) {
domainCache.replace((Domain) entry);
} else if (entry instanceof Server) {
serverCache.replace((Server) entry);
} else if (entry instanceof UCService) {
ucServiceCache.replace((UCService) entry);
} else if (entry instanceof XMPPComponent) {
xmppComponentCache.replace((XMPPComponent) entry);
} else if (entry instanceof LdapZimlet) {
zimletCache.replace((LdapZimlet) entry);
} else if (entry instanceof LdapAlwaysOnCluster) {
alwaysOnClusterCache.replace((AlwaysOnCluster) entry);
} else if (entry instanceof Group) {
/*
* DLs returned by Provisioning.get(DistributionListBy) and
* DLs/dynamic groups returned by Provisioning.getGroup(DistributionListBy)
* are "not" cached.
*
* DLs returned by Provisioning.getDLBasic(DistributionListBy) and
* DLs/dynamic groups returned by Provisioning.getGroupBasic(DistributionListBy)
* "are" cached.
*
* Need to flush out the cached entries if the instance being modified is not
* in cache. (i.e. the instance being modified was obtained by get/getGroup)
*/
Group modifiedInstance = (Group) entry;
Group cachedInstance = getGroupFromCache(DistributionListBy.id, modifiedInstance.getId());
if (cachedInstance != null && modifiedInstance != cachedInstance) {
groupCache.remove(cachedInstance);
}
}
}
use of com.zimbra.cs.account.XMPPComponent in project zm-mailbox by Zimbra.
the class LdapProvisioning method getXMPPComponentById.
private XMPPComponent getXMPPComponentById(String zimbraId, ZLdapContext zlc, boolean nocache) throws ServiceException {
if (zimbraId == null)
return null;
XMPPComponent x = null;
if (!nocache)
x = xmppComponentCache.getById(zimbraId);
if (x == null) {
x = getXMPPComponentByQuery(filterFactory.xmppComponentById(zimbraId), zlc);
xmppComponentCache.put(x);
}
return x;
}
use of com.zimbra.cs.account.XMPPComponent 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.cs.account.XMPPComponent in project zm-mailbox by Zimbra.
the class TestACLGrant method getXMPPComponent.
private XMPPComponent getXMPPComponent() throws ServiceException {
XMPPComponent xmppCpnt = mProv.get(XMPPComponentBy.name, XMPP_COMPONENT_NAME);
if (xmppCpnt == null) {
Map<String, Object> attrs = new HashMap<String, Object>();
attrs.put(Provisioning.A_zimbraXMPPComponentCategory, "whatever");
attrs.put(Provisioning.A_zimbraXMPPComponentClassName, "whatever");
attrs.put(Provisioning.A_zimbraXMPPComponentType, "whatever");
xmppCpnt = mProv.createXMPPComponent(XMPP_COMPONENT_NAME, getDomain(), getServer(), attrs);
}
return xmppCpnt;
}
Aggregations