text:
package proposervm

import (
	"context"
	"time"

	"go.uber.org/zap"

	"github.com/ava-labs/avalanchego/database"
	"github.com/ava-labs/avalanchego/snow/choices"
	"github.com/ava-labs/avalanchego/snow/consensus/snowman"
	"github.com/ava-labs/avalanchego/vms/proposervm/block"
)

var _ Block = (*preForkBlock)(nil)

type preForkBlock struct {
	snowman.Block
	vm *VM
}

func (b *preForkBlock) Accept(ctx context.Context) error {
	if err := b.acceptOuterBlk(); err != nil {
		return err
	}
	return b.acceptInnerBlk(ctx)
}

func (*preForkBlock) acceptOuterBlk() error {
	return nil
}

func (b *preForkBlock) acceptInnerBlk(ctx context.Context) error {
	return b.Block.Accept(ctx)
}

func (b *preForkBlock) Verify(ctx context.Context) error {
	parent, err := b.vm.getPreForkBlock(ctx, b.Block.Parent())
	if err != nil {
		return err
	}
	return parent.verifyPreForkChild(ctx, b)
}

func (b *preForkBlock) Options(ctx context.Context) ([2]snowman.Block, error) {
	oracleBlk, ok := b.Block.(snowman.OracleBlock)
	if !ok {
		return [2]snowman.Block{}, snowman.ErrNotOracle
	}

	options, err := oracleBlk.Options(ctx)
	if err != nil {
		return [2]snowman.Block{}, err
	}
	// A pre-fork block's child options are always pre-fork blocks
	return [2]snowman.Block{
		&preForkBlock{
			Block: options[0],
			vm:    b.vm,
		},
		&preForkBlock{
			Block: options[1],
			vm:    b.vm,
		},
	}, nil
}

func (b *preForkBlock) getInnerBlk() snowman.Block {
	return b.Block
}

func (b *preForkBlock) verifyPreForkChild(ctx context.Context, child *preForkBlock) error {
	parentTimestamp := b.Timestamp()
	if !parentTimestamp.Before(b.vm.activationTime) {
		if err := verifyIsOracleBlock(ctx, b.Block); err != nil {
			return err
		}

		if err := b.verifyIsPreForkBlock(); err != nil {
			return err
		}

		b.vm.ctx.Log.Debug("allowing pre-fork block after the fork time",
			zap.String("reason", "parent is an oracle block"),
			zap.Stringer("blkID", b.ID()),
		)
	}

	return child.Block.Verify(ctx)
}

// This method only returns nil once (during the transition)
func (b *preForkBlock) verifyPostForkChild(ctx context.Context, child *postForkBlock) error {
	if err := verifyIsNotOracleBlock(ctx, b.Block); err != nil {
		return err
	}

	if err := b.verifyIsPreForkBlock(); err != nil {
		return err
	}

	childID := child.ID()
	childPChainHeight := child.PChainHeight()
	currentPChainHeight, err := b.vm.ctx.ValidatorState.GetCurrentHeight(ctx)
	if err != nil {
		b.vm.ctx.Log.Error("block verification failed",
			zap.String("reason", "failed to get current P-Chain height"),
			zap.Stringer("blkID", childID),
			zap.Error(err),
		)
		return err
	}
	if childPChainHeight > currentPChainHeight {
		return errPChainHeightNotReached
	}
	if childPChainHeight < b.vm.minimumPChainHeight {
		return errPChainHeightTooLow
	}

	// Make sure [b] is the parent of [child]'s inner block
	expectedInnerParentID := b.ID()
	innerParentID := child.innerBlk.Parent()
	if innerParentID != expectedInnerParentID {
		return errInnerParentMismatch
	}

	// A *preForkBlock can only have a *postForkBlock child
	// if the *preForkBlock is the last *preForkBlock before activation takes effect
	// (its timestamp is at or after the activation time)
	parentTimestamp := b.Timestamp()
	if parentTimestamp.Before(b.vm.activationTime) {
		return errProposersNotActivated
	}

	// Child's timestamp must be at or after its parent's timestamp
	childTimestamp := child.Timestamp()
	if childTimestamp.Before(parentTimestamp) {
		return errTimeNotMonotonic
	}

	// Child timestamp can't be too far in the future
	maxTimestamp := b.vm.Time().Add(maxSkew)
	if childTimestamp.After(maxTimestamp) {
		return errTimeTooAdvanced
	}

	// Verify the lack of signature on the node
	if err := child.SignedBlock.Verify(false, b.vm.ctx.ChainID); err != nil {
		return err
	}

	// Verify the inner block and track it as verified
	return b.vm.verifyAndRecordInnerBlk(ctx, child)
}

func (*preForkBlock) verifyPostForkOption(context.Context, *postForkOption) error {
	return errUnexpectedBlockType
}

func (b *preForkBlock) buildChild(ctx context.Context) (Block, error) {
	parentTimestamp := b.Timestamp()
	if parentTimestamp.Before(b.vm.activationTime) {
		// The chain hasn't forked yet
		innerBlock, err := b.vm.ChainVM.BuildBlock(ctx)
		if err != nil {
			return nil, err
		}

		b.vm.ctx.Log.Info("built block",
			zap.Stringer("blkID", innerBlock.ID()),
			zap.Uint64("height", innerBlock.Height()),
			zap.Time("parentTimestamp", parentTimestamp),
		)

		return &preForkBlock{
			Block: innerBlock,
			vm:    b.vm,
		}, nil
	}

	// The chain is currently forking

	parentID := b.ID()
	newTimestamp := b.vm.Time().Truncate(time.Second)
	if newTimestamp.Before(parentTimestamp) {
		newTimestamp = parentTimestamp
	}

	// The child's P-Chain height is proposed as the optimal P-Chain height that
	// is at least the minimum height
	pChainHeight, err := b.vm.optimalPChainHeight(ctx, b.vm.minimumPChainHeight)
	if err != nil {
		return nil, err
	}

	innerBlock, err := b.vm.ChainVM.BuildBlock(ctx)
	if err != nil {
		return nil, err
	}

	statelessBlock, err := block.BuildUnsigned(
		parentID,
		newTimestamp,
		pChainHeight,
		innerBlock.Bytes(),
	)
	if err != nil {
		return nil, err
	}

	blk := &postForkBlock{
		SignedBlock: statelessBlock,
		postForkCommonComponents: postForkCommonComponents{
			vm:       b.vm,
			innerBlk: innerBlock,
			status:   choices.Processing,
		},
	}

	b.vm.ctx.Log.Info("built block",
		zap.Stringer("blkID", blk.ID()),
		zap.Stringer("innerBlkID", innerBlock.ID()),
		zap.Uint64("height", blk.Height()),
		zap.Time("parentTimestamp", parentTimestamp),
		zap.Time("blockTimestamp", newTimestamp))
	return blk, nil
}

func (*preForkBlock) pChainHeight(context.Context) (uint64, error) {
	return 0, nil
}

func (b *preForkBlock) verifyIsPreForkBlock() error {
	if status := b.Status(); status == choices.Accepted {
		_, err := b.vm.GetLastAccepted()
		if err == nil {
			// If this block is accepted and it was a preForkBlock, then there
			// shouldn't have been an accepted postForkBlock yet. If there was
			// an accepted postForkBlock, then this block wasn't a preForkBlock.
			return errUnexpectedBlockType
		}
		if err != database.ErrNotFound {
			// If an unexpected error was returned - propagate that that
			// error.
			return err
		}
	} else if _, contains := b.vm.Tree.Get(b.Block); contains {
		// If this block is a preForkBlock, then it's inner block shouldn't have
		// been registered into the inner block tree. If this block was
		// registered into the inner block tree, then it wasn't a preForkBlock.
		return errUnexpectedBlockType
	}
	return nil
}


text:
<configs>
    <title>Live Top 10 CPU Usage</title>
    <author>Centreon</author>
    <email>contact@centreon.com</email>
    <website>http://www.centreon.com</website>
    <description>This widget lists hosts ordered by CPU usage (percentage). It is possible to select the number of lines in the table  or to select a subset of resources.</description>
    <version>22.10.0</version>
    <keywords>centreon, widget, cpu</keywords>
    <screenshot></screenshot>
    <thumbnail>./widgets/live-top10-cpu-usage/resources/logo1.png</thumbnail>
    <url>./widgets/live-top10-cpu-usage/index.php</url>
    <autoRefresh>10</autoRefresh>
    <preferences>
        <preference label="Host Group Name" name="host_group" defaultValue="" type="hostgroup" header="Resource"/>
        <preference label="Service Description" name="service_description" defaultValue="cpu" type="text" header="Filter"/>
        <preference label="Metric Name" name="metric_name" defaultValue="cpu" type="text"/>
        <preference label="Results" name="nb_lin" defaultValue="10" type="text"/>
        <preference label="Refresh Interval (seconds)" name="refresh_interval" defaultValue="30" type="text" header="Misc"/>
    </preferences>
</configs>

redpajama_set_name: RedPajamaGithub


text:
Batch
=====

Batch files for DOS/Windows from xclimbing


text:
require 'dishes'

def new_actor (&blk)
  Class.new(Dishes::Actor) do
    define_method :act, &blk
  end
end

describe Dishes::Actor do
  it 'should act and return a result' do
    actor_class = new_actor {42}
    actor = actor_class.new

    actor.should.respond_to? :act
    actor.act.should == 42
  end

  it 'should accept parameters' do
    actor_class = new_actor {@params['a'] + @params['b']}
    actor = actor_class.new('a' => 2, 'b' => 2)

    actor.act.should == 4
  end
end


text:
#ifndef UNITTEST_H // -*- C++ -*-
#define UNITTEST_H

// Convenience header that pulls in all definitions in the UnitTest namespace.
//
#include "ProcSuite.h"
#include "RunResults.h"
#include "Suite.h"

/** \file
 */

#endif


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Uses of Interface org.apache.wicket.examples.spring.common.ContactDao (Wicket Parent 1.5.7 API)
</TITLE>

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Interface
org.apache.wicket.examples.spring.common.ContactDao

Packages that use ContactDao

org.apache.wicket.examples.spring.annot.web

org.apache.wicket.examples.spring.common

org.apache.wicket.examples.spring.common.web

Uses of ContactDao in org.apache.wicket.examples.spring.annot.web

Methods in org.apache.wicket.examples.spring.annot.web that return ContactDao

protected  ContactDao
ProxyDataProvider.getContactDao()

protected  ContactDao
ProxyModel.getContactDao()

