Package org.openbel.framework.common.cfg

Examples of org.openbel.framework.common.cfg.SystemConfiguration


            instance = new Namespaces();

            final CacheableResourceService c = new DefaultCacheableResourceService();
            final NamespaceHeaderParser p = new NamespaceHeaderParser();

            final SystemConfiguration sysConfig = getSystemConfiguration();
            final String resourceIndexURL = sysConfig.getResourceIndexURL();
            File indexFile = new File(resourceIndexURL);
            if (!indexFile.exists() || !indexFile.canRead()) {
                // try the index as an online resource.
                ResolvedResource resolvedResource = c.resolveResource(
                        ResourceType.RESOURCE_INDEX, resourceIndexURL);
View Full Code Here


        cacheService = new DefaultCacheableResourceService();
        eqIndexer = new EquivalenceIndexerServiceImpl();

        if (!ResourceIndex.INSTANCE.isLoaded()) {
            // Load resource index defined by the BELFramework instance
            final SystemConfiguration sysConfig = getSystemConfiguration();
            final String resourceIndexURL = sysConfig.getResourceIndexURL();
            File indexFile = new File(resourceIndexURL);
            if (!indexFile.exists() || !indexFile.canRead()) {
                // try the index as an online resource.
                ResolvedResource resolvedResource = cacheService
                        .resolveResource(ResourceType.RESOURCE_INDEX,
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public List<CachedResource> getResources() {
        SystemConfiguration config = getSystemConfiguration();
        File cacheDirectory = config.getCacheDirectory();

        List<CachedResource> cachedResource = new ArrayList<CachedResource>();

        for (File cacheSubDirectory : cacheDirectory.listFiles()) {
            if (cacheSubDirectory.isDirectory()) {
View Full Code Here

     * @throws Exception
     */
    public Index createResourceIndex() throws Exception {
        if (!ResourceIndex.INSTANCE.isLoaded()) {
            // Load resource index defined by the BELFramework instance
            final SystemConfiguration sysConfig = getSystemConfiguration();
            final String resourceIndexURL = sysConfig.getResourceIndexURL();
            File indexFile = new File(resourceIndexURL);
            if (!indexFile.exists() || !indexFile.canRead()) {
                // try the index as an online resource.
                ResolvedResource resolvedResource = cacheService
                        .resolveResource(ResourceType.RESOURCE_INDEX,
View Full Code Here

     * after the tests.
     * </p>
     */
    @After
    public void teardown() {
        SystemConfiguration config = SystemConfiguration
                .getSystemConfiguration();
        config.getApplicationLogPath().delete();

        deleteDirectoryContents(config.getCacheDirectory());
        deleteDirectory(config.getCacheDirectory());

        deleteDirectoryContents(config.getWorkingDirectory());
        deleteDirectory(config.getWorkingDirectory().getParentFile());

        SystemConfiguration.destroySystemConfiguration();
    }
View Full Code Here

    protected KAMStore ks;
    protected Kam testKam;

    protected void setupKamStore(final String kamName) {
        try {
            final SystemConfiguration syscfg = createSystemConfiguration();
            final DatabaseService dbs = new DatabaseServiceImpl();
            dbc = dbs.dbConnection(syscfg.getKamURL(),
                    syscfg.getKamUser(), syscfg.getKamPassword());
            ks = new KAMStoreImpl(dbc);
        } catch (IOException e) {
            e.printStackTrace();
            fail("Could not read system configuration.");
        } catch (SQLException e) {
View Full Code Here

        setOptions(getPhaseConfiguration());

        // Initialize the system configuration either through the
        // command-line or system defaults.
        initializeSystemConfiguration();
        SystemConfiguration syscfg = getSystemConfiguration();
        outputDirectory = syscfg.getWorkingDirectory();
    }
View Full Code Here

            throws PKAMSerializationFailure {
        if (nulls(kamName, filePath)) {
            throw new InvalidArgument("argument(s) were null");
        }

        final SystemConfiguration cfg =
                SystemConfiguration.getSystemConfiguration();

        KamInfo kamInfo = loadKAMInfo(kamName, filePath, cfg);

        PKAMWriter pkw = null;
View Full Code Here

    @Override
    public void deserializeKAM(final String kamName, final String filePath,
            final boolean noPreserve) throws PKAMSerializationFailure {

        // load destination KAM
        final SystemConfiguration cfg =
                SystemConfiguration.getSystemConfiguration();

        // parse and insert KAM data from portable KAM file
        PKAMReader pkr = null;
        CSVReader tabbedReader = null;
View Full Code Here

            printUsage();
            bail(GENERAL_FAILURE);
        }

        initializeSystemConfiguration();
        SystemConfiguration syscfg = getSystemConfiguration();

        final File wrkdir = syscfg.getWorkingDirectory();
        File[] dircontents = wrkdir.listFiles();
        if (dircontents != null && dircontents.length > 0) {
            if (!deleteDirectory(wrkdir)) {
                reportable.error(DIRECTORY_DELETION_FAILED + wrkdir);
                bail(ExitCode.DIRECTORY_DELETION_FAILED);
            }
            if (!wrkdir.mkdir()) {
                reportable.error(DIRECTORY_CREATION_FAILED + wrkdir);
                bail(ExitCode.DIRECTORY_CREATION_FAILED);
            }
            wrkdir.mkdir();
        }

        DatabaseService dbsvc = new DatabaseServiceImpl();

        // validate kamstore connection
        final String url = syscfg.getKamURL();
        final String user = syscfg.getKamUser();
        final String pass = syscfg.getKamPassword();
        try {
            if (!dbsvc.validConnection(url, user, pass)) {
                bail(ExitCode.KAM_CONNECTION_FAILURE);
            }
        } catch (DBConnectionFailure e) {
            reportable.error(e.getUserFacingMessage());
            bail(ExitCode.KAM_CONNECTION_FAILURE);
        }

        // If "--no-preserve" is not specified, query the database for an
        // existing KAM w/same name. If one exists, exit with proper ExitCode.
        if (!hasOption(LONG_OPT_NO_PRESERVE)){
            String kamName = getOptionValue("k");
            try{
                dbConnection = dbsvc.dbConnection(
                        syscfg.getKamURL(),
                        syscfg.getKamUser(),
                        syscfg.getKamPassword());
                kamStore = new KAMStoreImpl(dbConnection);
                kams = kamStore.getCatalog();
                for (KamInfo kam : kams){
                    if (kam.getName().equals(kamName)){
                        bail(ExitCode.DUPLICATE_KAM_NAME);
View Full Code Here

TOP

Related Classes of org.openbel.framework.common.cfg.SystemConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.