Search in sources :

Example 1 with KeyFactory

use of org.vcell.db.KeyFactory in project vcell by virtualcell.

the class StochtestCompareService method main.

public static void main(String[] args) {
    try {
        if (args.length != 1) {
            System.out.println("Usage:  StochtestService baseDirectory");
            System.exit(-1);
        }
        File baseDir = new File(args[0]);
        if (!baseDir.exists()) {
            throw new RuntimeException("base directory " + baseDir.getPath() + " not found");
        }
        PropertyLoader.loadProperties();
        DatabasePolicySQL.bAllowAdministrativeAccess = true;
        String driverName = PropertyLoader.getRequiredProperty(PropertyLoader.dbDriverName);
        String connectURL = PropertyLoader.getRequiredProperty(PropertyLoader.dbConnectURL);
        String dbSchemaUser = PropertyLoader.getRequiredProperty(PropertyLoader.dbUserid);
        String dbPassword = PropertyLoader.getSecretValue(PropertyLoader.dbPasswordValue, PropertyLoader.dbPasswordFile);
        // 
        // get appropriate database factory objects
        // 
        ConnectionFactory conFactory = DatabaseService.getInstance().createConnectionFactory(driverName, connectURL, dbSchemaUser, dbPassword);
        KeyFactory keyFactory = conFactory.getKeyFactory();
        StochtestCompareService stochtestService = new StochtestCompareService(baseDir, conFactory, keyFactory);
        while (true) {
            stochtestService.compareOne();
        }
    } catch (Throwable e) {
        e.printStackTrace(System.out);
    }
    System.exit(0);
}
Also used : ConnectionFactory(org.vcell.db.ConnectionFactory) File(java.io.File) KeyFactory(org.vcell.db.KeyFactory)

Example 2 with KeyFactory

use of org.vcell.db.KeyFactory in project vcell by virtualcell.

the class FunctionFileCrawler method main.

/**
 * Insert the method's description here.
 * Creation date: (6/27/2006 1:33:58 PM)
 * @param args java.lang.String[]
 */
public static void main(String[] args) {
    ConnectionFactory conFactory = null;
    try {
        String username = null;
        String outputdir = ".";
        int count = 0;
        boolean SCAN_SINGLE = false;
        while (count < args.length) {
            if (args[count].equals("-h")) {
                printUsage();
                System.exit(0);
            } else if (args[count].equals("-u")) {
                count++;
                username = args[count];
                SCAN_SINGLE = true;
            } else if (args[count].equals("-o")) {
                count++;
                outputdir = args[count];
            } else {
                System.out.println("Wrong arguments, see usage below.");
                printUsage();
                System.exit(1);
            }
            count++;
        }
        PropertyLoader.loadProperties();
        conFactory = DatabaseService.getInstance().createConnectionFactory();
        KeyFactory keyFactory = conFactory.getKeyFactory();
        AdminDatabaseServer adminDbServer = new LocalAdminDbServer(conFactory, keyFactory);
        FunctionFileCrawler crawler = new FunctionFileCrawler(adminDbServer, outputdir);
        if (SCAN_SINGLE) {
            crawler.scanAUser(username);
        } else {
            crawler.scanAllUsers();
        }
        System.exit(0);
    } catch (Exception ex) {
        ex.printStackTrace(System.out);
    } finally {
        try {
            if (conFactory != null) {
                conFactory.close();
            }
        } catch (Throwable ex) {
            ex.printStackTrace();
        }
        System.exit(0);
    }
}
Also used : ConnectionFactory(org.vcell.db.ConnectionFactory) KeyFactory(org.vcell.db.KeyFactory) AdminDatabaseServer(cbit.vcell.server.AdminDatabaseServer) DataAccessException(org.vcell.util.DataAccessException) SQLException(java.sql.SQLException)

Example 3 with KeyFactory

use of org.vcell.db.KeyFactory in project vcell by virtualcell.

the class SimulationDispatcher method main.

/**
 * Starts the application.
 * @param args an array of command-line arguments
 */
