本文整理汇总了C#中Ice.addAdminFacet方法的典型用法代码示例。如果您正苦于以下问题:C# Ice.addAdminFacet方法的具体用法?C# Ice.addAdminFacet怎么用?C# Ice.addAdminFacet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ice
的用法示例。
在下文中一共展示了Ice.addAdminFacet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: testFacets
testFacets(Ice.Communicator com)
{
test(com.findAdminFacet("Properties") != null);
test(com.findAdminFacet("Process") != null);
TestFacet f1 = new TestFacetI();
TestFacet f2 = new TestFacetI();
TestFacet f3 = new TestFacetI();
com.addAdminFacet(f1, "Facet1");
com.addAdminFacet(f2, "Facet2");
com.addAdminFacet(f3, "Facet3");
test(com.findAdminFacet("Facet1") == f1);
test(com.findAdminFacet("Facet2") == f2);
test(com.findAdminFacet("Facet3") == f3);
test(com.findAdminFacet("Bogus") == null);
try
{
com.addAdminFacet(f1, "Facet1");
test(false);
}
catch(Ice.AlreadyRegisteredException)
{
// Expected
}
try
{
com.removeAdminFacet("Bogus");
test(false);
}
catch(Ice.NotRegisteredException)
{
// Expected
}
com.removeAdminFacet("Facet1");
com.removeAdminFacet("Facet2");
com.removeAdminFacet("Facet3");
try
{
com.removeAdminFacet("Facet1");
test(false);
}
catch(Ice.NotRegisteredException)
{
// Expected
}
}
示例2: TestServiceI
public TestServiceI(Ice.Communicator serviceManagerCommunicator)
{
TestFacetI facet = new TestFacetI();
//
// Install a custom admin facet.
//
serviceManagerCommunicator.addAdminFacet(facet, "TestFacet");
//
// The TestFacetI servant also implements PropertiesAdminUpdateCallback.
// Set the callback on the admin facet.
//
Ice.Object propFacet = serviceManagerCommunicator.findAdminFacet("IceBox.Service.TestService.Properties");
if(propFacet != null)
{
Ice.NativePropertiesAdmin admin = (Ice.NativePropertiesAdmin)propFacet;
admin.addUpdateCallback(facet);
}
}
示例3: testFacets
static void testFacets(Ice.Communicator com, bool builtInFacets)
{
if(builtInFacets)
{
test(com.findAdminFacet("Properties") != null);
test(com.findAdminFacet("Process") != null);
test(com.findAdminFacet("Logger") != null);
test(com.findAdminFacet("Metrics") != null);
}
TestFacet f1 = new TestFacetI();
TestFacet f2 = new TestFacetI();
TestFacet f3 = new TestFacetI();
com.addAdminFacet(f1, "Facet1");
com.addAdminFacet(f2, "Facet2");
com.addAdminFacet(f3, "Facet3");
test(com.findAdminFacet("Facet1") == f1);
test(com.findAdminFacet("Facet2") == f2);
test(com.findAdminFacet("Facet3") == f3);
test(com.findAdminFacet("Bogus") == null);
Dictionary<string, Ice.Object> facetMap = com.findAllAdminFacets();
if(builtInFacets)
{
test(facetMap.Count == 7);
test(facetMap.ContainsKey("Properties"));
test(facetMap.ContainsKey("Process"));
test(facetMap.ContainsKey("Logger"));
test(facetMap.ContainsKey("Metrics"));
}
else
{
test(facetMap.Count >= 3);
}
test(facetMap.ContainsKey("Facet1"));
test(facetMap.ContainsKey("Facet2"));
test(facetMap.ContainsKey("Facet3"));
try
{
com.addAdminFacet(f1, "Facet1");
test(false);
}
catch(Ice.AlreadyRegisteredException)
{
// Expected
}
try
{
com.removeAdminFacet("Bogus");
test(false);
}
catch(Ice.NotRegisteredException)
{
// Expected
}
com.removeAdminFacet("Facet1");
com.removeAdminFacet("Facet2");
com.removeAdminFacet("Facet3");
try
{
com.removeAdminFacet("Facet1");
test(false);
}
catch(Ice.NotRegisteredException)
{
// Expected
}
}