@ManagedAttribute(description="Returns registered Schema version") public int getVersion() { return getEntity().getVersion(); }
/** * {@inheritDoc} */ @Override public String toString() { return "Schema [name=" + name + ", version=" + getVersion() + ", description=" + description + ", active=" + active + ", created at=" + getCreatedAt() + ", by=" + getCreatedBy() + ", props=" + props + ", indexes=" + indexes + ", triggers=" + triggers + ", fragments=" + fragments + ", collections=" + collections + ", resources=" + resources + ", views=" + views + "]"; }
@Override public Object process(Entry<String, Schema> entry) { logger.debug("process.enter; entry: {}", entry); if (entry.getValue() != null) { Schema schema = entry.getValue(); if (schema.getVersion() == getVersion()) { if (denitSchemaInCluster(schema) > 0) { schema.setActive(false); schema.updateVersion(getAdmin()); entry.setValue(schema); } else { entry.setValue(null); } auditEntity(AuditType.delete, schema); return schema; } else { // throw ex ? logger.warn("process; outdated schema version: {}; entry version: {}; process terminated", getVersion(), entry.getValue().getVersion()); } } return null; }
public Schema removeSchema(String schemaName) { Schema schema = entityCache.get(schemaName); if (schema != null) { String user = srvUser.getCurrentUser(); Object result = entityCache.executeOnKey(schemaName, new SchemaRemover(schema.getVersion(), user)); logger.debug("deleteSchema; execution result: {}", result); schema = (Schema) result; } return schema; }
if (entry.getValue() != null) { Schema schema = entry.getValue(); if (schema.getVersion() == getVersion()) {
@ManagedOperation(description="Deactivate Schema") public boolean deactivateSchema() { Schema schema = getEntity(); if (schema != null && schema.isActive()) { String user = getCurrentUser(); Object result = entityCache.executeOnKey(entityName, new SchemaActivator(schema.getVersion(), user, false)); logger.trace("deactivateSchema; execution result: {}", result); return result != null; } return false; }
@ManagedOperation(description="Activate Schema") public boolean activateSchema() { Schema schema = getEntity(); if (schema != null && !schema.isActive()) { String user = getCurrentUser(); Object result = entityCache.executeOnKey(entityName, new SchemaActivator(schema.getVersion(), user, true)); logger.trace("activateSchema; execution result: {}", result); return result != null; } return false; }
@ManagedOperation(description="Set named Schema property") @ManagedOperationParameters({ @ManagedOperationParameter(name = "name", description = "A name of the property to set"), @ManagedOperationParameter(name = "value", description = "A value of the property to set")}) public void setProperty(String name, String value) { Schema schema = getEntity(); if (schema != null) { Properties props = new Properties(); props.setProperty(name, value); Object result = entityCache.executeOnKey(entityName, new SchemaUpdater(schema.getVersion(), getCurrentUser(), false, props)); logger.trace("setProperty; execution result: {}", result); if (result != null) { //schema updated String message = "Schema property " + name + " set to " + value; String jmxType = "bdb.jmx.notification.property"; Notification note = new Notification(jmxType, this, jmxIndex++, System.currentTimeMillis(), message); note.setUserData(entityName); jmxPublisher.sendNotification(note); } } }
@ManagedOperation(description="Update Schema properties") @ManagedOperationParameters({ @ManagedOperationParameter(name = "properties", description = "Schema properties: key/value pairs separated by semicolon")}) public boolean updateProperties(String properties) { Schema schema = getEntity(); if (schema != null) { Properties props; try { props = PropUtils.propsFromString(properties); } catch (IOException ex) { logger.error("updateProperties.error: ", ex); return false; } Object result = entityCache.executeOnKey(entityName, new SchemaUpdater(schema.getVersion(), getCurrentUser(), true, props)); logger.trace("updateProperties; execution result: {}", result); return result != null; } return false; }
if (entry.getValue() != null) { Schema schema = entry.getValue(); if (schema.getVersion() == getVersion()) { if (activate) { if (!schema.isActive()) {