Search in sources :

Example 31 with RemoteException

use of java.rmi.RemoteException in project OpenAM by OpenRock.

the class RemoteServicesImpl method getAMTemplateDN.

/**
     * Get the AMTemplate DN (COSTemplateDN)
     * 
     * @param token
     *            SSOToken
     * @param entryDN
     *            DN of the profile whose template is to be set
     * @param serviceName
     *            Service Name
     * @param type
     *            the template type, AMTemplate.DYNAMIC_TEMPLATE
     * @return String DN of the AMTemplate
     */
public String getAMTemplateDN(SSOToken token, String entryDN, int objectType, String serviceName, int type) throws AMException {
    try {
        String tokenID = token.getTokenID().toString();
        Object[] objs = { tokenID, entryDN, new Integer(objectType), serviceName, new Integer(type) };
        return ((String) client.send(client.encodeMessage("getAMTemplateDN", objs), sessionCookies.getLBCookie(tokenID), null));
    } catch (AMRemoteException amrex) {
        if (getDebug().messageEnabled()) {
            getDebug().message("RemoteServicesImpl.getAMTemplateDN : entryDN=" + entryDN + ";  AMRemoteException caught exception=", amrex);
        }
        throw convertException(amrex);
    } catch (RemoteException rex) {
        getDebug().error("RemoteServicesImpl.getAMTemplateDN: caught exception=", rex);
        throw new AMException(AMSDKBundle.getString("1000"), "1000");
    } catch (Exception ex) {
        if (getDebug().messageEnabled()) {
            getDebug().message("RemoteServicesImpl.getAMTemplateDN : entryDN=" + entryDN + ";  caught exception=", ex);
        }
        throw new AMException(AMSDKBundle.getString("1000"), "1000");
    }
}
Also used : AMException(com.iplanet.am.sdk.AMException) RemoteException(java.rmi.RemoteException) AMEntryExistsException(com.iplanet.am.sdk.AMEntryExistsException) AMEventManagerException(com.iplanet.am.sdk.AMEventManagerException) RemoteException(java.rmi.RemoteException) AMException(com.iplanet.am.sdk.AMException) SSOException(com.iplanet.sso.SSOException)

Example 32 with RemoteException

use of java.rmi.RemoteException in project OpenAM by OpenRock.

the class RemoteServicesImpl method search.

/**
     * Search the Directory
     * 
     * @param token
     *            SSOToken
     * @param entryDN
     *            DN of the entry to start the search with
     * @param searchFilter
     *            search filter
     * @param searchControl
     *            search control defining the VLV indexes and search scope
     * @param attrNames
     *            attributes name
     * @return Set of matching DNs
     */
public AMSearchResults search(SSOToken token, String entryDN, String searchFilter, SearchControl searchControl, String[] attrNames) throws AMException {
    try {
        SortKey[] keys = searchControl.getSortKeys();
        LinkedList sortKeys = new LinkedList();
        for (int i = 0; (keys != null) && (i < keys.length); i++) {
            if (keys[i].reverse) {
                sortKeys.add("true:" + keys[i].attributeName);
            } else {
                // Using "fals" instead of "false" so that it
                // has 4 characters as "true", hence easy to
                // reconstruct SortKey
                sortKeys.add("fals:" + keys[i].attributeName);
            }
        }
        int[] vlvRange = searchControl.getVLVRange();
        if (vlvRange == null) {
            vlvRange = new int[3];
        }
        Set attrNamesSet = MiscUtils.stringArrayToSet(attrNames);
        String tokenID = token.getTokenID().toString();
        Object[] objs = { tokenID, entryDN, searchFilter, sortKeys, new Integer(vlvRange[0]), new Integer(vlvRange[1]), new Integer(vlvRange[2]), searchControl.getVLVJumpTo(), new Integer(searchControl.getTimeOut()), new Integer(searchControl.getMaxResults()), new Integer(searchControl.getSearchScope()), Boolean.valueOf(searchControl.isGetAllReturnAttributesEnabled()), attrNamesSet };
        Map results = (Map) client.send(client.encodeMessage("search3", objs), sessionCookies.getLBCookie(tokenID), null);
        String cString = (String) results.remove(AMSR_COUNT);
        Set dns = (Set) results.remove(AMSR_RESULTS);
        String eString = (String) results.remove(AMSR_CODE);
        int count = 0, errorCode = 0;
        try {
            count = Integer.parseInt(cString);
            errorCode = Integer.parseInt(eString);
        } catch (NumberFormatException nfe) {
            getDebug().error("RemoteServicesImpl.search: caught number " + "format error", nfe);
        }
        return (new AMSearchResults(count, dns, errorCode, results));
    } catch (AMRemoteException amrex) {
        if (getDebug().messageEnabled()) {
            getDebug().message("RemoteServicesImpl.search2 : entryDN" + entryDN + ";  AMRemoteException caught exception=", amrex);
        }
        throw convertException(amrex);
    } catch (RemoteException rex) {
        getDebug().error("RemoteServicesImpl.search: caught exception=", rex);
        throw new AMException(AMSDKBundle.getString("1000"), "1000");
    } catch (Exception ex) {
        if (getDebug().messageEnabled()) {
            getDebug().message("RemoteServicesImpl.search2 : entryDN=" + entryDN + ";  caught exception=", ex);
        }
        throw new AMException(AMSDKBundle.getString("1000"), "1000");
    }
}
Also used : Set(java.util.Set) AMException(com.iplanet.am.sdk.AMException) SortKey(com.iplanet.ums.SortKey) AMSearchResults(com.iplanet.am.sdk.AMSearchResults) LinkedList(java.util.LinkedList) AMEntryExistsException(com.iplanet.am.sdk.AMEntryExistsException) AMEventManagerException(com.iplanet.am.sdk.AMEventManagerException) RemoteException(java.rmi.RemoteException) AMException(com.iplanet.am.sdk.AMException) SSOException(com.iplanet.sso.SSOException) RemoteException(java.rmi.RemoteException) AMHashMap(com.iplanet.am.sdk.AMHashMap) Map(java.util.Map)

