From: <one...@us...> - 2003-01-04 11:16:02
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/jmx In directory sc8-pr-cvs1:/tmp/cvs-serv14211/src/net/sf/hibernate/jmx Modified Files: HibernateService.java HibernateServiceMBean.java SessionFactoryStub.java Log Message: reformatted code with beautiful, shiny, happy TABS! improved an exception Index: HibernateService.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/jmx/HibernateService.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** HibernateService.java 1 Jan 2003 13:56:05 -0000 1.1.1.1 --- HibernateService.java 4 Jan 2003 11:15:29 -0000 1.2 *************** *** 28,36 **** private static final Log log = LogFactory.getLog(HibernateServiceMBean.class); ! private final Properties props = new Properties(); private String mapResources; private String boundName; ! /** * The name of the current bean --- 28,36 ---- private static final Log log = LogFactory.getLog(HibernateServiceMBean.class); ! private final Properties props = new Properties(); private String mapResources; private String boundName; ! /** * The name of the current bean *************** *** 40,44 **** return props.getProperty(Environment.SESSION_FACTORY_NAME); } ! public String getMapResources() { return mapResources; --- 40,44 ---- return props.getProperty(Environment.SESSION_FACTORY_NAME); } ! public String getMapResources() { return mapResources; *************** *** 57,61 **** } } ! public String getDatasource() { return props.getProperty(Environment.DATASOURCE); --- 57,61 ---- } } ! public String getDatasource() { return props.getProperty(Environment.DATASOURCE); *************** *** 69,73 **** return props.getProperty(Environment.DIALECT); } ! public void setDialect(String dialect) { props.setProperty(Environment.DIALECT, dialect); --- 69,73 ---- return props.getProperty(Environment.DIALECT); } ! public void setDialect(String dialect) { props.setProperty(Environment.DIALECT, dialect); *************** *** 90,103 **** props.setProperty( Environment.OUTER_JOIN, uoj ? "true" : "false" ); //Boolean.toString() only in JDK1.4 } ! ! public boolean getShowSql() { ! String prop = props.getProperty(Environment.SHOW_SQL); return Boolean.valueOf(prop).booleanValue(); ! } ! ! public void setShowSql(boolean showSql) { ! props.setProperty(Environment.SHOW_SQL, showSql ? "true" : "false"); ! } ! public String getUserName() { return props.getProperty(Environment.USER); --- 90,103 ---- props.setProperty( Environment.OUTER_JOIN, uoj ? "true" : "false" ); //Boolean.toString() only in JDK1.4 } ! ! public boolean getShowSql() { ! String prop = props.getProperty(Environment.SHOW_SQL); return Boolean.valueOf(prop).booleanValue(); ! } ! ! public void setShowSql(boolean showSql) { ! props.setProperty(Environment.SHOW_SQL, showSql ? "true" : "false"); ! } ! public String getUserName() { return props.getProperty(Environment.USER); *************** *** 115,123 **** props.setProperty(Environment.PASS, password); } ! private String[] parseResourceList(String resourceList) { return PropertiesHelper.toStringArray(resourceList, ", "); } ! public void start() throws HibernateException { boundName = getJndiName(); --- 115,123 ---- props.setProperty(Environment.PASS, password); } ! private String[] parseResourceList(String resourceList) { return PropertiesHelper.toStringArray(resourceList, ", "); } ! public void start() throws HibernateException { boundName = getJndiName(); *************** *** 127,132 **** catch (HibernateException he) { log.info("Could not build SessionFactory using the MBean classpath - will try again using client classpath"); ! String[] mappingFiles = parseResourceList( getMapResources() ); ! new SessionFactoryStub(mappingFiles, props); } } --- 127,132 ---- catch (HibernateException he) { log.info("Could not build SessionFactory using the MBean classpath - will try again using client classpath"); ! String[] mappingFiles = parseResourceList( getMapResources() ); ! new SessionFactoryStub(mappingFiles, props); } } *************** *** 134,150 **** public void stop() { log.info("stopping service"); ! try { ! new InitialContext().unbind(boundName); ! } ! catch (NamingException e) { ! log.warn("exception while unbinding factory from JNDI", e); ! } ! } ! private void bindSessionFactory() throws HibernateException { log.info("starting service at JNDI name: " + boundName); log.info("properties: " + props); Datastore ds = Hibernate.createDatastore(); ! String[] mappingFiles = parseResourceList( getMapResources() ); for ( int i=0; i<mappingFiles.length; i++ ) { log.info( "compiling mapping: " + mappingFiles[i] ); --- 134,150 ---- public void stop() { log.info("stopping service"); ! try { ! new InitialContext().unbind(boundName); ! } ! catch (NamingException e) { ! log.warn("exception while unbinding factory from JNDI", e); ! } ! } ! private void bindSessionFactory() throws HibernateException { log.info("starting service at JNDI name: " + boundName); log.info("properties: " + props); Datastore ds = Hibernate.createDatastore(); ! String[] mappingFiles = parseResourceList( getMapResources() ); for ( int i=0; i<mappingFiles.length; i++ ) { log.info( "compiling mapping: " + mappingFiles[i] ); *************** *** 153,161 **** ds.buildSessionFactory(props); } ! public String getTransactionStrategy() { return props.getProperty(Environment.TRANSACTION_STRATEGY); } ! public String getUserTransactionName() { return props.getProperty(Environment.USER_TRANSACTION); --- 153,161 ---- ds.buildSessionFactory(props); } ! public String getTransactionStrategy() { return props.getProperty(Environment.TRANSACTION_STRATEGY); } ! public String getUserTransactionName() { return props.getProperty(Environment.USER_TRANSACTION); *************** *** 164,188 **** props.setProperty(Environment.TRANSACTION_STRATEGY, txnStrategy); } ! public void setUserTransactionName(String utName) { props.setProperty(Environment.USER_TRANSACTION, utName); } ! public String getProperties() { return props.toString(); } ! public void setProperty(String property, String value) { props.setProperty(property, value); } ! public String getTransactionManagerLookupStrategy() { return props.getProperty(Environment.TRANSACTION_MANAGER_STRATEGY); } ! public void setTransactionManagerLookupStrategy(String lkpStrategy) { props.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, lkpStrategy); } ! } --- 164,191 ---- props.setProperty(Environment.TRANSACTION_STRATEGY, txnStrategy); } ! public void setUserTransactionName(String utName) { props.setProperty(Environment.USER_TRANSACTION, utName); } ! public String getProperties() { return props.toString(); } ! public void setProperty(String property, String value) { props.setProperty(property, value); } ! public String getTransactionManagerLookupStrategy() { return props.getProperty(Environment.TRANSACTION_MANAGER_STRATEGY); } ! public void setTransactionManagerLookupStrategy(String lkpStrategy) { props.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, lkpStrategy); } ! } + + + Index: HibernateServiceMBean.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/jmx/HibernateServiceMBean.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** HibernateServiceMBean.java 1 Jan 2003 13:56:05 -0000 1.1.1.1 --- HibernateServiceMBean.java 4 Jan 2003 11:15:29 -0000 1.2 *************** *** 9,13 **** */ public interface HibernateServiceMBean { ! /** * The Hibernate mapping files (might be overridden by subclasses --- 9,13 ---- */ public interface HibernateServiceMBean { ! /** * The Hibernate mapping files (might be overridden by subclasses *************** *** 76,80 **** * @return String */ ! public String getDialect(); /** * The name of the dialect class to use in this <tt>SessionFactory</tt> --- 76,80 ---- * @return String */ ! public String getDialect(); /** * The name of the dialect class to use in this <tt>SessionFactory</tt> *************** *** 101,105 **** */ public String getTransactionStrategy(); ! /** * Set the fully qualified class name of the Hibernate <tt>TransactionFactory</tt> implementation --- 101,105 ---- */ public String getTransactionStrategy(); ! /** * Set the fully qualified class name of the Hibernate <tt>TransactionFactory</tt> implementation *************** *** 108,112 **** */ public void setTransactionStrategy(String txnStrategy); ! /** * The JNDI name of the JTA UserTransaction object (used only be <tt>JTATransaction</tt>). --- 108,112 ---- */ public void setTransactionStrategy(String txnStrategy); ! /** * The JNDI name of the JTA UserTransaction object (used only be <tt>JTATransaction</tt>). *************** *** 144,159 **** */ public void setUseOuterJoin(boolean uoj); ! ! /** ! * Is SQL logging enabled? ! * @return boolean ! */ ! public boolean getShowSql(); ! /** ! * Enable logging of SQL to console ! * @param boolean ! */ ! public void setShowSql(boolean showSql); ! /** * Create the <tt>SessionFactory</tt> and bind to the jndi name on startup --- 144,159 ---- */ public void setUseOuterJoin(boolean uoj); ! ! /** ! * Is SQL logging enabled? ! * @return boolean ! */ ! public boolean getShowSql(); ! /** ! * Enable logging of SQL to console ! * @param boolean ! */ ! public void setShowSql(boolean showSql); ! /** * Create the <tt>SessionFactory</tt> and bind to the jndi name on startup *************** *** 164,167 **** */ public void stop(); ! } --- 164,170 ---- */ public void stop(); ! } + + + Index: SessionFactoryStub.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/jmx/SessionFactoryStub.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SessionFactoryStub.java 1 Jan 2003 13:56:05 -0000 1.1.1.1 --- SessionFactoryStub.java 4 Jan 2003 11:15:29 -0000 1.2 *************** *** 43,47 **** private static final IdentifierGenerator uuidgen = new UUIDHexGenerator(); ! private transient SessionFactory impl; private transient String[] resources; --- 43,47 ---- private static final IdentifierGenerator uuidgen = new UUIDHexGenerator(); ! private transient SessionFactory impl; private transient String[] resources; *************** *** 49,53 **** private String uuid; private String name; ! SessionFactoryStub(String[] resources, Properties properties) { this.resources = resources; --- 49,53 ---- private String uuid; private String name; ! SessionFactoryStub(String[] resources, Properties properties) { this.resources = resources; *************** *** 63,67 **** SessionFactoryObjectFactory.addInstance(uuid, name, this, properties); } ! public Session openSession() throws SQLException { return getImpl().openSession(); --- 63,67 ---- SessionFactoryObjectFactory.addInstance(uuid, name, this, properties); } ! public Session openSession() throws SQLException { return getImpl().openSession(); *************** *** 73,77 **** return getImpl().openDatabinder(); } ! private synchronized SessionFactory getImpl() { if (impl==null) { --- 73,77 ---- return getImpl().openDatabinder(); } ! private synchronized SessionFactory getImpl() { if (impl==null) { *************** *** 90,94 **** return impl; } ! //readResolveObject Object readResolve() throws ObjectStreamException { --- 90,94 ---- return impl; } ! //readResolveObject Object readResolve() throws ObjectStreamException { *************** *** 111,115 **** return result; } ! /** * @see javax.naming.Referenceable#getReference() --- 111,115 ---- return result; } ! /** * @see javax.naming.Referenceable#getReference() *************** *** 125,153 **** public ClassMetadata getClassMetadata(Class persistentClass) ! throws HibernateException { return getImpl().getClassMetadata(persistentClass); } ! public CollectionMetadata getCollectionMetadata(String roleName) ! throws HibernateException { return getImpl().getCollectionMetadata(roleName); } ! public Session openSession(Connection connection, Interceptor interceptor) { return getImpl().openSession(connection, interceptor); } ! public Session openSession(Interceptor interceptor) throws SQLException { return getImpl().openSession(interceptor); } - public Map getAllClassMetadata() throws HibernateException { - return getImpl().getAllClassMetadata(); - } - - public Map getAllCollectionMetadata() throws HibernateException { - return getImpl().getAllCollectionMetadata(); - } - - } \ No newline at end of file --- 125,155 ---- public ClassMetadata getClassMetadata(Class persistentClass) ! throws HibernateException { return getImpl().getClassMetadata(persistentClass); } ! public CollectionMetadata getCollectionMetadata(String roleName) ! throws HibernateException { return getImpl().getCollectionMetadata(roleName); } ! public Session openSession(Connection connection, Interceptor interceptor) { return getImpl().openSession(connection, interceptor); } ! public Session openSession(Interceptor interceptor) throws SQLException { return getImpl().openSession(interceptor); } + + + public Map getAllClassMetadata() throws HibernateException { + return getImpl().getAllClassMetadata(); + } + + public Map getAllCollectionMetadata() throws HibernateException { + return getImpl().getAllCollectionMetadata(); + } + + } |