Пример #1
0
 public QueueManager getQueueManager() {
   QueueManager queueManager =
       (QueueManager) registryBroker.lookupObject(MuleProperties.OBJECT_QUEUE_MANAGER);
   if (queueManager == null) {
     Collection temp = registryBroker.lookupObjects(QueueManager.class);
     if (temp.size() > 0) {
       queueManager = ((QueueManager) temp.iterator().next());
     }
   }
   return queueManager;
 }
Пример #2
0
 /**
  * Gets the security manager used by this Mule instance to authenticate and authorise incoming and
  * outgoing event traffic and service invocations
  *
  * @return he security manager used by this Mule instance to authenticate and authorise incoming
  *     and outgoing event traffic and service invocations
  */
 public SecurityManager getSecurityManager() {
   SecurityManager securityManager =
       (SecurityManager) registryBroker.lookupObject(MuleProperties.OBJECT_SECURITY_MANAGER);
   if (securityManager == null) {
     Collection temp = registryBroker.lookupObjects(SecurityManager.class);
     if (temp.size() > 0) {
       securityManager = ((SecurityManager) temp.iterator().next());
     }
   }
   return securityManager;
 }
Пример #3
0
 /**
  * Returns the Jta transaction manager used by this Mule server instance. or null if a transaction
  * manager has not been set
  *
  * @return the Jta transaction manager used by this Mule server instance. or null if a transaction
  *     manager has not been set
  */
 public TransactionManager getTransactionManager() {
   TransactionManager transactionManager =
       (TransactionManager) registryBroker.lookupObject(MuleProperties.OBJECT_TRANSACTION_MANAGER);
   if (transactionManager == null) {
     Collection temp = registryBroker.lookupObjects(TransactionManagerFactory.class);
     if (temp.size() > 0) {
       try {
         transactionManager = (((TransactionManagerFactory) temp.iterator().next()).create());
       } catch (Exception e) {
         throw new MuleRuntimeException(CoreMessages.failedToCreate("transaction manager"), e);
       }
     } else {
       temp = registryBroker.lookupObjects(TransactionManager.class);
       if (temp.size() > 0) {
         transactionManager = (((TransactionManager) temp.iterator().next()));
       }
     }
   }
   return transactionManager;
 }
Пример #4
0
  public synchronized void dispose() {
    if (isDisposed()) {
      return;
    }

    ServerNotificationManager notificationManager = getNotificationManager();
    lifecycleManager.checkPhase(Disposable.PHASE_NAME);
    fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_DISPOSING));

    try {
      if (isStarted()) {
        stop();
      }
    } catch (MuleException e) {
      logger.error("Failed to stop manager: " + e.getMessage(), e);
    }

    try {
      lifecycleManager.firePhase(this, Disposable.PHASE_NAME);
      // Dispose internal registries
      registryBroker.dispose();
    } catch (Exception e) {
      logger.debug("Failed to cleanly dispose Mule: " + e.getMessage(), e);
    }

    notificationManager.fireNotification(
        new MuleContextNotification(this, MuleContextNotification.CONTEXT_DISPOSED));

    notificationManager.dispose();
    workManager.dispose();

    if ((getStartDate() > 0) && logger.isInfoEnabled()) {
      SplashScreen splashScreen = SplashScreen.getInstance(ServerShutdownSplashScreen.class);
      splashScreen.setHeader(this);
      logger.info(splashScreen.toString());
    }

    // SplashScreen holds static variables which need to be cleared in case we restart the server.
    SplashScreen.dispose();
  }
Пример #5
0
  public synchronized void initialise() throws InitialisationException {
    if (isInitialised()) {
      return;
    }

    lifecycleManager.checkPhase(Initialisable.PHASE_NAME);

    if (getNotificationManager() == null) {
      throw new MuleRuntimeException(
          CoreMessages.objectIsNull(MuleProperties.OBJECT_NOTIFICATION_MANAGER));
    }
    if (workManager == null) {
      throw new MuleRuntimeException(CoreMessages.objectIsNull("workManager"));
    }

    try {
      registryBroker = createRegistryBroker();
      muleRegistryHelper = createRegistryHelper(registryBroker);

      // Initialize internal registries
      registryBroker.initialise();

      // We need to start the work manager straight away since we need it to fire notifications
      workManager.start();
      getNotificationManager().start(workManager, workListener);

      fireNotification(
          new MuleContextNotification(this, MuleContextNotification.CONTEXT_INITIALISING));

      lifecycleManager.firePhase(this, Initialisable.PHASE_NAME);

      fireNotification(
          new MuleContextNotification(this, MuleContextNotification.CONTEXT_INITIALISED));
    } catch (Exception e) {
      throw new InitialisationException(e, this);
    }
  }
Пример #6
0
 // TODO This should ideally only be available via an Admin interface
 public void removeRegistry(long id) {
   registryBroker.removeRegistry(id);
 }
Пример #7
0
 // TODO This should ideally only be available via an Admin interface
 public void addRegistry(long id, Registry registry) {
   registryBroker.addRegistry(id, registry);
 }
Пример #8
0
 /**
  * Sets the Jta Transaction Manager to use with this Mule server instance
  *
  * @param manager the manager to use
  * @throws Exception
  */
 public void setTransactionManager(TransactionManager manager) throws RegistrationException {
   // checkLifecycleForPropertySet(MuleProperties.OBJECT_TRANSACTION_MANAGER,
   // Initialisable.PHASE_NAME);
   registryBroker.registerObject(MuleProperties.OBJECT_TRANSACTION_MANAGER, manager);
 }
Пример #9
0
 public void setQueueManager(QueueManager queueManager) throws RegistrationException {
   checkLifecycleForPropertySet(MuleProperties.OBJECT_QUEUE_MANAGER, Initialisable.PHASE_NAME);
   registryBroker.registerObject(MuleProperties.OBJECT_QUEUE_MANAGER, queueManager);
 }
Пример #10
0
 /**
  * Sets the security manager used by this Mule instance to authenticate and authorise incoming and
  * outgoing event traffic and service invocations
  *
  * @param securityManager the security manager used by this Mule instance to authenticate and
  *     authorise incoming and outgoing event traffic and service invocations
  */
 public void setSecurityManager(SecurityManager securityManager) throws RegistrationException {
   checkLifecycleForPropertySet(MuleProperties.OBJECT_SECURITY_MANAGER, Initialisable.PHASE_NAME);
   registryBroker.registerObject(MuleProperties.OBJECT_SECURITY_MANAGER, securityManager);
 }