Example 33 with RemoteException

use of java.rmi.RemoteException in project OpenAM by OpenRock.

the class RemoteServicesImpl method changePassword.

/**
     * Changes user password.
     * 
     * @param token Single sign on token
     * @param entryDN DN of the profile whose template is to be set
     * @param attrName password attribute name
     * @param oldPassword old password
     * @param newPassword new password
     * @throws AMException if an error occurs when changing user password
     * @throws SSOException If user's single sign on token is invalid.
     */
public void changePassword(SSOToken token, String entryDN, String attrName, String oldPassword, String newPassword) throws AMException, SSOException {
    try {
        String tokenID = token.getTokenID().toString();
        Object[] objs = { tokenID, entryDN, attrName, oldPassword, newPassword };
        client.send(client.encodeMessage("changePassword", objs), sessionCookies.getLBCookie(tokenID), null);
    } catch (AMRemoteException amrex) {
        if (getDebug().messageEnabled()) {
            getDebug().message("RemoteServicesImpl.changePassword : entryDN" + entryDN + ";  AMRemoteException caught exception=", amrex);
        }
        throw convertException(amrex);
    } catch (RemoteException rex) {
        getDebug().error("RemoteServicesImpl.changePassword: caught exception=", rex);
        throw new AMException(AMSDKBundle.getString("1000"), "1000");
    } catch (SSOException ssoe) {
        getDebug().error("RemoteServicesImpl.changePassword: caught SSOException=", ssoe);
        throw ssoe;
    } catch (Exception ex) {
        if (getDebug().messageEnabled()) {
            getDebug().message("RemoteServicesImpl.changePassword : entryDN=" + entryDN + ";  caught exception=", ex);
        }
        throw new AMException(AMSDKBundle.getString("1000"), "1000");
    }
}
Also used : AMException(com.iplanet.am.sdk.AMException) SSOException(com.iplanet.sso.SSOException) RemoteException(java.rmi.RemoteException) AMEntryExistsException(com.iplanet.am.sdk.AMEntryExistsException) AMEventManagerException(com.iplanet.am.sdk.AMEventManagerException) RemoteException(java.rmi.RemoteException) AMException(com.iplanet.am.sdk.AMException) SSOException(com.iplanet.sso.SSOException)

Example 34 with RemoteException

use of java.rmi.RemoteException in project OpenAM by OpenRock.

the class RemoteServicesImpl method getExternalAttributes.

/**
     * Returns attributes from an external data store.
     * 
     * @param token
     *            Single sign on token of user
     * @param entryDN
     *            DN of the entry user is trying to read
     * @param attrNames
     *            Set of attributes to be read
     * @param profileType
     *            Integer determining the type of profile being read
     * @return A Map of attribute-value pairs
     * @throws AMException
     *             if an error occurs when trying to read external datastore
     */
