当前位置: 首页>>代码示例>>Java>>正文


Java PGNotification.getParameter方法代码示例

本文整理汇总了Java中org.postgresql.PGNotification.getParameter方法的典型用法代码示例。如果您正苦于以下问题:Java PGNotification.getParameter方法的具体用法?Java PGNotification.getParameter怎么用?Java PGNotification.getParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.postgresql.PGNotification的用法示例。


在下文中一共展示了PGNotification.getParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseBaseTypesNotification

import org.postgresql.PGNotification; //导入方法依赖的package包/类
/**
 * Parses base type {@link PGNotification notifications} for synchronizing the state of
 * {@link BaseType base types} between multiple instances of BinNavi.
 * 
 * @param notification THe {@link PGNotification} from the database.
 * @return A {@link TypesNotificationContainer container} with the parsed information.
 */
private TypesNotificationContainer parseBaseTypesNotification(final PGNotification notification) {

  final Matcher matcher = BASE_TYPES_NOTIFICATION_PATTERN.matcher(notification.getParameter());

  if (!matcher.find()) {
    throw new IllegalStateException("Error: compiled pattern: " + BASE_TYPE_NOTIFICATION_REGEX
        + " did not match notification: " + notification.getParameter());
  }

  final String databaseOperation = matcher.group(2);
  final Integer moduleId = Integer.parseInt(matcher.group(3));
  final Integer baseTypeId = Integer.parseInt(matcher.group(4));

  return new TypesNotificationContainer(databaseOperation, moduleId, Optional.of(baseTypeId),
      Optional.<Integer>absent(), Optional.<BigInteger>absent(), Optional.<Integer>absent(),
      Optional.<Integer>absent());
}
 
开发者ID:google,项目名称:binnavi,代码行数:25,代码来源:PostgreSQLTypesNotificationParser.java

示例2: parseExpressionTypesNotification

import org.postgresql.PGNotification; //导入方法依赖的package包/类
/**
 * Parses expression type aka type substitution {@link PGNotification notifications} for
 * synchronizing the state of {@link TypeSubstitution type substitutions} between multiple
 * instances of BinNavi.
 * 
 * @param notification The {@link PGNotification} from the database.
 * @return A {@link TypesNotificationContainer container} with the parsed information.
 */
private TypesNotificationContainer parseExpressionTypesNotification(
    final PGNotification notification) {

  final Matcher matcher =
      EXPRESSION_TYPES_NOTIFICATION_PATTERN.matcher(notification.getParameter());

  if (!matcher.find()) {
    throw new IllegalStateException("Error: compliled pattern "
        + EXPRESSION_TYPES_NOTIFICATION_PATTERN.toString() + " did not match notification: "
        + notification.getParameter());
  }

  final String databaseOperation = matcher.group(2);
  final Integer moduleId = Integer.parseInt(matcher.group(3));
  final BigInteger address = new BigInteger(matcher.group(4));
  final Integer position = Integer.parseInt(matcher.group(5));
  final Integer expressionId = Integer.parseInt(matcher.group(6));

  return new TypesNotificationContainer(databaseOperation, moduleId, Optional.<Integer>absent(),
      Optional.<Integer>absent(), Optional.of(address), Optional.of(position),
      Optional.of(expressionId));
}
 
开发者ID:google,项目名称:binnavi,代码行数:31,代码来源:PostgreSQLTypesNotificationParser.java

示例3: parseTypesNotification

import org.postgresql.PGNotification; //导入方法依赖的package包/类
/**
 * Parses type {@link PGNotification notifications} for synchronizing the state of
 * {@link TypeMember type members} between multiple instances of BinNavi.
 * 
 * @param notification The {@link PGNotification} from the database.
 * @return A {@link TypesNotificationContainer container} with the parsed information.
 */
