· KLDP.org · KLDP.net · KLDP Wiki · KLDP BBS ·
Red5 Install/Open Meetings/Servlet Outputhandler Install

/OpenMeetings/ServletOutputhandlerInstall


* ¼³Ä¡ÇØ¾ß ÇÒ package
  • postfix ¼³Ä¡ TLS Æ÷ÇԵǾî ÀÖÀ½. ¼³Á¤ ?
  • swftools /usr/bin
  • imagemagick /usr/bin
  • ffmpeg /usr/bin
  • sox /usr/bin
  • slapd (LDAP) ?

* ¾Ë¾Æ º¸¾Æ¾ß ÇÒ °Íµé
  • sip °ü·Ã
  • openxg

* /src/app/org/openmeetings/servlet/outputhandler

* Install.java * public class Install extends VelocityViewServlet {
  • package org.openmeetings.servlet.outputhandler;
  • public Template handleRequest(HttpServletRequest httpServletRequest,
    HttpServletResponse httpServletResponse, Context ctx) throws ServletException, IOException {
    • try {
      • String command = httpServletRequest.getParameter("command");
      • if (command == null){ :) MM 1
        • File installerFile = new File(working_dir+InstallationDocumentHandler.installFileName);
        • workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/ROOT/conf
          • install.xml
        • file not exist :) MM 2
          • cat't make file because directory unwritable
          • return getVelocityEngine().getTemplate("install_error_"+lang+".vm");
          • create file
          • return getVelocityEngine().getTemplate("install_welcome_"+lang+".vm");
          • :) install_welcome_EN.vm ÀÌ Ãâ·ÂµÊ
            • <h1><A HREF="command=step1">Continue with STEP 1</A></h1>
            • command=step1 À¸·Î ¼öÇà
        • file exist
        • int i = InstallationDocumentHandler.getInstance().getCurrentStepNumber(working_dir);
          • i == 0
          • return tpl;
          • i != 0
          • return getVelocityEngine().getTemplate("install_step2_"+lang+".vm");
      • } else if (command.equals("step1")) {
        • int i = InstallationDocumentHandler.getInstance().getCurrentStepNumber(working_dir);
        • i == 0 :) MM 3
          • do init installation
          • Template tpl = super.getTemplate ("install_step1_"+lang+".vm");
          • return tpl
          • :) install_step1_EN.vm ÀÌ Ãâ·ÂµÊ
          • <form name="cmxform" id="form1" class="cmxform" method="post" action="command=step2"> ¿¡ ÀÇÇØ command=step2 ·Î À̵¿
        • i != 0
          • This Step of the installation has already been done. continue with step 2
      • } else if (command.equals("step2")) {
        • int i = InstallationDocumentHandler.getInstance().getCurrentStepNumber(working_dir);
        • i == 0 :) MM 4
          • do init installation
          • String username = httpServletRequest.getParameter("username");
            • username, userpass, useremail, orgname,....
          • ImportInitvalues.getInstance().loadInitLanguages(filePath);
            • loadMainMenu(), loadErrorMappingsFromXML(filePath), loadSalutations(),
            • loadConfiguration(crypt_ClassName, configdefault, .....),
            • loadInitUserAndOrganisation(username, userpass, useremail, orgname, timeZone),
            • loadDefaultRooms(), loadInitAppointmentCategories(), loadInitAppointmentReminderTypes()
          • add level to install file
          • InstallationDocumentHandler.getInstance().createDocument
            • (working_dir+InstallationDocumentHandler.installFileName,1);
          • return getVelocityEngine().getTemplate("install_step2_"+lang+".vm");
        • i != 0
          • This Step of the installation has already been done. continue with step 2
      • } else if (command.equals("step")){
      • }
    • }
  • }

* install_step2_EN.vm
  • return getVelocityEngine().getTemplate("install_step2_"+lang+".vm");
