/* * * Copyright (c) 1999 - 2011 my-Channels Ltd * Copyright (c) 2012 - 2017 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. * * Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG. * */ using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; using System.Linq; using System.Xml.Serialization; namespace com.pcbsys.nirvana.nAdminAPI.apps { using com.pcbsys.nirvana.client; using com.pcbsys.nirvana.nAdminAPI; using com.pcbsys.nirvana.nAdminAPI.xml; /// /// This application can be used to export the objects within a realm into an xml format. /// * /// * The program will search through the realm and output the acl entries and permissions, configuration, /// * for all channels, queues, interfaces and scheduler information /// * /// public class XMLExport { private string realmUrl = null; private nRealmNode node = null; private string fileName = null; private NirvanaRealm realm = null; private bool realms = false; private bool cluster = false; private bool realmAcl = false; private bool realmCfg = false; private bool channels = false; private bool channelAcls = false; private bool joins = false; private bool queues = false; private bool queueAcls = false; private bool interfaces = false; private bool iplugins = false; private bool via = false; private bool datagroups= false; private int numChannels = 0; private int numQueues = 0; private int numNSP = 0; private int numNHP = 0; private int numNSPS = 0; private int numNHPS = 0; /// /// Constructor for the class, takes the string realm url /// * /// public XMLExport(string[] args) { try { getOptions(args); report("Connecting to " + realmUrl); // construct the session attributes for the realm nSessionAttributes attr = new nSessionAttributes(realmUrl); // construct the realm node node = new nRealmNode(attr); node.waitForEntireNameSpace(); // create an instance of the XML bindings object. realm = new NirvanaRealm(); realm.comment = ("Realm configuration from " + realmUrl); realm.name = node.getRealm().getName(); realm.exportDate = DateTime.Now; if (cluster) { createCluster(realm, node); } // create the realm objects if (realms) { createRealms(realm, node); } // create the realm acl, the channels, queues and their acls createObjects(realm, node); // create the configuration objects if (realmCfg) { createConfiguration(realm, node); } // create the interfaces if (interfaces) { createInterfaces(realm, node); } // create a Marshaller and marshal to System.out XmlSerializer serializer = new XmlSerializer( realm.GetType()); TextWriter writer = new StreamWriter(fileName); serializer.Serialize(writer, realm); writer.Close(); // close the node, which closes all sessions made to the namespace } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { if (node != null) node.close(); } } /// /// Main program thread, takes a realm URL as the parameter to start the search /// static void Main(string[] args) { XMLExport dump = new XMLExport(args); } /// /// Set the program variables and flags based on command line args /// public virtual void getOptions(string[] args) { if (args == null || args.Length == 0) { Usage(); System.Environment.Exit(1); } realmUrl = args[0]; if (realmUrl == null) { Usage(); System.Environment.Exit(1); } fileName = args[1]; if (fileName == null) { Usage(); System.Environment.Exit(1); } if (args == null) { Usage(); System.Environment.Exit(1); } // set what will be exported based on command line arguments for (int x = 0; x < args.Length; x++) { if (args[x].Equals("-all")) { realms = true; cluster = true; realmAcl = true; realmCfg = true; channels = true; channelAcls = true; joins = true; queues = true; queueAcls = true; interfaces = true; iplugins = true; via = true; } if (args[x].Equals("-realmacl")) { realmAcl = true; } if (args[x].Equals("-realms")) { realms = true; } if (args[x].Equals("-cluster")) { cluster = true; } if (args[x].Equals("-realmcfg")) { realmCfg = true; } if (args[x].Equals("-channels")) { channels = true; } if (args[x].Equals("-channelacls")) { channelAcls = true; } if (args[x].Equals("-joins")) { joins = true; } if (args[x].Equals("-queues")) { queues = true; } if (args[x].Equals("-queueacls")) { queueAcls = true; } if (args[x].Equals("-interfaces")) { interfaces = true; } if (args[x].Equals("-plugins")) { iplugins = true; } if (args[x].Equals("-via")) { via = true; } if (args[x].Equals("-datagroups")) { datagroups = true; } } } /// /// Method to output contents of a realm node /// private void createObjects(NirvanaRealm realm, nRealmNode node) { try { RealmPermissionSet rpermset = new RealmPermissionSet(); // call the method to output the acl entries for the realm if (realmAcl) { createRealmACL(rpermset, node.getACLs()); } // call the method to search the child nodes within the realm node System.Collections.IEnumerator enum1 = node.getNodes(); while (enum1.MoveNext()) { nNode o = (nNode)enum1.Current; if (o is nLeafNode) { createLeafACL(realm, (nLeafNode)o); } else if (o is nContainer) { createContainerACL(realm, (nContainer)o); } } realm.RealmPermissionSet = new RealmPermissionSet(); realm.RealmPermissionSet.RealmACLEntry = rpermset.RealmACLEntry;//todo::group? if (datagroups) { createDataGroups(realm); } } catch (Exception ex) { throw ex; } } private void createDataGroups(NirvanaRealm realm) { IEnumerable alldatagroups = node.getSession().getDataGroups(); DataGroupEntry[] dgset = realm.DataGroupSet; List tmp = new List(); int i = 0; foreach (nDataGroup dataGroup in alldatagroups) { //Create Entry DataGroupEntry dgentry = createDataGroupDetails(dataGroup); if (dgset == null) tmp.Add(dgentry); else dgset[i] = dgentry; i++; } if (dgset == null) { dgset = tmp.ToArray(); } realm.DataGroupSet = (dgset); } private DataGroupEntry createDataGroupDetails(nDataGroup dataGroup) { DataGroupEntry dgentry=new DataGroupEntry(); //Create attributesf DataGroupAttributesEntry dgattrib = new DataGroupAttributesEntry(); dgattrib.id=(dataGroup.getID()); dgattrib.name=(dataGroup.Name); dgattrib.multicastenabled=dataGroup.isMulticastEnabled(); dgattrib.priority=dataGroup.getPriority(); dgentry.DataGroupAttributesEntry=(dgattrib); if (dataGroup.getConflationAttributes()!=null){ //Conflation Attributes nConflationAttributes ca=dataGroup.getConflationAttributes(); ConflationAttributesEntry cattribentry=new ConflationAttributesEntry(); if (ca.getAction() == nConflationAttributes.sDropEvents) cattribentry.type = ConflationAttributesEntryType.DROP_EVENTS_TYPE; else if (ca.getAction() == nConflationAttributes.sMergeEvents) cattribentry.type = ConflationAttributesEntryType.MERGE_EVENTS_TYPE; cattribentry.interval=(ca.getInterval()); dgentry.ConflationAttributesEntry=(cattribentry); } IEnumerable dgpubs=dataGroup.getPublishers(); // Publishers List tmp; if (dgentry.DataGroupPublisherEntry != null) { tmp = new List(dgentry.DataGroupPublisherEntry); } else { tmp = new List(); } foreach (String somepublisher in dgpubs) { String user = somepublisher.Substring(0, somepublisher.IndexOf("@")); String host = somepublisher.Substring(somepublisher.IndexOf("@") + 1); DataGroupPublisherEntry dgpubentry = new DataGroupPublisherEntry(); dgpubentry.name=(user); dgpubentry.host=(host); tmp.Add(dgpubentry); } dgentry.DataGroupPublisherEntry = tmp.ToArray(); IEnumerable nestediterator=dataGroup.getGroups(); List tmp2; if(dgentry.NestedGroupEntry==null) { tmp2 = new List(); } else { tmp2 = new List(dgentry.NestedGroupEntry); } foreach (nDataGroup nestedgroup in nestediterator) { NestedGroupEntry ndge = new NestedGroupEntry(); ndge.name=(nestedgroup.Name); tmp2.Add(ndge); } dgentry.NestedGroupEntry = tmp2.ToArray(); return dgentry; } /// /// Method to output contents of known realm nodes /// private void createRealms(NirvanaRealm realm, nRealmNode node) { RealmSet realmset = new RealmSet(); try { // call the method to output the acl entries for the realm if (realms) { createRealm(realm, realmset, node.getRealmList()); } } catch (Exception ex) { throw ex; } } /// /// Method to output contents of known clusters /// private void createCluster(NirvanaRealm realm, nRealmNode node) { ClusterSet clusterset = new ClusterSet(); try { if (cluster) { nClusterNode clusterNode = node.getCluster(); if (clusterNode != null) { createCluster(clusterset, clusterNode); realm.ClusterSet = clusterset.ClusterEntry; } else { report("Cluster export selected, however this realm is not part of a cluster"); } } } catch (Exception ex) { throw ex; } } /// /// Method to output contents of a known cluster node /// private void createCluster(ClusterSet clusters, nClusterNode cluster) { try { System.Collections.IEnumerator realms = cluster.getNodes(); clusters.ClusterEntry = new ClusterEntry[1]; ClusterEntry entry = new ClusterEntry(); entry.ClusterMember = new ClusterMember[cluster.getClusterConnectionStatus().Count]; int x = 0; while (realms.MoveNext()) { nRealmNode arealm = (nRealmNode)realms.Current; ClusterMember member = new ClusterMember(); member.name = arealm.Name; member.rname = arealm.getSession().getAttributes().getConnectionDetail(0); member.canBeMaster = cluster.canBeMaster(arealm); entry.ClusterMember[x] = member; x++; } IEnumerator sites = cluster.getSites(); x = 0; entry.ClusterSite = new ClusterSite[cluster.getNoOfSites()]; while (sites.MoveNext()) { nClusterSite site = (nClusterSite)sites.Current; ClusterSite csite = new ClusterSite(); csite.name = site.Name; csite.isPrime = site.isPrime(); entry.ClusterSite[x] = (csite); csite.SiteMember = new SiteMember[site.getNoOfMembers()]; IEnumerator siterealms = site.getEnumerator(); int y = 0; while (siterealms.MoveNext()) { string node = (string)siterealms.Current; SiteMember smember = new SiteMember(); smember.name = node; csite.SiteMember[y] = smember; y++; } x++; } entry.name = cluster.Name; clusters.ClusterEntry[0] = entry; realm.ClusterSet = clusters.ClusterEntry; } catch (Exception ex) { throw ex; } } /// /// Method to output contents of a realm node /// private void createRealm(NirvanaRealm realm, RealmSet realmset, ArrayList realms) { try { //Security Groups RealmSecurityGroupSet realmSecurityGroupSet = new RealmSecurityGroupSet(); List realmgroupList = realmSecurityGroupSet.RealmSecurityGroup == null ? new List() : realmSecurityGroupSet.RealmSecurityGroup.ToList(); IList groups = node.getSecurityGroupManager().getGroups(); List securityGroupReferenceEntries = new List(); List securityGroupSubjectEntries = new List(); foreach (nSecurityGroup next in groups) { RealmSecurityGroup secGroup = new RealmSecurityGroup(); if (!next.getName().Equals("Everyone", StringComparison.InvariantCultureIgnoreCase)) { RealmSecurityGroupEntry realmSecurityGroupEntry = new RealmSecurityGroupEntry(); realmSecurityGroupEntry.groupname=next.getName(); secGroup.RealmSecurityGroupEntry=realmSecurityGroupEntry; securityGroupReferenceEntries = secGroup.SecurityGroupReferenceEntry == null ? new List() : secGroup.SecurityGroupReferenceEntry.ToList(); securityGroupSubjectEntries = secGroup.SecurityGroupSubjectEntry==null?new List(): secGroup.SecurityGroupSubjectEntry.ToList(); //secGroup.setName(next.getName()); Collection subjs = next.getMembers(); foreach (nSubject subj in subjs) { if(subj is nSecurityGroup){ SecurityGroupReferenceEntry refEnt =new SecurityGroupReferenceEntry(); refEnt.groupname=subj.getName(); securityGroupReferenceEntries.Add(refEnt); }else{ SecurityGroupSubjectEntry subjEnt = new SecurityGroupSubjectEntry(); subjEnt.name=subj.getUser(); subjEnt.host=subj.getHost(); securityGroupSubjectEntries.Add(subjEnt); } } realmgroupList.Add(secGroup); } secGroup.SecurityGroupReferenceEntry = securityGroupReferenceEntries.ToArray(); secGroup.SecurityGroupSubjectEntry = securityGroupSubjectEntries.ToArray(); } realm.RealmSecurityGroupSet=realmgroupList.ToArray(); /////////////////////////////////////////////////// if (realms.Count == 0) return; realmset.RealmEntry = new RealmEntry[realms.Count]; for (int x = 0; x < realms.Count; x++) { RealmEntry realmentry = new RealmEntry(); nRealmNode rNode = (nRealmNode)realms[x]; realmentry.name = rNode.Name; List connections = rNode.getRealm().getConnections(); realmentry.rname = ((string)connections[0]); string mountPoint = rNode.getRealm().getMountPoint(); realmentry.mountpoint = mountPoint; realmset.RealmEntry[x] = realmentry; } realm.RealmSet = realmset.RealmEntry; } catch (Exception ex) { throw ex; } } /// /// Method to output contents of a realm node /// private void createConfiguration(NirvanaRealm realm, nRealmNode node) { RealmConfiguration cfg = new RealmConfiguration(); try { // create the configuration object and construct each group System.Collections.IEnumerator enum1 = node.getConfigGroups(); cfg.ConfigGroup = new ConfigGroup[node.getConfigGroupsLength()]; int y = 0; while (enum1.MoveNext()) { nConfigGroup ngrp = (nConfigGroup)enum1.Current; ConfigGroup grp = new ConfigGroup(); grp.name = ngrp.Name; System.Collections.IEnumerator items = ngrp.getItems(); int x = 0; grp.ConfigItem = new ConfigItem[ngrp.Length()]; while (items.MoveNext()) { // construct each config item and add to the item list nConfigEntry nitem = (nConfigEntry)items.Current; ConfigItem item = new ConfigItem(); item.name = nitem.Name; item.value = nitem.Value; grp.ConfigItem[x] = (item); x++; } cfg.ConfigGroup[y] = grp; y++; } realm.RealmConfiguration = cfg.ConfigGroup; } catch (Exception ex) { throw ex; } } private RealmMulticastConfigurationEntry createMulticastConfiguration(nMulticastConfiguration mconfig) { RealmMulticastConfigurationEntry entry = new RealmMulticastConfigurationEntry(); //basic configuration RealmMulticastBasicConfigurationEntry basicentry = entry.RealmMulticastBasicConfigurationEntry; if (basicentry == null) { basicentry = new RealmMulticastBasicConfigurationEntry(); entry.RealmMulticastBasicConfigurationEntry=basicentry; } basicentry.Name=mconfig.Name; basicentry.AdapterAddress=mconfig.getAdapter(); basicentry.MulticastAddress=mconfig.getMulticastAddress(); basicentry.AdapterBufferSize=((long)mconfig.getAdapterBufferSize()); basicentry.Clientestablishmenttimeout=(mconfig.getClientEstablishmentTimeout()); basicentry.useforClusters=(mconfig.isUseForCluster()); basicentry.useforDatagroups=(mconfig.isUseForDataGroups()); basicentry.useforStatusUpdates=(mconfig.isUseForStatusUpdate()); //Security RealmMulticastSecurityConfigurationEntry secentry = entry.RealmMulticastSecurityConfigurationEntry; if (secentry == null) { secentry = new RealmMulticastSecurityConfigurationEntry(); entry.RealmMulticastSecurityConfigurationEntry=(secentry); } switch (mconfig.getCRCType()) { case 0: default: { secentry.CRCtype = (RealmMulticastSecurityConfigurationEntryCRCtype.NONE); break; } case 1: { secentry.CRCtype=(RealmMulticastSecurityConfigurationEntryCRCtype.CRC); break; } case 2: { secentry.CRCtype = (RealmMulticastSecurityConfigurationEntryCRCtype.MD5); break; } case 3: { secentry.CRCtype = (RealmMulticastSecurityConfigurationEntryCRCtype.SHA); break; } } switch (mconfig.getEncryptionLevel()) { case 0: default: { secentry.encryptionlevel = (RealmMulticastSecurityConfigurationEntryEncryptionlevel.NONE); break; } case 1: { secentry.encryptionlevel = (RealmMulticastSecurityConfigurationEntryEncryptionlevel.AES128); break; } case 2: { secentry.encryptionlevel = (RealmMulticastSecurityConfigurationEntryEncryptionlevel.AES192); break; } case 3: { secentry.encryptionlevel = (RealmMulticastSecurityConfigurationEntryEncryptionlevel.AES256); break; } } secentry.RotateEncryptionKeyTime=(long.Parse(mconfig.getRotateEncryptionKeyTime().ToString())); secentry.RotateEnryptionKeyWait=(long.Parse(mconfig.getMaxOutstandingPackets().ToString())); //advanced configuration RealmMulticastAdvancedConfigurationEntry aentry = entry.RealmMulticastAdvancedConfigurationEntry; if (aentry == null) { aentry = new RealmMulticastAdvancedConfigurationEntry(); entry.RealmMulticastAdvancedConfigurationEntry=(aentry); } switch (mconfig.getMode()) { case 0: default: { aentry.ACKmode = (RealmMulticastAdvancedConfigurationEntryACKmode.ACKWINDOW); break; } case 1: { aentry.ACKmode = (RealmMulticastAdvancedConfigurationEntryACKmode.NACKWINDOW); break; } case 2: { aentry.ACKmode = (RealmMulticastAdvancedConfigurationEntryACKmode.BROADCAST); break; } } aentry.KeepAliveInterval=(mconfig.getKeepAliveInterval()); aentry.PacketTTL=(mconfig.getTTL()); aentry.TrafficClass=(mconfig.getTrafficClass()); aentry.FlusherInterval=(mconfig.getFlusherInterval()); aentry.AckWindowsize=(mconfig.getAckWindowSize()); aentry.UnackedWindowsize=(mconfig.getUnAckedWindowSize()); aentry.PacketSize=(mconfig.getPacketSize()); aentry.ReceiverOutstandingPacketSize=(mconfig.getMaxOutstandingPackets()); aentry.SenderOutstandingPacketSize=(mconfig.getOutstandingPacketsQueueSize()); aentry.PeakDetectionRate=(mconfig.getPeakRate()); return entry; } private void createInterfaces(NirvanaRealm realm, nRealmNode node) { try { // construct each interface from the nInterfaceManager nInterfaceManager mgr = node.getInterfaceManager(); ArrayList ifaces = mgr.getInterfaces(); RealmInterfaceSet iSet = new RealmInterfaceSet(); iSet.RealmNSPInterface = new RealmNSPInterfaceEntry[mgr.getNumberOfNSP()]; iSet.RealmNHPInterface = new RealmNHPInterfaceEntry[mgr.getNumberOfNHP()]; iSet.RealmNHPSInterface = new RealmNHPSInterfaceEntry[mgr.getNumberOfNHPS()]; iSet.RealmNSPSInterface = new RealmNSPSInterfaceEntry[mgr.getNumberOfNSPS()]; List shmList = null; if(iSet.RealmSHMConfiguration==null){ shmList = new List(); }else{ shmList = iSet.RealmSHMConfiguration.ToList(); } List multicastList = null; if (iSet.RealmMulticastConfiguration == null) { multicastList = new List(); } else { multicastList = iSet.RealmMulticastConfiguration.ToList(); } nMulticastManager multimgr = node.getMulticastManager(); nMulticastConfiguration[] multiconfigs = multimgr.getMulticastConfigurations(); for (int i = 0; i < multiconfigs.Length; i++) { nMulticastConfiguration mconfig = (nMulticastConfiguration)multiconfigs.GetValue(i); RealmMulticastConfigurationEntry entry = createMulticastConfiguration(mconfig); multicastList.Add(entry); } // loop through all known interfaces for (int x = 0; x < ifaces.Count; x++) { nInterfaceStatus status = (nInterfaceStatus) ifaces[x]; nInterface iface = status.getInterface(); if (iface is nSharedMemoryInterface) { nSharedMemoryInterface shmif = (nSharedMemoryInterface) iface; RealmSHMConfigurationEntry entry = new RealmSHMConfigurationEntry(); entry.name=shmif.Name; entry.buffersize=(shmif.getBufferSize()); entry.directory=(shmif.getDirectoryPath()); entry.timeout=(shmif.getTimeout()); shmList.Add(entry); } else { RealmInterfaceEntry entry = new RealmInterfaceEntry(); // set the values for the interface object entry.acceptThreads = (iface.getThreadCount()); entry.adapter = (iface.getAdapter()); entry.authtime = (iface.getAuthTimeOut()); entry.advertise = (iface.canAdvertise()); entry.autostart = (iface.willAutostart()); entry.name = iface.Name; entry.port = (iface.getPort()); entry.backlog = (iface.getBacklog()); entry.allowforinterrealm = (iface.isInterRealmAllow()); entry.receivebuffersize = (iface.getRecvBufferSize()); entry.sendbuffersize = (iface.getSendBufferSize()); entry.alias = (iface.getAdapaterAlias()); entry.allowclientconnections = (iface.isClientConnectionsAllowed()); // set the interface entry to be the actual interface of the right type nACL viaList = null; InterfacePermissionSet viaAcl = null; if (via) { viaList = iface.getViaList(); viaAcl = new InterfacePermissionSet(); createViaPermissions(viaAcl, viaList); } if (iface is nSSLInterface) { RealmNSPSInterfaceEntry ssl = new RealmNSPSInterfaceEntry(); ssl.RealmInterface = entry; if ((via) && (viaList.size() > 0)) { ssl.InterfacePermissionSet.InterfaceACLEntry = (viaAcl.InterfaceACLEntry);//todo::group? } RealmInterfaceSupportedCipherSet cSet = new RealmInterfaceSupportedCipherSet(); string[] ciphers = ((nSSLInterface) iface).getEnabledCiphers(); cSet.RealmInterfaceSupportedCipher = new RealmInterfaceSupportedCipher[ciphers.Length]; if (ciphers != null) { for (int y = 0; y < ciphers.Length; y++) { RealmInterfaceSupportedCipher cipher = new RealmInterfaceSupportedCipher(); cipher.name = ciphers[y]; cSet.RealmInterfaceSupportedCipher[y] = cipher; } } else { RealmInterfaceSupportedCipher cipher = new RealmInterfaceSupportedCipher(); cipher.name = ""; cSet.RealmInterfaceSupportedCipher[0] = cipher; } ssl.RealmInterfaceSupportedCipherSet = cSet.RealmInterfaceSupportedCipher; RealmInterfaceSSLConfig sslConfig = new RealmInterfaceSSLConfig(); nSSLInterface ssli = (nSSLInterface) iface; sslConfig.enableClientValidation = (ssli.getCertRequired()); sslConfig.certificateAlias = (ssli.getAlias()); sslConfig.keyStorePath = (ssli.getKeyStore()); sslConfig.trustStorePath = (ssli.getTrustStore()); ssl.RealmInterfaceSSLConfig = (sslConfig); if (ssli.getCRLFile() != null) { sslConfig.CRLFile = (ssli.getCRLFile()); } iSet.RealmNSPSInterface[numNSPS] = ssl; numNSPS++; } else if (iface is nSocketInterface) { RealmNSPInterfaceEntry sock = new RealmNSPInterfaceEntry(); sock.RealmInterface = (entry); if ((via) && (viaList.size() > 0)) { sock.InterfacePermissionSet.InterfaceACLEntry = (viaAcl.InterfaceACLEntry);//todo::group } iSet.RealmNSPInterface[numNSP] = sock; numNSP++; } else if (iface is nHTTPSInterface) { RealmNHPSInterfaceEntry https = new RealmNHPSInterfaceEntry(); https.RealmInterface = (entry); if ((via) && (viaList.size() > 0)) { https.InterfacePermissionSet.InterfaceACLEntry = (viaAcl.InterfaceACLEntry);//todo::group } nHTTPSInterface nhps = (nHTTPSInterface) iface; https.EnableWebSockets = (nhps.isWebSocketEnabled()); https.EnableNativeComet = (nhps.isNativeCometAllowed()); https.AjaxLPActiveDelay = (nhps.getAjaxLPActiveDelay()); https.AjaxLPIdleDelay = (nhps.getAjaxLPIdleDelay()); //https.InitialJavascript=(nhps.getInitialJavascript()); if (iplugins) { ArrayList plugins = nhps.getPlugin(); if ((plugins != null) && (plugins.Count > 0)) { createPlugins(https, plugins); } } RealmInterfaceSupportedCipherSet cSet = new RealmInterfaceSupportedCipherSet(); string[] ciphers = nhps.getEnabledCiphers(); cSet.RealmInterfaceSupportedCipher = new RealmInterfaceSupportedCipher[ciphers.Length]; if (ciphers != null) { for (int y = 0; y < ciphers.Length; y++) { RealmInterfaceSupportedCipher cipher = new RealmInterfaceSupportedCipher(); cipher.name = ciphers[y]; cSet.RealmInterfaceSupportedCipher[y] = cipher; } } else { RealmInterfaceSupportedCipher cipher = new RealmInterfaceSupportedCipher(); cipher.name = ""; cSet.RealmInterfaceSupportedCipher[0] = cipher; } https.RealmInterfaceSupportedCipherSet = (cSet.RealmInterfaceSupportedCipher); RealmInterfaceSSLConfig sslConfig = new RealmInterfaceSSLConfig(); sslConfig.enableClientValidation = (nhps.getCertRequired()); sslConfig.certificateAlias = (nhps.getAlias()); sslConfig.keyStorePath = (nhps.getKeyStore()); sslConfig.trustStorePath = (nhps.getTrustStore()); if (nhps.getCRLFile() != null) { sslConfig.CRLFile = (nhps.getCRLFile()); } iSet.RealmNHPSInterface[numNHPS] = https; numNHPS++; } else if (iface is nHTTPInterface) { RealmNHPInterfaceEntry http = new RealmNHPInterfaceEntry(); nHTTPInterface nhp = (nHTTPInterface) iface; JavascriptConfigEntryType jsconfigentry = new JavascriptConfigEntryType(); jsconfigentry.EnableWebSockets = (nhp.isWebSocketEnabled()); jsconfigentry.EnableNativeComet = (nhp.isNativeCometAllowed()); jsconfigentry.AjaxLPActiveDelay = (nhp.getAjaxLPActiveDelay()); jsconfigentry.AjaxLPIdleDelay = (nhp.getAjaxLPIdleDelay()); // jsconfigentry.InitialJavascript=(nhp.getInitialJavascript()); CustomHeadersConfigEntryType[] c = jsconfigentry.CustomHeadersConfig; List customheaderlist; if (c != null) { customheaderlist = new List(c); } else { customheaderlist = new List(); } List httpcustomheaderlist = nhp.getCustomHeaders(); if (httpcustomheaderlist != null && httpcustomheaderlist.Count > 0) { for (int i = 0; i < httpcustomheaderlist.Count; i++) { nCustomHeader customHeader = httpcustomheaderlist[i]; CustomHeadersConfigEntryType chentry = new CustomHeadersConfigEntryType(); chentry.Key = (customHeader.getKey()); chentry.Value = (customHeader.getValue()); chentry.UserAgents = (customHeader.getUserAgents()); customheaderlist.Add(chentry); } } http.JavascriptConfigEntry = (jsconfigentry); http.RealmInterface = (entry); if ((via) && (viaList.size() > 0)) { http.InterfacePermissionSet.InterfaceACLEntry = (viaAcl.InterfaceACLEntry);//todo::group? } if (iplugins) { ArrayList plugins = nhp.getPlugin(); if ((plugins != null) && (plugins.Count > 0)) { createPlugins(http, plugins); } } iSet.RealmNHPInterface[numNHP] = http; numNHP++; } } } // set the interfaces set in the realm object realm.RealmInterfaces = iSet; } catch (Exception ex) { throw ex; } } private void createPlugins(RealmNHPInterfaceEntry entry, ArrayList plugins) { try { entry.RealmInterfacePlugin = new RealmInterfacePluginEntry[plugins.Count]; for (int x = 0; x < plugins.Count; x++) { nPluginConfiguration cfg = (nPluginConfiguration)plugins[x]; string type = cfg.Name; entry.RealmInterfacePlugin[x] = new RealmInterfacePluginEntry(); if (type.Equals("File Plugin")) { entry.RealmInterfacePlugin[x].type = "File Plugin"; } else if (type.Equals("Nirvana XML Plugin")) { entry.RealmInterfacePlugin[x].type = "Nirvana XML Plugin"; } else if (type.Equals("Proxy Pass through Plugin")) { entry.RealmInterfacePlugin[x].type = "Proxy Pass through Plugin"; } else if (type.Equals("Nirvana SOAP Plugin")) { entry.RealmInterfacePlugin[x].type = "Nirvana SOAP Plugin"; } else if (type.Equals("Nirvana REST Plugin")) { entry.RealmInterfacePlugin[x].type = "Nirvana REST Plugin"; } else if (type.Equals("Realm Status Plugin")) { entry.RealmInterfacePlugin[x].type = "Realm Status Plugin"; } else if (type.Equals("ServletPlugin")) { entry.RealmInterfacePlugin[x].type = "ServletPlugin"; } else if (type.Equals("Change Password Plugin")) { entry.RealmInterfacePlugin[x].type = "Change Password Plugin"; } entry.RealmInterfacePlugin[x].PluginConfigEntry = createPluginConfig(cfg); entry.RealmInterfacePlugin[x].mountPoint = (cfg.getMountPoint()); entry.RealmInterfacePlugin[x].name = cfg.Name; } } catch (Exception e) { throw e; } } private void createPlugins(RealmNHPSInterfaceEntry entry, ArrayList plugins) { try { entry.RealmInterfacePlugin = new RealmInterfacePluginEntry[plugins.Count]; for (int x = 0; x < plugins.Count; x++) { nPluginConfiguration cfg = (nPluginConfiguration)plugins[x]; string type = cfg.Name; entry.RealmInterfacePlugin[x] = new RealmInterfacePluginEntry(); if (type.Equals("File Plugin")) { entry.RealmInterfacePlugin[x].type = "File Plugin"; } else if (type.Equals("Nirvana XML Plugin")) { entry.RealmInterfacePlugin[x].type = "Nirvana XML Plugin"; } else if (type.Equals("Proxy Pass through Plugin")) { entry.RealmInterfacePlugin[x].type = "Proxy Pass through Plugin"; } else if (type.Equals("Nirvana SOAP Plugin")) { entry.RealmInterfacePlugin[x].type = "Nirvana SOAP Plugin"; } else if (type.Equals("Nirvana REST Plugin")) { entry.RealmInterfacePlugin[x].type = "Nirvana REST Plugin"; } else if (type.Equals("Realm Status Plugin")) { entry.RealmInterfacePlugin[x].type = "Realm Status Plugin"; } else if (type.Equals("ServletPlugin")) { entry.RealmInterfacePlugin[x].type = "ServletPlugin"; } else if (type.Equals("Change Password Plugin")) { entry.RealmInterfacePlugin[x].type = "Change Password Plugin"; } entry.RealmInterfacePlugin[x].PluginConfigEntry = createPluginConfig(cfg); entry.RealmInterfacePlugin[x].mountPoint = (cfg.getMountPoint()); entry.RealmInterfacePlugin[x].name = cfg.Name; } } catch (Exception e) { throw e; } } private void createViaPermissions(InterfacePermissionSet ipermset, nACL entries) { IList ipermlist = ipermset.InterfaceACLEntry==null? new List(): ipermset.InterfaceACLEntry.ToList(); System.Collections.IEnumerator enum1 = entries.getEntries(); while (enum1.MoveNext()) { object obj = enum1.Current; if (obj is nInterfaceViaEntry) { nInterfaceViaEntry entry = (nInterfaceViaEntry)obj; if (entry.isGroup()) { InterfaceGroupACLEntry xmlentry = createInterfaceGroupACLEntry(entry); ipermlist.Add(xmlentry); } else { InterfaceACLEntry xmlentry = createInterfaceACLEntry(entry); ipermlist.Add(xmlentry); } } } //ipermset.InterfaceACLEntry = ipermlist.ToArray();//todo::need to add this back!!! } private void createContainerACL(NirvanaRealm realm, nContainer node) { try { // call the method to search the child nodes within the realm node System.Collections.IEnumerator enum1 = node.getNodes(); while (enum1.MoveNext()) { nNode o = (nNode)enum1.Current; if (o is nLeafNode) { createLeafACL(realm, (nLeafNode)o); } else if (o is nContainer) { createContainerACL(realm, (nContainer)o); } } } catch (Exception ex) { throw ex; } } /// /// Method to output the contents of a leaf node, i.e. a channel or a queue /// private void createLeafACL(NirvanaRealm realm, nLeafNode node) { // detect if the node is a channel or a queue if (node.isChannel()) { createChannelACL(realm, node); } else { createQueueACL(realm, node); } } private ChannelAttributesEntry createChannelAttributes(nLeafNode node) { if ((!channels) && (!channelAcls)) { if ((!queues) && (!queueAcls)) { return null; } } ChannelAttributesEntry entry = null; nChannelAttributes nca = null; if (((!channels) && (channelAcls)) || ((!queues) && (queueAcls))) { entry = new ChannelAttributesEntry(); nca = node.getAttributes(); entry.name = nca.getFullName(); } else if (channels || queues) { entry = new ChannelAttributesEntry(); nca = node.getAttributes(); entry.name = nca.getFullName(); entry.TTL = (nca.getTTL()); entry.capacity = (nca.getMaxEvents()); long eid = node.getLastEID(); if (eid < 0) // Since it is illegal to import a -1 eid = 0; entry.EID = (eid); entry.jmsEngine = (nca.isJMSEngine()); entry.mergeEngine = (nca.isMergeEngine()); switch (nca.getType()) { case nChannelAttributes.SIMPLE_TYPE: entry.type = ChannelAttributesEntryType.SIMPLE_TYPE; break; case nChannelAttributes.TRANSIENT_TYPE: entry.type = ChannelAttributesEntryType.TRANSIENT_TYPE; break; case nChannelAttributes.RELIABLE_TYPE: entry.type = ChannelAttributesEntryType.RELIABLE_TYPE; break; case nChannelAttributes.PERSISTENT_TYPE: entry.type = ChannelAttributesEntryType.PERSISTENT_TYPE; break; case nChannelAttributes.OFF_HEAP_TYPE: entry.type = ChannelAttributesEntryType.OFF_HEAP_TYPE; break; case nChannelAttributes.PAGE_TYPE: entry.type = ChannelAttributesEntryType.PAGE_TYPE; break; case nChannelAttributes.MIXED_TYPE: entry.type = ChannelAttributesEntryType.MIXED_TYPE; break; } entry.clusterWide = (nca.isClusterWide()); } return entry; } private StorePropertiesEntry createStoreProperties(nLeafNode node) { StorePropertiesEntry entry = null; nStoreProperties props = null; if (channels || queues) { props = node.getAttributes().getProperties(); nChannelAttributes att = new nChannelAttributes(); nStoreProperties test = att.getProperties(); if (test.getCacheOnReload() != props.getCacheOnReload()) { entry = new StorePropertiesEntry(); entry.CacheOnReload = (props.getCacheOnReload()); } if (props.getClientMergeEngineClassname() != null) { if (entry == null) entry = new StorePropertiesEntry(); entry.ClientMergeEngineClassname = (props.getClientMergeEngineClassname()); } if (props.getFanoutArchiveTarget() != null) { if (entry == null) entry = new StorePropertiesEntry(); entry.FanoutArchiveTarget=props.getFanoutArchiveTarget(); } if (test.getEnableCaching() != props.getEnableCaching()) { if (entry == null) entry = new StorePropertiesEntry(); entry.EnableCaching = (props.getEnableCaching()); } if (test.getEnableReadBuffering() != props.getEnableReadBuffering()) { if (entry == null) entry = new StorePropertiesEntry(); entry.EnableReadBuffering = (props.getEnableReadBuffering()); } if (test.getSyncMaxBatchSize() != props.getSyncMaxBatchSize()) { if (entry == null) entry = new StorePropertiesEntry(); entry.SyncMaxBatchSize = (props.getSyncMaxBatchSize()); } if (test.getHonorCapacityWhenFull() != props.getHonorCapacityWhenFull()) { if (entry == null) entry = new StorePropertiesEntry(); entry.HonorCapacityWhenFull = (props.getHonorCapacityWhenFull()); } if (test.getPerformAutomaticMaintenance() != props.getPerformAutomaticMaintenance()) { if (entry == null) entry = new StorePropertiesEntry(); entry.PerformAutomaticMaintenance = (props.getPerformAutomaticMaintenance()); } if (test.getReadBufferSize() != props.getReadBufferSize()) { if (entry == null) entry = new StorePropertiesEntry(); entry.ReadBufferSize = (props.getReadBufferSize()); } if (test.getSyncBatchTime() != props.getSyncBatchTime()) { if (entry == null) entry = new StorePropertiesEntry(); entry.SyncBatchTime = (props.getSyncBatchTime()); } if (test.canSyncOnEachWrite() != props.canSyncOnEachWrite()) { if (entry == null) entry = new StorePropertiesEntry(); entry.SyncOnEachWrite = (props.canSyncOnEachWrite()); } if (test.getPriority() != props.getPriority()) { if (entry == null) entry = new StorePropertiesEntry(); entry.Priority=(props.getPriority()); } if (test.getStampDictionary() != props.getStampDictionary()) { if (entry == null) entry = new StorePropertiesEntry(); entry.StampDictionary = (props.getStampDictionary()); } } return entry; } private ChannelKeySet createChannelKeySet(nLeafNode node) { if (!channels) { return null; } nChannelAttributes nca = null; nChannelPublishKeys[] keys = null; ChannelKeySet chankeyset = new ChannelKeySet(); nca = node.getAttributes(); keys = nca.getPublishKeys(); chankeyset.ChannelKeyEntry = new ChannelKeyEntry[keys.Length]; if ((keys != null) && (keys.Length > 0)) { for (int x = 0; x < keys.Length; x++) { nChannelPublishKeys key = keys[x]; ChannelKeyEntry chankeyentry = new ChannelKeyEntry(); chankeyentry.keyName = (key.getName()); chankeyentry.keyDepth = (key.getDepth()); chankeyset.ChannelKeyEntry[x] = chankeyentry; } } return chankeyset; } private ChannelJoinSet createChannelJoinSet(nLeafNode node) { if (!channels) { if (!joins) { return null; } } System.Collections.IEnumerator enum1 = null; ChannelJoinSet chanjoinset = new ChannelJoinSet(); bool isClustered = (node.getRealm().getCluster() != null); int count = 0; if (joins) { chanjoinset.ChannelJoinEntry = new ChannelJoinEntry[node.getOutboundJoinCount()]; enum1 = node.getOutboundJoins(); if (enum1 != null) { while (enum1.MoveNext()) { nJoinDetails join = (nJoinDetails)enum1.Current; string from = node.getAbsolutePath(); string to = join.getRemoteNode().getAbsolutePath(); if (isClustered) { from = node.getAttributes().getFullName(); to = join.getRemoteNode().getAttributes().getFullName(); } ChannelJoinEntry chanjoinentry = new ChannelJoinEntry(); chanjoinentry.to = (to); chanjoinentry.filter = (join.getSelector()); chanjoinentry.hopcount = (join.getHopCount()); chanjoinentry.allowPurge = (join.allowPurgeRequests()); chanjoinentry.from = (from); chanjoinset.ChannelJoinEntry[count] = chanjoinentry; count++; } } } if (count > 0) { return chanjoinset; } return null; } private void createQueueACL(NirvanaRealm realm, nLeafNode node) { if ((!queues) && (!queueAcls)) { return; } QueueSet queueset = null; if (realm.QueueSet == null) { realm.QueueSet = new QueueEntry[node.getRealm().getNoOfQueues()]; } QueueEntry qentry = new QueueEntry(); qentry.ChannelAttributesEntry = (createChannelAttributes(node)); qentry.StorePropertiesEntry = (createStoreProperties(node)); if (queueAcls) { QueuePermissionSet qpermset = new QueuePermissionSet(); System.Collections.IEnumerator aclenum = node.getACLs().getEntries(); int numGroups = GetNumberOfGroups(node.getACLs().getEntries()); qpermset.QueueACLEntry = new QueueACLEntry[node.getACLs().size()-numGroups]; qpermset.QueueGroupACLEntry = new QueueGroupACLEntry[numGroups]; List qpermgrouplist = qpermset.QueueGroupACLEntry.ToList(); List qpermlist = qpermset.QueueACLEntry.ToList(); int x = 0; int y = 0; while (aclenum.MoveNext()) { nChannelACLEntry o = (nChannelACLEntry)aclenum.Current; if (o.isGroup()) { QueueGroupACLEntry qaclentry = new QueueGroupACLEntry(); qaclentry.groupname = o.Name; qaclentry.listACLEntries = (o.canList()); qaclentry.modifyACLEntries = (o.canModify()); qaclentry.fullControl = (o.hasFullPrivileges()); qaclentry.peek = (o.canRead()); qaclentry.pop = (o.canPop()); qaclentry.push = (o.canWrite()); qaclentry.purge = (o.canPurge()); qpermgrouplist.Add(qaclentry); x++; } else { QueueACLEntry qaclentry = new QueueACLEntry(); qaclentry.host = (o.getHost()); qaclentry.name = o.Name; qaclentry.listACLEntries = (o.canList()); qaclentry.modifyACLEntries = (o.canModify()); qaclentry.fullControl = (o.hasFullPrivileges()); qaclentry.peek = (o.canRead()); qaclentry.pop = (o.canPop()); qaclentry.push = (o.canWrite()); qaclentry.purge = (o.canPurge()); qpermlist.Add(qaclentry); y++; } } qpermset.QueueGroupACLEntry = qpermgrouplist.ToArray(); qpermset.QueueACLEntry = qpermlist.ToArray(); qentry.QueuePermissionSet = qpermset; } realm.QueueSet[numQueues] = qentry; numQueues++; } private void createChannelACL(NirvanaRealm realm, nLeafNode node) { if ((!channels) && (!channelAcls)) { return; } if (realm.ChannelSet == null) { realm.ChannelSet = new ChannelEntry[node.getRealm().getNoOfChannels()]; } ChannelEntry chanentry = new ChannelEntry(); chanentry.ChannelPermissionSet = new ChannelPermissionSet(); chanentry.ChannelAttributesEntry = (createChannelAttributes(node)); chanentry.StorePropertiesEntry = (createStoreProperties(node)); if ((node.getAttributes().getPublishKeys() != null) && (node.getAttributes().getPublishKeys().Length > 0)) { chanentry.ChannelKeySet = (createChannelKeySet(node)).ChannelKeyEntry; } if (joins) { ChannelJoinSet joinSet = createChannelJoinSet(node); if (joinSet != null) { chanentry.ChannelJoinSet = (joinSet.ChannelJoinEntry); } } if (channelAcls) { ChannelPermissionSet chanpermset = new ChannelPermissionSet(); System.Collections.IEnumerator aclenum = node.getACLs().getEntries(); int numGroups = GetNumberOfGroups(node.getACLs().getEntries()); int x = 0; int y = 0; chanpermset.ChannelACLEntry = new ChannelACLEntry[node.getACLs().size()-numGroups]; chanpermset.ChannelGroupACLEntry = new ChannelGroupACLEntry[numGroups]; while (aclenum.MoveNext()) { nChannelACLEntry o = (nChannelACLEntry)aclenum.Current; if (o.isGroup()){ ChannelGroupACLEntry chanaclentry = new ChannelGroupACLEntry(); chanaclentry.groupname = o.Name; chanaclentry.listACLEntries = (o.canList()); chanaclentry.modifyACLEntries = (o.canModify()); chanaclentry.fullControl = (o.hasFullPrivileges()); chanaclentry.getLastEID = (o.canGetLastEID()); chanaclentry.publish = (o.canWrite()); chanaclentry.subscribe = (o.canRead()); chanaclentry.purgeEvents = (o.canPurge()); chanaclentry.useNamedSubcription = (o.canUseNamedSubscription()); chanpermset.ChannelGroupACLEntry[x] = (chanaclentry); x++; }else{ ChannelACLEntry chanaclentry = new ChannelACLEntry(); chanaclentry.host = (o.getHost()); chanaclentry.name = o.Name; chanaclentry.listACLEntries = (o.canList()); chanaclentry.modifyACLEntries = (o.canModify()); chanaclentry.fullControl = (o.hasFullPrivileges()); chanaclentry.getLastEID = (o.canGetLastEID()); chanaclentry.publish = (o.canWrite()); chanaclentry.subscribe = (o.canRead()); chanaclentry.purgeEvents = (o.canPurge()); chanaclentry.useNamedSubcription = (o.canUseNamedSubscription()); chanpermset.ChannelACLEntry[y] = (chanaclentry); y++; } } chanentry.ChannelPermissionSet.ChannelGroupACLEntry = chanpermset.ChannelGroupACLEntry; chanentry.ChannelPermissionSet.ChannelACLEntry = chanpermset.ChannelACLEntry; } realm.ChannelSet[numChannels] = chanentry; numChannels++; } /// /// Method to search an enumeration of nodes, these could be realm acl /// * entries, channel acl entries, leaf nodes or realm nodes /// private void createRealmACLList(RealmPermissionSet rpermset, System.Collections.IEnumerator enum1) { int x = 0; int y = 0; while (enum1.MoveNext()) { object obj = enum1.Current; nRealmACLEntry racl = (nRealmACLEntry) obj; if (racl != null) { if (racl.isGroup()) { RealmGroupACLEntry xmlentry = createRealmGroupACLEntry(racl); rpermset.RealmGroupACLEntry[x] = xmlentry; x++; } else { // if the node is a realm, call the method to output the acls for a realm node RealmACLEntry xmlentry = createRealmACLEntry((nRealmACLEntry) obj); rpermset.RealmACLEntry[y] = (xmlentry); y++; } } } } private int GetNumberOfGroups(IEnumerator e) { int numGroups = 0; while(e.MoveNext()) { if(((nACLEntry)e.Current).isGroup()) { numGroups++; } } return numGroups; } /// /// Method that outputs the entries of an acl object, by passing the enumeration of acl entries /// private void createRealmACL(RealmPermissionSet rpermset, nACL acl) { IEnumerator entriesEnum = acl.getEntries(); int numGroups = GetNumberOfGroups(entriesEnum); rpermset.RealmACLEntry = new RealmACLEntry[acl.size()-numGroups]; rpermset.RealmGroupACLEntry = new RealmGroupACLEntry[numGroups]; createRealmACLList(rpermset, acl.getEntries()); } /// /// Method to output the permissions for a realm acl entry /// private RealmACLEntry createRealmACLEntry(nRealmACLEntry entry) { RealmACLEntry xmlentry = new RealmACLEntry(); xmlentry.name = entry.Name; xmlentry.host = (entry.getHost()); xmlentry.connectToRealm = (entry.canAccessTheRealm()); xmlentry.changeRealmConfig = (entry.canConfigureRealm()); xmlentry.addremoveChannels = (entry.canManageChannels()); xmlentry.addremoveJoins = (entry.canManageJoins()); xmlentry.overrideConnectionCount = (entry.canOverrideConnectionCount()); xmlentry.addremoveRealms = (entry.canManageRealm()); xmlentry.fullControl = (entry.hasFullPrivileges()); xmlentry.listACLEntries = (entry.canList()); xmlentry.modifyACLEntries = (entry.canModify()); xmlentry.useAdminAPI = (entry.canUseAdminAPI()); xmlentry.manageDatagroups=(entry.canManageDataGroups()); xmlentry.ownDatagroups=(entry.canTakeOwnershipOfDataGroup()); xmlentry.publishDatagroups=(entry.canPublishToGlobalDataGroup()); return xmlentry; } /// /// Method to output the permissions for a realm acl entry /// private RealmGroupACLEntry createRealmGroupACLEntry(nRealmACLEntry entry) { RealmGroupACLEntry xmlentry = new RealmGroupACLEntry(); xmlentry.groupname = entry.Name; xmlentry.connectToRealm = (entry.canAccessTheRealm()); xmlentry.changeRealmConfig = (entry.canConfigureRealm()); xmlentry.addremoveChannels = (entry.canManageChannels()); xmlentry.addremoveJoins = (entry.canManageJoins()); xmlentry.overrideConnectionCount = (entry.canOverrideConnectionCount()); xmlentry.addremoveRealms = (entry.canManageRealm()); xmlentry.fullControl = (entry.hasFullPrivileges()); xmlentry.listACLEntries = (entry.canList()); xmlentry.modifyACLEntries = (entry.canModify()); xmlentry.useAdminAPI = (entry.canUseAdminAPI()); xmlentry.manageDatagroups = (entry.canManageDataGroups()); xmlentry.ownDatagroups = (entry.canTakeOwnershipOfDataGroup()); xmlentry.publishDatagroups = (entry.canPublishToGlobalDataGroup()); return xmlentry; } /// /// Method to output the permissions for a realm acl entry /// private InterfaceACLEntry createInterfaceACLEntry(nInterfaceViaEntry entry) { InterfaceACLEntry xmlentry = new InterfaceACLEntry(); xmlentry.name = entry.Name; xmlentry.host = (entry.getHost()); return xmlentry; } /// /// Method to output the permissions for a realm acl entry /// private InterfaceGroupACLEntry createInterfaceGroupACLEntry(nInterfaceViaEntry entry) { InterfaceGroupACLEntry xmlentry = new InterfaceGroupACLEntry(); xmlentry.groupname = entry.Name; return xmlentry; } private PluginConfigEntryType[] createPluginConfig(nPluginConfiguration configurations) { try { PluginConfigEntryType[] configs = new PluginConfigEntryType[configurations.size()]; for (int y = 0; y < configurations.size(); y++) { nPluginConfigEntry nEntry = (nPluginConfigEntry)configurations.elementAt(y); PluginConfigEntryType entry = new PluginConfigEntryType(); entry.name = nEntry.Name; entry.value = nEntry.Value; entry.description = nEntry.Description; configs[y] = entry; } return configs; } catch (Exception e) { throw e; } } /// /// Prints the usage message for this class /// private static void Usage() { Console.WriteLine("Usage ...\n"); Console.WriteLine("nexportrealmxml \n"); Console.WriteLine(" -all -realms -cluster -realmacl -realmcfg -channels -channeacls -joins -queues -queueacls -interfaces -plugins -via\n"); } public static void report(string line) { DateTime dt = DateTime.Now; Console.WriteLine(dt.ToString() + " > " + line); } } }