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


Java CommonUtils类代码示例

本文整理汇总了Java中com.ebay.jetstream.util.CommonUtils的典型用法代码示例。如果您正苦于以下问题:Java CommonUtils类的具体用法?Java CommonUtils怎么用?Java CommonUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getVisual

import com.ebay.jetstream.util.CommonUtils; //导入依赖的package包/类
@Hidden
public ByteBuffer getVisual() {
	try {
		String yumlData = "";
		DataFlows dFlow = (DataFlows) RootConfiguration.get("DataFlows");
		Map<String, Set<String>> graph = dFlow.getGraph();
		int edges = graph.size();
		for (Entry<String, Set<String>> edge : graph.entrySet()) {
			if (!CommonUtils.isEmpty(edge.getValue())) {
				for (String v : edge.getValue()) {
					yumlData += "(" + edge.getKey() + ")" + "->" + "(" + v
							+ ")";
					yumlData += ",";
				}
			} else {
				yumlData += "(" + edge.getKey() + ")";
				yumlData += ",";
			}
		}
		yumlData = yumlData.replaceAll(",$", "");
		return getAsByteArray(getYumlPic(yumlData));
	} catch (Throwable e) {
		logger.error(" Exception while construting pipeline data ", e);
		return null;
	}
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:27,代码来源:VisualDataFlow.java

示例2: getInstance

import com.ebay.jetstream.util.CommonUtils; //导入依赖的package包/类
@Hidden
public static JetstreamApplication getInstance() {
  if (s_application == null) {
    synchronized (s_applicationClass) {
      if (s_application == null) {
        try {
          s_applicationClass.newInstance();
        }
        catch (Exception e) {
          throw CommonUtils.runtimeException(e);
        }
      }
    }
  }
  return s_application;
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:17,代码来源:JetstreamApplication.java

示例3: startStandAlone

import com.ebay.jetstream.util.CommonUtils; //导入依赖的package包/类
public void startStandAlone() {
    try {

        WebAppContext context = new WebAppContext();
        String baseUrl = getBaseUrl();
        LOGGER.info("Config server baseUrl: " + baseUrl);
        context.setDescriptor(baseUrl + "/WEB-INF/web.xml");
        context.setResourceBase(baseUrl);
        context.setContextPath("/");
        context.setParentLoaderPriority(true);
        Server s_server = new Server(s_port);
        // Jetty8 can not set thread pool size.
        s_server.setHandler(context);

        LOGGER.info( "Config server started, listening on port " + s_port);
        s_server.start();
        running.set(true);

    } catch (Throwable t) {
        throw CommonUtils.runtimeException(t);
    }
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:23,代码来源:ConfigServer.java

示例4: process

import com.ebay.jetstream.util.CommonUtils; //导入依赖的package包/类
public Object process(Map<String, String[]> parameters) throws Exception {
	Object result = null;
	if (m_bean instanceof ControlBean) {
		result = ((ControlBean) m_bean).process(parameters);
	}
	else {
		for (Entry<String, String[]> entry : parameters.entrySet()) {
			String name = entry.getKey();
			String values[] = entry.getValue();
			if (values == null || values.length == 0 || CommonUtils.isEmptyTrimmed(values[0])) {
				executeAction(name);
			}
			else {
				setProperty(name, values);
			}
		}
	}
	return result;
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:20,代码来源:BeanController.java

示例5: setProperty

import com.ebay.jetstream.util.CommonUtils; //导入依赖的package包/类
protected void setProperty(String name, String values[]) throws Exception {
	PropertyDescriptor pd = new PropertyDescriptor(name, m_bean.getClass());
	Method setter = checkMethodForAnnotation(pd.getWriteMethod(), ManagedAttribute.class);
	Object value = null;
	if (values.length == 1) {
		value = CommonUtils.getObjectFromString(pd.getPropertyType(), values[0]);
	}
	else {
		IXmlDeserializer xs = XMLSerializationManager.getDeserializer(values[0]);
		if (xs == null)
			throw new IllegalArgumentException(values[0] + " is not a supported write format");
		Map<String, Object> deserialized = xs.deserialize(values[1]);
		// String setter = "set" + Character.toUpperCase(name.charAt(0)) + name.substring(1);
		value = deserialized.values().toArray()[0];
	}
	setter.invoke(m_bean, value);
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:18,代码来源:BeanController.java

示例6: onApplicationEvent

import com.ebay.jetstream.util.CommonUtils; //导入依赖的package包/类
public void onApplicationEvent(ApplicationEvent event) {
	if(!doNothing) {
		if (event instanceof ContextClosedEvent) {
			m_executorService.shutdown();

			try {
				m_executorService.awaitTermination(5, TimeUnit.SECONDS);
			} catch (InterruptedException e) {
				String error = CommonUtils.redirectPrintStackTraceToString(e);

				if (LOGGER.isErrorEnabled())
					LOGGER.error(
							"Waiting for shutdown, got InterruptedException: "
									+ error);
			}

		} else {
			BeanFactoryUpdater updater = new BeanFactoryUpdater();
			updater.setApplicationEvent(event);

			// Submit to the Executor Service to execute this task.
			m_executorService.submit(updater);

		}
	}
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:27,代码来源:MongoDbResource.java

示例7: getLdapContexts

import com.ebay.jetstream.util.CommonUtils; //导入依赖的package包/类
/**
 * Returns the ldap urls to get configuration information from. Currently only one ldap url is returned, and only if
 * the LDAPINFORMATION property or env var is populated.
 * 
 * @return the list of ldap urls
 */
public static List<String> getLdapContexts(ApplicationInformation ai) {
  List<String> ldap = new ArrayList<String>();
  String ldapInfo = ConfigUtils.getPropOrEnv("LDAPINFORMATION");
  if (ldapInfo != null) {
    int indexOfAt = ldapInfo.indexOf('@');
    if (indexOfAt != -1 && ai.containsKey("ldapHostPort") && ldapInfo.charAt(indexOfAt + 1) == '/') {
      ldapInfo = ldapInfo.substring(0, indexOfAt + 1) + ai.get("ldapHostPort") + ldapInfo.substring(indexOfAt + 1);
    }
    else if (indexOfAt != -1 && !ai.containsKey("ldapHostPort") && ldapInfo.charAt(indexOfAt + 1) == '/') {
      throw new RuntimeException("Ldap host/port not set");
    }
    if (!ldapInfo.contains("application=") && ai.containsKey("applicationName"))
      ldapInfo = addToUrlEnd(ldapInfo, "application=" + ai.get("applicationName"));
    if (!ldapInfo.contains("version=") && ai.containsKey("configVersion"))
      ldapInfo = addToUrlEnd(ldapInfo, "version=" + ai.get("configVersion"));
    if (!ldapInfo.contains("scope="))
      ldapInfo = addToUrlEnd(ldapInfo, "scope=" + ai.get("scope"));
  }
  if (!CommonUtils.isEmptyTrimmed(ldapInfo))
    ldap.add(ldapInfo);
  return ldap;
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:29,代码来源:Configuration.java

示例8: startStandAlone

import com.ebay.jetstream.util.CommonUtils; //导入依赖的package包/类
public void startStandAlone() {
    try {
        WebAppContext context = new WebAppContext();
        String baseUrl = getBaseUrl();
        LOGGER.info("Metric server baseUrl: " + baseUrl);
        context.setDescriptor(baseUrl + "/WEB-INF/web.xml");
        context.setResourceBase(baseUrl);
        context.setContextPath("/");
        context.setParentLoaderPriority(true);
        context.setAttribute("JetStreamRoot", applicationContext);
        Server s_server = new Server(s_port);
        s_server.setHandler(context);

        LOGGER.info( "Metric server started, listening on port " + s_port);
        s_server.start();
        running.set(true);
    } catch (Throwable t) {
        throw CommonUtils.runtimeException(t);
    }
}
 
开发者ID:pulsarIO,项目名称:realtime-analytics,代码行数:21,代码来源:MetricServer.java

示例9: getApplicationName

import com.ebay.jetstream.util.CommonUtils; //导入依赖的package包/类
@Override
public String getApplicationName() {
  String result = super.getApplicationName();
  if (CommonUtils.isEmptyTrimmed(result)) {
    setApplicationName(result = m_jetstreamApplication.getClass().getSimpleName());
  }
  return result;
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:9,代码来源:JetstreamApplicationInformation.java

示例10: getDnsMap

import com.ebay.jetstream.util.CommonUtils; //导入依赖的package包/类
protected DNSMap getDnsMap() throws ConfigException {
  if (m_dnsMap == null) {
    String zone = getZone();
    if (CommonUtils.isEmptyTrimmed(zone))
      m_dnsMap = new DNSJNDIMap(); 
    else {
      m_dnsMap = new DNSFileMap(); 
      ((DNSFileMap) m_dnsMap).setSource(zone);
    }
  }
  return m_dnsMap;
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:13,代码来源:JetstreamApplicationInformation.java

示例11: run

import com.ebay.jetstream.util.CommonUtils; //导入依赖的package包/类
@Override
public void run() {
  try {
    getInstance().shutdown();
  }
  catch (Throwable t) {
    throw CommonUtils.runtimeException(t);
  }
  System.out.println("Gracefully shutdown"); //KEEPME
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:11,代码来源:JetstreamApplication.java

示例12: subscribe

import com.ebay.jetstream.util.CommonUtils; //导入依赖的package包/类
void subscribe() {
    MessageService ms = MessageService.getInstance();

    if (ms.isInitialized()) {
        try {
            ms.subscribe(new JetstreamTopic(m_replayNotificationTopic), this);

            m_watchDog = Executors.newScheduledThreadPool(1);
            m_watchDog.scheduleWithFixedDelay(new Runnable() {

                @Override
                public void run() {
                    try {
                        checkStateMap();
                    } catch (Exception ex) {
                        LOGGER.error( "Fail to run watch dog task.", ex);
                    }
                }
                
            }, 1, 1, TimeUnit.MINUTES);
            if (LOGGER.isInfoEnabled()) {
                LOGGER.info( "Subscribed for Mongo Config Change Information using Message Service");
            }

        } catch (Exception e) {
            throw CommonUtils.runtimeException(e);
        }
    } else {
        LOGGER.error( "Message Service not initialized - unable to register listener");
    }
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:32,代码来源:RemoteController.java

示例13: stopApplication

import com.ebay.jetstream.util.CommonUtils; //导入依赖的package包/类
@ManagedOperation
public void stopApplication() {
    try {
        getInstance().shutdown();
    } catch (Throwable t) {
        throw CommonUtils.runtimeException(t);
    }
    System.out.println("Gracefully stop the application");
    try {
        Thread.sleep(1000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    System.exit(0);
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:16,代码来源:ConfigurationManagementApp.java

示例14: afterPropertiesSet

import com.ebay.jetstream.util.CommonUtils; //导入依赖的package包/类
public void afterPropertiesSet() throws Exception {
  if (CommonUtils.isEmptyTrimmed(getKeyStorePassword()) && CommonUtils.isEmptyTrimmed(getKeyStorePath()))
    throw new Exception("Keystore Path/Password required for hosting a SSL port !!!");

  LOGGER.warn( "Keystore Path And Password Not Empty/Nul. Keystore Path: " + getKeyStorePath());
      
  if (CommonUtils.isEmptyTrimmed(getTrustStorePath()))
    setTrustStorePath(getKeyStorePath());

  if (CommonUtils.isEmptyTrimmed(getTrustStorePassword()))
    setTrustStorePassword(getKeyStorePassword());
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:13,代码来源:SSLServerHost.java

示例15: formatOperation

import com.ebay.jetstream.util.CommonUtils; //导入依赖的package包/类
@Override
protected void formatOperation(Method method) throws IOException {
  PrintWriter pw = getWriter();
  pw.print(method.getName());
  String help = method.getAnnotation(ManagedOperation.class).description();
  if (!CommonUtils.isEmptyTrimmed(help)) {
    pw.print(":  " + help);
  }
  pw.println();
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:11,代码来源:HelpFormatter.java


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