<body>
<H1>Openmeetings - Installation Complete!</h1>
<h2><a href="/openmeetings/">Enter the Application</a></h2>
<br/>
<br/>
If your Red5-Server runs on a different Port or on a different domain<br/>
<a href="config.xml">alter the config values of the client</a>
</body>

* org.openmeetings.app.documents.InstallationDocumentHandler
  • /src/app/org/openmeetings/app/documents/InstallationDocumentHandler.java
  • public class InstallationDocumentHandler {
    • public static final String installFileName = "install.xml";
  • }
  • install ½Ã conf ¹Ø¿¡ »ý¼ºÇÏ¿© »ç¿ëÇÏ´Â µí ÇÔ.
  • /usr/share/red5-openmeetings/webapps/openmeetings/conf/install.xml
<?xml version="1.0" encoding="UTF-8"?>
<install><step><stepnumber>1</stepnumber><stepname>Step 1</stepname></step></install>

* /home/tcheun/eclipse.dir/workspace1/ROOT/src/templates

tcheun@enk:~/eclipse.dir/workspace1/ROOT/src/templates$ ls
activation_template.vm         requestcontactconfirm.vm
feedback.vm                    resetPass.vm
install_complete_EN.vm         rtp_player_applet.vm
install_error_EN.vm            screencast_jrdesktop.vm
install_exception_EN.vm        screencast_odsp_sharertemplate.vm
install_step1_EN.vm            screencast_odsp_viewertemplate.vm
install_step2_EN.vm            screencast_rtp.vm
install_welcome_EN.vm          screencast_template.vm
invitation.vm                  screenshare.vm
register_mail.vm               sip_template.vm
register_verification_mail.vm  usual_template.vm
requestcontact.vm

* /src/app/org/openmeetings/app/installation
  • package org.openmeetings.app.installation;
  • ImportInitvalues.java
    • public static final String languageFolderName = "languages/";
    • private static final String nameOfLanguageFile = "languages.xml";
    • private static final String nameOfCountriesFile = "countries.xml";
    • private static final String nameOfTimeZoneFile = "timezones.xml";
    • private static final String nameOfErrorFile = "errorvalues.xml";

  • loadInitLanguages(String filePath)
    • WebContent/languages/korean.xml
    • Loading initial Language from xml Files into database
    • Fieldmanagment.getInstance().addFieldValueByFieldAndLanguage
    • this.loadCountriesFiles(filePath);
      • Statemanagement.getInstance().addState(country);
    • this.loadTimeZoneFiles(filePath);
  • loadMainMenu()
    • Navimanagement.getInstance().addGlobalStructure
    • Navimanagement.getInstance().addMainStructurejj
  • loadErrorMappingsFromXML(String filePath)
    • WebContent/languages/errorvalues.xml
    • ErrorManagement.getInstance().addErrorValues
  • loadSalutations()
    • Mr, Ms, Mrs, Dr
    • Salutationmanagement.getInstance().addUserSalutation
  • loadConfiguration(crypt_ClassName, configdefault,....)
    • Configurationmanagement.getInstance().addConfByKey
  • loadInitUserAndOrganisation(username, userpass, useremail, orgname, timeZone)
    • Usermanagement.getInstance().registerUserInit
    • Organisationmanagement.getInstance().addOrganisation
    • Organisationmanagement.getInstance().addUserToOrganisation
  • loadDefaultRooms
    • Roommanagement.getInstance().addRoomType
    • Roommanagement.getInstance().addRoom
    • Roommanagement.getInstance().addRoomToOrganisation
  • loadInitAppointmentCategories()
    • AppointmentCategoryLogic.getInstance().createAppointmentCategory
  • loadInitAppointmentReminderTypes()
    • AppointmentRemindertypeLogic.getInstance().createAppointMentReminderType