Constructors in org.apache.wicket.examples.spring.annot.web with parameters of type ContactDao

ProxyDataProvider(ContactDao dao)

ProxyModel(Contact contact,
           ContactDao dao)

Uses of ContactDao in org.apache.wicket.examples.spring.common

Classes in org.apache.wicket.examples.spring.common that implement ContactDao

 class
ContactDaoImpl

          a dao implementation with an auto-generated embedded database. in a true application this dao
 would interface with a real database, but because we want to keep dependencies to a minimum we
 generate our own database here.

Uses of ContactDao in org.apache.wicket.examples.spring.common.web

Methods in org.apache.wicket.examples.spring.common.web that return ContactDao

protected abstract  ContactDao
ContactDetachableModel.getContactDao()

protected abstract  ContactDao
ContactDataProvider.getContactDao()

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.


text:
.class public interface abstract Lcom/android/dex/util/ByteInput;
.super Ljava/lang/Object;
.source "ByteInput.java"

# virtual methods
.method public abstract readByte()B
.end method


text:
{% extends "base.html" %}

{% block page_class %}npcs{% endblock %}

{% block title %}Random NPCs{% endblock %}

{% block content %}

A Funkaoshi Production Presents

{{characters|length}} Random NPCs

	        Class
	        STR
	        INT
	        WIS
	        DEX
	        CON
	        CHA
			Appearance and Personality

    {% for c in characters %}

        {{ c.class_name }}
        {{ c.attributes.0.1 }}
        {{ c.attributes.1.1 }}
        {{ c.attributes.2.1 }}
        {{ c.attributes.3.1 }}
        {{ c.attributes.4.1 }}
        {{ c.attributes.5.1 }}
        {{ c.appearance }}, {{ c.personality }}

    {% endfor %}

        Site designed and built by Ramanan Sivaranjan. Check out more D&D stuff at Save vs. Total Party Kill. Random Personalities from this random table.If this site looks ugly, please let me know—unless you're using Internet Explorer.

{% endblock %}


text:
package org.elasticsearch.action.admin.indices.close;

import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient;

/**
 * Builder for close index request
 */
public class CloseIndexRequestBuilder extends AcknowledgedRequestBuilder<CloseIndexRequest, CloseIndexResponse, CloseIndexRequestBuilder, IndicesAdminClient> {

    public CloseIndexRequestBuilder(IndicesAdminClient indicesClient) {
        super(indicesClient, new CloseIndexRequest());
    }

    public CloseIndexRequestBuilder(IndicesAdminClient indicesClient, String... indices) {
        super(indicesClient, new CloseIndexRequest(indices));
    }

    /**
     * Sets the indices to be closed
     * @param indices the indices to be closed
     * @return the request itself
     */
    public CloseIndexRequestBuilder setIndices(String... indices) {
        request.indices(indices);
        return this;
    }

    /**
     * Specifies what type of requested indices to ignore and wildcard indices expressions
     * For example indices that don't exist.
     *
     * @param indicesOptions the desired behaviour regarding indices to ignore and indices wildcard expressions
     * @return the request itself
     */
    public CloseIndexRequestBuilder setIndicesOptions(IndicesOptions indicesOptions) {
        request.indicesOptions(indicesOptions);
        return this;
    }

    @Override
    protected void doExecute(ActionListener<CloseIndexResponse> listener) {
        client.close(request, listener);
    }
}


text: Sign in using your social accounts


text:
import os
from setuptools import setup

with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
    README = readme.read()

os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))

setup(
    name='django-dana-time',
    version='0.1.0',
    packages=['danatime'],
    include_package_data=True,
    license='MIT License',
    description='Short, readable datetime filters.',
    long_description=README,
    url='https://github.com/danasilver/django-dana-time',
    author='Dana Silver',
    author_email='dsilver1221@gmail.com',
    classifiers=[
        'Environment :: Web Environment',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.4',
        'Topic :: Internet :: WWW/HTTP',
        'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
    ]
)


text:
using boost::format;
using boost::locale::generator;
using namespace std;
using namespace boost::locale::conv;
using namespace despoof;

template<typename GetFunction>
static GetFunction loadsym(const string &file, const char *symbol)
{
	auto module = LoadLibrary(utf_to_utf<wchar_t>(file).c_str());
	if(!module) {
		throw_windows_error("LoadLibrary");
	}
	auto raw_get = GetProcAddress(module, symbol);
	if(!raw_get) {
		throw_windows_error("GetProcAddress");
	}
	return static_cast<GetFunction>(static_cast<void*>(raw_get));
}

static string modfile(const char *prefix, const string &name)
{
	return (format("%1%-%2%.dll") % prefix % name).str();
}

bool despoof::init(int argc, char **argv, unique_ptr<context> &ctx)
{
	locale::global(generator().generate(""));

	configuration config;
	try {
		command_line_to_configuration(config, argc, argv);
	} catch(const command_line_error &e) {
		e.print_errors();
		return false;
	}

	if(config._nostart) { return false; }

	ctx.reset(new context(config, unique_ptr<network_api>(loadsym<getapi_function>(modfile("nw", config.nw_module), "getapi")()), loadsym<getlog_function>(modfile("log", config.log_module), "getlog")()));
	return true;
}


text:
<!doctype html>

    <title>Code coverage report for All files</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="prettify.css" />
    <link rel="stylesheet" href="base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">

      All files

        56.03%
        Statements
        79/141

        80%
        Branches
        32/40

        52.17%
        Functions
        24/46

        54.17%
        Lines
        65/120

      Press n or j to go to the next uncovered block, b, p or k for the previous block.

   File

   Statements

   Branches

   Functions

   Lines

	sequence.ts

	18.75%
	12/64
	100%
	8/8
	10%
	2/20
	16.95%
	10/59

	utility.ts

	83.87%
	52/62
	75%
	24/32
	84.62%
	22/26
	86.96%
	40/46

	utility_const.ts

	100%
	15/15
	100%
	0/0
	100%
	0/0
	100%
	15/15

  Code coverage
  generated by istanbul at Sat May 19 2018 18:30:48 GMT+0900 (東京 (標準時))


text:
import { Injectable } from "@angular/core";
import { Couchbase } from "nativescript-couchbase";

@Injectable()
export class CouchbaseService {

    private currentWeatherDatabase: any;
    private aggregateWeatherDatabase: any;

    constructor() { }

    init() {
        // current weather db
        this.currentWeatherDatabase = new Couchbase("current");
        this.currentWeatherDatabase.destroyDatabase();
        this.currentWeatherDatabase = new Couchbase("current");
        this.currentWeatherDatabase.createView("weather", "1", (document, emitter) => {
            emitter.emit(document._id, document);
        });

        this.aggregateWeatherDatabase = new Couchbase("aggregate");
        this.aggregateWeatherDatabase.destroyDatabase();
        this.aggregateWeatherDatabase = new Couchbase("aggregate");
        this.aggregateWeatherDatabase.createView("weather", "1", (document, emitter) => {
            emitter.emit(document._id, document);
        });
    }

    getCurrentWeatherDatabase() {
        return this.currentWeatherDatabase;
    }

    getAggregateWeatherDatabase() {
        return this.aggregateWeatherDatabase;
    }
}


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ShutdownTimer.Classes;

namespace ShutdownTimer.Forms
{
    internal partial class AddCPUUsageEvent : Form
    {
        public AddCPUUsageEvent()
        {
            InitializeComponent();
        }

        public CPUUsageEvent GetEvent()
        {
            if (this.DialogResult != DialogResult.OK)
                throw new Exception("Couldn't create Event");

            try
            {
                int usage = 0;
                int howLong = 0;
                int comparator = 0;

                usage = Convert.ToInt32(this.textBoxUsage.Text);
                howLong = Convert.ToInt32(this.textBoxSeconds.Text);

                string selectedItem = (string) this.comboBoxComparator.SelectedItem;
                switch (selectedItem)
                {
                    case "Above":
                        comparator = 1;
                        break;
                    case "Precisely":
                        comparator = 0;
                        break;
                    case "Under":
                        comparator = -1;
                        break;
                    default:
                        break;
                }

                return new CPUUsageEvent(usage, howLong, comparator);
            }
            catch (Exception)
            {
                throw new Exception("Couldn't create Event");
            }
        }
    }
}


text:
'''
    Author:     Andres Andreu
    Contact:    <andres [at] neurofuzzsecurity dot com>
    Company:    neuroFuzz, LLC
    Date:       6/23/2012
    Modified:   8/19/2016

    This software runs on certain flavors of Linux and Mac OSX (written on 10.7.x with python 2.6/2.7).
    Its intent is to temporarily change/spoof the MAC Address on the machine running it. Note that you
    will need to be on the machine locally, not a remote shell as you will kill your own session.

    The code I did see out there that operates on this same functionality just lacked so much and made so many static
    and bad assumptions that I decided to just write this myself. So in the spirit of open source I am sharing this
    with the world.

    If you are running this as a standalone prog,

    Usage:

        sudo python main.py

        or

        sudo python main.py --static=60:f8:1d:b3:a1:98

    If there is no static MAC Address value presented with the "--static" argument
    then this prog defaults to setting a randomly generated MAC Address value.

    If WRITEDAT is set to True it stores a record of your MAC Address activity with
    this tool in a file called: ".originalMac", the data in there is structured as such:

        interface tab MAC_Address tab #pid#date/time_stamp

    where the pid is that of the prog run when that change
    was made. An example:

        eth0    07:c8:6f:23:32:f0    #764#2012-06-25T23:49:15.405275

    #################################################################
    BSD 3-Clause License

    Copyright (c) 2012-2016, Andres Andreu, neuroFuzz LLC
    All rights reserved.

    Redistribution and use in source and binary forms, with or without modification,
    are permitted provided that the following conditions are met:

    1. Redistributions of source code must retain the above copyright notice,
    this list of conditions and the following disclaimer.

    2. Redistributions in binary form must reproduce the above copyright notice,
    this list of conditions and the following disclaimer in the documentation and/or
    other materials provided with the distribution.

    3. Neither the name of the copyright holder nor the names of its contributors may
    be used to endorse or promote products derived from this software without specific
    prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
    EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
    BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
    OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
    OF SUCH DAMAGE.
    #################################################################
    *** Take note:
    If you use this for criminal purposes and get caught you are on
    your own and I am not liable. I wrote this for legitimate
    pen-testing and auditing purposes.
    ***

    Be kewl and give credit where it is due if you use this. Also,
    send me feedback as I don't have the bandwidth to test for every
    condition or flavor of Linux under the Sun. - Dre
    #################################################################
'''
import getopt
import json
import time
import logging
import logging.config
from random import randint
from macCloaker import *

