use of io.fabric8.openshift.api.model.Build in project fabric8 by jboss-fuse.
the class BootstrapConfiguration method configureInternal.
void configureInternal(Map<String, ?> conf) throws Exception {
configuration = configurer.configure(conf, this);
if (Strings.isNullOrBlank(runtimeId)) {
throw new IllegalArgumentException("Runtime id must not be null or empty.");
}
if (Strings.isNullOrBlank(localResolver)) {
localResolver = globalResolver;
}
String decodedZookeeperPassword = null;
Properties userProps = new Properties();
try {
userProps.load(new File(confDir, "users.properties"));
} catch (IOException e) {
LOGGER.warn("Failed to load users from etc/users.properties. No users will be imported.", e);
}
if (Strings.isNotBlank(zookeeperPassword)) {
decodedZookeeperPassword = PasswordEncoder.decode(zookeeperPassword);
} else if (userProps.containsKey(DEFAULT_ADMIN_USER)) {
String passwordAndRole = userProps.getProperty(DEFAULT_ADMIN_USER).trim();
decodedZookeeperPassword = passwordAndRole.substring(0, passwordAndRole.indexOf(ROLE_DELIMITER));
} else {
decodedZookeeperPassword = PasswordEncoder.encode(CreateEnsembleOptions.generatePassword());
}
// do not trigger io.fabric8.zookeeper update if restart is pending (fabric:join)
if (!Boolean.getBoolean("karaf.restart") && zookeeperUrl != null && zookeeperPassword != null) {
Configuration zkConfugiration = configAdmin.get().getConfiguration(Constants.ZOOKEEPER_CLIENT_PID);
if (zkConfugiration.getProperties() == null) {
Hashtable<String, Object> zkProperties = new Hashtable<>();
zkProperties.put("zookeeper.url", zookeeperUrl);
zkProperties.put("zookeeper.password", PasswordEncoder.encode(decodedZookeeperPassword));
zkConfugiration.update(zkProperties);
}
}
if (userProps.isEmpty()) {
userProps.put(DEFAULT_ADMIN_USER, decodedZookeeperPassword + ROLE_DELIMITER + DEFAULT_ADMIN_ROLE);
}
String minimumPort = (String) configuration.get("minimum.port");
if (!Strings.isNullOrBlank(minimumPort)) {
this.minport = Integer.valueOf(minimumPort);
}
String maximumPort = (String) configuration.get("maximum.port");
if (!Strings.isNullOrBlank(maximumPort)) {
this.maxport = Integer.valueOf(maximumPort);
}
options = CreateEnsembleOptions.builder().bindAddress(bindAddress).agentEnabled(agentAutoStart).ensembleStart(ensembleAutoStart).zookeeperPassword(decodedZookeeperPassword).zooKeeperServerPort(zookeeperServerPort).zooKeeperServerConnectionPort(zookeeperServerConnectionPort).autoImportEnabled(profilesAutoImport).importPath(profilesAutoImportPath).resolver(localResolver).globalResolver(globalResolver).users(userProps).minimumPort(minport).maximumPort(maxport).profiles(profiles).version(version).build();
}
use of io.fabric8.openshift.api.model.Build in project fabric8 by jboss-fuse.
the class ConsumerControlMarshaller method looseUnmarshal.
/**
* Un-marshal an object instance from the data input stream
*
* @param o the object to un-marshal
* @param dataIn the data input stream to build the object from
* @throws IOException
*/
public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataByteArrayInputStream dataIn) throws IOException {
super.looseUnmarshal(wireFormat, o, dataIn);
ConsumerControl info = (ConsumerControl) o;
info.setClose(dataIn.readBoolean());
info.setConsumerId((ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn));
info.setPrefetch(dataIn.readInt());
}
use of io.fabric8.openshift.api.model.Build in project fabric8 by jboss-fuse.
the class ConsumerIdMarshaller method looseUnmarshal.
/**
* Un-marshal an object instance from the data input stream
*
* @param o the object to un-marshal
* @param dataIn the data input stream to build the object from
* @throws IOException
*/
public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataByteArrayInputStream dataIn) throws IOException {
super.looseUnmarshal(wireFormat, o, dataIn);
ConsumerId info = (ConsumerId) o;
info.setConnectionId(looseUnmarshalString(dataIn));
info.setSessionId(looseUnmarshalLong(wireFormat, dataIn));
info.setValue(looseUnmarshalLong(wireFormat, dataIn));
}
use of io.fabric8.openshift.api.model.Build in project fabric8 by jboss-fuse.
the class ConsumerInfoMarshaller method tightUnmarshal.
/**
* Un-marshal an object instance from the data input stream
*
* @param o the object to un-marshal
* @param dataIn the data input stream to build the object from
* @throws IOException
*/
public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataByteArrayInputStream dataIn, BooleanStream bs) throws IOException {
super.tightUnmarshal(wireFormat, o, dataIn, bs);
ConsumerInfo info = (ConsumerInfo) o;
info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
info.setBrowser(bs.readBoolean());
info.setDestination((ActiveMQDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
info.setPrefetchSize(dataIn.readInt());
info.setMaximumPendingMessageLimit(dataIn.readInt());
info.setDispatchAsync(bs.readBoolean());
info.setSelector(tightUnmarshalString(dataIn, bs));
info.setSubscriptionName(tightUnmarshalString(dataIn, bs));
info.setNoLocal(bs.readBoolean());
info.setExclusive(bs.readBoolean());
info.setRetroactive(bs.readBoolean());
info.setPriority(dataIn.readByte());
if (bs.readBoolean()) {
short size = dataIn.readShort();
BrokerId[] value = new BrokerId[size];
for (int i = 0; i < size; i++) {
value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs);
}
info.setBrokerPath(value);
} else {
info.setBrokerPath(null);
}
info.setAdditionalPredicate((BooleanExpression) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
info.setNetworkSubscription(bs.readBoolean());
info.setOptimizedAcknowledge(bs.readBoolean());
info.setNoRangeAcks(bs.readBoolean());
}
use of io.fabric8.openshift.api.model.Build in project fabric8 by jboss-fuse.
the class DataArrayResponseMarshaller method looseUnmarshal.
/**
* Un-marshal an object instance from the data input stream
*
* @param o the object to un-marshal
* @param dataIn the data input stream to build the object from
* @throws IOException
*/
public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataByteArrayInputStream dataIn) throws IOException {
super.looseUnmarshal(wireFormat, o, dataIn);
DataArrayResponse info = (DataArrayResponse) o;
if (dataIn.readBoolean()) {
short size = dataIn.readShort();
DataStructure[] value = new DataStructure[size];
for (int i = 0; i < size; i++) {
value[i] = (DataStructure) looseUnmarsalNestedObject(wireFormat, dataIn);
}
info.setData(value);
} else {
info.setData(null);
}
}
Aggregations