public void loadConfiguration(String crypt_ClassName,
                        String allowfrontendRegister, String smtpServer, String smtpPort,
                        String referer, String mailauthname, String mailauthpass, String mailusetls,
                        String default_lang_id, String swf_path, String im_path,
                        String url_feed, String url_feed2,
                        String sendEmailAtRegister, String sendEmailWithVerficationCode,
                        String default_export_font, String ldap_auth_path, String screen_viewer,
                        String ffmpeg_path, String sox_path, String sip_enable, String sip_realm,
                        String sip_port,
                        String sip_proxyname,
                        String sip_tunnel,
                        String sip_codebase,
                        String sip_forcetunnel,
                        String sip_openxg_enable,
                        String openxg_wrapper_url,
                        String openxg_client_id,
                        String openxg_client_secret,
                        String openxg_client_domain,
                        String openxg_community_code,
                        String openxg_language_code,
                        String openxg_adminid,
                        String sip_language_phonecode,
                        String sip_phonerange_start,
                        String sip_phonerange) {
}

* loadInitLanguages(String filePath)
  • /src/app/org/openmeetings/app/installationImportInitvalues.java
  • this.loadCountriesFiles(filePath);
    • Statemanagement.getInstance().addState(country);
    • /src/app/org/openmeetings/app/data/user/Statemanagement.java
      • Object idf = HibernateUtil.createSession();
        • session = getSessionFactory().openSession(); :) ¿©±â¿¡¼­ °É¸². 2011.9.8
      • /src/app/org/openmeetings/app/hibernate/utils

* getSessionFactory()
  • sessionFactory = new Configuration().configure(new File(current_dir)).buildSessionFactory();

* hibernate.cfg.xml
  • edit dialect
  • no difference

* change hibernate3.jar
  • ¹®Á¦ ¾Æ´Ô.

* /WebContent/WEB-INF/lib
  • add hibernate-jpa-2.0-api-1.0.0.Final.jar
  • mysql-connector À» ãÁö ¸øÇϸé, À̸¦ »ç¿ëÇÏ´Â µí ÇÔ.
  • °è¼ÓµÇ´Â ¸Þ½ÃÁö

* /WebContent/WEB-INF/lib
  • add mysql-connector-java-5.1.15-bin.jar
  • table µéÀ» ¸¸µé¾ú´Âµ¥....
  • °è¼ÓµÇ´Â ¸Þ½ÃÁö...

* /src/app/org/openmeetings/app/installation
  • app.installation.ImportInitvalues.loadInitLanguages 724
  • app.data.basic.Fieldmanagment.addFieldValueByFieldAndLanguage 343
  • org.hibernate.transaction.JDBCTransaction.commit
    • JDBCTransaction.java:133

* /etc/mysql/my.conf
  • mysqld
  • default-character-set=utf8
  • character-set-server=utf8

* restart
  • drop database openmeetings;
  • /etc/init.d/mysql restart

small methods


* /src/app/org/openmeetings/app/installation/ImportInitvalues.java

* private void loadCountriesFiles(String filePath) throws Exception {
  • Document document = reader.read(filePath + ImportInitvalues.nameOfCountriesFile);
    • /WebContent/languages/countries.xml
<countries>
        <country code="004" name="Afghanistan" short="AFG" />
        <country code="248" short="ALA" name="Aland Islands" />
        .....
        <country code="716" short="ZWE" name="Zimbabwe"/>
</countries>
  • Element root = document.getRootElement();
  • for (Iterator it = root.elementIterator("country"); it.hasNext();) {
    • Statemanagement.getInstance().addState(country);
  • }
* }

* /src/app/org/openmeetings/app/data/user/Statemanagement.java

* import org.openmeetings.app.hibernate.beans.adresses.States;

* public Long addState(String statename) {
  • adds a new State to the states table
  • Object idf = HibernateUtil.createSession();
  • Session session = HibernateUtil.getSession();
  • Transaction tx = session.beginTransaction();

  • States st = new States();
  • st.setName(statename);
  • st.setStarttime(new Date());
  • st.setDeleted("false");

  • Long id = (Long) session.save(st); :) write to mysql dbms openmeetings table states
  • tx.commit();
  • HibernateUtil.closeSession(idf);
* }

* /src/app/org/openmeetings/app/hibernate/beans/adresses

* hibernate.class table="states"