DEBUG = False

###############################################
APP_META = {'app_name':get_color_out(the_str='[neuroFuzz macCloaker] - ', the_color='yellow', do_bold=False)}

LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'formatters': {
        'standard': {
            'format': '%(levelname)s:%(name)s: %(message)s '
                    '(%(asctime)s; %(filename)s:%(lineno)d)',
            'datefmt': "%Y-%m-%d %H:%M:%S",
        }
    },
    'handlers': {
        'console': {
            'level': 'DEBUG',
            'formatter': 'standard',
            'class': 'logging.StreamHandler',
        },
        'rotate_file': {
            'level': 'DEBUG',
            'formatter': 'standard',
            'class': 'logging.handlers.RotatingFileHandler',
            'filename': 'rotated.log',
            'encoding': 'utf8',
            'maxBytes': 100000,
            'backupCount': 1,
        }
    },
    'loggers': {
        '': {
            'handlers': ['console', 'rotate_file'],
            'level': 'DEBUG',
        },
    }
}
logging.config.dictConfig(LOGGING)

log = logging.getLogger(__name__)

out_hdlr = logging.StreamHandler(sys.stdout)
#out_hdlr.setFormatter(logging.Formatter('%(asctime)s %(message)s'))
out_hdlr.setFormatter(logging.Formatter('%(app_name)s %(message)s'))
out_hdlr.setLevel(logging.INFO)

log.addHandler(out_hdlr)
log.setLevel(logging.INFO)
log.propagate = False

log = logging.LoggerAdapter(log, APP_META)
###############################################

if __name__ == "__main__":

    staticval = False
    rotate_mac = False
    options, remainder = getopt.getopt(sys.argv[1:], '', ['static=','rotate'])

    for opt, arg in options:
        if opt == '--static':
            staticval = arg
        if opt == '--rotate':
            rotate_mac = True

    if staticval and rotate_mac:
        print "\nCannot process a static MAC address value and set rotation on\n\n"
        sys.exit()

    if staticval:
        if not validate_mac_address_format(the_mac=staticval):
            print "\n'%s' - Not a valid MAC Address\n\n" % staticval
            sys.exit()

    '''
        go in here for randomly chosen MAC addresses
        that will rotate at certain intervals
    '''
    if rotate_mac:
        cnt = 0
        while True:
            try:
                if cnt == 0:
                    json_out = ''
                    json_out = cloak_mac(api_logger=log, verbose=True)

                    print("Now go do whatever it is you need to do with a spoofed MAC Address, wink wink ...")
                    print("Press [CTRL-C] when you want to set the Mac back to normal\n\n")

                else:
                    json_out = cloak_mac(interface_name=json_out['interface_name'], api_logger=log, verbose=True)

                if DEBUG:
                    print json_out

                json_out = json.loads(json_out)

                sys.stdout.write("MAC Address on '%s': %s   \n" % (json_out['interface_name'],
                                                                   get_color_out(the_str=json_out['fake_mac_address'],
                                                                                the_color='red',
                                                                                do_bold=False).strip()
                                                                   )
                                 )
                sys.stdout.flush()
                time.sleep(randint(3900,10800))
                cnt += 1
            except KeyboardInterrupt:
                print
                break
    else:
        '''
            go in here for static set MAC addresses or
            randomly chosen MAC address that will not
            rotate
        '''
        try:
            json_out = ''
            if staticval:
                json_out = cloak_mac(staticval=staticval, api_logger=log, verbose=True)
            else:
                json_out = cloak_mac(api_logger=log, verbose=True)

            print("Now go do whatever it is you need to do with a spoofed MAC Address, wink wink ...")
            print("Press [CTRL-C] when you want to set the Mac back to normal\n\n")

            if DEBUG:
                print json_out

            json_out = json.loads(json_out)

            sys.stdout.write("MAC Address on '%s': %s   \n" % (json_out['interface_name'],
                                                               get_color_out(the_str=json_out['fake_mac_address'],
                                                                             the_color='red',
                                                                             do_bold=False).strip()
                                                               )
                             )
            while True:
                pass
            #sys.stdout.flush()
        except KeyboardInterrupt:
            print
            pass

    reset_mac(vals=json.dumps(json_out), api_logger=log)


text:
<?=$content?>

<?php if(isset($byline)) : ?>
<footer class="byline t-clearfix">
<?=$byline?>
</footer>
<?php endif; ?>


text:
package org.apache.taverna.workflowmodel.processor.dispatch.layers;

import org.apache.taverna.workflowmodel.processor.config.ConfigurationBean;
import org.apache.taverna.workflowmodel.processor.config.ConfigurationProperty;

@ConfigurationBean(uri = Retry.URI + "#Config")
public class RetryConfig {
	private static final float BACKOFF_FACTOR = 1.0f;
	private static final int MAX_DELAY = 5000;
	private static final int INITIAL_DELAY = 1000;
	private static final int MAX_RETRIES = 0;

	private float backoffFactor = BACKOFF_FACTOR;
	private int initialDelay = INITIAL_DELAY;
	private int maxDelay = MAX_DELAY;
	private int maxRetries = MAX_RETRIES;

	/**
	 * Factor by which the initial delay is multiplied for each retry after the
	 * first, this allows for exponential backoff of retry times up to a certain
	 * ceiling
	 *
	 * @return
	 */
	public float getBackoffFactor() {
		return this.backoffFactor;
	}

	/**
	 * Delay in milliseconds between the initial failure message and the first
	 * attempt to retry the failed job
	 *
	 * @return
	 */
	public int getInitialDelay() {
		return this.initialDelay;
	}

	/**
	 * Maximum delay in milliseconds between failure reception and retry. This
	 * acts as a ceiling for the exponential backoff factor allowing the retry
	 * delay to initially increase to a certain value then remain constant after
	 * that point rather than exploding to unreasonable levels.
	 */
	public int getMaxDelay() {
		return this.maxDelay;
	}

	/**
	 * Maximum number of retries for a failing process
	 *
	 * @return
	 */
	public int getMaxRetries() {
		return this.maxRetries;
	}

	@ConfigurationProperty(name = "backoffFactor", label = "Backoff Factor", description = "Factor by which the initial delay is multiplied for each retry after the first retry", required=false)
	public void setBackoffFactor(float factor) {
		this.backoffFactor = factor;
	}

	@ConfigurationProperty(name = "initialDelay", label = "Initial Delay", description = "Delay in milliseconds between the initial failure message and the first attempt to retry the failed job", required=false)
	public void setInitialDelay(int delay) {
		this.initialDelay = delay;
	}

	@ConfigurationProperty(name = "maxDelay", label = "Maximum Delay", description = "Maximum delay in milliseconds between failure reception and retry", required=false)
	public void setMaxDelay(int delay) {
		this.maxDelay = delay;
	}

	@ConfigurationProperty(name = "maxRetries", label = "Maximum Retries", description = "Maximum number of retries for a failing process", required=false)
	public void setMaxRetries(int max) {
		this.maxRetries = max;
	}
}


text: One Rang catalog module.


text:
import * as React from "react";

import { LocaleConsumer } from "../Locale";

interface PercentProps {
  amount: number;
}

const Percent: React.StatelessComponent<PercentProps> = ({ amount }) => (
  <LocaleConsumer>
    {locale => {
      return (amount / 100).toLocaleString(locale, {
        maximumFractionDigits: 2,
        style: "percent"
      });
    }}
  </LocaleConsumer>
);
Percent.displayName = "Percent";
export default Percent;


text:
using org.apache.juddi.client.org.apache.juddi.v3.client.mapping;
using org.apache.juddi.jaxb;
using org.apache.juddi.v3.client.config;
using org.apache.juddi.v3.client.log;
using org.uddi.apiv3;
using org.xmlsoap.schemas;
using org.xmlsoap.schemas.easyWsdl;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Configuration;
using System.IO;
using System.Net;
using System.Web.Services.Description;
using System.Xml;
using System.Xml.Serialization;

namespace org.apache.juddi.v3.client.mapping
{
    ///
    ///
    /// This class implements the OASIS
    /// 'Using WSDL in a UDDI Registry, Version 2.0.2' technote. This class
    /// creates a detailed mapping of WSDL 1.1 artifacts to the UDDI V3 data model.
    ///
 Section 2.4 in the technote
2.4.1 wsdl:portType ->
    /// uddi:tModel - {@link #createWSDLPortTypeTModels(String, Map)}

2.4.2
    /// wsdl:binding -> uddi:tModel -
    /// {@link #createWSDLBindingTModels(String, Map)}

TODO: 2.4.3
    /// wsdl:service -> uddi:businessService

TODO: 2.4.4 wsdl:port ->
    /// uddi:bindingTemplate

TODO: 2.4.5 wsdl:port Address Extensions ->
    /// uddi:bindingTemplate

    ///
    ///
    /// @author Kurt T Stam
    /// @Since 3.1.5
    public class WSDL2UDDI
    {

        ///
        ///
        /// Required Properties are: businessName, for example: 'Apache' nodeName,
        /// for example: 'uddi.example.org_80' keyDomain, for example:
        /// juddi.apache.org
        ///
        /// Optional Properties are: lang: for example: 'nl'
        ///
        ///
        /// <param name="clerk">can be null if register/unregister methods are not used.</param>
        /// <param name="urlLocalizer">A reference to an custom</param>
        /// <param name="properties">required values keyDomain, businessKey, nodeName</param>
        /// <exception cref="ConfigurationException"></exception>
        public WSDL2UDDI(UDDIClerk clerk, URLLocalizer urlLocalizer, Properties properties)
        {
            if (properties == null)
                throw new ArgumentNullException("properties");
            this.clerk = clerk;
            this.urlLocalizer = urlLocalizer;
            this.properties = properties;

            if (clerk != null)
            {
                if (!properties.containsKey("keyDomain"))
                {
                    throw new ConfigurationErrorsException("Property keyDomain is a required property when using WSDL2UDDI.");
                }
                if (!properties.containsKey("businessKey") && !properties.containsKey("businessName"))
                {
                    throw new ConfigurationErrorsException("Either property businessKey, or businessName, is a required property when using WSDL2UDDI.");
                }
                if (!properties.containsKey("nodeName"))
                {
                    if (properties.containsKey("serverName") && properties.containsKey("serverPort"))
                    {
                        String nodeName = properties.getProperty("serverName") + "_" + properties.getProperty("serverPort");
                        properties.setProperty("nodeName", nodeName);
                    }
                    else
                    {
                        throw new ConfigurationErrorsException("Property nodeName is not defined and is a required property when using WSDL2UDDI.");
                    }
                }
            }

            //Obtaining values from the properties
            this.keyDomainURI = "uddi:" + properties.getProperty("keyDomain") + ":";
            if (properties.containsKey(Property.BUSINESS_KEY))
            {
                this.businessKey = properties.getProperty(Property.BUSINESS_KEY);
            }
            else
            {
                //using the BusinessKey Template, and the businessName to construct the key
                this.businessKey = UDDIKeyConvention.getBusinessKey(properties);
            }
            this.lang = properties.getProperty(Property.LANG, Property.DEFAULT_LANG);

        }

