Package org.wso2.carbon.apacheds.exception

Examples of org.wso2.carbon.apacheds.exception.DirectoryServerException


                        return registry.lookup(oid);
                    } catch (LdapException e) {
                        String msg = "An error occurred while querying attribute " + attributeName +
                                     " from registry.";
                        logger.error(msg, e);
                        throw new DirectoryServerException(msg, e);
                    }
                } else {
                    String msg = "Could not get attribute registry.";
                    logger.error(msg);
                    throw new DirectoryServerException(msg);

                }

            } else {
                String msg = "Cannot access schema manager. Directory server may not have started.";
                logger.error(msg);
                throw new DirectoryServerException(msg);

            }
        } else {
            String msg = "The directory service is null. LDAP server might not have started.";
            logger.error(msg);
            throw new DirectoryServerException(msg);

        }
    }
View Full Code Here


    private void throwException(String message, Throwable e)
            throws DirectoryServerException {
        if (e == null) {
            logger.error(message);
            throw new DirectoryServerException(message);
        } else {
            logger.error(message, e);
            throw new DirectoryServerException(message, e);
        }
    }
View Full Code Here

            try {
                adminSession = this.service.getAdminSession();
            } catch (Exception e) {
                String msg = "An error occurred while retraining admin session.";
                logger.error(msg, e);
                throw new DirectoryServerException(msg, e);
            }
            if (adminSession != null) {
                LdapPrincipal adminPrincipal = adminSession.getAuthenticatedPrincipal();
                if (adminPrincipal != null) {
                    return adminPrincipal;
                } else {
                    String msg = "Could not retrieve admin principle. Failed changing connection " +
                                 "user password.";
                    logger.error(msg);
                    throw new DirectoryServerException(msg);
                }
            } else {
                String msg = "Directory admin session is null. The LDAP server may not have " +
                             "started yet.";
                logger.error(msg);
                throw new DirectoryServerException(msg);
            }
        } else {
            String msg = "Directory service is null. The LDAP server may not have started yet.";
            logger.error(msg);
            throw new DirectoryServerException(msg);
        }

    }
View Full Code Here

            try {
                adminSession = this.service.getAdminSession();
            } catch (Exception e) {
                String msg = "An error occurred while retraining admin session.";
                logger.error(msg, e);
                throw new DirectoryServerException(msg, e);
            }
            if (adminSession != null) {
                LdapPrincipal adminPrincipal = adminSession.getAuthenticatedPrincipal();
                if (adminPrincipal != null) {

                    String passwordToStore = "{" + ConfigurationConstants.ADMIN_PASSWORD_ALGORITHM +
                                             "}";

                    MessageDigest messageDigest;
                    try {
                        messageDigest = MessageDigest.getInstance(
                                ConfigurationConstants.ADMIN_PASSWORD_ALGORITHM);
                    } catch (NoSuchAlgorithmException e) {
                        throw new DirectoryServerException(
                                "Could not find digest algorithm - " +
                                ConfigurationConstants.ADMIN_PASSWORD_ALGORITHM);
                    }
                    messageDigest.update(password.getBytes());
                    byte[] bytes = messageDigest.digest();
                    String hash = Base64.encode(bytes);
                    passwordToStore = passwordToStore + hash;

                    adminPrincipal.setUserPassword(passwordToStore.getBytes());

                    InternalModifyDnRequest request = new ModifyDnRequestImpl(0);

                    EntryAttribute passwordAttribute = new DefaultServerAttribute(
                            getAttributeType("userPassword"));
                    passwordAttribute.add(passwordToStore.getBytes());

                    ServerModification serverModification =
                            new ServerModification(ModificationOperation.REPLACE_ATTRIBUTE,
                                                   passwordAttribute);

                    List<Modification> modifiedList = new ArrayList<Modification>();
                    modifiedList.add(serverModification);

                    try {
                        adminSession.modify(adminPrincipal.getClonedName(), modifiedList);
                    } catch (Exception e) {
                        String msg = "Failed changing connection user password.";
                        logger.error(msg, e);
                        throw new DirectoryServerException(msg, e);
                    }

                } else {
                    String msg = "Could not retrieve admin principle. Failed changing connection " +
                                 "user password.";
                    logger.error(msg);
                    throw new DirectoryServerException(msg);
                }
            } else {
                String msg = "Directory admin session is null. The LDAP server may not have " +
                             "started yet.";
                logger.error(msg);
                throw new DirectoryServerException(msg);
            }
        } else {
            String msg = "Directory service is null. The LDAP server may not have started yet.";
            logger.error(msg);
            throw new DirectoryServerException(msg);
        }

    }
