void installRuntimeServices(final OperationContext context, final String name, final ModelNode model) throws OperationFailedException { boolean allowed = false; for (String ns : GLOBAL_NAMESPACES) { if (name.startsWith(ns)) { allowed = true; break; } } if (!allowed) { throw NamingLogger.ROOT_LOGGER.invalidNamespaceForBinding(name, Arrays.toString(GLOBAL_NAMESPACES)); } final BindingType type = BindingType.forName(NamingBindingResourceDefinition.BINDING_TYPE.resolveModelAttribute(context, model).asString()); if (type == BindingType.SIMPLE) { installSimpleBinding(context, name, model); } else if (type == BindingType.OBJECT_FACTORY) { installObjectFactory(context, name, model); } else if (type == BindingType.LOOKUP) { installLookup(context, name, model); } else if (type == BindingType.EXTERNAL_CONTEXT) { installExternalContext(context, name, model); } else { throw NamingLogger.ROOT_LOGGER.unknownBindingType(type.toString()); } }
public static BindingType forName(String localName) { if (localName == null) return null; final BindingType directoryGrouping = MAP.get(localName.toLowerCase()); return directoryGrouping == null ? BindingType.valueOf(localName.toUpperCase()) : directoryGrouping; }
/** * Converts the value of the directory grouping to a model node. * * @return a new model node for the value. */ public ModelNode toModelNode() { return new ModelNode().set(toString()); }
/** * Converts the value of the directory grouping to a model node. * * @return a new model node for the value. */ public ModelNode toModelNode() { return new ModelNode().set(toString()); }
void doRebind(OperationContext context, ModelNode model, BinderService service) throws OperationFailedException { ManagedReferenceFactory ref = service.getManagedObjectInjector().getValue(); if(ref instanceof MutableManagedReferenceFactory) { MutableManagedReferenceFactory factory = (MutableManagedReferenceFactory) ref; final BindingType type = BindingType.forName(NamingBindingResourceDefinition.BINDING_TYPE.resolveModelAttribute(context, model).asString()); if (type == BindingType.SIMPLE) { Object bindValue = createSimpleBinding(context, model); factory.setFactory(new ValueManagedReferenceFactory(new ImmediateValue<Object>(bindValue))); service.setSource(bindValue); } else if (type == BindingType.OBJECT_FACTORY) { final ObjectFactory objectFactoryClassInstance = createObjectFactory(context, model); final Hashtable<String, String> environment = getObjectFactoryEnvironment(context, model); factory.setFactory(new ObjectFactoryManagedReference(objectFactoryClassInstance, service.getName(), environment)); service.setSource(objectFactoryClassInstance); } else if (type == BindingType.LOOKUP) { final String lookup = NamingBindingResourceDefinition.LOOKUP.resolveModelAttribute(context, model).asString(); factory.setFactory(new LookupManagedReferenceFactory(lookup)); service.setSource(null); } else if (type == BindingType.EXTERNAL_CONTEXT) { throw NamingLogger.ROOT_LOGGER.cannotRebindExternalContext(); } else { throw NamingLogger.ROOT_LOGGER.unknownBindingType(type.toString()); } } else { throw NamingLogger.ROOT_LOGGER.cannotRebindExternalContext(); } }
/** * Converts the value of the directory grouping to a model node. * * @return a new model node for the value. */ public ModelNode toModelNode() { return new ModelNode().set(toString()); }
public static BindingType forName(String localName) { if (localName == null) return null; final BindingType directoryGrouping = MAP.get(localName.toLowerCase()); return directoryGrouping == null ? BindingType.valueOf(localName.toUpperCase()) : directoryGrouping; }
static void validateResourceModel(ModelNode modelNode, boolean allowExternal) throws OperationFailedException { final BindingType type = BindingType.forName(modelNode.require(NamingSubsystemModel.BINDING_TYPE).asString()); if (type == BindingType.SIMPLE) { if(!modelNode.hasDefined(NamingBindingResourceDefinition.VALUE.getName())) { throw NamingLogger.ROOT_LOGGER.unknownBindingType(type.toString());
/** * Converts the value of the directory grouping to a model node. * * @return a new model node for the value. */ public ModelNode toModelNode() { return new ModelNode().set(toString()); }
public static BindingType forName(String localName) { if (localName == null) return null; final BindingType directoryGrouping = MAP.get(localName.toLowerCase()); return directoryGrouping == null ? BindingType.valueOf(localName.toUpperCase()) : directoryGrouping; }
void installRuntimeServices(final OperationContext context, final String name, final ModelNode model, ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException { boolean allowed = false; for (String ns : GLOBAL_NAMESPACES) { if (name.startsWith(ns)) { allowed = true; break; } } if (!allowed) { throw NamingMessages.MESSAGES.invalidNamespaceForBinding(name, Arrays.toString(GLOBAL_NAMESPACES)); } final BindingType type = BindingType.forName(NamingBindingResourceDefinition.BINDING_TYPE.resolveModelAttribute(context,model).asString()); if (type == BindingType.SIMPLE) { installSimpleBinding(context, name, model, verificationHandler, newControllers); } else if (type == BindingType.OBJECT_FACTORY) { installObjectFactory(context, name, model, verificationHandler, newControllers); } else if (type == BindingType.LOOKUP) { installLookup(context, name, model, verificationHandler, newControllers); } else { throw NamingMessages.MESSAGES.unknownBindingType(type.toString()); } }
public static BindingType forName(String localName) { final BindingType directoryGrouping = localName != null ? MAP.get(localName.toLowerCase()) : null; return directoryGrouping == null ? BindingType.valueOf(localName.toUpperCase()) : directoryGrouping; }
void installRuntimeServices(final OperationContext context, final String name, final ModelNode model) throws OperationFailedException { boolean allowed = false; for (String ns : GLOBAL_NAMESPACES) { if (name.startsWith(ns)) { allowed = true; break; } } if (!allowed) { throw NamingLogger.ROOT_LOGGER.invalidNamespaceForBinding(name, Arrays.toString(GLOBAL_NAMESPACES)); } final BindingType type = BindingType.forName(NamingBindingResourceDefinition.BINDING_TYPE.resolveModelAttribute(context, model).asString()); if (type == BindingType.SIMPLE) { installSimpleBinding(context, name, model); } else if (type == BindingType.OBJECT_FACTORY) { installObjectFactory(context, name, model); } else if (type == BindingType.LOOKUP) { installLookup(context, name, model); } else if (type == BindingType.EXTERNAL_CONTEXT) { installExternalContext(context, name, model); } else { throw NamingLogger.ROOT_LOGGER.unknownBindingType(type.toString()); } }
void installRuntimeServices(final OperationContext context, final String name, final ModelNode model) throws OperationFailedException { boolean allowed = false; for (String ns : GLOBAL_NAMESPACES) { if (name.startsWith(ns)) { allowed = true; break; } } if (!allowed) { throw NamingLogger.ROOT_LOGGER.invalidNamespaceForBinding(name, Arrays.toString(GLOBAL_NAMESPACES)); } final BindingType type = BindingType.forName(NamingBindingResourceDefinition.BINDING_TYPE.resolveModelAttribute(context, model).asString()); if (type == BindingType.SIMPLE) { installSimpleBinding(context, name, model); } else if (type == BindingType.OBJECT_FACTORY) { installObjectFactory(context, name, model); } else if (type == BindingType.LOOKUP) { installLookup(context, name, model); } else if (type == BindingType.EXTERNAL_CONTEXT) { installExternalContext(context, name, model); } else { throw NamingLogger.ROOT_LOGGER.unknownBindingType(type.toString()); } }
@Override protected void populateModel(ModelNode operation, ModelNode model) throws OperationFailedException { final BindingType type = BindingType.forName(operation.require(BINDING_TYPE).asString()); NamingBindingResourceDefinition.BINDING_TYPE.validateAndSet(operation, model); if (type == BindingType.SIMPLE) { NamingBindingResourceDefinition.VALUE.validateAndSet(operation, model); NamingBindingResourceDefinition.TYPE.validateAndSet(operation, model); } else if (type == BindingType.OBJECT_FACTORY) { NamingBindingResourceDefinition.MODULE.validateAndSet(operation, model); NamingBindingResourceDefinition.CLASS.validateAndSet(operation, model); NamingBindingResourceDefinition.OBJECT_FACTORY_ENV.validateAndSet(operation, model); } else if (type == BindingType.LOOKUP) { NamingBindingResourceDefinition.LOOKUP.validateAndSet(operation, model); } else { throw NamingMessages.MESSAGES.unknownBindingType(type.toString()); } } }
void doRebind(OperationContext context, ModelNode model, BinderService service) throws OperationFailedException { ManagedReferenceFactory ref = service.getManagedObjectInjector().getValue(); if(ref instanceof MutableManagedReferenceFactory) { MutableManagedReferenceFactory factory = (MutableManagedReferenceFactory) ref; final BindingType type = BindingType.forName(NamingBindingResourceDefinition.BINDING_TYPE.resolveModelAttribute(context, model).asString()); if (type == BindingType.SIMPLE) { Object bindValue = createSimpleBinding(context, model); factory.setFactory(new ValueManagedReferenceFactory(new ImmediateValue<Object>(bindValue))); service.setSource(bindValue); } else if (type == BindingType.OBJECT_FACTORY) { final ObjectFactory objectFactoryClassInstance = createObjectFactory(context, model); final Hashtable<String, String> environment = getObjectFactoryEnvironment(context, model); factory.setFactory(new ObjectFactoryManagedReference(objectFactoryClassInstance, service.getName(), environment)); service.setSource(objectFactoryClassInstance); } else if (type == BindingType.LOOKUP) { final String lookup = NamingBindingResourceDefinition.LOOKUP.resolveModelAttribute(context, model).asString(); factory.setFactory(new LookupManagedReferenceFactory(lookup)); service.setSource(null); } else if (type == BindingType.EXTERNAL_CONTEXT) { throw NamingLogger.ROOT_LOGGER.cannotRebindExternalContext(); } else { throw NamingLogger.ROOT_LOGGER.unknownBindingType(type.toString()); } } else { throw NamingLogger.ROOT_LOGGER.cannotRebindExternalContext(); } }
void doRebind(OperationContext context, ModelNode model, BinderService service) throws OperationFailedException { ManagedReferenceFactory ref = service.getManagedObjectInjector().getValue(); if(ref instanceof MutableManagedReferenceFactory) { MutableManagedReferenceFactory factory = (MutableManagedReferenceFactory) ref; final BindingType type = BindingType.forName(NamingBindingResourceDefinition.BINDING_TYPE.resolveModelAttribute(context, model).asString()); if (type == BindingType.SIMPLE) { Object bindValue = createSimpleBinding(context, model); factory.setFactory(new ValueManagedReferenceFactory(new ImmediateValue<Object>(bindValue))); service.setSource(bindValue); } else if (type == BindingType.OBJECT_FACTORY) { final ObjectFactory objectFactoryClassInstance = createObjectFactory(context, model); final Hashtable<String, String> environment = getObjectFactoryEnvironment(context, model); factory.setFactory(new ObjectFactoryManagedReference(objectFactoryClassInstance, service.getName(), environment)); service.setSource(objectFactoryClassInstance); } else if (type == BindingType.LOOKUP) { final String lookup = NamingBindingResourceDefinition.LOOKUP.resolveModelAttribute(context, model).asString(); factory.setFactory(new LookupManagedReferenceFactory(lookup)); service.setSource(null); } else if (type == BindingType.EXTERNAL_CONTEXT) { throw NamingLogger.ROOT_LOGGER.cannotRebindExternalContext(); } else { throw NamingLogger.ROOT_LOGGER.unknownBindingType(type.toString()); } } else { throw NamingLogger.ROOT_LOGGER.cannotRebindExternalContext(); } }
static void validateResourceModel(ModelNode modelNode, boolean allowExternal) throws OperationFailedException { final BindingType type = BindingType.forName(modelNode.require(NamingSubsystemModel.BINDING_TYPE).asString()); if (type == BindingType.SIMPLE) { if(!modelNode.hasDefined(NamingBindingResourceDefinition.VALUE.getName())) { throw NamingLogger.ROOT_LOGGER.unknownBindingType(type.toString());
static void validateResourceModel(ModelNode modelNode, boolean allowExternal) throws OperationFailedException { final BindingType type = BindingType.forName(modelNode.require(NamingSubsystemModel.BINDING_TYPE).asString()); if (type == BindingType.SIMPLE) { if(!modelNode.hasDefined(NamingBindingResourceDefinition.VALUE.getName())) { throw NamingLogger.ROOT_LOGGER.unknownBindingType(type.toString());