001/** 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019package org.apache.oozie.client.rest; 020 021import java.util.Properties; 022 023import org.apache.oozie.client.JMSConnectionInfoWrapper; 024import org.apache.oozie.client.rest.JsonTags; 025import org.json.simple.JSONObject; 026import org.json.simple.JSONValue; 027/** 028 * JMS connection info bean representing the JMS related information for a job 029 * 030 */ 031public class JMSConnectionInfoBean implements JsonBean, JMSConnectionInfoWrapper { 032 033 private Properties JNDIProperties; 034 private String topicPrefix; 035 private Properties topicProperties; 036 037 038 @Override 039 public JSONObject toJSONObject() { 040 return toJSONObject("GMT"); 041 } 042 043 /** 044 * Set the JNDI properties for jms connection 045 * @param JNDIProperties 046 */ 047 public void setJNDIProperties(Properties JNDIProperties) { 048 this.JNDIProperties = JNDIProperties; 049 } 050 051 public Properties getJNDIProperties() { 052 return JNDIProperties; 053 } 054 055 @SuppressWarnings("unchecked") 056 @Override 057 public JSONObject toJSONObject(String timeZoneId) { 058 JSONObject json = new JSONObject(); 059 json.put(JsonTags.JMS_JNDI_PROPERTIES, JSONValue.toJSONString(JNDIProperties)); 060 json.put(JsonTags.JMS_TOPIC_PATTERN, JSONValue.toJSONString(topicProperties)); 061 json.put(JsonTags.JMS_TOPIC_PREFIX, topicPrefix); 062 return json; 063 } 064 065 @Override 066 public String getTopicPrefix() { 067 return topicPrefix; 068 } 069 070 /** 071 * Sets the topic prefix 072 * @param topicPrefix 073 */ 074 public void setTopicPrefix(String topicPrefix) { 075 this.topicPrefix = topicPrefix; 076 } 077 078 /** 079 * Set the topic pattern properties 080 * @param topicProperties 081 */ 082 public void setTopicPatternProperties(Properties topicProperties) { 083 this.topicProperties = topicProperties; 084 } 085 086 @Override 087 public Properties getTopicPatternProperties() { 088 return topicProperties; 089 } 090 091}