View Full Code Here

    private void configureDirectoryService()
            throws NamingException, DirectoryServerException {

        if (null == this.ldapConfigurations) {
            throw new DirectoryServerException("Directory service is not initialized.");
        }

        System.setProperty("workingDirectory", this.ldapConfigurations.getWorkingDirectory());

        this.service.setShutdownHookEnabled(false);
View Full Code Here

    protected void initializeLDAPServer()
            throws DirectoryServerException {

        if (null == this.service || null == this.ldapConfigurations) {
            throw new DirectoryServerException(
                    "The default apacheds service is not initialized. " +
                    "Make sure apacheds service is initialized first.");
        }

        this.ldapServer = new LdapServer();

        this.ldapServer.setTransports(new TcpTransport(this.ldapConfigurations.getLdapPort()));

        // set server initial properties
        this.ldapServer.setAllowAnonymousAccess(false);
        this.ldapServer.setMaxTimeLimit(this.ldapConfigurations.getMaxTimeLimit());
        this.ldapServer.setMaxSizeLimit(this.ldapConfigurations.getMaxSizeLimit());
        this.ldapServer.setSaslHost(this.ldapConfigurations.getSaslHostName());
        this.ldapServer.setSaslPrincipal(this.ldapConfigurations.getSaslPrincipalName());

        // add the apacheds service
        this.ldapServer.setDirectoryService(this.service);

        setupSaslMechanisms();

        try {
            this.ldapServer.addExtendedOperationHandler(new StartTlsHandler());
            this.ldapServer.addExtendedOperationHandler(
                    new StoredProcedureExtendedOperationHandler());
        } catch (Exception e) {
            throw new DirectoryServerException("can not add the extension handlers ", e);
        }
    }
View Full Code Here

            throws Exception {

        this.schemaZipStore = System.getProperty("schema.zip.store.location");

        if (this.schemaZipStore == null) {
            throw new DirectoryServerException(
                    "Schema Jar repository is not set. Please set schema.jar.location property " +
                    "with proper schema storage");
        }

        if (directoryService != null && directoryService.isStarted()) {
View Full Code Here

     * @return The end line number, or -1 if could not be determined
     */
    public int getEndLineNumber() {
      int ret=-1;
     
      ActivityInterface parent=getParent();
     
      if (parent != null) {
        int index=parent.getSubActivities().indexOf(this);
       
        if (index != -1) {
          if (index < (parent.getSubActivities().size()-1)) {
            ActivityInterface other=parent.getSubActivities().get(index+1);
           
            ret = other.getStartLineNumber()-1;
          } else {
            ret = parent.getEndLineNumber();
          }
        }
      }
View Full Code Here

     *
     * @param lineNumber The line number
     * @return The activity, or null if not found
     */
    public ActivityInterface getActivityAtLineNumber(int lineNumber) {
      ActivityInterface ret=null;
     
      int endline=getEndLineNumber();
     
      if (getStartLineNumber() <= lineNumber && (endline == -1 || endline >= lineNumber)) {
       
View Full Code Here

            int width = 0;
            int height = 0;
            dimensions = new SVGDimension(width, height);

            SVGDimension subActivityDim = null;
            ActivityInterface activity = null;
            Iterator<org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface> itr = getSubActivities().iterator();
            while (itr.hasNext()) {
                activity = itr.next();
                subActivityDim = activity.getDimensions();
                if (subActivityDim.getWidth() > width) {
                    width += subActivityDim.getWidth();
                }
                height += subActivityDim.getHeight();
            }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.apacheds.exception.DirectoryServerException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.