001 package com.croftsoft.apps.agoracast.c2p; 002 003 import java.awt.*; 004 import java.awt.event.*; 005 import java.io.*; 006 import javax.swing.*; 007 008 import com.croftsoft.core.net.news.NntpLib; 009 import com.croftsoft.core.net.news.UsenetLib; 010 import com.croftsoft.core.net.news.UsenetMessage; 011 import com.croftsoft.core.security.PreIdentifier; 012 import com.croftsoft.core.util.log.PrintStreamLog; 013 014 /********************************************************************* 015 * Creates the Agoracast newsgroup. 016 * 017 * <p /> 018 * 019 * @version 020 * 2001-07-30 021 * @since 022 * 2001-07-29 023 * @author 024 * <a href="https://www.croftsoft.com/">David Wallace Croft</a> 025 *********************************************************************/ 026 027 public final class AgoracastNewsgroupCreator 028 ////////////////////////////////////////////////////////////////////// 029 ////////////////////////////////////////////////////////////////////// 030 { 031 032 private static final String EMAIL 033 = "david@croftsoft.com"; 034 035 private static final String NEWSGROUP 036 = AgoracastConstants.DEFAULT_NEWSGROUP; 037 038 private static final String SHORT_DESCRIPTION 039 = "Decentralized XML message exchange."; 040 041 private static final String CHARTER 042 = "All posts must be in human-readable XML-based Agoracast format." 043 + "\r\n" 044 + "See http://agoracast.org/ for more information."; 045 046 private static final String JUSTIFICATION 047 = "To create a decentralized exchange of XML messages."; 048 049 private static final String PROPONENT 050 = "David Wallace Croft (" + EMAIL + ")"; 051 052 private static final boolean IS_BOOSTER = false; 053 054 ////////////////////////////////////////////////////////////////////// 055 ////////////////////////////////////////////////////////////////////// 056 057 public static void main ( String [ ] args ) 058 throws IOException 059 ////////////////////////////////////////////////////////////////////// 060 { 061 String nntpServer = args [ 0 ]; 062 063 String username = args.length > 1 ? args [ 1 ] : null; 064 065 String password = args.length > 2 ? args [ 2 ] : null; 066 067 UsenetMessage usenetMessage = UsenetLib.createNewGroupMessage ( 068 EMAIL, 069 NEWSGROUP, 070 SHORT_DESCRIPTION, 071 CHARTER, 072 JUSTIFICATION, 073 PROPONENT, 074 IS_BOOSTER ); 075 076 NntpLib.post ( 077 nntpServer, 078 new PreIdentifier ( username, password ), 079 usenetMessage, 080 PrintStreamLog.SYSTEM_OUT_INSTANCE ); 081 } 082 083 ////////////////////////////////////////////////////////////////////// 084 ////////////////////////////////////////////////////////////////////// 085 086 private AgoracastNewsgroupCreator ( ) { } 087 088 ////////////////////////////////////////////////////////////////////// 089 ////////////////////////////////////////////////////////////////////// 090 }