// Sample code file: ChatRegistration.java

// Warning: This code has been marked up for HTML

/*
   Copyright (c) 2000 Novell, Inc.  All Rights Reserved.

   THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND TREATIES. 
   USE AND REDISTRIBUTION OF THIS WORK IS SUBJECT TO THE LICENSE AGREEMENT 
   ACCOMPANYING THE SOFTWARE DEVELOPMENT KIT (SDK) THAT CONTAINS THIS WORK. 
   PURSUANT TO THE SDK LICENSE AGREEMENT, NOVELL HEREBY GRANTS TO DEVELOPER A 
   ROYALTY-FREE, NON-EXCLUSIVE LICENSE TO INCLUDE NOVELL'S SAMPLE CODE IN ITS 
   PRODUCT. NOVELL GRANTS DEVELOPER WORLDWIDE DISTRIBUTION RIGHTS TO MARKET, 
   DISTRIBUTE, OR SELL NOVELL'S SAMPLE CODE AS A COMPONENT OF DEVELOPER'S 
   PRODUCTS. NOVELL SHALL HAVE NO OBLIGATIONS TO DEVELOPER OR DEVELOPER'S 
   CUSTOMERS WITH RESPECT TO THIS CODE. 
*/
 
 
package com.novell.Chat.reg;

import com.novell.Chat.Chat;

// ConsoleOne imports
import com.novell.application.console.snapin.*;
import com.novell.application.console.snapin.scope.*;

// NDSNamespace and common library imports
import com.novell.admin.ns.*;
import com.novell.admin.ns.nds.*;

/**
 * Registers each of the snapins with ConsoleOne.  All of the snapins are
 * registered here to help increase the speed at which ConsoleOne is loaded.
 */
public class ChatRegistration implements Registration
{
   /**
    * Implementation of the Registration Interface.  
    *
    * Returns a RegistrationItem array, which the shell uses to 
    * categorize the snap-ins based on the content of the Scope and 
    * to instantiate the snap-ins. 
    * 
    * @return The array of items to be registered. 
    */
   public RegistrationItem[] getRegistration()
   {
        RegistrationItem[] info = new RegistrationItem[14];
        GlobalScope gScope = null;
        NamespaceTypeScope nsTypeScope = null;
    
        //Registers the 'Disable Chat' Menu
        gScope = new GlobalScope(Shell.SNAPIN_MENU);
        info[0] =  new RegistrationItem(gScope, "com.novell.Chat.DisableChatMenuSnapin");
        
        //Registers the 'On-line Chat Users' Menu
        gScope = new GlobalScope(Shell.SNAPIN_MENU);
        info[1] =  new RegistrationItem(gScope, "com.novell.Chat.OnLineUserSnapin");
        
        //Registers the 'On-line Chat Users' toolbar button
        gScope = new GlobalScope(Shell.SNAPIN_TOOLBARITEM);
        info[2] =  new RegistrationItem(gScope, "com.novell.Chat.OnLineUserSnapin");
        
        //Registers the 'Chat' popup menu for User objects
        nsTypeScope = new NamespaceTypeScope(Shell.SNAPIN_POPUP_MENU, NDSNamespace.name, "User");
        info[3] =  new RegistrationItem(nsTypeScope, "com.novell.Chat.ChatPopupMenuSnapin");
        
        //Registers the 'Chat' popup menu for Chat Room objects
        nsTypeScope = new NamespaceTypeScope(Shell.SNAPIN_POPUP_MENU, NDSNamespace.name, Chat.CHATROOM_TYPE);        
        info[4] =  new RegistrationItem(nsTypeScope, "com.novell.Chat.ChatPopupMenuSnapin");        
        
        //Registers the Chat Room page snapin for all of the NDSNamespace.
        nsTypeScope = new NamespaceTypeScope(Shell.SNAPIN_PAGE, NDSNamespace.name, Chat.CHATROOM_TYPE);          
        info[5] =  new RegistrationItem(nsTypeScope, "com.novell.Chat.ChatRoomPageSnapin");
        
        //Registers the 'New Chat Room' Menu for 'Organization' objects
        nsTypeScope = new NamespaceTypeScope(Shell.SNAPIN_MENU, NDSNamespace.name, "Organization");
        info[6] =  new RegistrationItem(nsTypeScope, "com.novell.Chat.ChatRoomSnapins");
        
        //Registers the 'New Chat Room' Menu for 'Organizational Unit' objects
        nsTypeScope = new NamespaceTypeScope(Shell.SNAPIN_MENU, NDSNamespace.name, "Organizational Unit");
        info[7] =  new RegistrationItem(nsTypeScope, "com.novell.Chat.ChatRoomSnapins");
        
        //Registers the 'New Chat Room' popup menu for 'Organization' objects
        nsTypeScope = new NamespaceTypeScope(Shell.SNAPIN_POPUP_MENU, NDSNamespace.name, "Organization");
        info[8] =  new RegistrationItem(nsTypeScope, "com.novell.Chat.ChatRoomSnapins");
        
        //Registers the 'New Chat Room' popup menu for 'Organizational Unit' objects
        nsTypeScope = new NamespaceTypeScope(Shell.SNAPIN_POPUP_MENU, NDSNamespace.name, "Organizational Unit");
        info[9] =  new RegistrationItem(nsTypeScope, "com.novell.Chat.ChatRoomSnapins");
        
        //Registers the 'New Chat Room' toolbar button for 'Organization' objects
        nsTypeScope = new NamespaceTypeScope(Shell.SNAPIN_TOOLBARITEM, NDSNamespace.name, "Organization");
        info[10] =  new RegistrationItem(nsTypeScope, "com.novell.Chat.ChatRoomSnapins");
        
        //Registers the 'New Chat Room' toolbar button for 'Organizational Unit' objects
        nsTypeScope = new NamespaceTypeScope(Shell.SNAPIN_TOOLBARITEM, NDSNamespace.name, "Organizational Unit");
        info[11] =  new RegistrationItem(nsTypeScope, "com.novell.Chat.ChatRoomSnapins"); 
        
        //This snapin uses the GlobalScope so that Chat will be enabled at the
        //startup of ConsoleOne.
        gScope = new GlobalScope(Shell.SNAPIN_SERVICE);
        info[12] =  new RegistrationItem(gScope, "com.novell.Chat.ChatServiceSnapin"); 
        
        //Registers the status bar snapin
        gScope = new GlobalScope(Shell.SNAPIN_STATUSBARITEM);      
        info[13] =  new RegistrationItem(gScope, "com.novell.Chat.ChatStatusBarSnapin");
          
        return info;
   }
    
    
    
}