        public businessService[] registerBusinessServices(org.xmlsoap.schemas.easyWsdl.tDefinitions wsdlDefinition)
        {
            List<businessService> businessServices = new List<businessService>();
            Dictionary<apache.juddi.v3.client.mapping.QName, org.xmlsoap.schemas.easyWsdl.tService>.Enumerator it = wsdlDefinition.getAllServices().GetEnumerator();
            while (it.MoveNext())
            {
                QName serviceQName = (QName)it.Current.Key;
                org.xmlsoap.schemas.easyWsdl.tService service = wsdlDefinition.getService(serviceQName);
                businessService businessService = null;
                //add service
                Uri serviceUrl = null;
                if (service.port != null && service.port.Count > 0)
                {
                    HashSet<org.xmlsoap.schemas.easyWsdl.tPort>.Enumerator it2 = service.port.GetEnumerator();
                    while (it2.MoveNext())
                    {
                        //for (Object portName : service.getPorts().keySet()) {
                        businessService = registerBusinessService(serviceQName, (String)it2.Current.name, serviceUrl, wsdlDefinition).getBusinessService();
                    }
                }
                if (businessService != null)
                {
                    businessServices.Add(businessService);
                }
            }

            return businessServices.ToArray();

        }
        public ServiceRegistrationResponse registerBusinessService(QName serviceQName, String portName, Uri serviceUrl,
            org.xmlsoap.schemas.easyWsdl.tDefinitions wsdlDefinition)
        {

            String genericWSDLURL = serviceUrl.ToString();     //TODO maybe point to repository version
            ServiceRegistrationResponse response = new ServiceRegistrationResponse();
            String serviceKey = UDDIKeyConvention.getServiceKey(properties, serviceQName.getLocalPart());
            businessService businessService = lookupService(serviceKey);
            if (businessService == null)
            {
                List<tModel> tModels = new List<tModel>();
                // Create the PortType tModels
                Dictionary
                    <QName, org.xmlsoap.schemas.easyWsdl.tPortType> portTypes = (Dictionary<QName, org.xmlsoap.schemas.easyWsdl.tPortType>)wsdlDefinition.getAllPortTypes();

                tModels.AddRange(createWSDLPortTypeTModels(genericWSDLURL, portTypes));
                // Create the Binding tModels
                Dictionary<QName, org.xmlsoap.schemas.easyWsdl.tBinding> bindings = (Dictionary<QName, org.xmlsoap.schemas.easyWsdl.tBinding>)wsdlDefinition.getAllBindings();
                tModels.AddRange(createWSDLBindingTModels(genericWSDLURL, bindings));
                // Register these tModels
                foreach (tModel tModel in tModels)
                {
                    clerk.register(tModel);
                }
                // Service
                businessService = createBusinessService(serviceQName, wsdlDefinition);
                // Register this Service
                clerk.register(businessService);
            }
            //Add the BindingTemplate to this Service
            bindingTemplate binding = createWSDLBinding(serviceQName, portName, serviceUrl, wsdlDefinition);
            // Register BindingTemplate
            if (binding.Item != null)
            {
                clerk.register(binding);
                if (businessService.bindingTemplates == null)
                {
                    businessService.bindingTemplates = new bindingTemplate[] { binding };
                }
                else
                {
                    List<bindingTemplate> bts = new List<bindingTemplate>();

                    for (int i = 0; i < businessService.bindingTemplates.Length; i++)
                        bts.Add(businessService.bindingTemplates[i]);
                    bts.Add(binding);
                    businessService.bindingTemplates = bts.ToArray();
                }

                response.setBindingKey(binding.bindingKey);
            }
            response.setBusinessService(businessService);
            return response;

        }

        ///
        ///
        /// Perform a lookup by serviceKey, and will return null if not found.
        ///
        ///
        /// <param name="serviceKey"></param>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        /// <exception cref="ConfigurationErrorsException"></exception>
        private businessService lookupService(string serviceKey)
        {
            //Checking if this serviceKey already exist
            businessService service = clerk.getServiceDetail(serviceKey);
            return service;
        }

        public String[] unRegisterBusinessServices(org.xmlsoap.schemas.easyWsdl.tDefinitions wsdlDefinition)
        {
            String[] businessServices = new String[wsdlDefinition.getAllServices().Count];
            int i = 0;
            Dictionary<apache.juddi.v3.client.mapping.QName, org.xmlsoap.schemas.easyWsdl.tService>.Enumerator it = wsdlDefinition.getAllServices().GetEnumerator();
            while (it.MoveNext())
            {

                QName serviceQName = it.Current.Key;
                org.xmlsoap.schemas.easyWsdl.tService service = it.Current.Value;
                //unregister service
                Uri serviceUrl = null;
                if (service.port != null && service.port.Count > 0)
                {
                    HashSet<org.xmlsoap.schemas.easyWsdl.tPort>.Enumerator it2 = service.port.GetEnumerator();
                    while (it2.MoveNext())
                    {
                        //construct the accessURL
                        serviceUrl = new Uri(getBindingURL((org.xmlsoap.schemas.easyWsdl.tPort)service.getPort(it2.Current.name)));
                        businessServices[i++] = unRegisterBusinessService(serviceQName, (String)it2.Current.name, serviceUrl);
                    }
                }
            }
            return businessServices;
        }