private TypesNotificationContainer parseTypesNotification(final PGNotification notification) {

  final Matcher matcher = TYPES_NOTIFICATION_PATTERN.matcher(notification.getParameter());

  if (!matcher.find()) {
    throw new IllegalStateException("Error: compiled pattern: " + TYPES_NOTIFICATION_REGEX
        + " did not match notification: " + notification.getParameter());
  }

  final String databaseOperation = matcher.group(2);
  final Integer moduleId = Integer.parseInt(matcher.group(3));
  final Integer typeMemberId = Integer.parseInt(matcher.group(4));

  return new TypesNotificationContainer(databaseOperation, moduleId, Optional.<Integer>absent(),
      Optional.of(typeMemberId), Optional.<BigInteger>absent(), Optional.<Integer>absent(),
      Optional.<Integer>absent());

}
 
开发者ID:google,项目名称:binnavi,代码行数:26,代码来源:PostgreSQLTypesNotificationParser.java

示例4: parse

import org.postgresql.PGNotification; //导入方法依赖的package包/类
@Override
public Collection<TypesNotificationContainer> parse(
    final Collection<PGNotification> notifications, final SQLProvider provider) {

  Preconditions.checkNotNull(notifications, "Error: notifications argument can not be null");
  Preconditions.checkNotNull(provider, "Error: provider argument can not be null");

  final Collection<TypesNotificationContainer> containers = Lists.newArrayList();

  for (final PGNotification notification : notifications) {
    if (notification.getParameter().startsWith(CTableNames.EXPRESSION_TYPES_TABLE)) {
      containers.add(parseExpressionTypesNotification(notification));
    } else if (notification.getParameter().startsWith(CTableNames.TYPE_MEMBERS_TABLE)) {
      containers.add(parseTypesNotification(notification));
    } else if (notification.getParameter().startsWith(CTableNames.BASE_TYPES_TABLE)) {
      containers.add(parseBaseTypesNotification(notification));
    } else {
      throw new IllegalStateException("Error: Table name supplied in notification "
          + notification.getParameter()
          + " does not match tables where type notifications are expected on.");
    }
  }
  return containers;
}
 
开发者ID:google,项目名称:binnavi,代码行数:25,代码来源:PostgreSQLTypesNotificationParser.java

示例5: parseTypeInstanceNotification

import org.postgresql.PGNotification; //导入方法依赖的package包/类
/**
 * Parses type instance notifications. This function parses messages for synchronization of
 * changes in the {@link CTableNames bn_type_instances} table.
 * 
 * @param notification The {@link PGNotification} which carries the information to be parsed.
 * @return A {@link TypeInstancesNotificationContainer} with the parsed information.
 */
private TypeInstancesNotificationContainer parseTypeInstanceNotification(
    final PGNotification notification) {

  final Matcher matcher = typeInstanceNotificationPattern.matcher(notification.getParameter());
  if (!matcher.find()) {
    throw new IllegalStateException("Error: compiled pattern: "
        + typeInstanceNotificationPattern.toString() + " did not match notification: "
        + notification.getParameter());
  }

  final String databaseOperation = matcher.group(2);
  final Integer moduleId = Integer.parseInt(matcher.group(3));
  final Integer typeInstanceId = Integer.parseInt(matcher.group(4));

  return new TypeInstancesNotificationContainer(databaseOperation, moduleId, typeInstanceId,
      Optional.<BigInteger>absent(), Optional.<Integer>absent(), Optional.<Integer>absent());
}
 
开发者ID:google,项目名称:binnavi,代码行数:25,代码来源:PostgreSQLTypeInstancesNotificationParser.java

示例6: parseExpressionTypeInstanceNotification

import org.postgresql.PGNotification; //导入方法依赖的package包/类
/**
 * Parses expression type instances or simpler type substitutions on operands. This function
 * parses messages for synchronization of changes in the {@link CTableNames
 * bn_expression_type_instances} table.
 * 
 * @param notification The {@link PGNotification} which carries the information to be parsed.
 * @return A {@link TypeInstancesNotificationContainer} with the parsed information.
 */