public static void main(java.lang.String[] args) {
    OperatingSystemInfo.getInstance();
    if (args.length != 3 && args.length != 0) {
        System.out.println("Missing arguments: " + VCellServices.class.getName() + " [sshHost sshUser sshKeyFile] ");
        System.exit(1);
    }
    try {
        PropertyLoader.loadProperties(REQUIRED_SERVICE_PROPERTIES);
        HtcProxy htcProxy = SlurmProxy.creatCommandService(args);
        int serviceOrdinal = 99;
        VCMongoMessage.serviceStartup(ServiceName.dispatch, new Integer(serviceOrdinal), args);
        // //
        // // JMX registration
        // //
        // MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
        // mbs.registerMBean(new VCellServiceMXBeanImpl(), new ObjectName(VCellServiceMXBean.jmxObjectName));
        ServiceInstanceStatus serviceInstanceStatus = new ServiceInstanceStatus(VCellServerID.getSystemServerID(), ServiceType.DISPATCH, serviceOrdinal, ManageUtils.getHostName(), new Date(), true);
        ConnectionFactory conFactory = DatabaseService.getInstance().createConnectionFactory();
        KeyFactory keyFactory = conFactory.getKeyFactory();
        DatabaseServerImpl databaseServerImpl = new DatabaseServerImpl(conFactory, keyFactory);
        AdminDBTopLevel adminDbTopLevel = new AdminDBTopLevel(conFactory);
        SimulationDatabase simulationDatabase = new SimulationDatabaseDirect(adminDbTopLevel, databaseServerImpl, true);
        VCMessagingService vcMessagingService_int = new VCMessagingServiceActiveMQ();
        String jmshost_int = PropertyLoader.getRequiredProperty(PropertyLoader.jmsIntHostInternal);
        int jmsport_int = Integer.parseInt(PropertyLoader.getRequiredProperty(PropertyLoader.jmsIntPortInternal));
        vcMessagingService_int.setConfiguration(new ServerMessagingDelegate(), jmshost_int, jmsport_int);
        VCMessagingService vcMessagingService_sim = new VCMessagingServiceActiveMQ();
        String jmshost_sim = PropertyLoader.getRequiredProperty(PropertyLoader.jmsSimHostInternal);
        int jmsport_sim = Integer.parseInt(PropertyLoader.getRequiredProperty(PropertyLoader.jmsSimPortInternal));
        vcMessagingService_sim.setConfiguration(new ServerMessagingDelegate(), jmshost_sim, jmsport_sim);
        SimulationDispatcher simulationDispatcher = new SimulationDispatcher(htcProxy, vcMessagingService_int, vcMessagingService_sim, serviceInstanceStatus, simulationDatabase, false);
        simulationDispatcher.init();
    } catch (Throwable e) {
        lg.error("uncaught exception initializing SimulationDispatcher: " + e.getLocalizedMessage(), e);
        System.exit(1);
    }
}
Also used : ServerMessagingDelegate(cbit.vcell.message.server.ServerMessagingDelegate) AdminDBTopLevel(cbit.vcell.modeldb.AdminDBTopLevel) HtcProxy(cbit.vcell.message.server.htc.HtcProxy) VCMessagingService(cbit.vcell.message.VCMessagingService) Date(java.util.Date) VCellServices(cbit.vcell.message.server.combined.VCellServices) ConnectionFactory(org.vcell.db.ConnectionFactory) ServiceInstanceStatus(cbit.vcell.message.server.ServiceInstanceStatus) DatabaseServerImpl(cbit.vcell.modeldb.DatabaseServerImpl) VCMessagingServiceActiveMQ(cbit.vcell.message.jms.activeMQ.VCMessagingServiceActiveMQ) KeyFactory(org.vcell.db.KeyFactory)

Example 4 with KeyFactory

use of org.vcell.db.KeyFactory in project vcell by virtualcell.

the class VCellServices method main.

/**
 * Starts the application.
 * @param args an array of command-line arguments
 */
