/// <summary> /// Compares this abbreviation to a full object id. /// </summary> /// <param name="other">the other object id.</param> /// <returns> /// Return <0 if this abbreviation names an object that is less than /// <code>other</code>; 0 if this abbreviation exactly matches the /// first <see cref="Length"/> digits of <code>other.name()</code>; /// >0 if this abbreviation names an object that is after /// <code>other</code>. /// </returns> public int prefixCompare(AnyObjectId other) { int cmp = NB.CompareUInt32(_w1, mask(1, other.W1)); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(_w2, mask(2, other.W2)); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(_w3, mask(3, other.W3)); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(_w4, mask(4, other.W4)); if (cmp != 0) { return(cmp); } return(NB.CompareUInt32(_w5, mask(5, other.W5))); }
/// <summary>Compares this abbreviation to a full object id.</summary> /// <remarks>Compares this abbreviation to a full object id.</remarks> /// <param name="other">the other object id.</param> /// <returns> /// <0 if this abbreviation names an object that is less than /// <code>other</code>; 0 if this abbreviation exactly matches the /// first /// <see cref="Length()">Length()</see> /// digits of <code>other.name()</code>; /// >0 if this abbreviation names an object that is after /// <code>other</code>. /// </returns> public int PrefixCompare(AnyObjectId other) { int cmp; cmp = NB.CompareUInt32(w1, Mask(1, other.w1)); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(w2, Mask(2, other.w2)); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(w3, Mask(3, other.w3)); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(w4, Mask(4, other.w4)); if (cmp != 0) { return(cmp); } return(NB.CompareUInt32(w5, Mask(5, other.w5))); }
private void WriteHeader() { Array.Copy(Constants.PACK_SIGNATURE, 0, _buf, 0, 4); NB.encodeInt32(_buf, 4, PackVersionGenerated); NB.encodeInt32(_buf, 8, getObjectsNumber()); _pos.Write(_buf, 0, 12); }
/// <summary>Compare this ObjectId to a network-byte-order ObjectId.</summary> /// <remarks>Compare this ObjectId to a network-byte-order ObjectId.</remarks> /// <param name="bs">array containing the other ObjectId in network byte order.</param> /// <param name="p"> /// position within /// <code>bs</code> /// to start the compare at. At least 5 /// integers, starting at this position are required. /// </param> /// <returns> /// a negative integer, zero, or a positive integer as this object is /// less than, equal to, or greater than the specified object. /// </returns> public int CompareTo(int[] bs, int p) { int cmp; cmp = NB.CompareUInt32(w1, bs[p]); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(w2, bs[p + 1]); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(w3, bs[p + 2]); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(w4, bs[p + 3]); if (cmp != 0) { return(cmp); } return(NB.CompareUInt32(w5, bs[p + 4])); }
/// <summary>Compare this abbreviation to a network-byte-order ObjectId.</summary> /// <remarks>Compare this abbreviation to a network-byte-order ObjectId.</remarks> /// <param name="bs">array containing the other ObjectId in network byte order.</param> /// <param name="p"> /// position within /// <code>bs</code> /// to start the compare at. At least /// 20 bytes, starting at this position are required. /// </param> /// <returns> /// <0 if this abbreviation names an object that is less than /// <code>other</code>; 0 if this abbreviation exactly matches the /// first /// <see cref="Length()">Length()</see> /// digits of <code>other.name()</code>; /// >0 if this abbreviation names an object that is after /// <code>other</code>. /// </returns> public int PrefixCompare(byte[] bs, int p) { int cmp; cmp = NB.CompareUInt32(w1, Mask(1, NB.DecodeInt32(bs, p))); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(w2, Mask(2, NB.DecodeInt32(bs, p + 4))); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(w3, Mask(3, NB.DecodeInt32(bs, p + 8))); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(w4, Mask(4, NB.DecodeInt32(bs, p + 12))); if (cmp != 0) { return(cmp); } return(NB.CompareUInt32(w5, Mask(5, NB.DecodeInt32(bs, p + 16)))); }
/// <summary>Create an empty entry at the specified stage.</summary> /// <remarks>Create an empty entry at the specified stage.</remarks> /// <param name="newPath">name of the cache entry, in the standard encoding.</param> /// <param name="stage">the stage index of the new entry.</param> /// <exception cref="System.ArgumentException"> /// If the path starts or ends with "/", or contains "//" either /// "\0". These sequences are not permitted in a git tree object /// or DirCache file. Or if /// <code>stage</code> /// is outside of the /// range 0..3, inclusive. /// </exception> public DirCacheEntry(byte[] newPath, int stage) { if (!IsValidPath(newPath)) { throw new InvalidPathException(ToString(newPath)); } if (stage < 0 || 3 < stage) { throw new ArgumentException(MessageFormat.Format(JGitText.Get().invalidStageForPath , stage, ToString(newPath))); } info = new byte[INFO_LEN]; infoOffset = 0; path = newPath; int flags = ((stage & unchecked ((int)(0x3))) << 12); if (path.Length < NAME_MASK) { flags |= path.Length; } else { flags |= NAME_MASK; } NB.EncodeInt16(info, infoOffset + P_FLAGS, flags); }
private void EncodeTS(int pIdx, long when) { int @base = infoOffset + pIdx; NB.EncodeInt32(info, @base, (int)(when / 1000)); NB.EncodeInt32(info, @base + 4, ((int)(when % 1000)) * 1000000); }
/// <summary> /// Open an existing pack <code>.idx</code> file for reading.. /// <para/> /// The format of the file will be automatically detected and a proper access /// implementation for that format will be constructed and returned to the /// caller. The file may or may not be held open by the returned instance. /// </summary> /// <param name="idxFile">existing pack .idx to read.</param> /// <returns></returns> public static PackIndex Open(FileInfo idxFile) { try { using (FileStream fs = idxFile.OpenRead()) { byte[] hdr = new byte[8]; IO.ReadFully(fs, hdr, 0, hdr.Length); if (IsTOC(hdr)) { int v = NB.DecodeInt32(hdr, 4); switch (v) { case 2: return(new PackIndexV2(fs)); default: throw new IOException("Unsupported pack index version " + v); } } return(new PackIndexV1(fs, hdr)); } } catch (IOException) { throw new IOException("Unable to read pack index: " + idxFile.FullName); } }
/// <summary> /// /// </summary> /// <param name="pIdx"></param> /// <param name="when"> /// New cached modification date of the file, in milliseconds. /// </param> private void EncodeTimestamp(int pIdx, long when) { int @base = _infoOffset + pIdx; NB.encodeInt32(_info, @base, (int)(when / 1000)); NB.encodeInt32(_info, @base + 4, ((int)(when % 1000)) * 1000000); }
/// <summary> /// Compares this abbreviation to a full object id. /// </summary> /// <param name="other">the other object id.</param> /// <returns> /// Return <0 if this abbreviation names an object that is less than /// <code>other</code>; 0 if this abbreviation exactly matches the /// first <see cref="Length"/> digits of <code>other.name()</code>; /// >0 if this abbreviation names an object that is after /// <code>other</code>. /// </returns> public int prefixCompare(AnyObjectId other) { if (other == null) { throw new ArgumentNullException("other"); } int cmp = NB.CompareUInt32(_w1, mask(1, other.W1)); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(_w2, mask(2, other.W2)); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(_w3, mask(3, other.W3)); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(_w4, mask(4, other.W4)); if (cmp != 0) { return(cmp); } return(NB.CompareUInt32(_w5, mask(5, other.W5))); }
/// <exception cref="NGit.Errors.CorruptObjectException"></exception> /// <exception cref="System.IO.IOException"></exception> internal PackIndexV1(InputStream fd, byte[] hdr) { byte[] fanoutTable = new byte[IDX_HDR_LEN]; System.Array.Copy(hdr, 0, fanoutTable, 0, hdr.Length); IOUtil.ReadFully(fd, fanoutTable, hdr.Length, IDX_HDR_LEN - hdr.Length); idxHeader = new long[256]; // really unsigned 32-bit... for (int k = 0; k < idxHeader.Length; k++) { idxHeader[k] = NB.DecodeUInt32(fanoutTable, k * 4); } idxdata = new byte[idxHeader.Length][]; for (int k_1 = 0; k_1 < idxHeader.Length; k_1++) { int n; if (k_1 == 0) { n = (int)(idxHeader[k_1]); } else { n = (int)(idxHeader[k_1] - idxHeader[k_1 - 1]); } if (n > 0) { idxdata[k_1] = new byte[n * (Constants.OBJECT_ID_LENGTH + 4)]; IOUtil.ReadFully(fd, idxdata[k_1], 0, idxdata[k_1].Length); } } objectCnt = idxHeader[255]; packChecksum = new byte[20]; IOUtil.ReadFully(fd, packChecksum, 0, packChecksum.Length); }
public void testDecodeUInt64() { Assert.AreEqual(0L, NB.DecodeUInt64(b(0, 0, 0, 0, 0, 0, 0, 0), 0)); Assert.AreEqual(0L, NB.DecodeUInt64(Padb(3, 0, 0, 0, 0, 0, 0, 0, 0), 3)); Assert.AreEqual(3L, NB.DecodeUInt64(b(0, 0, 0, 0, 0, 0, 0, 3), 0)); Assert.AreEqual(3L, NB.DecodeUInt64(Padb(3, 0, 0, 0, 0, 0, 0, 0, 3), 3)); Assert.AreEqual(0xdeadbeefL, NB.DecodeUInt64(b(0, 0, 0, 0, 0xde, 0xad, 0xbe, 0xef), 0)); Assert.AreEqual(0xdeadbeefL, NB.DecodeUInt64(Padb(3, 0, 0, 0, 0, 0xde, 0xad, 0xbe, 0xef), 3)); Assert.AreEqual(0x0310adefL, NB.DecodeUInt64(b(0, 0, 0, 0, 0x03, 0x10, 0xad, 0xef), 0)); Assert.AreEqual(0x0310adefL, NB.DecodeUInt64(Padb(3, 0, 0, 0, 0, 0x03, 0x10, 0xad, 0xef), 3)); unchecked { Assert.AreEqual((long)0xc0ffee78deadbeefL, NB.DecodeUInt64(b(0xc0, 0xff, 0xee, 0x78, 0xde, 0xad, 0xbe, 0xef), 0)); Assert.AreEqual((long)0xc0ffee78deadbeefL, NB.DecodeUInt64(Padb(3, 0xc0, 0xff, 0xee, 0x78, 0xde, 0xad, 0xbe, 0xef), 3)); Assert.AreEqual(0x00000000ffffffffL, NB.DecodeUInt64(b(0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff), 0)); Assert.AreEqual(0x00000000ffffffffL, NB.DecodeUInt64(Padb(3, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff), 3)); Assert.AreEqual((long)0xffffffffffffffffL, NB.DecodeUInt64(b(0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff), 0)); Assert.AreEqual((long)0xffffffffffffffffL, NB.DecodeUInt64(Padb(3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff), 3)); } }
public void testEncodeInt16() { var @out = new byte[16]; PrepareOutput(@out); NB.encodeInt16(@out, 0, 0); AssertOutput(b(0, 0), @out, 0); PrepareOutput(@out); NB.encodeInt16(@out, 3, 0); AssertOutput(b(0, 0), @out, 3); PrepareOutput(@out); NB.encodeInt16(@out, 0, 3); AssertOutput(b(0, 3), @out, 0); PrepareOutput(@out); NB.encodeInt16(@out, 3, 3); AssertOutput(b(0, 3), @out, 3); PrepareOutput(@out); NB.encodeInt16(@out, 0, 0xdeac); AssertOutput(b(0xde, 0xac), @out, 0); PrepareOutput(@out); NB.encodeInt16(@out, 3, 0xdeac); AssertOutput(b(0xde, 0xac), @out, 3); PrepareOutput(@out); NB.encodeInt16(@out, 3, -1); AssertOutput(b(0xff, 0xff), @out, 3); }
/// <summary>Compare this abbreviation to a network-byte-order ObjectId.</summary> /// <remarks>Compare this abbreviation to a network-byte-order ObjectId.</remarks> /// <param name="bs">array containing the other ObjectId in network byte order.</param> /// <param name="p"> /// position within /// <code>bs</code> /// to start the compare at. At least 5 /// ints, starting at this position are required. /// </param> /// <returns> /// <0 if this abbreviation names an object that is less than /// <code>other</code>; 0 if this abbreviation exactly matches the /// first /// <see cref="Length()">Length()</see> /// digits of <code>other.name()</code>; /// >0 if this abbreviation names an object that is after /// <code>other</code>. /// </returns> public int PrefixCompare(int[] bs, int p) { int cmp; cmp = NB.CompareUInt32(w1, Mask(1, bs[p])); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(w2, Mask(2, bs[p + 1])); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(w3, Mask(3, bs[p + 2])); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(w4, Mask(4, bs[p + 3])); if (cmp != 0) { return(cmp); } return(NB.CompareUInt32(w5, Mask(5, bs[p + 4]))); }
public void testWrite_Large() { const int buflen = SideBandOutputStream.MAX_BUF - SideBandOutputStream.HDR_SIZE; byte[] buf = new byte[buflen]; for (int i = 0; i < buf.Length; i++) { buf[i] = (byte)i; } SideBandOutputStream o; o = new SideBandOutputStream(SideBandOutputStream.CH_DATA, SideBandOutputStream.MAX_BUF, rawOut); o.Write(buf, 0, buf.Length); o.Flush(); byte[] act = rawOut.ToArray(); string explen = NB.DecimalToBase(buf.Length + SideBandOutputStream.HDR_SIZE, 16); Assert.AreEqual(SideBandOutputStream.HDR_SIZE + buf.Length, act.Length); Assert.AreEqual(Charset.forName("UTF-8").GetString(act, 0, 4), explen); Assert.AreEqual(1, act[4]); for (int i = 0, j = SideBandOutputStream.HDR_SIZE; i < buf.Length; i++, j++) { Assert.AreEqual(buf[i], act[j]); } }
/// <exception cref="System.IO.IOException"></exception> private void OnOpenPack() { PackIndex idx = Idx(); byte[] buf = new byte[20]; fd.Seek(0); fd.ReadFully(buf, 0, 12); if (RawParseUtils.Match(buf, 0, Constants.PACK_SIGNATURE) != 4) { throw new IOException(JGitText.Get().notAPACKFile); } long vers = NB.DecodeUInt32(buf, 4); long packCnt = NB.DecodeUInt32(buf, 8); if (vers != 2 && vers != 3) { throw new IOException(MessageFormat.Format(JGitText.Get().unsupportedPackVersion, Sharpen.Extensions.ValueOf(vers))); } if (packCnt != idx.GetObjectCount()) { throw new PackMismatchException(MessageFormat.Format(JGitText.Get().packObjectCountMismatch , Sharpen.Extensions.ValueOf(packCnt), Sharpen.Extensions.ValueOf(idx.GetObjectCount ()), GetPackFile())); } fd.Seek(length - 20); fd.ReadFully(buf, 0, 20); if (!Arrays.Equals(buf, packChecksum)) { throw new PackMismatchException(MessageFormat.Format(JGitText.Get().packObjectCountMismatch , ObjectId.FromRaw(buf).Name, ObjectId.FromRaw(idx.packChecksum).Name, GetPackFile ())); } }
/// <exception cref="System.IO.IOException"></exception> internal void WriteFileHeader(int version, long objectCount) { System.Array.Copy(Constants.PACK_SIGNATURE, 0, headerBuffer, 0, 4); NB.EncodeInt32(headerBuffer, 4, version); NB.EncodeInt32(headerBuffer, 8, (int)objectCount); Write(headerBuffer, 0, 12); }
/// <summary> /// Compare this ObjectId to another and obtain a sort ordering. /// </summary> /// <param name="other">the other id to compare to. Must not be null.</param> /// <returns> /// < 0 if this id comes before other; 0 if this id is equal to /// other; > 0 if this id comes after other. /// </returns> public int CompareTo(ObjectId other) { if (this == other) { return(0); } int cmp = NB.CompareUInt32(W1, other.W1); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(W2, other.W2); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(W3, other.W3); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(W4, other.W4); if (cmp != 0) { return(cmp); } return(NB.CompareUInt32(W5, other.W5)); }
/// <summary> /// Create an empty entry at the specified stage. /// </summary> /// <param name="newPath"> /// Name of the cache entry, in the standard encoding. /// </param> /// <param name="stage">The stage index of the new entry.</param> public DirCacheEntry(byte[] newPath, int stage) { if (!isValidPath(newPath)) { throw new ArgumentException("Invalid path: " + toString(newPath)); } if (stage < 0 || 3 < stage) { throw new ArgumentException("Invalid stage " + stage + " for path " + toString(newPath)); } _info = new byte[INFO_LEN]; _infoOffset = 0; _path = newPath; int flags = ((stage & 0x3) << 12); if (_path.Length < NameMask) { flags |= _path.Length; } else { flags |= NameMask; } NB.encodeInt16(_info, _infoOffset + PFlags, flags); }
/// <summary>Compare this ObjectId to a network-byte-order ObjectId.</summary> /// <remarks>Compare this ObjectId to a network-byte-order ObjectId.</remarks> /// <param name="bs">array containing the other ObjectId in network byte order.</param> /// <param name="p"> /// position within /// <code>bs</code> /// to start the compare at. At least /// 20 bytes, starting at this position are required. /// </param> /// <returns> /// a negative integer, zero, or a positive integer as this object is /// less than, equal to, or greater than the specified object. /// </returns> public int CompareTo(byte[] bs, int p) { int cmp; cmp = NB.CompareUInt32(w1, NB.DecodeInt32(bs, p)); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(w2, NB.DecodeInt32(bs, p + 4)); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(w3, NB.DecodeInt32(bs, p + 8)); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(w4, NB.DecodeInt32(bs, p + 12)); if (cmp != 0) { return(cmp); } return(NB.CompareUInt32(w5, NB.DecodeInt32(bs, p + 16))); }
/// <summary>Compare this ObjectId to another and obtain a sort ordering.</summary> /// <remarks>Compare this ObjectId to another and obtain a sort ordering.</remarks> /// <param name="other">the other id to compare to. Must not be null.</param> /// <returns> /// < 0 if this id comes before other; 0 if this id is equal to /// other; > 0 if this id comes after other. /// </returns> public int CompareTo(AnyObjectId other) { if (this == other) { return(0); } int cmp; cmp = NB.CompareUInt32(w1, other.w1); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(w2, other.w2); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(w3, other.w3); if (cmp != 0) { return(cmp); } cmp = NB.CompareUInt32(w4, other.w4); if (cmp != 0) { return(cmp); } return(NB.CompareUInt32(w5, other.w5)); }
private void WriteCRCs() { foreach (PackedObjectInfo oe in entries) { NB.encodeInt32(tmp, 0, oe.CRC); _stream.BaseStream.Write(tmp, 0, 4); } }
private long DecodeTimestamp(int pIdx) { int @base = _infoOffset + pIdx; int sec = NB.DecodeInt32(_info, @base); int ms = NB.DecodeInt32(_info, @base + 4) / 1000000; return(1000L * sec + ms); }
/// <summary> /// Copy this ObjectId to a byte array. /// </summary> /// <param name="buf">the buffer to copy to.</param> /// <param name="off">the offset within b to write at.</param> public void copyRawTo(byte[] buf, int off) { NB.encodeInt32(buf, 0 + off, W1); NB.encodeInt32(buf, 4 + off, W2); NB.encodeInt32(buf, 8 + off, W3); NB.encodeInt32(buf, 12 + off, W4); NB.encodeInt32(buf, 16 + off, W5); }
public void FromRaw(byte[] bs, int p) { W1 = NB.DecodeInt32(bs, p); W2 = NB.DecodeInt32(bs, p + 4); W3 = NB.DecodeInt32(bs, p + 8); W4 = NB.DecodeInt32(bs, p + 12); W5 = NB.DecodeInt32(bs, p + 16); }
/// <summary>Copy this ObjectId to a byte array.</summary> /// <remarks>Copy this ObjectId to a byte array.</remarks> /// <param name="b">the buffer to copy to.</param> /// <param name="o">the offset within b to write at.</param> public virtual void CopyRawTo(byte[] b, int o) { NB.EncodeInt32(b, o, w1); NB.EncodeInt32(b, o + 4, w2); NB.EncodeInt32(b, o + 8, w3); NB.EncodeInt32(b, o + 12, w4); NB.EncodeInt32(b, o + 16, w5); }
/// <exception cref="System.IO.IOException"></exception> private void WriteCRCs() { foreach (PackedObjectInfo oe in entries) { NB.EncodeInt32(tmp, 0, oe.GetCRC()); @out.Write(tmp, 0, 4); } }
/// <summary>Copy the ObjectId and other meta fields from an existing entry.</summary> /// <remarks> /// Copy the ObjectId and other meta fields from an existing entry. /// <p> /// This method copies everything except the path from one entry to another, /// supporting renaming. /// </remarks> /// <param name="src">the entry to copy ObjectId and meta fields from.</param> public virtual void CopyMetaData(NGit.Dircache.DirCacheEntry src) { int pLen = NB.DecodeUInt16(info, infoOffset + P_FLAGS) & NAME_MASK; System.Array.Copy(src.info, src.infoOffset, info, infoOffset, INFO_LEN); NB.EncodeInt16(info, infoOffset + P_FLAGS, pLen | NB.DecodeUInt16(info, infoOffset + P_FLAGS) & ~NAME_MASK); }
/// <exception cref="System.IO.IOException"></exception> private void PackHeader(TemporaryBuffer.Heap tinyPack, int cnt) { byte[] hdr = new byte[8]; NB.EncodeInt32(hdr, 0, 2); NB.EncodeInt32(hdr, 4, cnt); tinyPack.Write(Constants.PACK_SIGNATURE); tinyPack.Write(hdr, 0, 8); }
/// <summary>Convert an ObjectId from raw binary representation.</summary> /// <remarks>Convert an ObjectId from raw binary representation.</remarks> /// <param name="bs"> /// the raw byte buffer to read from. At least 20 bytes after p /// must be available within this byte array. /// </param> /// <param name="p">position to read the first byte of data from.</param> public virtual void FromRaw(byte[] bs, int p) { w1 = NB.DecodeInt32(bs, p); w2 = NB.DecodeInt32(bs, p + 4); w3 = NB.DecodeInt32(bs, p + 8); w4 = NB.DecodeInt32(bs, p + 12); w5 = NB.DecodeInt32(bs, p + 16); }
public void ConnectToBrokerAsServer(NB.Configuration.Config config) { serviceAdapter = new ServiceAdapter(); publisher = new Publisher(config, "NetServer", serviceAdapter); //NB.Configuration.Config config = Config.InstanceOf(AppDomain.CurrentDomain.BaseDirectory + "\\NetBroker.xml"); //BrokerPlugConfig plugConfig = new BrokerPlugConfig(config, NB.Transport.Enums.PlugType.Server); //publisher = new Publisher(plugConfig); //serviceAdapter.RegisterDelegates(); ////publisher.Register(serviceAdapter); //((RequestHandler)publisher.BrokerConnection).RegisterServiceHandler(serviceAdapter); log.InfoFormat("Connected to message broker as server on {0}.", config.Server_URL); return; }
public Object UpdateJobState(NB.Configuration.NbIdentity identity, Object arg) { object o = engine.UpdateJobState(arg); return o; }
public Object GetStartUpJobsInstant(NB.Configuration.NbIdentity identity, Object arg) { object o = engine.GetStartUpJobsInstant(identity, arg); return o; }
public Object GetUserWatchedJob(NB.Configuration.NbIdentity identity, Object arg) { return engine.GetUserWatchedJob(identity, arg); }
public Object SetCentralConfigToDb(NB.Configuration.NbIdentity identity, object arg) { try { XmlDocument xdoc = (XmlDocument)(XmlDocumentSerializable)arg; string jobName = xdoc.SelectSingleNode("Job").Attributes["name"].Value.Replace("*RUN_INSTANCE*", "").Replace("__", "_").Replace("_Job", ""); globalConfig.Hierarchy.SetValue(@"appgroup\BITS_JOB_SPEC", jobName, xdoc.InnerXml); return true; } catch (Exception ex) { log.Error(ex); return false; } }
public Object AddUserToList(NB.Configuration.NbIdentity identity, Object arg) { return engine.AddUserToList(arg); }
public Object CopyUserEntitlements(NB.Configuration.NbIdentity identity, Object arg) { return engine.CopyUserEntitlements(arg); }
public Object GetDashboardSystemList(NB.Configuration.NbIdentity identity, Object arg) { return engine.GetDashboardSystemList(arg); }
public Object GetEmailStatus(NB.Configuration.NbIdentity identity, Object arg) { return engine.GetEmailStatus(arg); }
public Object SetJobSpecToDb(NB.Configuration.NbIdentity identity, Object arg) { object o = engine.SetJobSpecToDb(identity, arg); return o; }
public Object Broadcast(NB.Configuration.NbIdentity identity, Object arg) { engine.Broadcast(arg as MessageArgs); return null; }
public Object MonitorJobLog(NB.Configuration.NbIdentity identity, Object arg) { object o = engine.MonitorJobLog(identity, arg); return o; }
public Object RunJobXml(NB.Configuration.NbIdentity identity, Object arg) { object o = engine.RunJobXml(identity, arg); return o; }
public Object UnloadAssembly(NB.Configuration.NbIdentity identity, Object arg) { object o = engine.UnloadAssembly(identity, arg); return o; }
public Object ToggleStartupJob(NB.Configuration.NbIdentity identity, Object arg) { return engine.ToggleStartupJob(arg); }
public Object GetDashboardFunctionalAreaList(NB.Configuration.NbIdentity identity, Object arg) { return engine.GetDashboardFunctionalAreaList(arg); }
public Object GetRunInstanceAs(NB.Configuration.NbIdentity identity, Object arg) { return engine.GetRunInstanceAs(arg); }
public Object UpdateProcessAlert(NB.Configuration.NbIdentity identity, Object arg) { return engine.UpdateProcessAlert(arg); }
public Object GetAllStartupJobs(NB.Configuration.NbIdentity identity, Object arg) { return engine.GetAllStartupJobs(arg); }
public Object GetProcessSystems(NB.Configuration.NbIdentity identity, Object arg) { return engine.GetProcessSystems(arg); }
public Object DeleteUser(NB.Configuration.NbIdentity identity, Object arg) { return engine.DeleteUser(arg); }
public Object GetGenericDashboardView(NB.Configuration.NbIdentity identity, Object arg) { return engine.GetGenericDashboardView(arg); }
public Object GetUserList(NB.Configuration.NbIdentity identity, Object arg) { return engine.GetUserList(arg); }
public Object ResetUniqueJobInstance(NB.Configuration.NbIdentity identity, Object arg) { return engine.ResetUniqueJobInstance(arg); }
public Object BuildJobsSpec(NB.Configuration.NbIdentity identity, object arg) { StringBuilder sb = new StringBuilder(); Hashtable ht = arg as Hashtable; try { if (ht == null) throw new ApplicationException("No args to process."); try { if (!ht["jobname"].ToString().StartsWith("RP_")) ht["jobname"] = "RP_" + ht["jobname"].ToString(); ht["jobname"] = ht["jobname"].ToString().Replace("_Job", ""); if (ht.ContainsKey("Type")) { switch (ht["Type"].ToString().ToUpper()) { case "RP": sb.AppendFormat("<Job name=\"{0}_Job\" dependencyTraversalMode=\"Breadth-first\" jobTemplate=\"GenevaReport\" isHistoricalMode=\"true\" skipTodayIfPassed=\"true\" runOnce=\"{1}\">", ht["jobname"], ht["runOnce"]); sb.AppendFormat("<Module name=\"{0}_Scheduler\" moduleType=\"JobScheduler\" jobName=\"{0}_Job\" resetInterval=\"1440\" weeklySchedule=\"{1}\" startTime=\"{2}\" />", ht["jobname"], ht["schedule"], ht["time"]); sb.AppendFormat("<Module name=\"{0}_Report\" moduleType=\"CommandShell\" inputs=\"{0}_Scheduler\" exe=\"C:\\BamApps\\RdlShipper\\bin\\RdlShipper.exe\" args=\"{1}\" workingPath=\"C:\\BamApps\\RdlShipper\\\" ifWaitForJob=\"false\" />", ht["jobname"], ht["args"]); sb.AppendFormat("</Job>"); break; case "QUERY": sb.AppendFormat("<Job name=\"{0}_Job\" dependencyTraversalMode=\"Breadth-first\" jobTemplate=\"GenevaReport\" isHistoricalMode=\"true\" skipTodayIfPassed=\"true\" runOnce=\"{1}\">", ht["jobname"], ht["runOnce"]); sb.AppendFormat("<Module name=\"{0}_Scheduler\" moduleType=\"JobScheduler\" jobName=\"{0}_Job\" resetInterval=\"1440\" weeklySchedule=\"{1}\" startTime=\"{2}\" />", ht["jobname"], ht["schedule"], ht["time"]); sb.AppendFormat("<Module name=\"{0}_Query\" moduleType=\"GenevaSoapSelect\" inputs=\"{0}_Scheduler\" port=\"*GENEVA_PORT*\" host=\"*RUN_SERVER*-geneva\" uid=\"SysLoaderBITS\" pwd=\"loaderbits\" ifOverrideSoapErrorRetry=\"true\" url=\"*GENEVA_SOAP_URL*\" query=\"{1}\" />", ht["jobname"], ht["query"]); sb.AppendFormat("<Module name=\"{0}_Output\" moduleType=\"ExportDataTableToFile\" inputs=\"{0}_Query\" inputToProcess=\"{0}_Query\" filename=\"{1}\" path=\"\\\\*RUN_SERVER*-biz\\geneva\\\" newpath=\"\\\\*RUN_SERVER*-biz\\geneva\\queries\" ifOverwrite=\"true\" ifIncludeHeaders=\"true\" separator=\",\" resetOnEachRun=\"true\" />", ht["jobname"], ht["filename"]); sb.AppendFormat("<Module name=\"{0}_MailMessage\" moduleType=\"SmtpMailer\" inputs=\"{0}_Output\" listTo=\"{1}\" listFrom=\"BITS Trade Loader,[email protected]\" subject=\"{0} Extract [*RUN_INSTANCE*]\" body=\"\" Envelope=\"GenevaSoapSelectMailEnvelope\" Attachments=\"\\\\*RUN_SERVER*-biz\\geneva\\queries\\{2}\" mailServer=\"fh1-ms2\" mailUid=\"fountainhead\\\\svcSqlServer\" mailPwd=\"5q1Adm1n\" />", ht["jobname"], ht["listTo"], ht["filename"]); sb.AppendFormat("</Job>"); break; } } globalConfig.Hierarchy.SetValue(@"appgroup\BITS_JOB_SPEC", ht["jobname"].ToString(), ConfigUtils.MetaTagReplacer(sb.ToString())); } catch (Exception ex) { log.Error(ex); } } catch (Exception ex) { log.Error(ex); return ""; } return sb.ToString(); }
public Object GetRegisteredAdapters(NB.Configuration.NbIdentity identity, Object arg) { return engine.GetRegisteredAdapters(arg); }
public Object SaveState(NB.Configuration.NbIdentity identity, Object arg) { return null; //object o = engine.SaveState(arg); //return o; }
public Object GetWatchers(NB.Configuration.NbIdentity identity, Object arg) { return engine.GetWatchers(arg); }
public Object RemoveJob(NB.Configuration.NbIdentity identity, Object arg) { object o = engine.RemoveJob(arg, true); return o; }
public Object RemoveStartUpJob(NB.Configuration.NbIdentity identity, Object arg) { object o = engine.RemoveStartUpJob(identity, arg); return o; }