* public class States {
  • private Long state_id;
  • private String name;
  • private Date starttime;
  • private Date updatetime;
  • private String deleted;

  • setter, getter
* }

* States.hbm.xml
<hibernate-mapping>
  <class table="states" name="org.openmeetings.app.hibernate.beans.adresses.States">
    <id column="state_id" name="state_id">
      <generator class="increment"/>
    </id>
    <property name="name" type="string" column="name"/>
    <property name="starttime" type="java.util.Date" column="starttime"/>
    <property name="updatetime" type="java.util.Date" column="updatetime"/>
    <property name="deleted" type="string" column="deleted"/>
  </class>
</hibernate-mapping>

create dbms tables


* loadInitLanguages - loadCountriesFiles - addState(country) - HibernateUtil.createSession

* Object idf = HibernateUtil.createSession();

* public static Object createSession() throws Exception{
  • Session session = (Session)currentSession.get();
  • if(session == null){
    • session = getSessionFactory().openSession();
    • currentSession.set(session);
    • return trueOwner;
  • }
* }

* private synchronized static SessionFactory getSessionFactory() {
  • :) 1. System.out.println("Configuring hibernate From "+current_dir);
  • sessionFactory = new Configuration().configure(new File(current_dir)).buildSessionFactory();
    • current_dir = hibernate.cfg.xml
* }

* /home/tcheun/hibernate-core/core/src/main/java/org/hibernate/cfg
  • Configuration.java

* public Configuration configure(File configFile) throws HibernateException {
  • :) 2. log.info( "configuring from file: " + configFile.getName() );
  • return doConfigure( new FileInputStream( configFile ), configFile.toString() );
* }

* protected Configuration doConfigure(InputStream stream, String resourceName) throws HibernateException {
  • doConfigure( document );
* }

* protected Configuration doConfigure(Document doc) throws HibernateException {
  • addProperties( sfNode );
  • parseSessionFactory( sfNode, name );
  • :) 5. log.info( "Configured SessionFactory: " + name );
  • :) 6. log.debug( "properties: " + properties );
* }

* private void addProperties(Element parent) {
  • while ( itr.hasNext() ) {
    • :) 3. log.debug( name + "=" + value );
  • }
* }

* private void parseSessionFactory(Element sfNode, String name) {
  • while ( elements.hasNext() ) {
    • parseMappingElement( subelement, name );
  • }
* }

* private void parseMappingElement(Element mappingElement, String name) {
  • :) 4. log.debug( "session-factory config named resource for mapping", name, resourceName );
* }

* public SessionFactory buildSessionFactory() throws HibernateException {
  • :) 7. log.debug( "Preparing to build session factory with filters : " + filterDefinitions );
  • secondPassCompile();
  • Settings settings = buildSettings( copy );
  • return new SessionFactoryImpl( this, mapping, settings, getInitializedEventListeners(), \
    • sessionFactoryObserver );
* }
* /WebContent/WEB-INF/lib ¿¡ ´ÙÀ½ µÎ jar file ÀÌ ¾øÀ¸¸é, ¿©±â¿¡¼­ ¸ØÃã
  • mysql-connector-java-5.1.15-bin.jar À» ¸ÕÀú ³Ö¾úÀ¸¸é, ½±°Ô ³¡³ªÁö ¾Ê¾ÒÀ»±î?
  • hibernate-jpa-2.0-api-1.0.0.Final.jar À» ¸ÕÀú ³ÖÀ¸¹Ç·Î, ¹«ÇÑ loop ºñ½ÁÇÑ °á°ú
    • hibernate-jpa-2.0-api-1.0.0.Final.jar
    • mysql-connector-java-5.1.15-bin.jar
  • µÎ ÆÄÀÏÀ» ³Ö¾ú¾îµµ ¹«ÇÑ loop ºñ½ÁÇÑ °á°ú
  • ¾î´À ¼ø°£¿¡ hibernate.properties ¸¦ ¼öÁ¤ÇÏ¿´´ÂÁö´Â ±â¾ïÇÏÁö ¸ø ÇÔ.
  • /etc/mysql/my.cnf ¿¡ mysqld ¹Ø¿¡ ´ÙÀ½ µÎÁÙÀ» ³ÖÀ¸¹Ç·Î¼­ ¼º°ø
    • default-character-set=utf8
    • character-set-server=utf8