public static void main(java.lang.String[] args) {
    OperatingSystemInfo.getInstance();
    if (args.length != 3 && args.length != 0) {
        System.out.println("Missing arguments: " + VCellServices.class.getName() + " [sshHost sshUser sshKeyFile] ");
        System.exit(1);
    }
    try {
        PropertyLoader.loadProperties(REQUIRED_SERVICE_PROPERTIES);
        ResourceUtil.setNativeLibraryDirectory();
        new LibraryLoaderThread(false).start();
        PythonSupport.verifyInstallation(new PythonPackage[] { PythonPackage.VTK, PythonPackage.THRIFT });
        HtcProxy htcProxy = SlurmProxy.creatCommandService(args);
        int serviceOrdinal = 0;
        VCMongoMessage.serviceStartup(ServiceName.dispatch, new Integer(serviceOrdinal), args);
        // //
        // // JMX registration
        // //
        // MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
        // mbs.registerMBean(new VCellServiceMXBeanImpl(), new ObjectName(VCellServiceMXBean.jmxObjectName));
        ServiceInstanceStatus serviceInstanceStatus = new ServiceInstanceStatus(VCellServerID.getSystemServerID(), ServiceType.MASTER, serviceOrdinal, ManageUtils.getHostName(), new Date(), true);
        ConnectionFactory conFactory = DatabaseService.getInstance().createConnectionFactory();
        KeyFactory keyFactory = conFactory.getKeyFactory();
        DatabaseServerImpl databaseServerImpl = new DatabaseServerImpl(conFactory, keyFactory);
        AdminDBTopLevel adminDbTopLevel = new AdminDBTopLevel(conFactory);
        SimulationDatabase simulationDatabase = new SimulationDatabaseDirect(adminDbTopLevel, databaseServerImpl, true);
        String cacheSize = PropertyLoader.getRequiredProperty(PropertyLoader.simdataCacheSizeProperty);
        long maxMemSize = Long.parseLong(cacheSize);
        Cachetable cacheTable = new Cachetable(MessageConstants.MINUTE_IN_MS * 20, maxMemSize);
        DataSetControllerImpl dataSetControllerImpl = new DataSetControllerImpl(cacheTable, new File(PropertyLoader.getRequiredProperty(PropertyLoader.primarySimDataDirInternalProperty)), new File(PropertyLoader.getProperty(PropertyLoader.secondarySimDataDirInternalProperty, PropertyLoader.getRequiredProperty(PropertyLoader.primarySimDataDirInternalProperty))));
        ExportServiceImpl exportServiceImpl = new ExportServiceImpl();
        // add dataJobListener
        DataServerImpl dataServerImpl = new DataServerImpl(dataSetControllerImpl, exportServiceImpl);
        VCMessagingService vcMessagingService_int = new VCMessagingServiceActiveMQ();
        String jmshost_int = PropertyLoader.getRequiredProperty(PropertyLoader.jmsIntHostInternal);
        int jmsport_int = Integer.parseInt(PropertyLoader.getRequiredProperty(PropertyLoader.jmsIntPortInternal));
        vcMessagingService_int.setConfiguration(new ServerMessagingDelegate(), jmshost_int, jmsport_int);
        VCMessagingService vcMessagingService_sim = new VCMessagingServiceActiveMQ();
        String jmshost_sim = PropertyLoader.getRequiredProperty(PropertyLoader.jmsSimHostInternal);
        int jmsport_sim = Integer.parseInt(PropertyLoader.getRequiredProperty(PropertyLoader.jmsSimPortInternal));
        vcMessagingService_sim.setConfiguration(new ServerMessagingDelegate(), jmshost_sim, jmsport_sim);
        VCellServices vcellServices = new VCellServices(htcProxy, vcMessagingService_int, vcMessagingService_sim, serviceInstanceStatus, databaseServerImpl, dataServerImpl, simulationDatabase);
        dataSetControllerImpl.addDataJobListener(vcellServices);
        exportServiceImpl.addExportListener(vcellServices);
        vcellServices.init();
    } catch (Throwable e) {
        e.printStackTrace(System.out);
    }
}
Also used : Cachetable(cbit.vcell.simdata.Cachetable) DataServerImpl(cbit.vcell.simdata.DataServerImpl) ServerMessagingDelegate(cbit.vcell.message.server.ServerMessagingDelegate) AdminDBTopLevel(cbit.vcell.modeldb.AdminDBTopLevel) HtcProxy(cbit.vcell.message.server.htc.HtcProxy) SimulationDatabase(cbit.vcell.message.server.dispatcher.SimulationDatabase) VCMessagingService(cbit.vcell.message.VCMessagingService) LibraryLoaderThread(cbit.vcell.resource.LibraryLoaderThread) Date(java.util.Date) ConnectionFactory(org.vcell.db.ConnectionFactory) SimulationDatabaseDirect(cbit.vcell.message.server.dispatcher.SimulationDatabaseDirect) ServiceInstanceStatus(cbit.vcell.message.server.ServiceInstanceStatus) DatabaseServerImpl(cbit.vcell.modeldb.DatabaseServerImpl) DataSetControllerImpl(cbit.vcell.simdata.DataSetControllerImpl) ExportServiceImpl(cbit.vcell.export.server.ExportServiceImpl) VCMessagingServiceActiveMQ(cbit.vcell.message.jms.activeMQ.VCMessagingServiceActiveMQ) File(java.io.File) KeyFactory(org.vcell.db.KeyFactory)