public Map getExternalAttributes(SSOToken token, String entryDN, Set attrNames, int profileType) throws AMException {
    try {
        String tokenID = token.getTokenID().toString();
        Object[] objs = { tokenID, entryDN, attrNames, new Integer(profileType) };
        return ((Map) client.send(client.encodeMessage("getExternalAttributes", objs), sessionCookies.getLBCookie(tokenID), null));
    } catch (AMRemoteException amrex) {
        if (getDebug().messageEnabled()) {
            getDebug().message("RemoteServicesImpl.getExternalAttributes: entryDN=" + entryDN + ";  AMRemoteException caught exception=", amrex);
        }
        throw convertException(amrex);
    } catch (RemoteException rex) {
        getDebug().error("RemoteServicesImpl.getExternalAttributes: caught " + "exception=", rex);
        throw new AMException(AMSDKBundle.getString("1000"), "1000");
    } catch (Exception ex) {
        if (getDebug().messageEnabled()) {
            getDebug().message("RemoteServicesImpl.getExternalAttributes: entryDN=" + entryDN + ";  caught exception=", ex);
        }
        throw new AMException(AMSDKBundle.getString("1000"), "1000");
    }
}
Also used : AMException(com.iplanet.am.sdk.AMException) RemoteException(java.rmi.RemoteException) AMEntryExistsException(com.iplanet.am.sdk.AMEntryExistsException) AMEventManagerException(com.iplanet.am.sdk.AMEventManagerException) RemoteException(java.rmi.RemoteException) AMException(com.iplanet.am.sdk.AMException) SSOException(com.iplanet.sso.SSOException)

Example 35 with RemoteException

use of java.rmi.RemoteException in project OpenAM by OpenRock.

the class RemoteServicesImpl method removeAdminRole.

/**
     * Remove group admin role
     * 
     * @param token
     *            SSOToken of the caller
     * @param dn
     *            group DN
     * @param recursive
     *            true to delete all admin roles for all sub groups or sub
     *            people container
     */
public void removeAdminRole(SSOToken token, String dn, boolean recursive) throws SSOException, AMException {
    try {
        String tokenID = token.getTokenID().toString();
        Object[] objs = { tokenID, dn, Boolean.valueOf(recursive) };
        client.send(client.encodeMessage("removeAdminRole", objs), sessionCookies.getLBCookie(tokenID), null);
    } catch (AMRemoteException amrex) {
        if (getDebug().messageEnabled()) {
            getDebug().message("RemoteServicesImpl.removeAdminRole: dn=" + dn + ";  AMRemoteException caught exception=", amrex);
        }
        throw convertException(amrex);
    } catch (RemoteException rex) {
        getDebug().error("RemoteServicesImpl.removeAdminRole: caught exception=", rex);
        throw new AMException(AMSDKBundle.getString("1000"), "1000");
    } catch (SSOException ssoe) {
        getDebug().error("RemoteServicesImpl.removeAdminRole: caught SSOException=", ssoe);
        throw ssoe;
    } catch (Exception ex) {
        if (getDebug().messageEnabled()) {
            getDebug().message("RemoteServicesImpl.removeAdminRole: dn=" + dn + ";  caught exception=", ex);
        }
        throw new AMException(AMSDKBundle.getString("1000"), "1000");
    }
}
Also used : AMException(com.iplanet.am.sdk.AMException) SSOException(com.iplanet.sso.SSOException) RemoteException(java.rmi.RemoteException) AMEntryExistsException(com.iplanet.am.sdk.AMEntryExistsException) AMEventManagerException(com.iplanet.am.sdk.AMEventManagerException) RemoteException(java.rmi.RemoteException) AMException(com.iplanet.am.sdk.AMException) SSOException(com.iplanet.sso.SSOException)

Aggregations

RemoteException (java.rmi.RemoteException)396 IOException (java.io.IOException)57 VmwareContext (com.cloud.hypervisor.vmware.util.VmwareContext)38 VmwareHypervisorHost (com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost)34 SSOException (com.iplanet.sso.SSOException)32 AMException (com.iplanet.am.sdk.AMException)31 EJBException (javax.ejb.EJBException)31 LocateRegistry (java.rmi.registry.LocateRegistry)30 Registry (java.rmi.registry.Registry)30 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)29 AMEntryExistsException (com.iplanet.am.sdk.AMEntryExistsException)29 AMEventManagerException (com.iplanet.am.sdk.AMEventManagerException)29 UnsupportedEncodingException (java.io.UnsupportedEncodingException)27 InvocationTargetException (java.lang.reflect.InvocationTargetException)27 ArrayList (java.util.ArrayList)25 VirtualMachineMO (com.cloud.hypervisor.vmware.mo.VirtualMachineMO)24 ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)24 ConnectException (java.net.ConnectException)20 HashMap (java.util.HashMap)19 DatastoreMO (com.cloud.hypervisor.vmware.mo.DatastoreMO)18