SessionFactoryImpl


* /hibernate-core/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
  • ¿©±â¿¡¼­ table À» ¸¸µë.

secondPassCompile


* /hibernate-core/core/src/main/java/org/hibernate/cfg/Configuration.java

* protected void secondPassCompile() throws MappingException {
  • metadataSourceQueue.processMetadata( determineMetadataSourcePrecedence() );
  • processFkSecondPassInOrder();
  • originalSecondPassCompile();
  • applyConstraintsToDDL();
* }

* protected class MetadataSourceQueue implements Serializable {
  • protected void processMetadata(List<MetadataSourceType> order) {
    • for ( MetadataSourceType type : order ) {
      • if ( MetadataSourceType.HBM.equals( type ) ) {
        • processHbmXmlQueue();
      • } else if ( MetadataSourceType.CLASS.equals( type ) ) {
        • processAnnotatedClassesQueue();
      • }
    • }
  • }

  • private void processHbmXmlQueue() {
    • :) log.debug( "Processing hbm.xml files" );
    • for ( Map.Entry<XmlDocument, Set<String>> entry : hbmMetadataToEntityNamesMap.entrySet() ) {
      • processHbmXml( entry.getKey(), entry.getValue()
    • }
  • }

  • private void processHbmXml(XmlDocument metadataXml, Set<String> entityNames) {
    • HbmBinder.bindRoot( metadataXml, createMappings(), CollectionHelper.EMPTY_MAP, entityNames );
  • }
* }

* /hibernate-core/core/src/main/java/org/hibernate/cfg/HbmBinder.java

* public static void bindRoot( XmlDocument metadataXml, \
  • Mappings mappings, java.util.Map inheritedMetas, \
  • java.util.Set<String> entityNames) throws MappingException {
  • while ( rootChildren.hasNext() ) {
    • bindRootClass( element, rootclass, mappings, inheritedMetas );
  • }
* }

* public static void bindRootClass(Element node, RootClass rootClass, \
  • Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
  • bindRootPersistentClassCommonValues( node, inheritedMetas, mappings, rootClass );
* }

* private static void bindRootPersistentClassCommonValues(Element node, \
  • java.util.Map inheritedMetas, Mappings mappings, RootClass entity) \
  • throws MappingException {
  • :) log.info( "Mapping class: " + entity.getEntityName() + " -> " + entity.getTable().getName());
  • while ( subnodes.hasNext() ) {
    • bindSimpleId( subnode, entity, mappings, inheritedMetas );
  • }
* }

* private static void bindSimpleId(Element idNode, RootClass entity, Mappings mappings, \
  • java.util.Map inheritedMetas) throws MappingException {
  • bindProperty( idNode, prop, mappings, inheritedMetas );
* }

* public static void bindProperty(
  • String msg = "Mapped property: " + property.getName();
  • :) log.debug( msg );
* }

* private void processAnnotatedClassesQueue() {
  • :) log.debug( "Process annotated classes" );
* }

* private void originalSecondPassCompile() throws MappingException {
  • :) log.debug( "processing extends queue" );
  • :) log.debug( "processing collection mappings" );
  • :) log.debug( "processing native query and ResultSetMapping mappings" );
  • :) log.debug( "processing association property references" );
  • :) log.debug( "processing foreign key constraints" )
  • while ( itr.hasNext() ) {
    • secondPassCompileForeignKeys( (Table) itr.next(), done );
  • }
* }

* protected void secondPassCompileForeignKeys(Table table, Set done) throws MappingException {
  • while ( iter.hasNext() ) {
    • if ( !done.contains( fk ) ) {
      • :) log.debug( "resolving reference to class: " + referencedEntityName );
    • }
  • }
