Showing posts with label Todo. Show all posts
Showing posts with label Todo. Show all posts

Saturday, 21 July 2012

stored as karaf documents in sent mail in sonuasher89@gmail.com and even felix document also stored there

Karaf commands in console how to start and stop the bundles


stored as  karaf documents in sent mail in sonuasher89@gmail.com and even felix document also stored there

Tuesday, 17 July 2012

Json Object conversion it is stored with jsonobject subject

Json Object conversion it is stored with jsonobject subject in sonuasher89@gmail.com


package com.demo;

import javax.xml.bind.annotation.XmlElement;

import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

@XmlRootElement(name = "book")
// If you want you can define the order in which the fields are written
// Optional
@XmlType(propOrder = { "author", "name", "publisher", "isbn" })
public class Book {

private String name;
private String author;
private String publisher;
private String isbn;

// If you like the variable name, e.g. "name", you can easily change this
// name for your XML-Output:
@XmlElement(name = "title")
public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getAuthor() {
return author;
}

public void setAuthor(String author) {
this.author = author;
}

public String getPublisher() {
return publisher;
}

public void setPublisher(String publisher) {
this.publisher = publisher;
}

public String getIsbn() {
return isbn;
}

public void setIsbn(String isbn) {
this.isbn = isbn;
}

}







package com.demo;

import java.io.ByteArrayInputStream;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
import java.io.Writer;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;

import org.apache.commons.io.FileUtils;
import org.codehaus.jackson.map.ObjectMapper;

public class BookMain {

private static final String BOOKSTORE_XML = "C:/senddata/iPod.txt";

public static void main(String[] args) throws JAXBException, IOException {
try {
String userDataJSON = getUserDataJSON(BOOKSTORE_XML);
 InputStream json = new ByteArrayInputStream(userDataJSON.getBytes());
File destDir = new File("JSON.txt");
FileUtils.copyInputStreamToFile(json, destDir);
System.out.println(userDataJSON);
} catch (Exception e) {
e.printStackTrace();
}
}
public static String getUserDataJSON(String BOOKSTORE_XML) throws Exception
{
JAXBContext context = JAXBContext.newInstance(BookStore.class);
Unmarshaller um = context.createUnmarshaller();
BookStore bookstore2 = (BookStore) um.unmarshal(new FileReader(BOOKSTORE_XML));
// System.out.println(bookstore2.getBooksList());
// for(Book book : bookstore2.getBooksList())
// {
// System.out.println(book.getAuthor() + "  " + book.getName());
// }
ObjectMapper mapper = new ObjectMapper();
Writer strWriter = new StringWriter();
mapper.writeValue(strWriter, bookstore2);
return strWriter.toString();
}
}








package com.demo;

import java.util.ArrayList;



import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;

//This statement means that class "Bookstore.java" is the root-element of our example
@XmlRootElement(name = "bookstore")
public class BookStore {

// XmLElementWrapper generates a wrapper element around XML representation
@XmlElementWrapper(name = "bookList")
// XmlElement sets the name of the entities
@XmlElement(name = "book")
private ArrayList<Book> bookList;
private String name;
private String location;

public void setBookList(ArrayList<Book> bookList) {
this.bookList = bookList;
}

public ArrayList<Book> getBooksList() {
return bookList;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getLocation() {
return location;
}

public void setLocation(String location) {
this.location = location;
}
}




package com.demo;

import org.json.JSONObject;

import com.liferay.portal.kernel.json.JSONFactoryUtil;


class Sample
{
public static void main(String[] args) {



JSONObject jsonObj = (JSONObject) JSONFactoryUtil.createJSONObject();
}
}



POM



<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.demo</groupId>
<artifactId>TestProj</artifactId>
<version>0.0.1-SNAPSHOT</version>

<dependencies>

<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>1.9.6</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.6</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.6</version>
</dependency>

<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<version>6.0.4</version>
</dependency>

<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
</dependencies>

<build>
<plugins>

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>

<Export-Package>com.demo;version="0.0.1-SNAPSHOT",
</Export-Package>


</instructions>
</configuration>
</plugin>
</plugins>
</build>


</project>

Saturday, 14 July 2012

Performace testing set up for Jclouds video upload to amazon s3 is done using Junit perf and is present in sent mails in sonuasher89@gmail.com with the subject  Test_set_up_performace_testing
 It can be run in eclipse just we need to set up maven plugin in the eclipse

Tuesday, 10 July 2012

Storage Mechanism of CBS


My  CBSArchiver Client  and and CBSArchiver are stored in mail with name updated_client and updated_server it is stored in sent mails in namratha.asher@gmail.com it was made run in netbeans

Wednesday, 4 July 2012

Jclouds Karaf Usage necessary Urls



install karaf : http://karaf.apache.org/index/community/download.html
starting karaf : Unzip the download go into folder and run bin\karaf.bat
Make sure maven is in your path
Install jclouds. On karaf shell
Features:addUrl mvn:org.jclouds.karaf/jclouds-karaf/1.5.0-alpha.6/xml/features
Features:install jclouds-api-filesystem [ call features:list | grep jclouds for exact name]
Compile the attached source code The zip only contains the src files and features.xml directory
Features:addUrl file://///features.xml/features.xml  (This is present in project)





To change the mvn url use following on karaf shell:
Features:listUrl
Features:removeUrl <Url with jclouds in it>
Features:addUrl <Url with jclouds. Change .6 to .1>
Features:install jclouds-api-filesystem



.cfg file


public_key_file=C:/AE2-035/cloudStorage/public.key
private_key_file=C:/AE2-035/cloudStorage/private.key
secret_key=value of secnote
access_key=value of accnote
cloud_provider=filesystem
filesystem_base_directory=C:/
mRootContainer=CBSCloudArchive

Monday, 18 June 2012

Jclouds dependencies


Jclouds compendium for component context
Jclouds core for Contect builder

Pass a HashMap from Angular Client to Spring boot API

This example is for the case where fileData is very huge and in json format   let map = new Map<string, string>()      map.set(this.ge...