Package org.nasutekds.server.api

Examples of org.nasutekds.server.api.ExtendedOperationHandler


    String name = null;
    String oid = extendedOperation.getRequestOID();
    StringBuilder buffer = new StringBuilder(100);
    appendHeader(extendedOperation, "EXTENDED", CATEGORY_REQUEST, buffer);
    ExtendedOperationHandler extOpHandler =
      DirectoryServer.getExtendedOperationHandler(oid);
    if (extOpHandler != null) {
      name = extOpHandler.getExtendedOperationName();
      if (name != null) {
        buffer.append(" name=\"");
        buffer.append(name);
        buffer.append("\"");
      }
View Full Code Here


    String name = null;
    String oid = extendedOperation.getResponseOID();
    if (oid != null)
    {
      ExtendedOperationHandler extOpHandler =
        DirectoryServer.getExtendedOperationHandler(oid);
      if (extOpHandler != null) {
        name = extOpHandler.getExtendedOperationName();
        if (name != null) {
          buffer.append(" name=\"");
          buffer.append(name);
          buffer.append("\"");
        }
View Full Code Here

      // Ignore this handler if it is disabled.
      if (config.isEnabled())
      {
        // Load the handler's implementation class and initialize it.
        ExtendedOperationHandler handler = getHandler(config);

        // Put this handler in the hash map so that we will be able to find
        // it if it is deleted or disabled.
        handlers.put(config.dn(), handler);
      }
View Full Code Here

    boolean    adminActionRequired = false;


    // See if the entry is registered as an extended operation handler.  If so,
    // deregister it and finalize the handler.
    ExtendedOperationHandler handler = handlers.remove(configuration.dn());
    if (handler != null)
    {
      handler.finalizeExtendedOperationHandler();
    }


    return new ConfigChangeResult(resultCode, adminActionRequired);
  }
View Full Code Here

       ExtendedOperationHandlerCfg configuration)
  {
    // Attempt to get the existing handler. This will only
    // succeed if it was enabled.
    DN dn = configuration.dn();
    ExtendedOperationHandler handler = handlers.get(dn);

    // Default result code.
    ResultCode resultCode = ResultCode.SUCCESS;
    boolean adminActionRequired = false;
    ArrayList<Message> messages = new ArrayList<Message>();

    // See whether the handler should be enabled.
    if (handler == null) {
      if (configuration.isEnabled()) {
        // The handler needs to be enabled.
        try {
          handler = getHandler(configuration);

          // Put this handler in the hash so that we will
          // be able to find it if it is altered.
          handlers.put(dn, handler);

        } catch (ConfigException e) {
          if (debugEnabled())
          {
            TRACER.debugCaught(DebugLogLevel.ERROR, e);
          }

          messages.add(e.getMessageObject());
          resultCode = DirectoryServer.getServerErrorResultCode();
        } catch (Exception e) {
          if (debugEnabled())
          {
            TRACER.debugCaught(DebugLogLevel.ERROR, e);
          }

          messages.add(ERR_CONFIG_EXTOP_INITIALIZATION_FAILED.get(
                  String.valueOf(configuration.getJavaClass()),
                  String.valueOf(dn),
                  stackTraceToSingleLineString(e)));
          resultCode = DirectoryServer.getServerErrorResultCode();
        }
      }
    } else {
      if (configuration.isEnabled()) {
        // The handler is currently active, so we don't
        // need to do anything. Changes to the class name cannot be
        // applied dynamically, so if the class name did change then
        // indicate that administrative action is required for that
        // change to take effect.
        String className = configuration.getJavaClass();
        if (!className.equals(handler.getClass().getName())) {
          adminActionRequired = true;
        }
      } else {
        // We need to disable the connection handler.

        handlers.remove(dn);

        handler.finalizeExtendedOperationHandler();
      }
    }

    // Return the configuration result.
    return new ConfigChangeResult(resultCode, adminActionRequired,
View Full Code Here

    if (configuration.isEnabled())
    {
      // The connection handler needs to be enabled.
      DN dn = configuration.dn();
      try {
        ExtendedOperationHandler handler = getHandler(configuration);

        // Put this connection handler in the hash so that we will be
        // able to find it if it is altered.
        handlers.put(dn, handler);
View Full Code Here

    ClassPropertyDefinition pd = d
        .getJavaClassPropertyDefinition();

    // Load the class and cast it to an extended operation handler.
    Class<? extends ExtendedOperationHandler> theClass;
    ExtendedOperationHandler extendedOperationHandler;

    try
    {
      theClass = pd.loadClass(className, ExtendedOperationHandler.class);
      extendedOperationHandler = theClass.newInstance();
View Full Code Here

    // Load the class and cast it to an extended operation handler.
    Class<? extends ExtendedOperationHandler> theClass;
    try {
      theClass = pd.loadClass(className, ExtendedOperationHandler.class);
      ExtendedOperationHandler extOpHandler = theClass.newInstance();

      // Determine the initialization method to use: it must take a
      // single parameter which is the exact type of the configuration
      // object.
      Method method = theClass.getMethod("isConfigurationAcceptable",
View Full Code Here

      checkIfCanceled(false);


      // Get the extended operation handler for the request OID.  If there is
      // none, then fail.
      ExtendedOperationHandler handler =
           DirectoryServer.getExtendedOperationHandler(requestOID);
      if (handler == null)
      {
        setResultCode(ResultCode.UNWILLING_TO_PERFORM);
        appendErrorMessage(ERR_EXTENDED_NO_HANDLER.get(
                String.valueOf(requestOID)));
        return;
      }


      // Look at the controls included in the request and ensure that all
      // critical controls are supported by the handler.
      List<Control> requestControls = getRequestControls();
      if ((requestControls != null) && (! requestControls.isEmpty()))
      {
        for (Control c : requestControls)
        {
          try
          {
            if (!AccessControlConfigManager.getInstance()
                .getAccessControlHandler().isAllowed(
                    this.getAuthorizationDN(), this, c))
            {
              setResultCode(ResultCode.INSUFFICIENT_ACCESS_RIGHTS);
              appendErrorMessage(ERR_CONTROL_INSUFFICIENT_ACCESS_RIGHTS
                  .get(c.getOID()));
              return;
            }
          }
          catch (DirectoryException e)
          {
            setResultCode(e.getResultCode());
            appendErrorMessage(e.getMessageObject());
            return;
          }

          if (! c.isCritical())
          {
            // The control isn't critical, so we don't care if it's supported
            // or not.
          }
          else if (! handler.supportsControl(c.getOID()))
          {
            setResultCode(ResultCode.UNAVAILABLE_CRITICAL_EXTENSION);

            appendErrorMessage(ERR_EXTENDED_UNSUPPORTED_CRITICAL_CONTROL.get(
                    String.valueOf(requestOID),
                    c.getOID()));

            return;
          }
        }
      }


      // Check to see if the client has permission to perform the
      // extended operation.

      // FIXME: for now assume that this will check all permission
      // pertinent to the operation. This includes proxy authorization
      // and any other controls specified.
      try
      {
        if (AccessControlConfigManager.getInstance()
            .getAccessControlHandler().isAllowed(this) == false)
        {
          setResultCode(ResultCode.INSUFFICIENT_ACCESS_RIGHTS);
          appendErrorMessage(ERR_EXTENDED_AUTHZ_INSUFFICIENT_ACCESS_RIGHTS
              .get(String.valueOf(requestOID)));
          return;
        }
      }
      catch (DirectoryException e)
      {
        setResultCode(e.getResultCode());
        appendErrorMessage(e.getMessageObject());
        return;
      }

      try
      {
        // Invoke the pre-operation extended plugins.
        PluginResult.PreOperation preOpResult =
            pluginConfigManager.invokePreOperationExtendedPlugins(this);
        if(!preOpResult.continueProcessing())
        {
          setResultCode(preOpResult.getResultCode());
          appendErrorMessage(preOpResult.getErrorMessage());
          setMatchedDN(preOpResult.getMatchedDN());
          setReferralURLs(preOpResult.getReferralURLs());
          return;
        }

        checkIfCanceled(false);

        // Actually perform the processing for this operation.
        handler.processExtendedOperation(this);

      }
      finally
      {
        pluginConfigManager.invokePostOperationExtendedPlugins(this);
View Full Code Here

TOP

Related Classes of org.nasutekds.server.api.ExtendedOperationHandler

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.