private TypeInstancesNotificationContainer parseExpressionTypeInstanceNotification(
    final PGNotification notification) {

  final Matcher matcher =
      expressionTypeInstanceNotificationPattern.matcher(notification.getParameter());
  if (!matcher.find()) {
    throw new IllegalStateException("Error: compiled pattern: "
        + expressionTypeInstanceNotificationPattern.toString() + " did not match notification: "
        + notification.getParameter());
  }

  final String databaseOperation = matcher.group(2);
  final Integer moduleId = Integer.parseInt(matcher.group(3));
  final BigInteger address = new BigInteger(matcher.group(4));
  final Integer position = Integer.parseInt(matcher.group(5));
  final Integer expressionId = Integer.parseInt(matcher.group(6));
  final Integer typeInstanceId = Integer.parseInt(matcher.group(7));

  return new TypeInstancesNotificationContainer(databaseOperation, moduleId, typeInstanceId,
      Optional.of(address), Optional.of(position), Optional.of(expressionId));
}
 
开发者ID:google,项目名称:binnavi,代码行数:30,代码来源:PostgreSQLTypeInstancesNotificationParser.java

示例7: parse

import org.postgresql.PGNotification; //导入方法依赖的package包/类
@Override
public Collection<TypeInstancesNotificationContainer> parse(
    final Collection<PGNotification> notifications, final SQLProvider provider) {

  Preconditions.checkNotNull(notifications, "Error: notifications argument can not be null");
  Preconditions.checkNotNull(provider, "Error: provider argument can not be null");

  final Collection<TypeInstancesNotificationContainer> containers = Lists.newArrayList();

  for (final PGNotification notification : notifications) {
    if (notification.getParameter().startsWith(CTableNames.TYPE_INSTANCE_TABLE)) {
      containers.add(parseTypeInstanceNotification(notification));
    } else if (notification.getParameter()
        .startsWith(CTableNames.EXPRESSION_TYPE_INSTANCES_TABLE)) {
      containers.add(parseExpressionTypeInstanceNotification(notification));
    } else {
      throw new IllegalStateException("Error: Table name supplied in notification "
          + notification.getParameter()
          + " does not match tables where type instance notifications are accepted on.");
    }
  }
  return containers;
}
 
开发者ID:google,项目名称:binnavi,代码行数:24,代码来源:PostgreSQLTypeInstancesNotificationParser.java

示例8: parseFunctionNotification

import org.postgresql.PGNotification; //导入方法依赖的package包/类
private FunctionNotificationContainer parseFunctionNotification(final PGNotification notification,
    final SQLProvider provider) {

  final Pattern pattern = Pattern.compile(functionNotificationPattern);
  final Matcher matcher = pattern.matcher(notification.getParameter());
  if (!matcher.find()) {
    throw new IllegalStateException("IE02739: compiled pattern: " + pattern.toString()
        + " did not match notification: " + notification.getParameter());
  }

  final String databaseOperation = matcher.group(2);
  final Integer moduleId = Integer.parseInt(matcher.group(3));
  final IAddress functionAddress = new CAddress(new BigInteger(matcher.group(4)));
  final INaviModule module = provider.findModule(moduleId);
  return new FunctionNotificationContainer(moduleId, module, functionAddress, databaseOperation);
}
 
开发者ID:google,项目名称:binnavi,代码行数:17,代码来源:PostgreSQLFunctionNotificationParser.java

示例9: parse

import org.postgresql.PGNotification; //导入方法依赖的package包/类
@Override
public Collection<FunctionNotificationContainer> parse(
    final Collection<PGNotification> notifications, final SQLProvider provider) {

  Preconditions.checkNotNull(notifications, "IE02629: notifications argument can not be null");
  Preconditions.checkNotNull(provider, "IE02630: provider argument can not be null");

  final Collection<FunctionNotificationContainer> containers =
      new ArrayList<FunctionNotificationContainer>();

  for (final PGNotification notification : notifications) {
    if (notification.getParameter().startsWith(CTableNames.FUNCTIONS_TABLE)) {
      containers.add(parseFunctionNotification(notification, provider));
    } else {
      throw new IllegalStateException("IE02738: Table name supplied in notification: "
          + notification.getParameter()
          + " does not match tables where function notifications are accepted on.");
    }
  }
  return containers;
}
 
