private static ServiceDomain createDomain(SwitchYardModel config, ServiceDomainManager domainManager) { // Use the ROOT_DOMAIN name for now. Getting an exception SwitchYardModel.getQName(). return domainManager.addApplicationServiceDomain(ServiceDomainManager.ROOT_DOMAIN, config); } }
/** * Create a ServiceDomain instance. * <p/> * Uses {@link #ROOT_DOMAIN} as the domain name. * @return The ServiceDomain instance. */ public ServiceDomain createDomain() { return createDomain(ROOT_DOMAIN, null); }
/** * @param newState the new state of the service handler. */ protected void setState(State newState) { if (newState == null) { throw BaseDeployMessages.MESSAGES.stateCannotBeNull(); } _state = newState; }
/** * Create a new SwitchYard runtime from the specified config. * @param config Switchyard configuration. * @throws IOException Error reading configuration. */ public SwitchYard(InputStream config) throws IOException { _deployment = new Deployment(config); _domain = new ServiceDomainManager().createDomain( _deployment.getConfig().getQName(), _deployment.getConfig()); _activatorList = ActivatorLoader.createActivators(_domain); }
/** * Construct a qualified reference name based on the specified component and reference name. * @param componentName service component name * @param referenceName reference name * @return qualified name */ public static QName qualify(QName componentName, QName referenceName) { return qualify(componentName.getLocalPart(), referenceName.getLocalPart(), componentName.getNamespaceURI()); }
/** * Return an unqualified name from the given service reference, removing the name of the * service component. * @param reference service reference * @return name without service component name included */ public static QName unqualify(ServiceReference reference) { return unqualify(reference.getName()); }
@Override protected void doInit(List<Activator> activators) { for (Activator activator : activators) { if (activator.getActivationTypes().contains(BeanComponentActivator.BEAN_TYPE)) { _activateBeans = true; return; } } }
/** * If this is the last component calling stop, then stop the change services. * @param component the component */ public static void stop(Component component) { stop(component.getName()); }
/** * Destroy the application. */ public void destroy() { _domainManager.removeApplicationServiceDomain(_deployment.getDomain()); }
/** * Determine if a component is eligible to activate a given set of types. */ private static boolean canActivate(Component component, List<String> activationTypes) { for (String componentType : component.getActivationTypes()) { if (activationTypes.contains(componentType)) { return true; } } return false; } }
@Override public void init(Configuration config) { super.init(config); initConfig(); }
@Override public void addObserver(EventObserver observer, Class<? extends EventObject> event) { _domainManager.getEventManager().addObserver(observer, event); }
@Override public void stop() { /* * TODO: should we verify that we could retrieve the service handler? * should we check the state first? */ getGatewayLifecycle().stop(); }
@Override public State getState() { final Lifecycle lifecycle = getGatewayLifecycle(); return lifecycle == null ? State.NONE : lifecycle.getState(); }
@Override public void start() { /* * TODO: should we verify that we could retrieve the service handler? * should we check the state first? */ getGatewayLifecycle().start(); }
@Override protected void doInit(List<Activator> activators) { for (Activator activator : activators) { if (activator.getActivationTypes().contains(BeanComponentActivator.BEAN_TYPE)) { _activateBeans = true; return; } } }
/** * If this is the first component calling start, then start the change services. * @param component the component */ public static void start(Component component) { start(component.getName()); }
@Override public Component getComponent(String type) { for (Component component : _components) { if (component.getActivationTypes().contains(type)) { return component; } } return null; }
@Override public void removeObserver(EventObserver observer) { _domainManager.getEventManager().removeObserver(observer); }
@Override public Component getComponent(String type) { for (Component component : _components) { if (component.getActivationTypes().contains(type)) { return component; } } return null; }