/// <summary> /// Creates new RelationSupport object. /// /// This constructor has to be used when the user relation MBean implements the interfaces expected /// to be supported by a relation by delegating to a RelationSupport object. /// /// This object needs to know the Relation Service expected to handle the relation. So it has to know /// the MBean Server where the Relation Service is registered. /// /// According to a limitation, a relation MBean must be registered in the same MBean Server as the /// Relation Service expected to handle it. So the user relation MBean has to be created and /// registered, and then the wrapped RelationSupport object can be created with identified MBean Server. /// /// Nothing is done at the Relation Service level, i.e. the RelationSupport object is not added, /// and no check if the provided values are correct. The object is always created, EXCEPT if: /// <list type="bullet"> /// <item>one required parameter is not provided</item> /// <item>the same name is used for two roles.</item> /// </list> /// To be handled as a relation, the object has then to be added in the Relation Service using the Relation /// Service method <see cref="RelationServiceMBean.AddRelation"/>(). /// </summary> /// <param name="relationId">Relation identifier, to identify the relation in the Relation Service. Expected to be unique in the given Relation Service.</param> /// <param name="relationServiceName">ObjectName of the Relation Service where the relation will be registered. /// It is required as this is the Relation Service that is aware of the definition of the relation type /// of given relation, so that will be able to check update operations (set). /// </param> /// <param name="relationServiceMBeanServer">MBean Server where the wrapping MBean is or will be registered. /// Expected to be the MBean Server where the Relation Service is or will be registered. /// </param> /// <param name="relationType">Name of relation type. Expected to have been created in given Relation Service.</param> /// <param name="roles">Roles (Role objects) to initialised the relation. Can be null. Expected to conform to relation info in associated relation type.</param> public RelationSupport(string relationId, ObjectName relationServiceName, IMBeanServer relationServiceMBeanServer, string relationType, IEnumerable <Role> roles) { _relationId = relationId; if (relationServiceMBeanServer == null || relationServiceName.Domain != "") { _relationServiceName = relationServiceName; } else { _relationServiceName = new ObjectName(relationServiceMBeanServer.GetDefaultDomain(), relationServiceName.KeyPropertyList); } _relationServiceMBeanServer = relationServiceMBeanServer; _relationService = _relationServiceMBeanServer.CreateDynamicProxy(_relationServiceName); _relationTypeName = relationType; _roles = new Dictionary <string, Role>(); if (roles != null) { foreach (Role role in roles) { if (!_roles.ContainsKey(role.Name)) { _roles[role.Name] = role; } else { throw new InvalidRoleValueException(); } } } }
/// <summary> /// Creates new RelationSupport object. /// /// This constructor has to be used when the user relation MBean implements the interfaces expected /// to be supported by a relation by delegating to a RelationSupport object. /// /// This object needs to know the Relation Service expected to handle the relation. So it has to know /// the MBean Server where the Relation Service is registered. /// /// According to a limitation, a relation MBean must be registered in the same MBean Server as the /// Relation Service expected to handle it. So the user relation MBean has to be created and /// registered, and then the wrapped RelationSupport object can be created with identified MBean Server. /// /// Nothing is done at the Relation Service level, i.e. the RelationSupport object is not added, /// and no check if the provided values are correct. The object is always created, EXCEPT if: /// <list type="bullet"> /// <item>one required parameter is not provided</item> /// <item>the same name is used for two roles.</item> /// </list> /// To be handled as a relation, the object has then to be added in the Relation Service using the Relation /// Service method <see cref="RelationServiceMBean.AddRelation"/>(). /// </summary> /// <param name="relationId">Relation identifier, to identify the relation in the Relation Service. Expected to be unique in the given Relation Service.</param> /// <param name="relationServiceName">ObjectName of the Relation Service where the relation will be registered. /// It is required as this is the Relation Service that is aware of the definition of the relation type /// of given relation, so that will be able to check update operations (set). /// </param> /// <param name="relationServiceMBeanServer">MBean Server where the wrapping MBean is or will be registered. /// Expected to be the MBean Server where the Relation Service is or will be registered. /// </param> /// <param name="relationType">Name of relation type. Expected to have been created in given Relation Service.</param> /// <param name="roles">Roles (Role objects) to initialised the relation. Can be null. Expected to conform to relation info in associated relation type.</param> public RelationSupport(string relationId, ObjectName relationServiceName, IMBeanServer relationServiceMBeanServer, string relationType, IEnumerable<Role> roles) { _relationId = relationId; if (relationServiceMBeanServer == null || relationServiceName.Domain != "") { _relationServiceName = relationServiceName; } else { _relationServiceName = new ObjectName(relationServiceMBeanServer.GetDefaultDomain(), relationServiceName.KeyPropertyList); } _relationServiceMBeanServer = relationServiceMBeanServer; _relationService = _relationServiceMBeanServer.CreateDynamicProxy(_relationServiceName); _relationTypeName = relationType; _roles = new Dictionary<string, Role>(); if (roles != null) { foreach (Role role in roles) { if (!_roles.ContainsKey(role.Name)) { _roles[role.Name] = role; } else { throw new InvalidRoleValueException(); } } } }
public void AfterPropertiesSet() { if (_namingStrategy == null) { _namingStrategy = new KeyNamingStrategy(BeanServer.GetDefaultDomain()); } RegisterBeans(); }
public ObjectName PreRegister(IMBeanServer server, ObjectName name) { _relationServiceMBeanServer = server; if (_relationServiceName.Domain == "") { _relationServiceName = new ObjectName(server.GetDefaultDomain(), _relationServiceName.KeyPropertyList); } _relationService = _relationServiceMBeanServer.CreateDynamicProxy(_relationServiceName); return(name); }
public ObjectName PreRegister(IMBeanServer server, ObjectName name) { _relationServiceMBeanServer = server; if (_relationServiceName.Domain == "") { _relationServiceName = new ObjectName(server.GetDefaultDomain(), _relationServiceName.KeyPropertyList); } _relationService = _relationServiceMBeanServer.CreateDynamicProxy(_relationServiceName); return name; }
private XmlFragment <GetDefaultDomainResponse> GetDefaultDomain() { return(new XmlFragment <GetDefaultDomainResponse>(new GetDefaultDomainResponse { DomainName = _server.GetDefaultDomain() })); }