protected ThrottleManager createThrottleManager() { Service service = getService(); if (service == null || service.getMessageBroker() == null) return new ThrottleManager(); // Return the default. try { Class<? extends ThrottleManager> throttleManagerClass = service.getMessageBroker().getThrottleManagerClass(); Object instance = ClassUtil.createDefaultInstance(throttleManagerClass, null); if (instance instanceof ThrottleManager) return (ThrottleManager)instance; } catch (Throwable t) { // NOWARN } return new ThrottleManager(); // Return the default. }
protected ThrottleManager createThrottleManager() { Service service = getService(); if (service == null || service.getMessageBroker() == null) return new ThrottleManager(); // Return the default. try { Class<? extends ThrottleManager> throttleManagerClass = service.getMessageBroker().getThrottleManagerClass(); Object instance = ClassUtil.createDefaultInstance(throttleManagerClass, null); if (instance instanceof ThrottleManager) return (ThrottleManager)instance; } catch (Throwable t) { // NOWARN } return new ThrottleManager(); // Return the default. }
/** * Sets the <code>SecurityConstraint</code> reference of the <code>Destination</code>. * <code>MessageBroker</code> has to know the <code>SecurityConstraint</code> * reference. Note that <code>getSecurityConstraint</code> can return null * if the reference is set but the <code>Destination</code> is not started yet. * * @param ref <code>SecurityConstraint</code> reference. */ public void setSecurityConstraint(String ref) { if (isStarted()) { MessageBroker msgBroker = getService().getMessageBroker(); securityConstraint = msgBroker.getSecurityConstraint(ref); // No need to throw an error as MessageBroker automatically throws // an error if no such constraint exists } securityConstraintRef = ref; }
/** * Sets the <code>SecurityConstraint</code> reference of the <code>Destination</code>. * <code>MessageBroker</code> has to know the <code>SecurityConstraint</code> * reference. Note that <code>getSecurityConstraint</code> can return null * if the reference is set but the <code>Destination</code> is not started yet. * * @param ref <code>SecurityConstraint</code> reference. */ public void setSecurityConstraint(String ref) { if (isStarted()) { MessageBroker msgBroker = getService().getMessageBroker(); securityConstraint = msgBroker.getSecurityConstraint(ref); // No need to throw an error as MessageBroker automatically throws // an error if no such constraint exists } securityConstraintRef = ref; }
/** * Sets the <code>SecurityConstraint</code> reference of the <code>Destination</code>. * <code>MessageBroker</code> has to know the <code>SecurityConstraint</code> * reference. Note that <code>getSecurityConstraint</code> can return null * if the reference is set but the <code>Destination</code> is not started yet. * * @param ref <code>SecurityConstraint</code> reference. */ public void setSecurityConstraint(String ref) { if (isStarted()) { MessageBroker msgBroker = getService().getMessageBroker(); securityConstraint = msgBroker.getSecurityConstraint(ref); // No need to throw an error as MessageBroker automatically throws // an error if no such constraint exists } securityConstraintRef = ref; }
/** * Sets the id of the <code>Destination</code>. If the <code>Destination</code> * has a <code>Service</code> assigned, it also updates the id in the * <code>Service</code>. * * @param id The id of the <code>Destination</code>. */ public void setId(String id) { String oldId = getId(); super.setId(id); // Update the destination id in the service and MessageBroker Service service = getService(); if (service != null) { service.getMessageBroker().unregisterDestination(oldId); service.getDestinations().remove(oldId); service.getMessageBroker().registerDestination(id, service.getId()); service.getDestinations().put(id, this); } }
/** * The destination may be not clustered at all, may be clustered for channel failover * only, or it may be clustered for channel failover and also have shared back ends. * If the destination is clustered, regardless of whether or not it relies on a shared * back end for cluster configuration, this method returns true. Note that this method * returns <code>false</code> if the <code>Destination</code> is not runnning. * * @return <code>true</code> if the <code>Destination</code> is clustered; otherwise <code>false</code>. */ public boolean isClustered() { if (!isStarted()) return false; ClusterManager clm = getService().getMessageBroker().getClusterManager(); boolean clusterReplicated = clm.isDestinationClustered(getService().getClass().getName(), getId()); return clusterReplicated; }
/** * The destination may be not clustered at all, may be clustered for channel failover and * destination sharing, or it may be clustered for channel failover and also have a * common backend, such as a common database or backend clustered JMS topic. * If the destination is clustered and has a common backend to coordinate the cluster, * this method returns true; otherwise it return false. Note that this method returns * <code>false</code> if the <code>Destination</code> is not runnning. * * @return <code>true</code> if the clustered <code>Destination</code> shares a common backend; * otherwise <code>false</code>. */ public boolean isBackendShared() { if (!isStarted()) return false; ClusterManager clm = getService().getMessageBroker().getClusterManager(); return clm.isBackendShared(getService().getClass().getName(), getId()); }
/** * The destination may be not clustered at all, may be clustered for channel failover and * destination sharing, or it may be clustered for channel failover and also have a * common backend, such as a common database or backend clustered JMS topic. * If the destination is clustered and has a common backend to coordinate the cluster, * this method returns true; otherwise it return false. Note that this method returns * <code>false</code> if the <code>Destination</code> is not runnning. * * @return <code>true</code> if the clustered <code>Destination</code> shares a common backend; * otherwise <code>false</code>. */ public boolean isBackendShared() { if (!isStarted()) return false; ClusterManager clm = getService().getMessageBroker().getClusterManager(); return clm.isBackendShared(getService().getClass().getName(), getId()); }
/** * The destination may be not clustered at all, may be clustered for channel failover and * destination sharing, or it may be clustered for channel failover and also have a * common backend, such as a common database or backend clustered JMS topic. * If the destination is clustered and has a common backend to coordinate the cluster, * this method returns true; otherwise it return false. Note that this method returns * <code>false</code> if the <code>Destination</code> is not runnning. * * @return <code>true</code> if the clustered <code>Destination</code> shares a common backend; * otherwise <code>false</code>. */ public boolean isBackendShared() { if (!isStarted()) return false; ClusterManager clm = getService().getMessageBroker().getClusterManager(); boolean backendShared = clm.isBackendShared(getService().getClass().getName(), getId()); return backendShared; }
/** * The destination may be not clustered at all, may be clustered for channel failover * only, or it may be clustered for channel failover and also have shared back ends. * If the destination is clustered, regardless of whether or not it relies on a shared * back end for cluster configuration, this method returns true. Note that this method * returns <code>false</code> if the <code>Destination</code> is not runnning. * * @return <code>true</code> if the <code>Destination</code> is clustered; otherwise <code>false</code>. */ public boolean isClustered() { if (!isStarted()) return false; if (!clusteredCalculated) { ClusterManager clm = getService().getMessageBroker().getClusterManager(); clustered = clm.isDestinationClustered(getService().getClass().getName(), getId()); clusteredCalculated = true; } return clustered; }
/** * The destination may be not clustered at all, may be clustered for channel failover * only, or it may be clustered for channel failover and also have shared back ends. * If the destination is clustered, regardless of whether or not it relies on a shared * back end for cluster configuration, this method returns true. Note that this method * returns <code>false</code> if the <code>Destination</code> is not runnning. * * @return <code>true</code> if the <code>Destination</code> is clustered; otherwise <code>false</code>. */ public boolean isClustered() { if (!isStarted()) return false; if (!clusteredCalculated) { ClusterManager clm = getService().getMessageBroker().getClusterManager(); clustered = clm.isDestinationClustered(getService().getClass().getName(), getId()); clusteredCalculated = true; } return clustered; }
/** * Verifies that the <code>MessagingAdapter</code> is in valid state before * it is started. If subclasses override, they must call <code>super.validate()</code>. */ protected void validate() { if (isValid()) return; super.validate(); // Initialize constraint manager to avoid null pointer checks even though // it won't do any real constraint checking. if (constraintManager == null) constraintManager = new MessagingSecurityConstraintManager(getDestination().getService().getMessageBroker()); }
/** * Checks if the method is allowed to be invoked, i.e., if it has been * explicitly excluded, or if inclusions have been specified and it is not * on the inclusion list. * * @throw MessageException if method is not allowed. */ protected void validateAgainstMethodFilters(String methodName) { if (includeMethods != null) { RemotingMethod method = (RemotingMethod)includeMethods.get(methodName); if (method == null) MethodMatcher.methodNotFound(methodName, null, new Match(null)); // Check method-level security constraint, if defined. SecurityConstraint constraint = method.getSecurityConstraint(); if (constraint != null) getDestination().getService().getMessageBroker().getLoginManager().checkConstraint(constraint); } else if ((excludeMethods != null) && excludeMethods.containsKey(methodName)) MethodMatcher.methodNotFound(methodName, null, new Match(null)); }
/** * Checks if the method is allowed to be invoked, i.e., if it has been * explicitly excluded, or if inclusions have been specified and it is not * on the inclusion list. * * @throw MessageException if method is not allowed. */ protected void validateAgainstMethodFilters(String methodName) { if (includeMethods != null) { RemotingMethod method = (RemotingMethod)includeMethods.get(methodName); if (method == null) MethodMatcher.methodNotFound(methodName, null, new Match(null)); // Check method-level security constraint, if defined. SecurityConstraint constraint = method.getSecurityConstraint(); if (constraint != null) getDestination().getService().getMessageBroker().getLoginManager().checkConstraint(constraint); } else if ((excludeMethods != null) && excludeMethods.containsKey(methodName)) MethodMatcher.methodNotFound(methodName, null, new Match(null)); }
/** * Sets the factory of the <code>FactoryDestination</code>. * <code>MessageBroker</code> has to know the factory before it can be * assigned to the destination. * * @param id The id of the factory. */ public void setFactory(String id) { if (isStarted()) { MessageBroker broker = getService().getMessageBroker(); FlexFactory factory = broker.getFactory(id); if (factory == null) { ConfigurationException ex = new ConfigurationException(); ex.setMessage(INVALID_FACTORY, new Object[] {getId(), factory}); throw ex; } setFactory(factory); } factoryId = id; }
/** * Initializes the <code>MessagingAdapter</code> with the properties. * Subclasses should call <code>super.initialize</code>. * * @param id Id of the <code>MessagingAdapter</code>. * @param properties Properties for the <code>MessagingAdapter</code>. */ public void initialize(String id, ConfigMap properties) { super.initialize(id, properties); if (properties == null || properties.size() == 0) return; ConfigMap server = properties.getPropertyAsMap(DestinationSettings.SERVER_ELEMENT, null); if (server != null) { if (constraintManager == null) constraintManager = new MessagingSecurityConstraintManager(getDestination().getService().getMessageBroker()); constraintManager.createConstraints(server); } }
/** * Sets the factory of the <code>FactoryDestination</code>. * <code>MessageBroker</code> has to know the factory before it can be * assigned to the destination. * * @param id The id of the factory. */ public void setFactory(String id) { if (isStarted()) { MessageBroker broker = getService().getMessageBroker(); FlexFactory factory = broker.getFactory(id); if (factory == null) { ConfigurationException ex = new ConfigurationException(); ex.setMessage(INVALID_FACTORY, new Object[] {getId(), factory}); throw ex; } setFactory(factory); } factoryId = id; }
/** * Sets the factory of the <code>FactoryDestination</code>. * <code>MessageBroker</code> has to know the factory before it can be * assigned to the destination. * * @param id The id of the factory. */ public void setFactory(String id) { if (isStarted()) { MessageBroker broker = getService().getMessageBroker(); FlexFactory factory = broker.getFactory(id); if (factory == null) { ConfigurationException ex = new ConfigurationException(); ex.setMessage(INVALID_FACTORY, new Object[] {getId(), factory}); throw ex; } setFactory(factory); } factoryId = id; }
MessageBroker broker = getService().getMessageBroker(); FlexFactory f = broker.getFactory(factoryId); if (f == null)