001: /*
002: * BEGIN_HEADER - DO NOT EDIT
003: *
004: * The contents of this file are subject to the terms
005: * of the Common Development and Distribution License
006: * (the "License"). You may not use this file except
007: * in compliance with the License.
008: *
009: * You can obtain a copy of the license at
010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011: * See the License for the specific language governing
012: * permissions and limitations under the License.
013: *
014: * When distributing Covered Code, include this CDDL
015: * HEADER in each file and include the License file at
016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017: * If applicable add the following below this CDDL HEADER,
018: * with the fields enclosed by brackets "[]" replaced with
019: * your own identifying information: Portions Copyright
020: * [year] [name of copyright owner]
021: */
022:
023: /*
024: * @(#)FileBindingContext.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package com.sun.jbi.binding.file;
030:
031: import javax.jbi.component.ComponentContext;
032: import javax.jbi.messaging.DeliveryChannel;
033: import java.util.logging.Logger;
034:
035: /**
036: * Context object to store sequencing engine specific informaiton.
037: *
038: * @author Sun Microsystems, Inc.
039: */
040: public final class FileBindingContext {
041: /**
042: * This object
043: */
044: private static FileBindingContext sFileContext;
045:
046: /**
047: * ENgine context
048: */
049: private ComponentContext mContext;
050:
051: /**
052: * Logger object.
053: */
054: private Logger mLogger;
055:
056: /**
057: * DD schema.
058: */
059: private String mDDSchema;
060:
061: /**
062: * Creates a new FileBindingContext object.
063: */
064: private FileBindingContext() {
065: }
066:
067: /**
068: * Gets the engine channel.
069: *
070: * @return engine channel
071: */
072: public DeliveryChannel getChannel() {
073: DeliveryChannel chnl = null;
074:
075: if (mContext != null) {
076: try {
077: chnl = mContext.getDeliveryChannel();
078: } catch (Exception e) {
079: e.printStackTrace();
080: }
081: }
082:
083: return chnl;
084: }
085:
086: /**
087: * Sets the engine context.
088: *
089: * @param ctx engine context.
090: */
091: public void setContext(ComponentContext ctx) {
092: mContext = ctx;
093: }
094:
095: /**
096: * Returns the context.
097: *
098: * @return engine context
099: */
100: public ComponentContext getContext() {
101: return mContext;
102: }
103:
104: /**
105: * Sets the logger.
106: *
107: * @param logger Logger.
108: */
109: public void setLogger(Logger logger) {
110: mLogger = logger;
111: }
112:
113: /**
114: * Returns the logger.
115: *
116: * @return engine context
117: */
118: public Logger getLogger() {
119: if (mLogger == null) {
120: mLogger = Logger.getLogger("com.sun.jbi.binding.file");
121: }
122: return mLogger;
123: }
124:
125: /**
126: * Used to grab a reference of this object.
127: *
128: * @return an initialized FileBindingContext reference
129: */
130: public static synchronized FileBindingContext getInstance() {
131: if (sFileContext == null) {
132: sFileContext = new FileBindingContext();
133: }
134:
135: return sFileContext;
136: }
137:
138: /**
139: * Gets the deployment descriptor schema file path.
140: *
141: * @return Full path of the DD schema file.
142: */
143: public String getDDSchema() {
144: return mDDSchema;
145: }
146:
147: /**
148: * Sets the deployment descriptor schema file path.
149: *
150: * @ return full path of the DD schema.
151: */
152: public void setDDSchema(String sch) {
153: mDDSchema = sch;
154: }
155: }
|