private ObjectStore getObjectStore() throws Exception { if (os != null) { return os; } if (osAlias == null) { throw new BuildException("objectStoreWriter attribute is not set"); } if (os == null) { System .out.println("Connecting to db: " + osAlias); os = ObjectStoreFactory.getObjectStore(osAlias); } return os; }
private ObjectStore getObjectStore() throws Exception { if (os != null) { return os; } if (osAlias == null) { throw new BuildException("objectStoreWriter attribute is not set"); } if (os == null) { System .out.println("Connecting to db: " + osAlias); os = ObjectStoreFactory.getObjectStore(osAlias); } return os; }
/** * @throws BuildException if a problem occurs * @see Task#execute */ @Override public void execute() { try { Class<?> clazz = getClass().getClassLoader().loadClass(className); ObjectStore os = ObjectStoreFactory.getObjectStore(osAlias); Method m = clazz.getMethod(method, new Class[]{ObjectStore.class}); m.invoke(null, new Object[]{os}); } catch (Exception err) { throw new BuildException(err); } } }
/** * @throws BuildException if a problem occurs * @see Task#execute */ @Override public void execute() { try { Class<?> clazz = getClass().getClassLoader().loadClass(className); ObjectStore os = ObjectStoreFactory.getObjectStore(osAlias); Method m = clazz.getMethod(method, new Class[]{ObjectStore.class}); m.invoke(null, new Object[]{os}); } catch (Exception err) { throw new BuildException(err); } } }
public void setUp() throws Exception { os = (ObjectStoreInterMineImpl) ObjectStoreFactory.getObjectStore("os.unittest"); }
/** * Returns the production ObjectStore configured in webapp.os.alias. * * @return an ObjectStore */ public static ObjectStore getObjectStore() { if (objectStore == null) { Properties props = getProperties(); String osAlias = (String) props.get("webapp.os.alias"); try { objectStore = ObjectStoreFactory.getObjectStore(osAlias); } catch (Exception e) { throw new IllegalArgumentException("Error getting objectstore", e); } } return objectStore; }
/** * Returns the production ObjectStore configured in webapp.os.alias. * * @return an ObjectStore */ public static ObjectStore getObjectStore() { if (objectStore == null) { Properties props = getProperties(); String osAlias = (String) props.get("webapp.os.alias"); try { objectStore = ObjectStoreFactory.getObjectStore(osAlias); } catch (Exception e) { throw new IllegalArgumentException("Error getting objectstore", e); } } return objectStore; }
/** * {@inheritDoc} */ @Override public void execute() { if (alias == null) { throw new BuildException("alias attribute is not set"); } if (query == null) { throw new BuildException("You need to provide an IQL query string"); } ObjectStoreInterMineImpl os; try { os = (ObjectStoreInterMineImpl) ObjectStoreFactory.getObjectStore(alias); } catch (Exception e) { throw new BuildException("Exception while creating ObjectStore", e); } runIqlQuery(os, query); }
/** * {@inheritDoc} */ @Override public void execute() { if (alias == null) { throw new BuildException("alias attribute is not set"); } if (query == null) { throw new BuildException("You need to provide an IQL query string"); } ObjectStoreInterMineImpl os; try { os = (ObjectStoreInterMineImpl) ObjectStoreFactory.getObjectStore(alias); } catch (Exception e) { throw new BuildException("Exception while creating ObjectStore", e); } runIqlQuery(os, query); }
/** * {@inheritDoc} */ @Override public void execute() { if (objectStoreAlias == null) { throw new BuildException("objectStoreAlias attribute is not set"); } if (precomputePropertiesPath == null) { throw new BuildException("precomputePropertiesPath attribute is not set"); } if (minRows == -1) { throw new BuildException("minRows attribute is not set"); } ObjectStore os; try { os = ObjectStoreFactory.getObjectStore(objectStoreAlias); } catch (Exception e) { throw new BuildException("Exception while creating ObjectStore", e); } if (!(os instanceof ObjectStoreInterMineImpl)) { throw new BuildException(objectStoreAlias + " isn't an ObjectStoreInterMineImpl"); } precompute(false, os, minRows); }
/** * Gets an ObjectStoreFastCollectionsImpl instance for the given properties * * @param osAlias the alias of this objectstore * @param props the properties * @return the ObjectStore * @throws IllegalArgumentException if props are invalid * @throws ObjectStoreException if there is a problem with the instance */ public static ObjectStoreFastCollectionsImpl getInstance(String osAlias, Properties props) throws ObjectStoreException { String underlyingOsAlias = props.getProperty("os"); if (underlyingOsAlias == null) { throw new IllegalArgumentException("No 'os' property specified for FastCollections" + " objectstore"); } ObjectStore objectStore; try { objectStore = ObjectStoreFactory.getObjectStore(underlyingOsAlias); } catch (Exception e) { throw new IllegalArgumentException("ObjectStore '" + underlyingOsAlias + "' not found in properties"); } return new ObjectStoreFastCollectionsImpl(objectStore); }
public void testConfigure() throws Exception { ObjectStore os1 = ObjectStoreFactory.getObjectStore("os.unittest"); ObjectStore os2 = ObjectStoreFactory.getObjectStore("os.unittest"); // These should be exactly the same object assertTrue(os1 == os2); }
/** * Sets up the instance variables * * @throws BuildException if something is wrong */ public void setUp() { if (alias == null && objectStore == null) { throw new BuildException("exactly one of alias and objectStore must be set"); } if (objectStore == null) { try { objectStore = ObjectStoreFactory.getObjectStore(alias); } catch (Exception e) { throw new BuildException("Exception while creating ObjectStore", e); } } if (objectStore instanceof ObjectStoreInterMineImpl) { ObjectStoreInterMineImpl osii = ((ObjectStoreInterMineImpl) objectStore); database = osii.getDatabase(); schema = osii.getSchema(); } else { // change comment on setAlias() when this changes throw new BuildException("the alias (" + alias + ") does not refer to an " + "ObjectStoreInterMineImpl"); } }
public void testValid() throws Exception { ObjectStore os = ObjectStoreFactory.getObjectStore("os.unittest"); assertNotNull(os); }
public void testInvalid() throws Exception { try { ObjectStoreFactory.getObjectStore("db.unittest"); fail("Expected: ObjectStoreException"); } catch (ObjectStoreException e) { } } }
public static void oneTimeSetUp( String osName, String osWriterName, String modelName, String itemsXmlFilename) throws Exception { os = (ObjectStoreInterMineImpl)ObjectStoreFactory.getObjectStore(osName); ObjectStoreAbstractImplTestCase.oneTimeSetUp(os, osWriterName, modelName, itemsXmlFilename); }
protected DatabaseSchema getSchema() throws Exception { DatabaseSchema schema = ((ObjectStoreInterMineImpl) ObjectStoreFactory.getObjectStore("os.notxmlunittest")).getSchema(); return schema; } public String getRegisterOffset1() {
public void testNull() throws Exception { try { ObjectStoreFactory.getObjectStore(null); fail("Expected: NullPointerException"); } catch (NullPointerException e) { } }
public void testEmpty() throws Exception { try { ObjectStoreFactory.getObjectStore(""); fail("Expected: IllegalArgumentException"); } catch (IllegalArgumentException e) { } }
protected DatabaseSchema getSchema() throws Exception { return ((ObjectStoreInterMineImpl) ObjectStoreFactory.getObjectStore("os.flatmodeunittest")).getSchema(); }