nesper: how to see audit information - nesper

When you use the #Audit annotation in a sentence how / where can I find the #audit information in nesper?
I have configured
Configuration config = new Configuration();
config.EngineDefaults.ExecutionConfig.IsPrioritized = true;
config.EngineDefaults.LoggingConfig.IsEnableExecutionDebug = true;
config.EngineDefaults.LoggingConfig.IsEnableTimerDebug = true;
config.EngineDefaults.LoggingConfig.IsEnableQueryPlan= true;
And I use the Log to write the rest of information.
private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
But I don't see anything.
I have tried with esper and java, and I see de information.
There is any example?
Thanks in advance,

Related

In Current Project i am using this syntax to retrieve data from Dynamic CRM

please help with this below code to change to oauth
// Create Server Configuration
ServerConnection.Configuration config = new ServerConnection.Configuration();
config.ServerAddress = serverAddress;
config.DiscoveryUri = new Uri(String.Format("xxx", config.ServerAddress));
config.OrganizationName = organizationName;
config.OrganizationUri = new Uri(String.Format("xxx", config.ServerAddress));
config.Credentials = credentials;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
crmServiceClient = new CrmServiceClient('xxx', credentials);
//dynamicsServiceProxy = ServerConnection.GetOrganizationProxy(config);
//dynamicsServiceProxy.EnableProxyTypes();
crmServiceClient.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new
ProxyTypesBehavior(Assembly.GetExecutingAssembly()));
Any one please help me what changes i need to do?
I have Read this article but how to replace IOrganizationService in code?

Get the total mapping and reducing times in hadoop programmatically

I am trying to calculate the individual total times of Mapping, Shuffling and Reducing by all tasks in my MR code.
I need help retrieving that information for each MapReduce Job.
Can someone post any code snippet that does that calculation?
You need to use the JobClient API as shown below:
There are however some quirks to the API. Try it let me know i will help you out.
JobClient client = null;
Configuration configuration = new Configuration();
configuration.set("mapred.job.tracker", jobTrackerURL);
client = new JobClient(new JobConf(configuration));
while (true) {
List<JobStatus> jobEntries = getTrackerEntries(jobName,
client);
for (JobStatus jobStatus : jobEntries) {
JobID jobId = jobStatus.getJobID();
String trackerJobName = client.getJob(jobId)
.getJobName();
TaskReport[] mapReports = client
.getMapTaskReports(jobId);
TaskReport[] reduceReports = client
.getReduceTaskReports(jobId);
client.getJob(jobId).getJobStatus().getStartTime();
int jobMapper = mapReports.length;
mapNumber = +jobMapper;
int jobReducers = reduceReports.length;
reduceNumber = +jobReducers;
}
}

job information not found in JobContext

I am running a Java program on a remote computer and trying to read the split data using RecordReader object but instead getting:
Exception in thread "main" java.io.IOException: job information not found in JobContext. HCatInputFormat.setInput() not called?
I already have called the following:
_hcatInputFmt = HCatInputFormat.setInput(_myJob, db,tbl);
and then creating the RecordReader object as:
_hcatInputFmt.createRecordReader(hSplit, taskContext)
On debugging it fails while searching for the value of the key: HCAT_KEY_JOB_INFO in job configuration object, while trying to create a RecordReader object.
How do I set this value? Any pointers will be helpful.
Thanks.
We have to use getConfiguration() method to get the configuration from the job object. The configuration object used in creating the job object won't do it.
I had the same problem, you shuold use:
HCatInputFormat.setInput(job, dbName, inputTableName);
HCatSchema inputschema = HCatBaseInputFormat.getTableSchema(job.getConfiguration());
not
HCatInputFormat.setInput(job, dbName, inputTableName);
HCatSchema inputschema = HCatBaseInputFormat.getTableSchema(getConf());
Because, when you use Job.getInstance(conf), it will copy the conf, you can't use the original conf. Here is the code:
/**
* A new configuration with the same settings cloned from another.
*
* #param other the configuration from which to clone settings.
*/
#SuppressWarnings("unchecked")
public Configuration(Configuration other) {
this.resources = (ArrayList<Resource>) other.resources.clone();
synchronized(other) {
if (other.properties != null) {
this.properties = (Properties)other.properties.clone();
}
if (other.overlay!=null) {
this.overlay = (Properties)other.overlay.clone();
}
this.updatingResource = new ConcurrentHashMap<String, String[]>(
other.updatingResource);
this.finalParameters = Collections.newSetFromMap(
new ConcurrentHashMap<String, Boolean>());
this.finalParameters.addAll(other.finalParameters);
}
synchronized(Configuration.class) {
REGISTRY.put(this, null);
}
this.classLoader = other.classLoader;
this.loadDefaults = other.loadDefaults;
setQuietMode(other.getQuietMode());
}

Where can I find XrmServicesContext Class?