Example 5 with KeyFactory

use of org.vcell.db.KeyFactory in project vcell by virtualcell.

the class DatabaseServer method main.

/**
 * Starts the application.
 * @param args an array of command-line arguments
 */
public static void main(java.lang.String[] args) {
    OperatingSystemInfo.getInstance();
    if (args.length != 0) {
        System.out.println("Unexpected arguments: " + DatabaseServer.class.getName());
        System.exit(1);
    }
    try {
        PropertyLoader.loadProperties(REQUIRED_SERVICE_PROPERTIES);
        int serviceOrdinal = 99;
        VCMongoMessage.serviceStartup(ServiceName.database, new Integer(serviceOrdinal), args);
        // 
        // JMX registration
        // 
        // MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
        // mbs.registerMBean(new VCellServiceMXBeanImpl(), new ObjectName(VCellServiceMXBean.jmxObjectName));
        ServiceInstanceStatus serviceInstanceStatus = new ServiceInstanceStatus(VCellServerID.getSystemServerID(), ServiceType.DB, serviceOrdinal, ManageUtils.getHostName(), new Date(), true);
        ConnectionFactory conFactory = DatabaseService.getInstance().createConnectionFactory();
        KeyFactory keyFactory = conFactory.getKeyFactory();
        DatabaseServerImpl databaseServerImpl = new DatabaseServerImpl(conFactory, keyFactory);
        VCMessagingService vcMessagingService = VCellServiceHelper.getInstance().loadService(VCMessagingService.class);
        String jmshost = PropertyLoader.getRequiredProperty(PropertyLoader.jmsIntHostInternal);
        int jmsport = Integer.parseInt(PropertyLoader.getRequiredProperty(PropertyLoader.jmsIntPortInternal));
        vcMessagingService.setConfiguration(new ServerMessagingDelegate(), jmshost, jmsport);
        DatabaseServer databaseServer = new DatabaseServer(serviceInstanceStatus, databaseServerImpl, vcMessagingService, false);
        databaseServer.init();
    } catch (Throwable e) {
        e.printStackTrace(System.out);
    }
}
Also used : ServerMessagingDelegate(cbit.vcell.message.server.ServerMessagingDelegate) ConnectionFactory(org.vcell.db.ConnectionFactory) ServiceInstanceStatus(cbit.vcell.message.server.ServiceInstanceStatus) DatabaseServerImpl(cbit.vcell.modeldb.DatabaseServerImpl) VCMessagingService(cbit.vcell.message.VCMessagingService) Date(java.util.Date) KeyFactory(org.vcell.db.KeyFactory)

Aggregations

KeyFactory (org.vcell.db.KeyFactory)16 ConnectionFactory (org.vcell.db.ConnectionFactory)15 DatabaseServerImpl (cbit.vcell.modeldb.DatabaseServerImpl)7 File (java.io.File)7 AdminDBTopLevel (cbit.vcell.modeldb.AdminDBTopLevel)5 VCMessagingService (cbit.vcell.message.VCMessagingService)4 DataAccessException (org.vcell.util.DataAccessException)4 User (org.vcell.util.document.User)4 ServerMessagingDelegate (cbit.vcell.message.server.ServerMessagingDelegate)3 ServiceInstanceStatus (cbit.vcell.message.server.ServiceInstanceStatus)3 SQLException (java.sql.SQLException)3 Date (java.util.Date)3 ExportServiceImpl (cbit.vcell.export.server.ExportServiceImpl)2 VCMessagingServiceActiveMQ (cbit.vcell.message.jms.activeMQ.VCMessagingServiceActiveMQ)2 SimulationDatabaseDirect (cbit.vcell.message.server.dispatcher.SimulationDatabaseDirect)2 HtcProxy (cbit.vcell.message.server.htc.HtcProxy)2 LocalAdminDbServer (cbit.vcell.modeldb.LocalAdminDbServer)2 PropertyLoader (cbit.vcell.resource.PropertyLoader)2 AdminDatabaseServer (cbit.vcell.server.AdminDatabaseServer)2 Cachetable (cbit.vcell.simdata.Cachetable)2