        private string getBindingURL(xmlsoap.schemas.easyWsdl.tPort tPort)
        {
            String bindingUrl = null;
            if (tPort.Any != null)
            {
                HashSet<XmlElement>.Enumerator it = tPort.Any.GetEnumerator();
                while (it.MoveNext())
                {
                    String location = null;
                    if (it.Current.LocalName.Equals("address", StringComparison.CurrentCultureIgnoreCase) &&
                                   it.Current.NamespaceURI.Equals("http://schemas.xmlsoap.org/wsdl/soap/", StringComparison.CurrentCultureIgnoreCase))
                    {

                        location = it.Current.GetAttribute("location");
                    }
                    else
                        if (it.Current.LocalName.Equals("address", StringComparison.CurrentCultureIgnoreCase) &&
                        it.Current.NamespaceURI.Equals("http://schemas.xmlsoap.org/wsdl/http/", StringComparison.CurrentCultureIgnoreCase))
                        {
                            location = it.Current.GetAttribute("location");
                        }
                        else

                            if (it.Current.LocalName.Equals("address", StringComparison.CurrentCultureIgnoreCase) &&
                        it.Current.NamespaceURI.Equals("http://schemas.xmlsoap.org/wsdl/soap12/", StringComparison.CurrentCultureIgnoreCase))
                            {
                                location = it.Current.GetAttribute("location");
                            }

                    Uri locationURI = new Uri(location);
                    if (locationURI != null)
                    {
                        bindingUrl = urlLocalizer.rewrite(locationURI);
                        break;
                    }
                }
            }
            return bindingUrl;
        }
        public String unRegisterBusinessService(QName serviceName, String portName, Uri serviceUrl)
        {
            String serviceKey = UDDIKeyConvention.getServiceKey(properties, serviceName.getLocalPart());
            businessService service = lookupService(serviceKey);
            bool isRemoveServiceIfNoTemplates = true;
            String bindingKey = UDDIKeyConvention.getBindingKey(properties, serviceName, portName, serviceUrl);
            //check if this bindingKey is in the service's binding templates
            foreach (bindingTemplate bindingTemplate in service.bindingTemplates)
            {
                if (bindingKey.Equals(bindingTemplate.bindingKey))
                {
                    clerk.unRegisterBinding(bindingKey);
                    //if this is the last binding for this service, and
                    if (service.bindingTemplates.Length == 1 && isRemoveServiceIfNoTemplates)
                    {
                        clerk.unRegisterService(serviceKey);
                        if (bindingTemplate.tModelInstanceDetails != null)
                        {
                            for (int i = 0; i < bindingTemplate.tModelInstanceDetails.Length; i++)
                            {
                                //foreach (tModelInstanceInfo tmi in bindingTemplate.tModelInstanceDetails)) {
                                String tModelKey = bindingTemplate.tModelInstanceDetails[i].tModelKey;
                                tModelDetail tModelDetail = clerk.getTModelDetail(tModelKey);
                                //delete all tModels assuming they are the portType and Binding tModels.
                                if (tModelDetail.tModel != null && tModelDetail.tModel.Length > 0)
                                {
                                    for (int k = 0; k < tModelDetail.tModel.Length; k++)
                                    {
                                        clerk.unRegisterTModel(tModelDetail.tModel[k].tModelKey);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return serviceKey;
        }
        public String getKeyDomainURI() { return keyDomainURI; }
        public void setKeyDomain(String keyDomainURI) { }
        public String getLang() { return lang; }
        String lang = "en";
        private UDDIClerk clerk;
        private URLLocalizer urlLocalizer;
        private Properties properties;
        private string keyDomainURI;
        private string businessKey;
        public void setLang(String lang)
        {
            this.lang = lang;
        }
        public String Lang
        {
            get
            {
                return lang;
            }
            set
            {
                lang = value;
            }
        }

        ///
        /// a simple convenience wrapper
        ///
        /// <param name="tModelKey"></param>
        /// <param name="keyName"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        protected static keyedReference newKeyedReference(String tModelKey, String keyName, String value)
        {
            keyedReference typesReference = new keyedReference();
            typesReference.tModelKey = (tModelKey);
            typesReference.keyName = (keyName);
            typesReference.keyValue = (value);
            return typesReference;
        }
        ///
        ///
        /// Builds a finder to find the binding tModels for a portType.
        ///
        ///
        /// <param name="portType"></param>
        ///  <param name="ns">Namespace</param>
        /// <returns></returns>
        public static find_tModel createFindBindingTModelForPortType(String portType, String ns)
        {

            find_tModel findTModel = new find_tModel();
            categoryBag categoryBag = new categoryBag();
            List<keyedReference> items = new List<keyedReference>();
            if (ns != null && ns.Length != 0)
            {
                keyedReference namespaceReference = newKeyedReference(
                        "uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", ns);
                items.Add(namespaceReference);
            }
            keyedReference bindingReference = newKeyedReference(
                    "uddi:uddi.org:wsdl:types", "uddi-org:wsdl:types", "binding");
            items.Add(bindingReference);

            keyedReference portTypeReference = newKeyedReference(
                    "uddi:uddi.org:wsdl:porttypereference", "uddi-org:wsdl:portTypeReference", portType);
            items.Add(portTypeReference);

            categoryBag.Items = (object[])items.ToArray();
            findTModel.categoryBag = (categoryBag);

            if (log.isDebugEnabled())
            {
                log.debug(new PrintUDDI<find_tModel>().print(findTModel));
            }
            return findTModel;
        }
        ///
        ///
        /// Builds a finder to find the portType tModels for a portType.
        ///
        ///
        /// <param name="portTypeName"></param>
        /// <param name="ns">Namespace</param>
        /// <returns></returns>
        public static find_tModel createFindPortTypeTModelForPortType(String portTypeName, String ns)
        {
            find_tModel findTModel = new find_tModel();
            categoryBag categoryBag = new categoryBag();
            List<keyedReference> cbitems = new List<keyedReference>();

            if (ns != null && ns.Length != 0)
            {
                keyedReference namespaceReference = newKeyedReference(
                        "uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", ns);
                cbitems.Add(namespaceReference);
            }
            keyedReference bindingReference = newKeyedReference(
                    "uddi:uddi.org:wsdl:types", "uddi-org:wsdl:types", "binding");
            cbitems.Add(bindingReference);

            keyedReference portTypeReference = newKeyedReference(
                    "uddi:uddi.org:wsdl:porttypereference", "uddi-org:wsdl:portTypeReference", portTypeName);
            cbitems.Add(portTypeReference);
            categoryBag.Items = cbitems.ToArray();
            findTModel.categoryBag = categoryBag;

            if (log.isDebugEnabled())
            {
                log.debug(new PrintUDDI<find_tModel>().print(findTModel));
            }
            return findTModel;
        }

        ///
        ///
        /// Creates a business service based off of a WSDL definition<Br>No changes are made to the UDDI
        /// endpoints using this method
        /// <br>
        /// Example Code:
        /// <pre>
        /// URL url = new URL("http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl");
        /// String domain = url.getHost();
        /// ReadWSDL rw = new ReadWSDL();
        /// Definition wsdlDefinition = rw.readWSDL(url);
        /// properties.put("keyDomain", domain);
        /// properties.put("businessName", domain);
        /// properties.put("serverName", url.getHost());
        /// properties.put("serverPort", url.getPort());
        /// wsdlURL = wsdlDefinition.getDocumentBaseURI();
        /// WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(null, new URLLocalizerDefaultImpl(), properties);
        /// BusinessServices businessServices = wsdl2UDDI.createBusinessServices(wsdlDefinition);
        /// </pre>
        ///
        /// <param name="wsdlDefinition">must not be null</param>
        /// <returns>a business service</returns>
        /// <exception cref="ArgumentNullException"> if the wsdlDefinition is null</exception>
        public businessService[] createBusinessServices(org.xmlsoap.schemas.easyWsdl.tDefinitions wsdlDefinition)
        {
            if (wsdlDefinition == null)
            {
                throw new ArgumentNullException();
            }
            List<businessService> businessServices = new List<businessService>();

            Dictionary<apache.juddi.v3.client.mapping.QName, org.xmlsoap.schemas.easyWsdl.tService>.Enumerator it = wsdlDefinition.getAllServices().GetEnumerator();
            while (it.MoveNext())
            {
                QName serviceQName = it.Current.Key;
                org.xmlsoap.schemas.easyWsdl.tService service = it.Current.Value;
                businessService businessService = createBusinessService(serviceQName, wsdlDefinition);
                //service.getExtensibilityElements().
                //add the bindingTemplates
                Uri serviceUrl = null;
                if (service.port != null && service.port.Count > 0)
                {
                    List<bindingTemplate> bts = new List<bindingTemplate>();
                    HashSet<org.xmlsoap.schemas.easyWsdl.tPort>.Enumerator it2 = service.port.GetEnumerator();
                    while (it2.MoveNext())
                    {
                        bindingTemplate bindingTemplate = createWSDLBinding(serviceQName, (String)it2.Current.name, serviceUrl, wsdlDefinition);
                        bts.Add(bindingTemplate);
                    }
                    businessService.bindingTemplates = bts.ToArray();
                }
                businessServices.Add(businessService);
            }

            return businessServices.ToArray();
        }

        ///
        ///
        /// Creates a UDDI Business Service.
        ///
        ///
        /// <param name="serviceQName"></param>
        /// <param name="wsdlDefinition"></param>
        /// <returns></returns>
        private businessService createBusinessService(QName serviceQName, xmlsoap.schemas.easyWsdl.tDefinitions wsdlDefinition)
        {

            log.debug("Constructing Service UDDI Information for " + serviceQName);
            businessService service = new businessService();
            // BusinessKey
            service.businessKey = (businessKey);
            // ServiceKey
            service.serviceKey = (UDDIKeyConvention.getServiceKey(properties, serviceQName.getLocalPart()));
            // Description
            String serviceDescription = "";
            // Override with the service description from the WSDL if present
            org.xmlsoap.schemas.easyWsdl.tService svc = wsdlDefinition.getService(serviceQName);
            if (svc != null && svc.documentation != null)
            {
                HashSet<XmlNode>.Enumerator it = svc.documentation.Any.GetEnumerator();
                while (it.MoveNext())
                {

                    if (it.Current.Value != null)
                    {
                        serviceDescription += it.Current.Value;
                    }
                }

            }
            if (String.IsNullOrEmpty(serviceDescription))
            {
                serviceDescription = properties.getProperty(Property.SERVICE_DESCRIPTION, Property.DEFAULT_SERVICE_DESCRIPTION);
            }

            service.description = Common2UDDI.mapdescription(serviceDescription, lang).ToArray();
            // Service name
            name sName = new name();
            sName.lang = (lang);
            sName.Value = (serviceQName.getLocalPart());
            service.name = new name[] { sName };

            categoryBag categoryBag = new categoryBag();

            String ns = serviceQName.getNamespaceURI();
            List<keyedReference> cbitems = new List<keyedReference>();
            if (ns != null && ns != "")
            {
                keyedReference namespaceReference = newKeyedReference(
                        "uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", ns);
                cbitems.Add(namespaceReference);
            }

            keyedReference serviceReference = newKeyedReference(
                    "uddi:uddi.org:wsdl:types", "uddi-org:wsdl:types", "service");
            cbitems.Add(serviceReference);

            keyedReference localNameReference = newKeyedReference(
                    "uddi:uddi.org:xml:localname", "uddi-org:xml:localName", serviceQName.getLocalPart());
            cbitems.Add(localNameReference);
            categoryBag.Items = (object[])cbitems.ToArray();
            service.categoryBag = categoryBag;

            return service;
        }

        private bindingTemplate createWSDLBinding(QName serviceQName, string portName, Uri serviceUrl, xmlsoap.schemas.easyWsdl.tDefinitions wsdlDefinition)
        {
            bindingTemplate bindingTemplate = new bindingTemplate();
            // Set BusinessService Key
            bindingTemplate.serviceKey = (UDDIKeyConvention.getServiceKey(properties, serviceQName.getLocalPart()));

            if (serviceUrl != null)
            {
                // Set AccessPoint
                accessPoint accessPoint = new accessPoint();
                accessPoint.useType = (AccessPointType.endPoint.ToString());
                accessPoint.Value = (urlLocalizer.rewrite(serviceUrl));
                bindingTemplate.Item = (accessPoint);
                // Set Binding Key
                String bindingKey = UDDIKeyConvention.getBindingKey(properties, serviceQName, portName, serviceUrl);
                bindingTemplate.bindingKey = (bindingKey);
            }

            org.xmlsoap.schemas.easyWsdl.tService service = wsdlDefinition.getService(serviceQName);
            if (service != null)
            {
                List<tModelInstanceInfo> tii = new List<tModelInstanceInfo>();

                org.xmlsoap.schemas.easyWsdl.tPort port = service.getPort(portName);
                if (port != null)
                {
                    if (serviceUrl == null)
                    {
                        if (port.Any != null)
                        {
                            HashSet<XmlElement>.Enumerator it = port.Any.GetEnumerator();
                            while (it.MoveNext())
                            {
                                String location = null;
                                if (it.Current.LocalName.Equals("address", StringComparison.CurrentCultureIgnoreCase) &&
                                    it.Current.NamespaceURI.Equals("http://schemas.xmlsoap.org/wsdl/soap/", StringComparison.CurrentCultureIgnoreCase))
                                {

                                    location = it.Current.GetAttribute("location");
                                }
                                else
                                    if (it.Current.LocalName.Equals("address", StringComparison.CurrentCultureIgnoreCase) &&
                                    it.Current.NamespaceURI.Equals("http://schemas.xmlsoap.org/wsdl/http/", StringComparison.CurrentCultureIgnoreCase))
                                    {
                                        location = it.Current.GetAttribute("location");
                                    }
                                    else

                                        if (it.Current.LocalName.Equals("address", StringComparison.CurrentCultureIgnoreCase) &&
                                    it.Current.NamespaceURI.Equals("http://schemas.xmlsoap.org/wsdl/soap12/", StringComparison.CurrentCultureIgnoreCase))
                                        {
                                            location = it.Current.GetAttribute("location");
                                        }
                                if (location != null)
                                {
                                    try
                                    {
                                        Uri locationURI = new Uri(location);
                                        accessPoint accessPoint = new accessPoint();
                                        accessPoint.useType = (AccessPointType.endPoint.ToString());
                                        accessPoint.Value = (urlLocalizer.rewrite(locationURI));
                                        bindingTemplate.Item = (accessPoint);
                                        // Set Binding Key
                                        String bindingKey = UDDIKeyConvention.getBindingKey(properties, serviceQName, portName, locationURI);
                                        bindingTemplate.bindingKey = (bindingKey);
                                        break;
                                    }
                                    catch (Exception e)
                                    {
                                        log.error("", e);
                                    }
                                }
                            }
                        }

                    }
                    XmlQualifiedName bx = port.binding;
                    org.xmlsoap.schemas.easyWsdl.tBinding bindingelement = wsdlDefinition.getBinding(bx);
                    // Set the Binding Description
                    String bindingDescription = "";
                    // Override with the service description from the WSDL if present

                    if (bindingelement != null && bindingelement.documentation != null
                        && bindingelement.documentation.Any != null)
                    {
                        HashSet<XmlNode>.Enumerator it = bindingelement.documentation.Any.GetEnumerator();
                        while (it.MoveNext())
                        {
                            bindingDescription += it.Current.Value;
                        }
                    }
                    if (String.IsNullOrEmpty(bindingDescription))
                        bindingDescription = properties.getProperty(Property.BINDING_DESCRIPTION, Property.DEFAULT_BINDING_DESCRIPTION); ;

                    bindingTemplate.description = Common2UDDI.mapdescription(bindingDescription, lang).ToArray();

                    // reference wsdl:binding tModel
                    tModelInstanceInfo tModelInstanceInfoBinding = new tModelInstanceInfo();
                    tModelInstanceInfoBinding.tModelKey = (keyDomainURI + bindingelement.name);
                    instanceDetails instanceDetails = new instanceDetails();
                    instanceDetails.instanceParms = (portName);
                    tModelInstanceInfoBinding.instanceDetails = (instanceDetails);

                    tModelInstanceInfoBinding.description = Common2UDDI.mapdescription("The wsdl:binding that this wsdl:port implements. " + bindingDescription
                            + " The instanceParms specifies the port local name.", lang).ToArray();
                    tii.Add(tModelInstanceInfoBinding);

                    // reference wsdl:portType tModel
                    org.xmlsoap.schemas.easyWsdl.tPortType portType = wsdlDefinition.getPortType(bindingelement.type);
                    tModelInstanceInfo tModelInstanceInfoPortType = new tModelInstanceInfo();
                    tModelInstanceInfoPortType.tModelKey = (keyDomainURI + portType.name);
                    String portTypeDescription = "";
                    if (portType.documentation != null && portType.documentation.Any != null)
                    {
                        HashSet<XmlNode>.Enumerator it = portType.documentation.Any.GetEnumerator();
                        while (it.MoveNext())
                        {
                            portTypeDescription += it.Current.Value;
                        }
                    }

                    tModelInstanceInfoPortType.description = Common2UDDI.mapdescription("The wsdl:portType that this wsdl:port implements." + portTypeDescription,lang).ToArray();
                    tii.Add(tModelInstanceInfoPortType);

                    bindingTemplate.tModelInstanceDetails = tii.ToArray();
                }
                else
                {
                    log.error("Could not find Port with portName: " + portName);
                }
            }
            else
            {
                log.error("Could not find Service with serviceName: " + serviceQName.getLocalPart());
            }

            return bindingTemplate;
        }

        ///
        ///
        /// <h3>2.4.1 wsdl:portType -> uddi:tModel</h3>
        ///
        /// <p>A wsdl:portType MUST be modeled as a uddi:tModel.</p>
        ///
        /// <p>The minimum information that must be captured about a portType is its
        /// entity type, its local name, its namespace, and the location of the WSDL
        /// document that defines the portType. Capturing the entity type enables
        /// users to search for tModels that represent portType artifacts. Capturing
        /// the local name, namespace, and WSDL location enables users to locate the
        /// definition of the specified portType artifact.</p>
        ///
        /// <p>The wsdl:portType information is captured as follows:</p>
        ///
        /// <p>The uddi:name element of the tModel MUST be the value of the name
        /// attribute of the wsdl:portType.</p>
        ///
        /// <p>The tModel MUST contain a categoryBag, and the categoryBag MUST
        /// contain a keyedReference with a tModelKey of the WSDL Entity Type
        /// category system and a keyValue of "portType".</p>
        ///
        /// <p>If the wsdl:portType has a targetNamespace then the categoryBag MUST
        /// also contain an additional keyedReference with a tModelKey of the XML
        /// Namespace category system and a keyValue of the target namespace of the
        /// wsdl:definitions element that contains the wsdl:portType. If the
        /// targetNamespace is absent from the portType, a categoryBag MUST NOT
        /// contain a keyedReference to the XML Namespace category system.</p>
        ///
        /// <p>The tModel MUST contain an overviewDoc with an overviewURL containing
        /// the location of the WSDL document that describes the wsdl:portType.</p>
        /// Example Code
        /// <pre>
        /// URL url = new URL("http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl");
        /// String domain = url.getHost();
        /// ReadWSDL rw = new ReadWSDL();
        /// Definition wsdlDefinition = rw.readWSDL(url);
        /// properties.put("keyDomain", domain);
        /// properties.put("businessName", domain);
        /// properties.put("serverName", url.getHost());
        /// properties.put("serverPort", url.getPort());
        /// wsdlURL = wsdlDefinition.getDocumentBaseURI();
        /// WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(null, new URLLocalizerDefaultImpl(), properties);
        /// Map<QName, PortType> portTypes = (Map<QName, PortType>) wsdlDefinition.getAllPortTypes();
        /// Set<TModel> portTypeTModels = wsdl2UDDI.createWSDLPortTypeTModels(wsdlURL, portTypes);
        /// </pre>
        ///
        ///
        /// <param name="wsdlURL">This is used to set the Overview URL</param>
        /// <param name="portTypes">Map</param>
        /// <returns>set of WSDL PortType tModels</returns>
        /// <exception cref="Exception"></exception>

        public List<tModel> createWSDLPortTypeTModels(string wsdlURL, Dictionary<QName, xmlsoap.schemas.easyWsdl.tPortType> portTypes)
        {
            List<tModel> tModels = new List<tModel>();
            Dictionary<QName, xmlsoap.schemas.easyWsdl.tPortType>.Enumerator it = portTypes.GetEnumerator();
            while (it.MoveNext())
            {
                QName qName = it.Current.Key;
                tModel tModel = new tModel();
                String localpart = qName.getLocalPart();
                String ns = qName.getNamespaceURI();
                // Set the Key
                tModel.tModelKey = (keyDomainURI + localpart);

                // Set the Name. The uddi:name element of the tModel MUST be the value of
                // the name attribute of the wsdl:portType.
                name name = new name();
                name.lang = (lang);
                name.Value = (localpart);
                tModel.name = (name);
                // Set the OverviewURL. The tModel MUST contain an overviewDoc with an
                // overviewURL containing the location of the WSDL document that
                // describes the wsdl:portType.
                overviewURL overviewURL = new overviewURL();
                overviewURL.useType = (AccessPointType.wsdlDeployment.ToString());
                overviewURL.Value = (wsdlURL);
                overviewDoc overviewDoc = new overviewDoc();
                overviewDoc.overviewURLs = new overviewURL[] { (overviewURL) };
                tModel.overviewDoc = new overviewDoc[] { (overviewDoc) };
                // Create the categoryBag, The tModel MUST contain a categoryBag
                categoryBag categoryBag = new categoryBag();

                List<keyedReference> cbitems = new List<keyedReference>();
                // the categoryBag MUST contain a keyedReference with a tModelKey of the WSDL
                // Entity Type category system and a keyValue of "portType".
                keyedReference typesReference = newKeyedReference(
                        "uddi:uddi.org:wsdl:types", "uddi-org:wsdl:types", "portType");
                cbitems.Add(typesReference);

                // If the wsdl:portType has a targetNamespace then the categoryBag MUST also contain an
                // additional keyedReference with a tModelKey of the XML Namespace category system and a
                // keyValue of the target namespace of the wsdl:definitions element that contains the
                // wsdl:portType. If the targetNamespace is absent from the portType, a categoryBag
                // MUST NOT contain a keyedReference to the XML Namespace category system.
                if (ns != null && !"".Equals(ns))
                {
                    keyedReference namespaceReference = newKeyedReference(
                            "uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", ns);
                    cbitems.Add(namespaceReference);
                }

                categoryBag.Items = (object[])cbitems.ToArray();
                tModel.categoryBag = categoryBag;

                tModels.Add(tModel);

            }
            return tModels;

        }

        static Log log = LogFactory.getLog(typeof(WSDL2UDDI));

        ///
        ///
        /// <h3>2.4.1 wsdl:portType -> uddi:tModel</h3>
        ///
        /// <p>A wsdl:portType MUST be modeled as a uddi:tModel.</p>
        ///
        /// <p>The minimum information that must be captured about a portType is its
        /// entity type, its local name, its namespace, and the location of the WSDL
        /// document that defines the portType. Capturing the entity type enables
        /// users to search for tModels that represent portType artifacts. Capturing
        /// the local name, namespace, and WSDL location enables users to locate the
        /// definition of the specified portType artifact.</p>
        ///
        /// <p>The wsdl:portType information is captured as follows:</p>
        ///
        /// <p>The uddi:name element of the tModel MUST be the value of the name
        /// attribute of the wsdl:portType.</p>
        ///
        /// <p>The tModel MUST contain a categoryBag, and the categoryBag MUST
        /// contain a keyedReference with a tModelKey of the WSDL Entity Type
        /// category system and a keyValue of "portType".</p>
        ///
        /// <p>If the wsdl:portType has a targetNamespace then the categoryBag MUST
        /// also contain an additional keyedReference with a tModelKey of the XML
        /// Namespace category system and a keyValue of the target namespace of the
        /// wsdl:definitions element that contains the wsdl:portType. If the
        /// targetNamespace is absent from the portType, a categoryBag MUST NOT
        /// contain a keyedReference to the XML Namespace category system.</p>
        ///
        /// <p>The tModel MUST contain an overviewDoc with an overviewURL containing
        /// the location of the WSDL document that describes the wsdl:portType.</p>
        /// Example Code
        /// <pre>
        /// URL url = new URL("http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl");
        /// String domain = url.getHost();
        /// ReadWSDL rw = new ReadWSDL();
        /// Definition wsdlDefinition = rw.readWSDL(url);
        /// properties.put("keyDomain", domain);
        /// properties.put("businessName", domain);
        /// properties.put("serverName", url.getHost());
        /// properties.put("serverPort", url.getPort());
        /// wsdlURL = wsdlDefinition.getDocumentBaseURI();
        /// WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(null, new URLLocalizerDefaultImpl(), properties);
        /// Map<QName, PortType> portTypes = (Map<QName, PortType>) wsdlDefinition.getAllPortTypes();
        /// Set<TModel> portTypeTModels = wsdl2UDDI.createWSDLPortTypeTModels(wsdlURL, portTypes);
        /// </pre>
        ///
        ///
        /// <param name="wsdlURL">This is used to set the Overview URL</param>
        /// <param name="portType">Map</param>
        /// @return set of WSDL PortType tModels
        /// <exception cref="Exception"></exception>

        public List<tModel> createWSDLBindingTModels(string wsdlURL, Dictionary<QName, xmlsoap.schemas.easyWsdl.tBinding> bindings)
        {
            List<tModel> tModels = new List<tModel>();
            Dictionary<QName, xmlsoap.schemas.easyWsdl.tBinding>.Enumerator it = bindings.GetEnumerator();
            while (it.MoveNext())
            {
                QName qName = it.Current.Key;
                String localpart = qName.getLocalPart();
                String ns = qName.getNamespaceURI();
                // Build the tModel
                tModel tModel = new tModel();
                // Set the Key
                tModel.tModelKey = (keyDomainURI + localpart);
                // Set the Name
                name name = new name();
                name.lang = (lang);
                name.Value = (localpart);
                tModel.name = (name);
                // Set the OverviewURL
                overviewURL overviewURL = new overviewURL();
                overviewURL.useType = (AccessPointType.wsdlDeployment.ToString());
                overviewURL.Value = (wsdlURL);
                overviewDoc overviewDoc = new overviewDoc();
                overviewDoc.overviewURLs = new overviewURL[] { (overviewURL) };
                tModel.overviewDoc = new overviewDoc[] { (overviewDoc) };
                // Set the categoryBag
                categoryBag categoryBag = new categoryBag();

                List<keyedReference> cbitems = new List<keyedReference>();
                if (ns != null && !"".Equals(ns))
                {
                    // A keyedReference with a tModelKey of the WSDL Entity Type category system and a keyValue of "binding".
                    keyedReference namespaceReference = newKeyedReference(
                            "uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", ns);
                    cbitems.Add(namespaceReference);
                }

                // A keyedReference with a tModelKey of the WSDL Entity Type category system and a keyValue of "binding".
                keyedReference typesReference = newKeyedReference(
                        "uddi:uddi.org:wsdl:types", "uddi-org:wsdl:types", "binding");
                cbitems.Add(typesReference);

                // A keyedReference with a tModelKey of the WSDL portType Reference category system and a keyValue
                // of the tModelKey that models the wsdl:portType to which the wsdl:binding relates.

                org.xmlsoap.schemas.easyWsdl.tBinding binding = bindings[(qName)];
                String portTypeKey = keyDomainURI + binding.type.Name;
                keyedReference namespaceReference2 = newKeyedReference(
                        "uddi:uddi.org:wsdl:porttypereference", "uddi-org:wsdl:portTypeReference",
                        portTypeKey);
                cbitems.Add(namespaceReference2);

                //  A keyedReference with a tModelKey of the UDDI Types category system and a keyValue of
                // "wsdlSpec" for backward compatibility.
                keyedReference typesReferenceBackwardsCompatible = newKeyedReference(
                        "uddi:uddi.org:categorization:types", "uddi-org:types", "wsdlSpec");
                cbitems.Add(typesReferenceBackwardsCompatible);

                // One or two keyedReferences as required to capture the protocol
                foreach (XmlElement xe in binding.Any)
                {

                    if (xe.NamespaceURI.Equals("http://schemas.xmlsoap.org/wsdl/soap/", StringComparison.CurrentCultureIgnoreCase)
                        && xe.LocalName.Equals("binding", StringComparison.CurrentCultureIgnoreCase))
                    {

                        // If the wsdl:binding contains a soap:binding extensibility element from the
                        // 'http://schemas.xmlsoap.org/wsdl/soap/' namespace then the categoryBag MUST
                        //include a keyedReference with a tModelKey of the Protocol Categorization
                        // category system and a keyValue of the tModelKey of the SOAP Protocol tModel.

                        keyedReference soapProtocol = newKeyedReference(
                                "uddi:uddi.org:wsdl:categorization:protocol", "uddi-org:protocol:soap", "uddi:uddi.org:protocol:soap");
                        cbitems.Add(soapProtocol);
                        // If the value of the transport attribute of the soap:binding element
                        // is 'http://schemas.xmlsoap.org/soap/http' then the categoryBag MUST
                        // include a keyedReference with a tModelKey of the Transport Categorization
                        // category system and a keyValue of the tModelKey of the HTTP Transport tModel.

                        if (String.IsNullOrEmpty(xe.GetAttribute("transport")))
                        {
                            // TODO If the value of the transport attribute is anything else,
                            // then the bindingTemplate MUST include an additional keyedReference with a tModelKey
                            // of the Transport Categorization category system and a keyValue of the tModelKey of
                            // an appropriate transport tModel.
                            log.warn("empty soap transport for binding " + it.Current.Key.getLocalPart() + " " + it.Current.Key.getNamespaceURI());
                        }
                        else
                        {
                            String attr = xe.GetAttribute("transport");

                            if (attr != null && attr.Equals("http://schemas.xmlsoap.org/soap/http"))
                            {
                                keyedReference httpTransport = newKeyedReference(
                                       "uddi:uddi.org:wsdl:categorization:transport", "uddi-org:http", "uddi:uddi.org:transport:http");
                                cbitems.Add(httpTransport);
                            }
                            else
                            {
                                log.warn("i don't know how to process the soap transport value of " + xe.GetAttribute("transport", "http://schemas.xmlsoap.org/wsdl/soap/"));
                            }
                        }
                    }
                    else if (xe.NamespaceURI.Equals("http://schemas.xmlsoap.org/wsdl/http/", StringComparison.CurrentCultureIgnoreCase)
                      && xe.LocalName.Equals("binding", StringComparison.CurrentCultureIgnoreCase))
                    {

                        // If the wsdl:binding contains an http:binding extensibility element from the
                        // http://schemas.xmlsoap.org/wsdl/http/ namespace then the categoryBag MUST
                        // include a keyedReference with a tModelKey of the Protocol Categorization
                        // category system and a keyValue of the tModelKey of the HTTP Protocol tModel.
                        keyedReference soapProtocol = newKeyedReference(
                                "uddi:uddi.org:wsdl:categorization:protocol", "uddi-org:protocol:http", "uddi:uddi.org:protocol:http");
                        cbitems.Add(soapProtocol);
                    }
                    else if (xe.NamespaceURI.Equals("http://schemas.xmlsoap.org/wsdl/soap12/", StringComparison.CurrentCultureIgnoreCase)
                        && xe.LocalName.Equals("binding", StringComparison.CurrentCultureIgnoreCase))
                    {
                        // If the wsdl:binding contains a soap:binding extensibility element from the
                        // 'http://schemas.xmlsoap.org/wsdl/soap/' namespace then the categoryBag MUST
                        //include a keyedReference with a tModelKey of the Protocol Categorization
                        // category system and a keyValue of the tModelKey of the SOAP Protocol tModel.

                        keyedReference soapProtocol = newKeyedReference(
                                "uddi:uddi.org:wsdl:categorization:protocol", "uddi-org:protocol:soap", "uddi:uddi.org:protocol:soap");
                        cbitems.Add(soapProtocol);
                        // If the value of the transport attribute of the soap:binding element
                        // is 'http://schemas.xmlsoap.org/soap/http' then the categoryBag MUST
                        // include a keyedReference with a tModelKey of the Transport Categorization
                        // category system and a keyValue of the tModelKey of the HTTP Transport tModel.

                        if (String.IsNullOrEmpty(xe.GetAttribute("transport")))
                        {
                            // TODO If the value of the transport attribute is anything else,
                            // then the bindingTemplate MUST include an additional keyedReference with a tModelKey
                            // of the Transport Categorization category system and a keyValue of the tModelKey of
                            // an appropriate transport tModel.
                            log.warn("empty soap transport for binding " + it.Current.Key.getLocalPart() + " " + it.Current.Key.getNamespaceURI());
                        }
                        else
                        {
                            String attr = xe.GetAttribute("transport");

                            if (attr != null && attr.Equals("http://schemas.xmlsoap.org/soap/http"))
                            {
                                keyedReference httpTransport = newKeyedReference(
                                       "uddi:uddi.org:wsdl:categorization:transport", "uddi-org:http", "uddi:uddi.org:transport:http");
                                cbitems.Add(httpTransport);
                            }
                            else
                            {
                                log.warn("i don't know how to process the soap transport value of " + xe.GetAttribute("transport", "http://schemas.xmlsoap.org/wsdl/soap/"));
                            }
                        }
                    }
                    else
                    {
                        log.warn("Unrecongnized binding type: " + xe.NamespaceURI + " " + xe.LocalName + ". Generated"
                            + "binding tModel may be missing the required (according to WSDL2UDDI spec) "
                            + "uddi:uddi.org:wsdl:categorization:protocol keyedReference.");
                    }
                }

                categoryBag = new uddi.apiv3.categoryBag();
                categoryBag.Items = cbitems.ToArray();
                tModel.categoryBag = categoryBag;
                tModels.Add(tModel);
            }
            return tModels;
        }
    }

    ///
    /// Information about a web service, a WSDL Parser
    /// Supports imported WSDL's
    ///
    public class ReadWSDL
    {
        bool ignoressl = false;
        public bool ignoreSSLErrors
        {
            get { return ignoressl; }
            set { ignoressl = value; }
        }

        ///
        /// Parses a WSDL. Note all exceptions are returned to the caller, including transport
        /// IO and parsing errors
        ///
        /// <param name="file">the file path or URL to the WSDL</param>
        /// <returns></returns>
        /// <throws>ArgumentNullException if file is null</throws>
        public org.xmlsoap.schemas.easyWsdl.tDefinitions readWSDL(String file)
        {
            if (file == null)
                throw new ArgumentNullException();
            org.xmlsoap.schemas.easyWsdl.tDefinitions wsdl = getWsdl(file);
            return wsdl;
        }

        org.xmlsoap.schemas.easyWsdl.tDefinitions getWsdl(String url)
        {
            org.xmlsoap.schemas.tDefinitions imported = null;
            //read it
            if (url.StartsWith("http", StringComparison.CurrentCultureIgnoreCase))
            {
                if (url.StartsWith("https", StringComparison.CurrentCultureIgnoreCase) && ignoressl)
                {
                    ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
                }
                WebClient c = new WebClient();
                if (url.StartsWith("https", StringComparison.CurrentCultureIgnoreCase) && ignoressl)
                    ServicePointManager.ServerCertificateValidationCallback = null;
                String s = c.DownloadString(url);
                StringReader sr = new StringReader(s);
                XmlSerializer xs = new XmlSerializer(typeof(org.xmlsoap.schemas.tDefinitions));
                imported = (org.xmlsoap.schemas.tDefinitions)xs.Deserialize(sr);
                c.Dispose();
            }
            else
            {
                //serialize it
                StringReader sr = new StringReader(File.ReadAllText(url));
                XmlSerializer xs = new XmlSerializer(typeof(org.xmlsoap.schemas.tDefinitions));
                imported = (org.xmlsoap.schemas.tDefinitions)xs.Deserialize(sr);
            }

            //convert it

            org.xmlsoap.schemas.easyWsdl.tDefinitions defs = ConvertTo.toEasyWsdl(imported);
            HashSet<org.xmlsoap.schemas.easyWsdl.tImport>.Enumerator it = defs.import.GetEnumerator();
            while (it.MoveNext())
            {
                if (it.Current.location.EndsWith(".xsd", StringComparison.CurrentCultureIgnoreCase))
                    continue;
                org.xmlsoap.schemas.easyWsdl.tDefinitions xi = null;
                if (!it.Current.location.StartsWith("http"))
                {
                    String temp = url.Substring(0, url.LastIndexOf(Path.DirectorySeparatorChar)) + Path.DirectorySeparatorChar + (it.Current.location);
                    xi = getWsdl(temp);
                }
                else
                    xi = getWsdl(it.Current.location);

                //merge import stuff into our main
                HashSet<XmlElement>.Enumerator it2 = xi.Any.GetEnumerator();
                while (it2.MoveNext())
                {
                    defs.Any.Add(it2.Current);
                }
                HashSet<org.xmlsoap.schemas.easyWsdl.tBinding>.Enumerator it3 = xi.binding.GetEnumerator();
                while (it3.MoveNext())
                {
                    defs.binding.Add(it3.Current);
                }

                if (defs.documentation == null)
                    defs.documentation = new xmlsoap.schemas.easyWsdl.tDocumentation();
                if (defs.documentation.Any == null)
                    defs.documentation.Any = new HashSet<System.Xml.XmlNode>();

                HashSet<XmlNode>.Enumerator it4 = xi.documentation.Any.GetEnumerator();
                while (it4.MoveNext())
                {
                    defs.documentation.Any.Add(it4.Current);
                }

                HashSet<org.xmlsoap.schemas.easyWsdl.tMessage>.Enumerator it5 = xi.message.GetEnumerator();
                while (it5.MoveNext())
                {

                    defs.message.Add(it5.Current);
                }

                HashSet<org.xmlsoap.schemas.easyWsdl.tPortType>.Enumerator it6 = xi.portType.GetEnumerator();
                while (it6.MoveNext())
                {
                    defs.portType.Add(it6.Current);
                }

                HashSet<org.xmlsoap.schemas.easyWsdl.tService>.Enumerator it7 = xi.service.GetEnumerator();
                while (it7.MoveNext())
                {
                    defs.service.Add(it7.Current);
                }

                HashSet<org.xmlsoap.schemas.easyWsdl.tTypes>.Enumerator it8 = xi.types.GetEnumerator();
                while (it8.MoveNext())
                {
                    defs.types.Add(it8.Current);
                }

            }

            return defs;

        }

        public void setIgnoreSSLErrors(bool p)
        {
            ignoressl = p;
        }
    }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Items
{
    public class GSM
    {
        public static GSM IPhone4S = new GSM("IPhone4s", "Apple", 1000, null, new GsmBattery("AAA", 20.5, 5.5), new GsmDisplay(5, 16000000000));

        private string model;
        private string manufacturer;
        private decimal? price;
        private string owner;
        private List<GsmCall> callHistory;

        public string Model
        {
            get
            {
                return this.model;
            }
            set
            {
                if (string.IsNullOrWhiteSpace(value))
                {
                    throw new ArgumentException("Model cannot be empty, null or whitespace!");
                }

                this.model = value;
            }
        }

        public string Manufacturer
        {
            get
            {
                return this.manufacturer;
            }
            set
            {
                if (string.IsNullOrWhiteSpace(value))
                {
                    throw new ArgumentException("Manufacturer cannot be empty, null or whitespace!");
                }

                this.manufacturer = value;
            }
        }

        public decimal? Price
        {
            get
            {
                return this.price;
            }
            set
            {
                if (value <= 0)
                {
                    throw new ArgumentException("Price must be greater than zero!");
                }

                this.price = value;
            }
        }

        public string Owner
        {
            get
            {
                return this.owner;
            }
            set
            {
                if (IsStringEmptyOrWhitespace(value))
                {
                    throw new ArgumentException("Owner cannot be empty, null or whitespace!");
                }

                this.owner = value;
            }
        }

        public List<GsmCall> CallHistory
        {
            get
            {
                return this.callHistory;
            }
            private set
            {
                this.callHistory = value;
            }
        }

        public GsmBattery Battery { get; set; }

        public GsmDisplay Display { get; set; }

        public GSM(string model, string manufacturer, decimal? price, string owner, GsmBattery battery, GsmDisplay display)
        {
            this.Model = model;
            this.Manufacturer = manufacturer;
            this.Price = price;
            this.Owner = owner;
            this.Battery = battery;
            this.Display = display;
            this.CallHistory = new List<GsmCall>();
        }

        public GSM(string model, string manufacturer, decimal? price, string owner, GsmBattery battery)
            : this(model, manufacturer, price, owner, battery, null)
        { }

        public GSM(string model, string manufacturer, decimal? price, string owner)
            : this(model, manufacturer, price, owner, null, null)
        { }

        public GSM(string model, string manufacturer, decimal? price)
            : this(model, manufacturer, price, null, null, null)
        { }

        public GSM(string model, string manufacturer)
            : this(model, manufacturer, null, null, null, null)
        { }

        public void AddCall(GsmCall call)
        {
            this.CallHistory.Add(call);
        }

        public void DeleteCall(GsmCall call)
        {
            this.CallHistory.Remove(call);
        }

        public void ClearCallHistory()
        {
            this.CallHistory = new List<GsmCall>();
        }

        public decimal CalculateCallsPrice(decimal pricePerMinute)
        {
            decimal totalSeconds = 0;

            foreach (var call in CallHistory)
            {
                totalSeconds += call.Duration;
            }

            return totalSeconds / 60 * pricePerMinute;
        }

        public override string ToString()
        {
            StringBuilder result = new StringBuilder();

            result.AppendLine(string.Format("Model: {0}", this.Model));
            result.AppendLine(string.Format("Manufacturer: {0}", this.Manufacturer));
            result.AppendLine(string.Format("Price: {0}", this.Price));
            result.AppendLine(string.Format("Owner: {0}", this.Owner));
            result.AppendLine(string.Format("Battery:\n{0}", this.Battery));
            result.AppendLine(string.Format("Display:\n{0}", this.Display));

            return result.ToString();
        }

                private bool IsStringEmptyOrWhitespace(string value)
        {
            if ((value != null) && ((value.Length == 0) || value.All(x => x == ' ')))
            {
                return true;
            }

            return false;
        }
    }
}


text:
package com.linecorp.armeria.server.docs;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.List;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;

import org.junit.jupiter.api.Test;

import com.google.common.collect.ImmutableList;

import com.linecorp.armeria.common.HttpMethod;
import com.linecorp.armeria.common.MediaType;

class ServiceInfoTest {

    private static MethodInfo createMethodInfo(String methodName, HttpMethod method,
                                               String endpointPathMapping) {
        final EndpointInfo endpoint = EndpointInfo.builder("*", endpointPathMapping)
                .availableMimeTypes(MediaType.JSON_UTF_8).build();
        return new MethodInfo(methodName, TypeSignature.ofBase("T"), ImmutableList.of(), ImmutableList.of(),
                              ImmutableList.of(endpoint), method, DescriptionInfo.empty());
    }

    @Test
    void testCollectMethodsWithDifferentMethods() {
        final MethodInfo barMethodInfo = createMethodInfo("bar", HttpMethod.GET, "exact:/bar");
        final MethodInfo fooMethodInfo = createMethodInfo("foo", HttpMethod.GET, "exact:/foo");
        final List<MethodInfo> inputMethodInfos = ImmutableList.of(barMethodInfo, fooMethodInfo);
        assertThat(ServiceInfo.mergeEndpoints(inputMethodInfos)).isEqualTo(inputMethodInfos);
    }

    @Test
    void testCollectMethodGrouping() {

        final MethodInfo barGet1 = createMethodInfo("bar", HttpMethod.GET, "exact:/bar1");
        final MethodInfo barGet2 = createMethodInfo("bar", HttpMethod.GET, "exact:/bar2");
        final MethodInfo barPost3 = createMethodInfo("bar", HttpMethod.POST, "exact:/bar3");
        final MethodInfo barPost4 = createMethodInfo("bar", HttpMethod.POST, "exact:/bar4");
        final MethodInfo fooGet1 = createMethodInfo("foo", HttpMethod.GET, "exact:/foo1");
        final MethodInfo fooGet2 = createMethodInfo("foo", HttpMethod.GET, "exact:/foo2");
        final MethodInfo fooPost3 = createMethodInfo("foo", HttpMethod.POST, "exact:/foo3");
        final MethodInfo fooPost4 = createMethodInfo("foo", HttpMethod.POST, "exact:/foo4");

        final List<MethodInfo> inputMethodInfos = ImmutableList.of(barGet1, barGet2, barPost3, barPost4,
                                                                   fooGet1, fooGet2, fooPost3, fooPost4);
        final List<MethodInfo> collectMethods =
                ImmutableList.copyOf(ServiceInfo.mergeEndpoints(inputMethodInfos));

        assertThat(collectMethods).hasSize(4);

        final Function<MethodInfo, Set<String>> getPaths = methodInfo ->
                methodInfo.endpoints().stream().map(EndpointInfo::pathMapping).collect(Collectors.toSet());
        assertThat(getPaths.apply(collectMethods.get(0))).containsExactly("exact:/bar1", "exact:/bar2");
        assertThat(getPaths.apply(collectMethods.get(1))).containsExactly("exact:/bar3", "exact:/bar4");
        assertThat(getPaths.apply(collectMethods.get(2))).containsExactly("exact:/foo1", "exact:/foo2");
        assertThat(getPaths.apply(collectMethods.get(3))).containsExactly("exact:/foo3", "exact:/foo4");
    }
}