* }

Configuration


* Root WebApplicationContext: initialization started * Installer service created * RTMP Mina Transport bound to /0.0.0.0:1935 * Connection Threads: 2 * Initializing ExecutorService 'openmeetings.TaskExecutor' * webAppPath : /home/tcheun/hibernate/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/ROOT * Adding type registration boolean * .... * Adding type registration imm_serializable * org.hibernate.cfg.Environment * Registering IdentifierGenerator strategy * configuring from file: hibernate.cfg.xml 131 * org.hibernate.cfg.Configuration - connection.username=openmeetings * ... * org.hibernate.cfg.Configuration - hibernate.c3p0.timeout=100 * org.hibernate.cfg.Configuration - session-factory config null
  • named resource org/openmeetings/app/hibernate/beans/adresses/Adresses.hbm.xml
  • for mapping
* ... * org.hibernate.cfg.Configuration - session-factory config null
  • named resource org/openmeetings/app/hibernate/beans/user/Users_Usergroups.hbm.xml
  • for mapping
* org.hibernate.cfg.Configuration - Configured SessionFactory: null 414 * Preparing to build session factory with filters : {} 417, 1571, 2004 * org.red5.server.Scope -
  • Could not start scope [WebScope@162f030 Depth = 1, Path = '/default',
  • Name = 'openmeetings']. java.lang.NoClassDefFoundError:
  • javax/persistence/EntityListeners
* Adding type registration boolean * Registering IdentifierGenerator strategy * org.hibernate.cfg.Configuration - configuring from file: hibernate.cfg.xml * o.s.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 5422 ms * o.a.a.d.WarBasedAxisConfigurator - trying to load axis2.xml from module: /WEB-INF/conf/axis2.xml * org.apache.axis2.engine.Phase * o.a.a.d.WarBasedAxisConfigurator - setting web location string: 436
  • /home/tcheun/hibernate/.metadata/.plugins/org.eclipse.wst.server.core
  • /tmp0/wtpwebapps/ROOT
* o.a.a.i18n.? * o.a.axis2.scripting.ScriptModule * o.a.axis2.description.AxisService 1173 * o.a.v.t.v.s.ServletToolboxManager - No toolbox was found at '/WEB-INF/toolbox.xml' * Adding type registration boolean 1183-1270 * Registering IdentifierGenerator strategy * org.hibernate.cfg.Configuration - configuring from file: hibernate.cfg.xml 1286 * org.hibernate.cfg.Configuration * .... * org.hibernate.cfg.Configuration - Configured SessionFactory: null 1568 * org.hibernate.cfg.Configuration - Preparing to build session factory with filters : {} * o.a.v.t.v.s.ServletToolboxManager - No toolbox was found at '/WEB-INF/toolbox.xml' * command equals null * step 0+ start init with values. openmeetings ***** tcheun@hotmail.com enk * Adding type registration boolean 1611-1703 * Registering IdentifierGenerator strategy * org.hibernate.cfg.Configuration - configuring from file: hibernate.cfg.xml 1719 * org.hibernate.cfg.Configuration 1723-1997 * org.hibernate.cfg.Configuration - Configured SessionFactory: null 2001 * org.hibernate.cfg.Configuration - Preparing to build session factory with filters : {} * Shutting down ExecutorService 'openmeetings.TaskExecutor' 2006 * Destroying singletons * Closing org.springframework.context.support.ClassPathXmlApplicationContext@16dc861:
  • startup date Fri Sep 09 00:23:52 KST 2011; root of context hierarchy
* Destroying singletons * Closing ApplicationContext 'default.context':
  • startup date Fri Sep 09 00:23:53 KST 2011; root of context hierarchy
* Destroying singletons * RTMP Mina Transport unbind

ID
Password
Join
You will attract cultured and artistic people to your home.


sponsored by andamiro
sponsored by cdnetworks
sponsored by HP

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2011-09-20 11:11:59
Processing time 0.0242 sec