code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
@GetMapping
public String viewTagWizard(
@RequestParam(required = false, value = "selectedTarget") String target, Model model) {
List<String> entityTypeIds =
dataService
.findAll(ENTITY_TYPE_META_DATA, EntityType.class)
.filter(entityType -> !EntityTypeUtils.isSystemEntity(en... | java |
public Language create(String code, String name, boolean active) {
Language language = super.create(code);
language.setName(name);
language.setActive(active);
return language;
} | java |
static String getSqlAddColumn(EntityType entityType, Attribute attr, ColumnMode columnMode) {
StringBuilder sql = new StringBuilder("ALTER TABLE ");
String columnSql = getSqlColumn(entityType, attr, columnMode);
sql.append(getTableName(entityType)).append(" ADD ").append(columnSql);
List<String> sqlTa... | java |
static String getSqlDropColumnDefault(EntityType entityType, Attribute attr) {
return "ALTER TABLE "
+ getTableName(entityType)
+ " ALTER COLUMN "
+ getColumnName(attr)
+ " DROP DEFAULT";
} | java |
private static boolean isPersistedInOtherTable(Attribute attr) {
boolean bidirectionalOneToMany = attr.getDataType() == ONE_TO_MANY && attr.isMappedBy();
return isMultipleReferenceType(attr) || bidirectionalOneToMany;
} | java |
private static <E extends Entity> boolean isDistinctSelectRequired(
EntityType entityType, Query<E> q) {
return isDistinctSelectRequiredRec(entityType, q.getRules());
} | java |
static <E extends Entity> String getSqlCount(
EntityType entityType, Query<E> q, List<Object> parameters) {
StringBuilder sqlBuilder = new StringBuilder("SELECT COUNT");
String idAttribute = getColumnName(entityType.getIdAttribute());
List<QueryRule> queryRules = q.getRules();
if (queryRules == n... | java |
@RunAsSystem
public Group getGroup(String groupName) {
Fetch roleFetch = new Fetch().field(RoleMetadata.NAME).field(RoleMetadata.LABEL);
Fetch fetch =
new Fetch()
.field(GroupMetadata.ROLES, roleFetch)
.field(GroupMetadata.NAME)
.field(GroupMetadata.LABEL)
... | java |
@RunAsSystem
public void addMember(final Group group, final User user, final Role role) {
ArrayList<Role> groupRoles = newArrayList(group.getRoles());
Collection<RoleMembership> memberships = roleMembershipService.getMemberships(groupRoles);
boolean isGroupRole = groupRoles.stream().anyMatch(gr -> gr.getN... | java |
@GetMapping("/logo/{name}.{extension}")
public void getLogo(
OutputStream out,
@PathVariable("name") String name,
@PathVariable("extension") String extension,
HttpServletResponse response)
throws IOException {
File f = fileStore.getFileUnchecked("/logo/" + name + "." + extension);
... | java |
static boolean isPersistedInPostgreSql(EntityType entityType) {
String backend = entityType.getBackend();
if (backend == null) {
// TODO remove this check after getBackend always returns the backend
if (null != getApplicationContext()) {
DataService dataService = getApplicationContext().getB... | java |
@Override
public String generateId(Attribute attribute) {
String idPart = generateHashcode(attribute.getEntity().getId() + attribute.getIdentifier());
String namePart = truncateName(cleanName(attribute.getName()));
return namePart + SEPARATOR + idPart;
} | java |
@SuppressWarnings("WeakerAccess")
public Entity getPluginSettings() {
String entityTypeId = DefaultSettingsEntityType.getSettingsEntityName(getId());
return RunAsSystemAspect.runAsSystem(() -> getPluginSettings(entityTypeId));
} | java |
DecoratorConfiguration removeReferencesOrDeleteIfEmpty(
List<Object> decoratorParametersToRemove, DecoratorConfiguration configuration) {
List<DecoratorParameters> decoratorParameters =
stream(
configuration.getEntities(PARAMETERS, DecoratorParameters.class).spliterator(),
... | java |
@Scheduled(fixedRate = 60000)
public void logStatistics() {
// TODO: do we want to log diff with last log instead?
if (LOG.isDebugEnabled()) {
LOG.debug("Cache stats:");
for (Map.Entry<String, LoadingCache<Query<Entity>, List<Object>>> cacheEntry :
caches.entrySet()) {
LOG.debug(... | java |
static Object getPostgreSqlValue(Entity entity, Attribute attr) {
String attrName = attr.getName();
AttributeType attrType = attr.getDataType();
switch (attrType) {
case BOOL:
return entity.getBoolean(attrName);
case CATEGORICAL:
case XREF:
Entity xrefEntity = entity.getEn... | java |
private void performIndexActions(Progress progress, String transactionId) {
List<IndexAction> indexActions =
dataService
.findAll(INDEX_ACTION, createQueryGetAllIndexActions(transactionId), IndexAction.class)
.collect(toList());
try {
boolean success = true;
int count... | java |
private boolean performAction(Progress progress, int progressCount, IndexAction indexAction) {
requireNonNull(indexAction);
String entityTypeId = indexAction.getEntityTypeId();
updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.STARTED);
try {
if (dataService.hasEntityType(entity... | java |
private void rebuildIndexOneEntity(String entityTypeId, String untypedEntityId) {
LOG.trace("Indexing [{}].[{}]... ", entityTypeId, untypedEntityId);
// convert entity id string to typed entity id
EntityType entityType = dataService.getEntityType(entityTypeId);
if (null != entityType) {
Object en... | java |
static Query<IndexAction> createQueryGetAllIndexActions(String transactionId) {
QueryRule rule = new QueryRule(INDEX_ACTION_GROUP_ATTR, EQUALS, transactionId);
QueryImpl<IndexAction> q = new QueryImpl<>(rule);
q.setSort(new Sort(ACTION_ORDER));
return q;
} | java |
private IntermediateParseResults getEntityTypeFromSource(RepositoryCollection source) {
IntermediateParseResults intermediateResults = parseTagsSheet(source.getRepository(EMX_TAGS));
parsePackagesSheet(source.getRepository(EMX_PACKAGES), intermediateResults);
parseEntitiesSheet(source.getRepository(EMX_ENT... | java |
IntermediateParseResults parseTagsSheet(Repository<Entity> tagRepository) {
IntermediateParseResults intermediateParseResults =
new IntermediateParseResults(entityTypeFactory);
if (tagRepository != null) {
for (Entity tagEntity : tagRepository) {
String id = tagEntity.getString(EMX_TAG_IDE... | java |
private void parsePackagesSheet(
Repository<Entity> repo, IntermediateParseResults intermediateResults) {
if (repo == null) return;
// Collect packages
int rowIndex = 1;
for (Entity packageEntity : resolvePackages(repo)) {
rowIndex++;
parseSinglePackage(intermediateResults, rowIndex, ... | java |
private static List<Tag> toTags(
IntermediateParseResults intermediateResults, List<String> tagIdentifiers) {
if (tagIdentifiers.isEmpty()) {
return emptyList();
}
List<Tag> tags = new ArrayList<>(tagIdentifiers.size());
for (String tagIdentifier : tagIdentifiers) {
Tag tag = intermed... | java |
List<EntityType> putEntitiesInDefaultPackage(
IntermediateParseResults intermediateResults, String defaultPackageId) {
Package p = getPackage(intermediateResults, defaultPackageId);
if (p == null) {
throw new UnknownPackageException(defaultPackageId);
}
List<EntityType> entities = newArrayL... | java |
static boolean parseBoolean(String booleanString, int rowIndex, String columnName) {
if (booleanString.equalsIgnoreCase(TRUE.toString())) return true;
else if (booleanString.equalsIgnoreCase(FALSE.toString())) return false;
else
throw new InvalidValueException(
booleanString, columnName, "TR... | java |
private Language toLanguage(Entity emxLanguageEntity) {
Language language = languageFactory.create();
language.setCode(emxLanguageEntity.getString(EMX_LANGUAGE_CODE));
language.setName(emxLanguageEntity.getString(EMX_LANGUAGE_NAME));
return language;
} | java |
public <A> Set<A> getAllDependants(
A item, Function<A, Integer> getDepth, Function<A, Set<A>> getDependants) {
Set<A> currentGeneration = singleton(item);
Set<A> result = newHashSet();
Set<A> visited = newHashSet();
for (int depth = 0; !currentGeneration.isEmpty(); depth++) {
currentGenera... | java |
private Integer getLookupAttributeIndex(
EditorAttribute editorAttribute, EditorEntityType editorEntityType) {
String editorAttributeId = editorAttribute.getId();
int index =
editorEntityType
.getLookupAttributes()
.stream()
.map(EditorAttributeIdentifier::get... | java |
public AttributeMapping addAttributeMapping(String targetAttributeName) {
if (attributeMappings.containsKey(targetAttributeName)) {
throw new IllegalStateException(
"AttributeMapping already exists for target attribute " + targetAttributeName);
}
Attribute targetAttribute = targetEntityType.... | java |
Object getDataValuesForType(Entity entity, Attribute attribute) {
String attributeName = attribute.getName();
switch (attribute.getDataType()) {
case DATE:
return entity.getLocalDate(attributeName);
case DATE_TIME:
return entity.getInstant(attributeName);
case BOOL:
ret... | java |
private void validate(Entity entity) {
MailSettingsImpl mailSettings = new MailSettingsImpl(entity);
if (mailSettings.isTestConnection()
&& mailSettings.getUsername() != null
&& mailSettings.getPassword() != null) {
mailSenderFactory.validateConnection(mailSettings);
}
} | java |
@Override
public boolean upgrade() {
int schemaVersion = versionService.getSchemaVersion();
if (schemaVersion < 31) {
throw new UnsupportedOperationException(
"Upgrading from schema version below 31 is not supported");
}
if (schemaVersion < versionService.getAppVersion()) {
LOG.i... | java |
protected void onStartup(ServletContext servletContext, Class<?> appConfig, int maxFileSize) {
// Create the 'root' Spring application context
AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
rootContext.setAllowBeanDefinitionOverriding(false);
rootContext... | java |
Document createDocument(Entity entity) {
int maxIndexingDepth = entity.getEntityType().getIndexingDepth();
XContentBuilder contentBuilder;
try {
contentBuilder = XContentFactory.contentBuilder(JSON);
XContentGenerator generator = contentBuilder.generator();
generator.writeStartObject();
... | java |
@GetMapping("/**")
public String initView(Model model) {
super.init(model, ID);
model.addAttribute("username", super.userAccountService.getCurrentUser().getUsername());
return QUESTIONNAIRE_VIEW;
} | java |
@SuppressWarnings("squid:S2259") // potential multi-threading NPE
public Package getRootPackage() {
Package aPackage = this;
while (aPackage.getParent() != null) {
aPackage = aPackage.getParent();
}
return aPackage;
} | java |
public void renumberViolationRowIndices(List<Integer> actualIndices) {
violations.forEach(v -> v.renumberRowIndex(actualIndices));
} | java |
public static Style createLocal(String location) {
String name = location.replaceFirst("bootstrap-", "");
name = name.replaceFirst(".min", "");
name = name.replaceFirst(".css", "");
return new AutoValue_Style(name, false, location);
} | java |
public void populate() {
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
try {
Resource[] bootstrap3Themes = resolver.getResources(LOCAL_CSS_BOOTSTRAP_3_THEME_LOCATION);
Resource[] bootstrap4Themes = resolver.getResources(LOCAL_CSS_BOOTSTRAP_4_THEME_LOCATION... | java |
public static Fetch createDefaultEntityFetch(EntityType entityType, String languageCode) {
boolean hasRefAttr = false;
Fetch fetch = new Fetch();
for (Attribute attr : entityType.getAtomicAttributes()) {
Fetch subFetch = createDefaultAttributeFetch(attr, languageCode);
if (subFetch != null) {
... | java |
public static Fetch createDefaultAttributeFetch(Attribute attr, String languageCode) {
Fetch fetch;
if (isReferenceType(attr)) {
fetch = new Fetch();
EntityType refEntityType = attr.getRefEntity();
String idAttrName = refEntityType.getIdAttribute().getName();
fetch.field(idAttrName);
... | java |
public void renumberRowIndex(List<Integer> indices) {
this.rowNr = this.rowNr != null ? Long.valueOf(indices.get(toIntExact(this.rowNr - 1))) : null;
} | java |
public static String generateScript(Script script, Map<String, Object> parameterValues) {
StringWriter stringWriter = new StringWriter();
try {
Template template =
new Template(null, new StringReader(script.getContent()), new Configuration(VERSION));
template.process(parameterValues, strin... | java |
@Override
@Transactional(readOnly = true)
@RunAsSystem
public UserDetails findUserByToken(String token) {
Token molgenisToken = getMolgenisToken(token);
return userDetailsService.loadUserByUsername(molgenisToken.getUser().getUsername());
} | java |
@Override
@Transactional
@RunAsSystem
public String generateAndStoreToken(String username, String description) {
User user = dataService.query(USER, User.class).eq(USERNAME, username).findOne();
if (user == null) {
throw new IllegalArgumentException(format("Unknown username [%s]", username));
}
... | java |
static String generateUniqueLabel(String label, Set<String> existingLabels) {
StringBuilder newLabel = new StringBuilder(label);
while (existingLabels.contains(newLabel.toString())) {
newLabel.append(POSTFIX);
}
return newLabel.toString();
} | java |
@Override
@RunAsSystem
public String resolveCodeWithoutArguments(String code, Locale locale) {
return Optional.ofNullable(
dataService.query(L10N_STRING, L10nString.class).eq(MSGID, code).findOne())
.map(l10nString -> l10nString.getString(locale))
.orElse(null);
} | java |
@RunAsSystem
public Map<String, String> getMessages(String namespace, Locale locale) {
return getL10nStrings(namespace)
.stream()
.filter(e -> e.getString(locale) != null)
.collect(toMap(L10nString::getMessageID, e -> e.getString(locale)));
} | java |
@Transactional
public void deleteNamespace(String namespace) {
List<L10nString> namespaceEntities = getL10nStrings(namespace);
dataService.delete(L10N_STRING, namespaceEntities.stream());
} | java |
@SuppressWarnings("WeakerAccess")
public final <R> Optional<R> apply(Timeout timeout, Function<T, R> function)
throws InterruptedException {
T obj = claim(timeout);
if (obj == null) {
return Optional.empty();
}
try {
return Optional.ofNullable(function.apply(obj));
} finally {
... | java |
@SuppressWarnings("WeakerAccess")
public final boolean supply(Timeout timeout, Consumer<T> consumer)
throws InterruptedException {
T obj = claim(timeout);
if (obj == null) {
return false;
}
try {
consumer.accept(obj);
return true;
} finally {
obj.release();
}
} | java |
Reallocator<T> getAdaptedReallocator() {
if (allocator == null) {
return null;
}
if (metricsRecorder == null) {
if (allocator instanceof Reallocator) {
return (Reallocator<T>) allocator;
}
return new ReallocatingAdaptor<>((Allocator<T>) allocator);
} else {
if (allo... | java |
public void setFunctionName(String functionName) {
String oldFunctionName = functionName;
this.functionName = functionName;
firePropertyChange("FunctionName", oldFunctionName, functionName);
} | java |
public static String getSpringBootMavenPluginClassifier(MavenProject project, Log log) {
String classifier = null;
try {
classifier = MavenProjectUtil.getPluginGoalConfigurationString(project,
"org.springframework.boot:spring-boot-maven-plugin", "repackage", "classifier")... | java |
public static File getSpringBootUberJAR(MavenProject project, Log log) {
File fatArchive = getSpringBootUberJARLocation(project, log);
if (net.wasdev.wlp.common.plugins.util.SpringBootUtil.isSpringBootUberJar(fatArchive)) {
log.info("Found Spring Boot Uber JAR: " + fatArchive.getAbsolutePa... | java |
public static File getSpringBootUberJARLocation(MavenProject project, Log log) {
String classifier = getSpringBootMavenPluginClassifier(project, log);
if (classifier == null) {
classifier = "";
}
if (!classifier.isEmpty() && !classifier.startsWith("-")) {
classif... | java |
protected void installServerAssembly() throws Exception {
if (installType == InstallType.ALREADY_EXISTS) {
log.info(MessageFormat.format(messages.getString("info.install.type.preexisting"), ""));
} else {
if (installType == InstallType.FROM_ARCHIVE) {
installFromA... | java |
protected String stripVersionFromName(String name, String version) {
int versionBeginIndex = name.lastIndexOf("-" + version);
if ( versionBeginIndex != -1) {
return name.substring(0, versionBeginIndex) + name.substring(versionBeginIndex + version.length() + 1);
} else {
r... | java |
private String getWlpOutputDir() throws IOException {
Properties envvars = new Properties();
File serverEnvFile = new File(installDirectory, "etc/server.env");
if (serverEnvFile.exists()) {
envvars.load(new FileInputStream(serverEnvFile));
}
serverEn... | java |
@Override
protected Artifact createArtifact(final ArtifactItem item) throws MojoExecutionException {
assert item != null;
if (item.getVersion() == null) {
throw new MojoExecutionException("Unable to find artifact without version specified: " + item.getGroupId()
+... | java |
public void addFeature(String feature) {
if (feature == null) {
throw new IllegalArgumentException("Invalid null argument passed for addFeature");
}
feature = feature.trim();
if (!feature.isEmpty()) {
Feature newFeature = new Feature();
newFeature.add... | java |
public static String getPluginConfiguration(MavenProject proj, String pluginGroupId, String pluginArtifactId, String key) {
Xpp3Dom dom = proj.getGoalConfiguration(pluginGroupId, pluginArtifactId, null, null);
if (dom != null) {
Xpp3Dom val = dom.getChild(key);
if (val != null) {... | java |
public static String getPluginGoalConfigurationString(MavenProject project, String pluginKey, String goal, String configName) throws PluginScenarioException {
PluginExecution execution = getPluginGoalExecution(project, pluginKey, goal);
final Xpp3Dom config = (Xpp3Dom)execution.getConfiguration... | java |
public static File getManifestFile(MavenProject proj, String pluginArtifactId) {
Xpp3Dom dom = proj.getGoalConfiguration("org.apache.maven.plugins", pluginArtifactId, null, null);
if (dom != null) {
Xpp3Dom archive = dom.getChild("archive");
if (archive != null) {
... | java |
protected void installLooseConfigWar(MavenProject proj, LooseConfigData config) throws Exception {
// return error if webapp contains java source but it is not compiled yet.
File dir = new File(proj.getBuild().getOutputDirectory());
if (!dir.exists() && containsJavaSource(proj)) {
th... | java |
protected void installLooseConfigEar(MavenProject proj, LooseConfigData config) throws Exception {
LooseEarApplication looseEar = new LooseEarApplication(proj, config);
looseEar.addSourceDir();
looseEar.addApplicationXmlFile();
Set<Artifact> artifacts = proj.getArtifacts();
log.... | java |
private String getAppFileName(MavenProject project) {
String name = project.getBuild().getFinalName() + "." + project.getPackaging();
if (project.getPackaging().equals("liberty-assembly")) {
name = project.getBuild().getFinalName() + ".war";
}
if (stripVersion) {
... | java |
protected void invokeSpringBootUtilCommand(File installDirectory, String fatArchiveSrcLocation,
String thinArchiveTargetLocation, String libIndexCacheTargetLocation) throws Exception {
SpringBootUtilTask springBootUtilTask = (SpringBootUtilTask) ant
.createTask("antlib:net/wasdev/wlp... | java |
public void onCreate(Activity activity, Bundle savedInstanceState) {
this.activity = activity;
container = (ScreenContainer) activity.findViewById(R.id.magellan_container);
checkState(container != null, "There must be a ScreenContainer whose id is R.id.magellan_container in the view hierarchy");
for (Sc... | java |
public void onSaveInstanceState(Bundle outState) {
for (Screen screen : backStack) {
screen.save(outState);
screen.onSave(outState);
}
} | java |
public void resetWithRoot(Activity activity, final Screen root) {
checkOnCreateNotYetCalled(activity, "resetWithRoot() must be called before onCreate()");
backStack.clear();
backStack.push(root);
} | java |
public void goBackToRoot(NavigationType navigationType) {
navigate(new HistoryRewriter() {
@Override
public void rewriteHistory(Deque<Screen> history) {
while (history.size() > 1) {
history.pop();
}
}
}, navigationType, BACKWARD);
} | java |
public String getBackStackDescription() {
ArrayList<Screen> backStackCopy = new ArrayList<>(backStack);
Collections.reverse(backStackCopy);
String currentScreen = "";
if (!backStackCopy.isEmpty()) {
currentScreen = backStackCopy.remove(backStackCopy.size() - 1).toString();
}
return TextUti... | java |
@Override
public int read(final byte[] buffer, final int bufPos, final int length)
throws IOException {
int i = super.read(buffer, bufPos, length);
if ((i == length) || (i == -1))
return i;
int j = super.read(buffer, bufPos + i, length - i);
if (j == -1... | java |
private String sendBind(BindType bindType, String systemId,
String password, String systemType,
InterfaceVersion interfaceVersion, TypeOfNumber addrTon,
NumberingPlanIndicator addrNpi, String addressRange, long timeout)
throws PDUExcept... | java |
public OutbindRequest waitForOutbind(long timeout)
throws IllegalStateException, TimeoutException {
SessionState currentSessionState = getSessionState();
if (currentSessionState.equals(SessionState.OPEN)) {
new SMPPOutboundServerSession.PDUReaderWorker().start();
try {
return outbindRe... | java |
public String bind(BindParameter bindParam, long timeout)
throws IOException {
try {
String smscSystemId = sendBind(bindParam.getBindType(), bindParam.getSystemId(), bindParam.getPassword(), bindParam.getSystemType(),
bindParam.getInterfaceVersion(), bindParam.getAddrTon(), bindParam.getAddrNp... | java |
public static String convertHexStringToString(String hexString) {
String uHexString = hexString.toLowerCase();
StringBuilder sBld = new StringBuilder();
for (int i = 0; i < uHexString.length(); i = i + 2) {
char c = (char)Integer.parseInt(uHexString.substring(i, i + 2), 16);
... | java |
public static byte[] convertHexStringToBytes(String hexString, int offset,
int endIndex) {
byte[] data;
String realHexString = hexString.substring(offset, endIndex)
.toLowerCase();
if ((realHexString.length() % 2) == 0)
data = new byte[realHexString.length... | java |
private static String intToString(int value, int digit) {
StringBuilder stringBuilder = new StringBuilder(digit);
stringBuilder.append(Integer.toString(value));
while (stringBuilder.length() < digit) {
stringBuilder.insert(0, "0");
}
return stringBuilder.toString();
... | java |
private static String getDeliveryReceiptValue(String attrName, String source)
throws IndexOutOfBoundsException {
String tmpAttr = attrName + ":";
int startIndex = source.indexOf(tmpAttr);
if (startIndex < 0) {
return null;
}
startIndex = startIndex + tmpAt... | java |
private SMPPSession getSession() throws IOException {
if (session == null) {
LOGGER.info("Initiate session for the first time to {}:{}", remoteIpAddress, remotePort);
session = newSession();
}
else if (!session.getSessionState().isBound()) {
throw new IOException("We have no valid session ... | java |
private void reconnectAfter(final long timeInMillis) {
new Thread() {
@Override
public void run() {
LOGGER.info("Schedule reconnect after {} millis", timeInMillis);
try {
Thread.sleep(timeInMillis);
}
catch (InterruptedException e) {
}
int attem... | java |
public void accept(String systemId, InterfaceVersion interfaceVersion) throws PDUStringException, IllegalStateException, IOException {
StringValidator.validateString(systemId, StringParameter.SYSTEM_ID);
lock.lock();
try {
if (!done) {
done = true;
try... | java |
public void reject(int errorCode) throws IllegalStateException, IOException {
lock.lock();
try {
if (done) {
throw new IllegalStateException("Response already initiated");
} else {
done = true;
try {
responseHand... | java |
public void done(T response) throws IllegalArgumentException {
lock.lock();
try {
if (response != null) {
this.response = response;
condition.signal();
} else {
throw new IllegalArgumentException("response cannot be null");
... | java |
public void waitDone() throws ResponseTimeoutException,
InvalidResponseException {
lock.lock();
try {
if (!isDoneResponse()) {
try {
condition.await(timeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
... | java |
public byte[] serialize() {
byte[] value = serializeValue();
ByteBuffer buffer = ByteBuffer.allocate(value.length + 4);
buffer.putShort(tag);
buffer.putShort((short)value.length);
buffer.put(value);
return buffer.array();
} | java |
@Override
public BindRequest connectAndOutbind(String host, int port,
String systemId, String password) throws IOException {
return connectAndOutbind(host, port, new OutbindParameter(systemId, password), 60000);
} | java |
public BindRequest connectAndOutbind(String host, int port, OutbindParameter outbindParameter, long timeout)
throws IOException {
logger.debug("Connect and bind to {} port {}", host, port);
if (getSessionState() != SessionState.CLOSED) {
throw new IOException("Session state is not closed");
}
... | java |
private BindRequest waitForBind(long timeout)
throws IllegalStateException, TimeoutException {
SessionState currentSessionState = getSessionState();
if (currentSessionState.equals(SessionState.OPEN)) {
try {
return bindRequestReceiver.waitForRequest(timeout);
}
catch (IllegalStat... | java |
public static int bytesToInt(byte[] bytes, int offset) {
//
int result = 0x00000000;
int length;
if (bytes.length - offset < 4) // maximum byte size for int data type
// is 4
length = bytes.length - offset;
else
le... | java |
public static short bytesToShort(byte[] bytes, int offset) {
short result = 0x0000;
int end = offset + 2;
for (int i = 0; i < 2; i++) {
result |= (bytes[end - i - 1] & 0xff) << (8 * i);
}
return result;
} | java |
OutbindRequest waitForRequest(long timeout) throws IllegalStateException, TimeoutException {
this.lock.lock();
try {
if (this.alreadyWaitForRequest) {
throw new IllegalStateException("waitForRequest(long) method already invoked");
}
else if (this.request == null) {
try {
... | java |
void notifyAcceptOutbind(Outbind outbind) throws IllegalStateException {
this.lock.lock();
try {
if (this.request == null) {
this.request = new OutbindRequest(outbind);
this.requestCondition.signal();
}
else {
throw new IllegalStateException("Already waiting for accepta... | java |
public void setPduProcessorDegree(int pduProcessorDegree) throws IllegalStateException {
if (!getSessionState().equals(SessionState.CLOSED)) {
throw new IllegalStateException(
"Cannot set PDU processor degree since the PDU dispatcher thread already created");
}
th... | java |
protected void ensureReceivable(String activityName) throws IOException {
// TODO uudashr: do we have to use another exception for this checking?
SessionState currentState = getSessionState();
if (!currentState.isReceivable()) {
throw new IOException("Cannot " + activityName + " whil... | java |
protected void ensureTransmittable(String activityName, boolean only) throws IOException {
// TODO uudashr: do we have to use another exception for this checking?
SessionState currentState = getSessionState();
if (!currentState.isTransmittable() || (only && currentState.isReceivable())) {
... | java |
void notifyAcceptBind(Bind bindParameter) throws IllegalStateException {
lock.lock();
try {
if (request == null) {
request = new BindRequest(bindParameter, responseHandler);
requestCondition.signal();
} else {
throw new IllegalState... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.