TAILIEUCHUNG - Building Java Enterprise Applications Volume I: Architecture phần 5

Tham khảo tài liệu 'building java enterprise applications volume i: architecture phần 5', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Building Java Enterprise Applications Volume I Architecture Create the objectclass to add Attribute objClasses new BasicAttribute objectClass top person organizationalPerson inetOrgPerson Assign the username first name and last name String cnValue new StringBuffer firstName .append .append lastName .toString Attribute cn new BasicAttribute cn cnValue Attribute givenName new BasicAttribute givenName firstName Attribute sn new BasicAttribute sn lastName Attribute uid new BasicAttribute uid username Add password Attribute userPassword new BasicAttribute userpassword password Add these to the container objClasses cn sn givenName uid userPassword Create the entry getUserDN username container Deleting users or any type of subcontext is a much simpler task. All you need to do is identify the name that the subcontext is bound to in this case the user s DN and invoke the destroySubcontext method on the manager s DirContext object. Additionally while the method still throws a NamingException it should trap one specific problem the NameNotFoundException. This exception is thrown when the requested subcontext does not exist within the directory however because ensuring that the DN for the user specified doesn t exist is the point of the deleteUser method this problem is ignored. Whether the specified user is deleted or did not exist prior to the method call is irrelevant to the client. Add the deleteUser method shown here to your source code public void deleteUser String username throws NamingException try getUserDN username catch NameNotFoundException e If the user is not found ignore the error Any other exceptions that might result such as connection failures are still reported through the NamingException that can be thrown in the method. With these two methods in place all user .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.