开发者ID:google,项目名称:binnavi,代码行数:22,代码来源:PostgreSQLFunctionNotificationParser.java

示例10: parseViewNotification

import org.postgresql.PGNotification; //导入方法依赖的package包/类
/**
 * Parser for a bn_views notification. The function uses the viewNotificationPattern to parse the
 * incoming {@link PGNotification} into a {@link ViewNotificationContainer}.
 *
 * @param notification The {@link PGNotification} to parse.
 * @param provider The {@link SQLProvider} to access the database.
 *
 * @return A {@link ViewNotificationContainer} with the parsed information.
 */
private ViewNotificationContainer parseViewNotification(
    final PGNotification notification, final SQLProvider provider) {

  final Matcher matcher = viewNotificationPattern.matcher(notification.getParameter());
  if (!matcher.find()) {
    throw new IllegalStateException("IE02742: compiled pattern: "
        + viewNotificationPattern.toString() + " did not match notification: "
        + notification.getParameter());
  }

  final Integer viewId = Integer.parseInt(matcher.group(3));
  final Optional<INaviView> view =
      Optional.fromNullable(ViewManager.get(provider).getView(viewId));
  final String databaseOperation = matcher.group(2);

  return new ViewNotificationContainer(viewId,
      view,
      Optional.<Integer>absent(),
      Optional.<INaviModule>absent(),
      Optional.<INaviProject>absent(),
      databaseOperation);
}
 
开发者ID:google,项目名称:binnavi,代码行数:32,代码来源:PostgreSQLViewNotificationParser.java

示例11: parseModuleViewNotification

import org.postgresql.PGNotification; //导入方法依赖的package包/类
/**
 * Parser for a bn_module_views notification. The function uses the moduleViewNotificationPattern
 * to parse the incoming {@link PGNotification} into a {@link ViewNotificationContainer}.
 *
 * @param notification The {@link PGNotification} to parse.
 * @param provider The {@link SQLProvider} to access the database.
 *
 * @return A {@link ViewNotificationContainer} with the parsed information.
 */
private ViewNotificationContainer parseModuleViewNotification(
    final PGNotification notification, final SQLProvider provider) {

  final Matcher matcher = moduleViewNotificationPattern.matcher(notification.getParameter());
  if (!matcher.find()) {
    throw new IllegalStateException("IE02743: compiled pattern: "
        + moduleViewNotificationPattern.toString() + " did not match notification: "
        + notification.getParameter());
  }

  final Integer viewId = Integer.parseInt(matcher.group(3));
  final Optional<INaviView> view =
      Optional.fromNullable(ViewManager.get(provider).getView(viewId));
  final Optional<Integer> moduleId = Optional.fromNullable(Integer.parseInt(matcher.group(4)));
  final Optional<INaviModule> module = Optional.fromNullable(provider.findModule(moduleId.get()));
  final String databaseOperation = matcher.group(2);

  return new ViewNotificationContainer(viewId,
      view,
      moduleId,
      module,
      Optional.<INaviProject>absent(),
      databaseOperation);
}
 
开发者ID:google,项目名称:binnavi,代码行数:34,代码来源:PostgreSQLViewNotificationParser.java

示例12: parseProjectViewNotification

import org.postgresql.PGNotification; //导入方法依赖的package包/类
/**
 * Parser for the bn_project_views notification. The function uses the
 * projectViewNotificationPattern to parse the incoming {@link PGNotification} into a
 * {@link ViewNotificationContainer}
 *
 * @param notification The {@link PGNotification} to parse.
 * @param provider The {@link SQLProvider} to access the database.
 */
