@Override public Module create(Object... inParameters) throws ModuleCreationException { if(inParameters == null || inParameters.length != 1) { throw new ModuleCreationException(Messages.PARAMETER_COUNT_ERROR); } String instanceName = String.valueOf(inParameters[0]); return new HeadwaterModule(new ModuleURN(PROVIDER_URN, instanceName), instanceName); } /**
@Override public Module create(Object... inParameters) throws ModuleCreationException { if(inParameters == null || inParameters.length != 1) { throw new ModuleCreationException(Messages.PARAMETER_COUNT_ERROR); } ISubscriber subscriber = (ISubscriber)inParameters[0]; return new PublisherModule(new ModuleURN(PROVIDER_URN, "instance"+counter.incrementAndGet()), subscriber); } /**
throw new ModuleCreationException(PARAMETER_COUNT_ERROR); if(inParameters[0] instanceof String) { if(((String)inParameters[0]).isEmpty()) { throw new ModuleCreationException(EMPTY_INSTANCE_ERROR); } else { instanceName = (String)inParameters[0]; throw new ModuleCreationException(new I18NBoundMessage3P(PARAMETER_TYPE_ERROR, 1, String.class.getName(), throw new ModuleCreationException(new I18NBoundMessage2P(NULL_PARAMETER_ERROR, 2, String.class.getName())); throw new ModuleCreationException(EMPTY_NAME_ERROR); } else { name = (String)inParameters[1]; throw new ModuleCreationException(new I18NBoundMessage3P(PARAMETER_TYPE_ERROR, 2, String.class.getName(), throw new ModuleCreationException(new I18NBoundMessage2P(NULL_PARAMETER_ERROR, 3, Language.class.getName())); type = Language.valueOf(((String)inParameters[2]).toUpperCase());
@Override public Module create(Object...inParameters) throws ModuleCreationException { if(getURL() != null && !ClientManager.isInitialized()) { ClientParameters parameters = new ClientParameters(getUsername(), getPassword() == null ? null : getPassword().toCharArray(),getURL(), getHostname(), getPort(), getIDPrefix()); try { ClientManager.init(parameters); } catch (ConnectionException e) { throw new ModuleCreationException(e, Messages.CREATE_MODULE_ERROR); } catch (ClientInitException e) { //This failure cannot happen as we only execute //this code when client is not initialized. throw new ModuleCreationException(e, Messages.CREATE_MODULE_ERROR); } } return new ClientModule(INSTANCE_URN, true); }
List<ModuleURN> urns = getModuleInstances(inProviderURN); if(!urns.isEmpty()) { throw new ModuleCreationException(new I18NBoundMessage2P( Messages.CANNOT_CREATE_SINGLETON, inProviderURN.toString(), urns.get(0).toString())); paramTypes.length != inParameters.length))) { throw new ModuleCreationException(new I18NBoundMessage3P( Messages.CANNOT_CREATE_MODULE_WRONG_PARAM_NUM, inProviderURN.toString(), paramTypes.length, if(inParameters[i] != null && !c.isInstance(inParameters[i]) && !isPrimitiveMatch(c, inParameters[i])) { throw new ModuleCreationException(new I18NBoundMessage4P( Messages.CANNOT_CREATE_MODULE_WRONG_PARAM_TYPE, inProviderURN.toString(), i,c.getName(),
List<ModuleURN> urns = getModuleInstances(inFactory.getProviderURN()); if(!urns.isEmpty()) { throw new ModuleCreationException(new I18NBoundMessage2P( Messages.CANNOT_CREATE_SINGLETON, inFactory.getProviderURN().toString(), throw new ModuleCreationException(new I18NBoundMessage1P( Messages.DUPLICATE_MODULE_URN,urn.toString()));
autowireModule(inModule); } catch (RuntimeException e) { throw new ModuleCreationException(e, new I18NBoundMessage1P(Messages.CANNOT_AUTOWIRE_MODULE, inModule.getURN()));