Search in sources :

Example 1 with NamedClusterServiceOsgi

use of org.pentaho.di.core.osgi.api.NamedClusterServiceOsgi in project pentaho-kettle by pentaho.

the class AbstractMetaTest method testGetSetNamedClusterServiceOsgi.

@Test
public void testGetSetNamedClusterServiceOsgi() throws Exception {
    assertNull(meta.getNamedClusterServiceOsgi());
    NamedClusterServiceOsgi mockNamedClusterOsgi = mock(NamedClusterServiceOsgi.class);
    meta.setNamedClusterServiceOsgi(mockNamedClusterOsgi);
    assertEquals(mockNamedClusterOsgi, meta.getNamedClusterServiceOsgi());
}
Also used : NamedClusterServiceOsgi(org.pentaho.di.core.osgi.api.NamedClusterServiceOsgi) Test(org.junit.Test)

Example 2 with NamedClusterServiceOsgi

use of org.pentaho.di.core.osgi.api.NamedClusterServiceOsgi in project pentaho-kettle by pentaho.

the class NamedClusterEmbedManager method clear.

/**
 * Clear the embedded metastore of any named clusters
 */
public void clear() {
    NamedClusterServiceOsgi ncso = meta.getNamedClusterServiceOsgi();
    if (ncso != null) {
        // Don't kill the embedded if we don't have the service to rebuild
        addedAllClusters = false;
        addedAnyClusters = false;
        // saved.
        if (embeddedMetaStoreFactory != null) {
            try {
                List<NamedClusterOsgi> list = embeddedMetaStoreFactory.getElements();
                for (NamedClusterOsgi nc : list) {
                    namedClusterPool.put(nc.getName(), nc);
                    embeddedMetaStoreFactory.deleteElement(nc.getName());
                }
            } catch (MetaStoreException e) {
                logMetaStoreException(e);
            }
        }
    }
}
Also used : NamedClusterOsgi(org.pentaho.di.core.osgi.api.NamedClusterOsgi) MetaStoreException(org.pentaho.metastore.api.exceptions.MetaStoreException) NamedClusterServiceOsgi(org.pentaho.di.core.osgi.api.NamedClusterServiceOsgi)

Example 3 with NamedClusterServiceOsgi

use of org.pentaho.di.core.osgi.api.NamedClusterServiceOsgi in project pentaho-kettle by pentaho.

the class NamedClusterEmbedManager method addAllClusters.

private void addAllClusters() {
    NamedClusterServiceOsgi ncso = meta.getNamedClusterServiceOsgi();
    if (ncso != null && meta.getMetaStore() != null) {
        try {
            List<String> list = ncso.listNames(meta.getMetaStore());
            for (String name : list) {
                addClusterToMeta(name);
            }
            for (NamedClusterOsgi nc : namedClusterPool.values()) {
                if (!list.contains(nc.getName())) {
                    addClusterToMeta(nc);
                }
            }
            addedAllClusters = true;
        } catch (MetaStoreException e) {
            logMetaStoreException(e);
        }
    }
}
Also used : NamedClusterOsgi(org.pentaho.di.core.osgi.api.NamedClusterOsgi) MetaStoreException(org.pentaho.metastore.api.exceptions.MetaStoreException) NamedClusterServiceOsgi(org.pentaho.di.core.osgi.api.NamedClusterServiceOsgi)

Aggregations

NamedClusterServiceOsgi (org.pentaho.di.core.osgi.api.NamedClusterServiceOsgi)3 NamedClusterOsgi (org.pentaho.di.core.osgi.api.NamedClusterOsgi)2 MetaStoreException (org.pentaho.metastore.api.exceptions.MetaStoreException)2 Test (org.junit.Test)1