private ViewNotificationContainer parseProjectViewNotification(
    final PGNotification notification, final SQLProvider provider) {

  final Matcher matcher = projectViewNotificationPattern.matcher(notification.getParameter());
  if (!matcher.find()) {
    throw new IllegalStateException("IE02744: compiled pattern: "
        + projectViewNotificationPattern.toString() + " did not match notification: "
        + notification.getParameter());
  }

  final Integer viewId = Integer.parseInt(matcher.group(3));
  final Optional<INaviView> view =
      Optional.fromNullable(ViewManager.get(provider).getView(viewId));
  final Optional<Integer> projectId = Optional.fromNullable(Integer.parseInt(matcher.group(4)));
  final Optional<INaviProject> project =
      Optional.fromNullable(provider.findProject(projectId.get()));
  final String databaseOperation = matcher.group(2);

  return new ViewNotificationContainer(viewId,
      view,
      projectId,
      Optional.<INaviModule>absent(),
      project,
      databaseOperation);
}
 
开发者ID:google,项目名称:binnavi,代码行数:34,代码来源:PostgreSQLViewNotificationParser.java

示例13: parse

import org.postgresql.PGNotification; //导入方法依赖的package包/类
/**
 * The parser function for view notifications. The function checks for the database table the
 * notification originated from and dispatches the parsing appropriately to the right function.
 *
 * @param notifications The {@link Collection} of {@link PGNotification} to parse.
 * @param provider The {@link SQLProvider} to access the database with.
 * @return A {@link Collection} of {@link ViewNotificationContainer}.
 */
@Override
public Collection<ViewNotificationContainer> parse(
    final Collection<PGNotification> notifications, final SQLProvider provider) {
  Preconditions.checkNotNull(notifications, "IE02745: notifications argument can not be null");
  Preconditions.checkNotNull(provider, "IE02746: provider argument can not be null");

  final Collection<ViewNotificationContainer> containers = Lists.newArrayList();

  for (final PGNotification notification : notifications) {
    if (notification.getParameter().startsWith(CTableNames.VIEWS_TABLE)) {
      containers.add(parseViewNotification(notification, provider));
    } else if (notification.getParameter().startsWith(CTableNames.MODULE_VIEWS_TABLE)) {
      containers.add(parseModuleViewNotification(notification, provider));
    } else if (notification.getParameter().startsWith(CTableNames.PROJECT_VIEWS_TABLE)) {
      containers.add(parseProjectViewNotification(notification, provider));
    } else {
      throw new IllegalStateException("IE02747: Table name supplied in notification: "
          + notification.getParameter()
          + " does not match tables where view notifications are accepted on.");
    }
  }
  return containers;
}
 
开发者ID:google,项目名称:binnavi,代码行数:32,代码来源:PostgreSQLViewNotificationParser.java

示例14: parseNotifications

import org.postgresql.PGNotification; //导入方法依赖的package包/类
@Override
public void parseNotifications(final List<PGNotification> notifications) {
    for (final PGNotification notification : notifications) {
        final String parameter = notification.getParameter();
        if (parameter != null && !parameter.isEmpty() && parameter.contains("|")) {
            final String[] split = parameter.split("\\|");
            final String user = split[1];
            final String questionId = split[0];
            final NotificationView notificationView = new NotificationView();
            notificationView.setQuestionId(Integer.valueOf(questionId));
            simpMessagingTemplate.convertAndSendToUser(user, "/topic/notifications", notificationView);
        }
    }
}
 
开发者ID:kTT,项目名称:adjule,代码行数:15,代码来源:NotificationsListener.java

示例15: processNotifications

import org.postgresql.PGNotification; //导入方法依赖的package包/类
@SuppressWarnings("MethodCanBeVariableArityMethod")
private void processNotifications(@Nullable final PGNotification[] notifications)
{
	if (notifications == null)
	{
		return;
	}
	for (final PGNotification notification : notifications)
	{
		final String notificationName = notification.getName(); // same as channel parameter
		final String notificationParameter = notification.getParameter();
		processNotificationUser.processNotification(notificationName, notificationParameter);
	}
}
 
开发者ID:health-and-care-developer-network,项目名称:health-and-care-developer-network,代码行数:15,代码来源:PostgresqlListenerRunnable.java


注:本文中的org.postgresql.PGNotification.getParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。