I found this snippet that provides a creation of a new entity called annotation.
I can't find the class XrmServicesContext declared into the using directive.
has anybody knows what the hell is this?
private static void AddNoteToContact(IOrganizationService service, Guid id)
{
Entity annotation = new Entity();
annotation.LogicalName = "annotation";
using (var crm = new XrmServicesContext(service))
{
var contact = crm.ContactSet.Where(c => c.ContactId == id).First();
Debug.Write(contact.FirstName);
annotation["createdby"] = new EntityReference("systemuser", new Guid("2a213502-db00-e111-b263-001ec928e97f"));
annotation["objectid"] = contact.ToEntityReference();
annotation["subject"] = "Creato con il plu-in";
annotation["notetext"] = "Questa note è stata creata con l'esempio del plug-in";
annotation["ObjectTypeCode"] = contact.LogicalName;
try
{
Guid annotationId = service.Create(annotation);
crm.AddObject(annotation);
crm.SaveChanges();
}
catch (Exception e)
{
throw new Exception(e.Message);
}
// var note = new Annotation{
//Subject ="Creato con il plu-in",
//NoteText ="Questa note è stata creata con l'esempio del plug-in",
//ObjectId = contact.ToEntityReference(),
//ObjectTypeCode = contact.LogicalName
};
}
First you have to generate the early bound entity classes. Check this article. Then, insert using statement in your code.
In your example you are using combination of early and late binding. I suggest you to choose one of them. In case of early binding, after generating early binding classes you can modify your code like:
Annotation annotation = new Annotation();
using (var crm = new XrmServiceContext(service))
{
annotation.ObjectId = contact.ToEntityReference();
annotation.Subject = "Creato con il plu-in";
annotation.NoteText = "Questa note e stata creata con l'esempio del plug-in";
annotation.ObjectTypeCode = Contact.LogicalName;
crm.AddObject(annotation);
crm.SaveChanges();
}
You have one error here, annotation.CreatedBy field is read only and you can't set value to this from code.
If you're gonna use late binding, XrmServiceContext is not necessary. You can get Contact from CRM using QueryExpression. Find examples here. And for annotation create use:
Guid annotationId = service.Create(annotation);
In SDK/bin/CrmSvcUtil.exe, This tool is used to generate early bound entity classes
from command prompt, run CrmSvcUtil.exe with parameters i.e.
If your sdk bin location is "D:\Data\sdk2013\SDK\Bin\CrmSvcUtil.exe" then your command will like this,
cmd:
D:\Data\sdk 2013\SDK\Bin>CrmSvcUtil.exe /out:Xrm\Xrm.cs /url:[OrganizationServiceUrl] /username:[yourusername] /password:[yourpass] /namespace:Xrm /serviceContextName:XrmServiceContext
[OrganizationServiceUrl]: is your organization service url, u can find it from setting/customization/Developer rosources/Organization service e.g
https://msdtraders.api.crm.dynamics.com/XRMServices/2011/Organization.svc
[yourusername]: your user name
[yourpass]: your password
This will generate and Entity classes in file with name Xrm.cs in bin/Xrm/Xrm.cs. Create folder Xrm in bin if it not exist, or edit parameters in cmd [out:Xrm\Xrm.cs].
Add Xrm.cs in your project
Add using statement in your code where you use XrmServicesContext.
like using Xrm;
Now you can use/access XrmServicesContext and all Entities ...... enjoy.

Framework for generating BPEL in runtime?

I need to generate BPEL XML code in runtime. The only way I can do it now is to create XML document with "bare hands" using DOM API. But there must be a framework that could ease such work incorporating some kind of object model.
I guess it should look something like this:
BPELProcessFactory.CreateProcess().addSequence
Do you know any?
The Eclipse BPEL designer project provides an EMF model for BPEL 2.0. The generated code can be used to programmatically create BPEL code with a convenient API.
In case anyone stumbles upon this.
Yes this can be done using the BPEL Model.
Here is a sample piece of code which generates a quite trivial BPEL file:
public Process createBPEL()
{
Process process = null;
BPELFactory factory = BPELFactory.eINSTANCE;
try
{
ResourceSet rSet = new ResourceSetImpl();
rSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
.put("bpel", new BPELResourceFactoryImpl());
File file = new File("myfile.bpel");
file.createNewFile();
String filePath = file.getAbsolutePath();
System.out.println(filePath);
AdapterRegistry.INSTANCE.registerAdapterFactory( BPELPackage.eINSTANCE, BasicBPELAdapterFactory.INSTANCE );
Resource resource = rSet.createResource(URI.createFileURI(filePath));
process = factory.createProcess();
process.setName("FirstBPEL");
Sequence seq = factory.createSequence();
seq.setName("MainSequence");
Receive recieve = factory.createReceive();
PortType portType = new PortTypeProxy(URI.createURI("http://baseuri"), new QName("qname"));
Operation operation = new OperationProxy(URI.createURI("http://localhost"), portType , "operation_name");
recieve.setOperation(operation);
Invoke invoke = factory.createInvoke();
invoke.setOperation(operation);
While whiles = factory.createWhile();
If if_st = factory.createIf();
List<Activity> activs = new ArrayList<Activity>();
activs.add(recieve);
activs.add(invoke);
activs.add(if_st);
activs.add(whiles);
seq.getActivities().addAll(activs);
process.setActivity(seq);
resource.getContents().add(process);
Map<String,String> map = new HashMap<String, String>();
map.put("bpel", "http://docs.oasis-open.org/wsbpel/2.0/process/executable");
map.put("xsd", "http://www.w3.org/2001/XMLSchema");
resource.save(map);
}
catch(Exception e)
{
e.printStackTrace();
}
return process;
}
The dependencies require that you add the following jars to the project's build path from the plugins folder in eclipse installation directory:
org.eclipse.bpel.model_*.jar
org.eclipse.wst.wsdl_*.jar
org.eclipse.emf.common_*.jar
org.eclipse.emf.ecore_*.jar
org.eclipse.emf.ecore.xmi_*.jar
javax.wsdl_*.jar
org.apache.xerces_*.jar
org.eclipse.bpel.common.model_*.jar
org.eclipse.xsd_*.jar
org.eclipse.core.resources_*.jar
org.eclipse.osgi_*.jar
org.eclipse.core.runtime_*.jar
org.eclipse.equinox.common_*.jar
org.eclipse.core.jobs_*.jar
org.eclipse.core.runtime.compatibility_*.jar

Resources