Monday, 24 December 2018

Core Creation in Solr

Before Starting anything into the Solr We have to create the Core. A Core is a running instance or the process of a Lucene index that contains all the Solr configuration files. We need to create a Core to perform operations like indexing and analyzing. It is mentioned that the Solr application may contain one core or more and can communicate with multiple cores.

Its similar to Creating the Endeca App. The Core can be created in two ways.


Creating through Command

Navigate to C:\Dev\solr-7.5.0\bin>solr.cmd create -c example

It will create the core for the Solr.

WARNING: Using _default configset with data have driven schema functionality. NOT RECOMMENDED for production use.
         To turn off: bin\solr config -c example -p 8983 -action set-user-property -property update.autoCreateFields -value false
INFO  - 2018-12-25 12:03:30.613; org.apache.solr.util.configuration.SSLCredentialProviderFactory; Processing SSL Credential Provider chain: env;sysprop

Created a new core 'example'

Creating through Solr Admin UI

Navigate to AdminUI>core Admin>Add Core

Fill the following popup

name:<name of the solr>

instanceDir:<Directory where the solr-Config.xml is avalible> In case if the solr-Config.xml is not created the We can use it from the default config set that comes up with Solr.

C:\Dev\solr-7.5.0\server\solr\example

Copy the directory conf from the

C:\Dev\solr-7.5.0\server\solr\configsets\_default

to

C:\Dev\solr-7.5.0\server\solr\example\conf

Give the Instance Directory as C:\Dev\solr-7.5.0\server\solr\example

dataDir:<Directory Where the Indexing Files stored>

C:\Dev\solr-7.5.0\server\solr\example\data

Remaining config and schema leave it as it.

Here understanding two folder structure is important.

conf> Where the solr configurations are stored.

data>Where the indexed data files are stored in the non readable format.

Happy Coring !!!!

Understanding Solr and Admin Console

We have seen how to download and install from our previous posts, Now its time to Understand it further.
After unzipping into the Folder Observe the Folder Structure.

Folder Structure

C:\Dev\solr-7.5.0\




bin> This will be having the Command Files. From where we will start/stop the Solr.

Contrib> This Will have add-on plugins for specialized features of Solr

dist> This will have the main Solr .jar files.

docs> This will have the link for the online documentation.

example> This will have the example docs which can be used for learning and getting started purpose.

licenses> The licenses directory includes all of the licenses for 3rd party libraries used by Solr.

server> This is the core of the Solr, Official documentation defines it as a heart. This will have the Following

server>solr-webapp> -->Solr’s Admin UI

server>lib> -->Jetty libraries

server>logs> -->Log files

server>solr>configsets> --> Sample configsets


Solr Admin UI.

Solr has the default admin UI that can be accessed via the port number 8983

http://127.0.0.1:8983/solr/ or http://localhost:8983/solr/ 





This will have the core selector, Logging, Schema selection, Query  Execution, memory stats and more. For the developers from Endeca, it can also Similar to the jspref Orange Application in Endeca, with more features.

Happy Structuring !!!

Installing Solr

The Installation of Solr is very simple. On Comparing with other Search Platforms Which I worked, this is considered to be the simplest one in terms of installation.

Download the zip file from the official site of Solr. Its always good Practise to move to some development folder to proceed, instead of having it in the Downloads folder.

Prerequesties:

Make sure your java is compatible with the version of Solr you download.

Make Sure your java home and path variable is set.

Follow the below steps for Installation.

1. Unzip the zip file which we downloaded. Usually, the File is in the Following format solr-7.X.X.zip

Once you unzip it. Congratulations you are done with your installation.

We have a walk through explanation on the folder structure in a different post.

Starting the Solr.

Normal Mode

Consider my Solr in the following Directory C:\Dev\solr-7.5.0 then

Navigate to C:\Dev\solr-7.5.0\bin open the command prompt in this location

and execute the Following command C:\Dev\solr-7.5.0\bin>solr.cmd start

Solr is started with the following logs on the prompt.

INFO  - 2018-12-25 10:39:32.458; org.apache.solr.util.configuration.SSLCredentialProviderFactory; Processing SSL Credential Provider chain: env;sysprop
Waiting up to 30 to see Solr running on port 8983
Started Solr server on port 8983. Happy searching!

Debug Mode

If you want the solr in Debug mode then execute the below command in the same location.

C:\Dev\solr-7.5.0\bin>solr.cmd start -a "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=18983"

This will start the solr in debug mode with listening to the port 18983. if you need detailed explannation check my post here.

By Default Solr is running on the port 8983, If that port is already occupied either stop the process in that port or start the solr with different port.

Stopping the Process running on the port

1.Identifying the process running on the port.(Windows)

netstat -ano | findstr :8983 will list all the ports currently running in the machine.

2.Killing the Process running on the port (Windows)

taskkill /PID <PID_NO> /F

C:\Dev\solr-7.5.0\bin>netstat -ano | findstr :8983
  TCP    0.0.0.0:8983           0.0.0.0:0              LISTENING       18596
  TCP    [::]:8983              [::]:0                 LISTENING       18596

C:\Dev\solr-7.5.0\bin>taskkill /PID 18596 /F
SUCCESS: The process with PID 18596 has been terminated.

Starting the Solr in a different port.

C:\Dev\solr-7.5.0\bin>solr.cmd start -p 8990

This will start the solr in different port.


Stopping the solr.


C:\Dev\solr-7.5.0\bin>solr.cmd stop -all

This will stop if the solr is running in all the ports.

Happy Installation !!!!!

Saturday, 7 July 2018

JAVA SE 6 Features and Enhancements Part-1

Hi All,

You might be thinking why I started writing the posts, related to the Java SE-6. This Idea came as part of my discussion with the friends. Because Java 9 is about to be released, but are we really using the features and implement effectively the answer is no. That's why I wanted to give the heads up at least we can keep in mind these are available.

When I jumped looked into this thought might be not that much bigger, on looking the release document found that's it's huge. In this post, I am going to quickly run through the changes happened in the Collections framework. While reading this document, came to know there are so much Which I need to concentrate on the basics. I will start writing those simpler basics for you and for my learning.I am adding some information I gathered in Java6 in collections frame work.

Let's try to Implement these in our daily coding.

These new collection interfaces are provided:

1.Deque a double ended queue, supporting element insertion and removal at both ends

This Deque can be used in our application, when you want to access the both the ends of the queus in the faster way, it has different methods that allows you to iterate without much effort. Unlike the List interface, this interface does not provide support for indexed access to elements.While Deque implementations are not strictly required to prohibit the insertion of null elements, they are strongly encouraged to do so. Users of any Deque implementations that do allow null elements are strongly encouraged not to take advantage of the ability to insert nulls. This is so because null is used as a special return value by various methods to indicated that the deque is empty.

When going through this API you will find confusing of difference between the add and offer.

1. Both are from different interfaces. add is from the collection, the offer is from the queue.
2. Add throws exception it is not able to add the element, where else the offer returns the false statement.


2.BlockingDeque

A Deque that additionally supports blocking operations that wait for the deque to become non-empty when retrieving an element, and wait for space to become available in the deque when storing an element.

3.NavigableSet<E>

A SortedSet extended with navigation methods reporting closest matches for given search targets. Methods lower, floor, ceiling, and higher return elements respectively less than, less than or equal, greater than or equal, and greater than a given element, returning null if there is no such element. A NavigableSet may be accessed and traversed in either ascending or descending order. The descendingSet method returns a view of the set with the senses of all relational and directional methods inverted. The performance of ascending operations and views is likely to be faster than that of descending ones.

4.NavigableMap<K,V>

A SortedMap extended with navigation methods returning the closest matches for given search targets. Methods lowerEntry, floorEntry, ceilingEntry, and higherEntry return Map.Entry objects associated with keys respectively less than, less than or equal, greater than or equal, and greater than a given key, returning null if there is no such key. Similarly, methods lowerKey, floorKey, ceilingKey, and higherKey return only the associated keys. All of these methods are designed for locating, not traversing entries.
A NavigableMap may be accessed and traversed in either ascending or descending key order. The descendingMap method returns a view of the map with the senses of all relational and directional methods inverted. The performance of ascending operations and views is likely to be faster than that of descending ones.

5.ConcurrentMap<K,V>

A Map providing additional atomic putIfAbsent, remove, and replace methods.

Memory consistency effects: As with other concurrent collections, actions in a thread prior to placing an object into a ConcurrentMap as a key or value happen-before actions subsequent to the access or removal of that object from the ConcurrentMap in another thread.

The following concrete implementation classes have been added:

1.ArrayDeque<E>

Resizable-array implementation of the Deque interface. Array deques have no capacity restrictions; they grow as necessary to support usage. They are not thread-safe; in the absence of external synchronization, they do not support concurrent access by multiple threads. Null elements are prohibited. This class is likely to be faster than Stack when used as a stack, and faster than LinkedList when used as a queue.

Most ArrayDeque operations run in amortized constant time. Exceptions include remove, removeFirstOccurrence, removeLastOccurrence, contains, iterator.remove(), and the bulk operations, all of which run in linear time.

2.ConcurrentSkipListSet<E>

A scalable concurrent NavigableSet implementation based on a ConcurrentSkipListMap. The elements of the set are kept sorted according to their natural ordering, or by a Comparator provided at set creation time, depending on which constructor is used.

3.ConcurrentSkipListMap<K,V>

A scalable concurrent ConcurrentNavigableMap implementation. The map is sorted according to the natural ordering of its keys, or by a Comparator provided at map creation time, depending on which constructor is used.

4.LinkedBlockingDeque<E>

An optionally-bounded blocking deque based on linked nodes.

The optional capacity bound constructor argument serves as a way to prevent excessive expansion. The capacity, if unspecified, is equal to Integer.MAX_VALUE. Linked nodes are dynamically created upon each insertion unless this would bring the deque above capacity.

5.AbstractMap.SimpleEntry<K,V>

An Entry maintaining a key and a value. The value may be changed using the setValue method. This class facilitates the process of building custom map implementations. For example, it may be convenient to return arrays of SimpleEntry instances in method Map.entrySet().toArray

6.AbstractMap.SimpleImmutableEntry<K,V>

An Entry maintaining an immutable key and value. This class does not support method setValue. This class may be convenient in methods that return thread-safe snapshots of key-value mappings.

These existing classes have been retrofitted to implement new interfaces:

1. LinkedList<E>

Linked list implementation of the List interface. Implements all optional list operations, and permits all elements (including null). In addition to implementing the List interface, the LinkedList class provides uniformly named methods to get, remove and insert an element at the beginning and end of the list. These operations allow linked lists to be used as a stack, queue, or double-ended queue.

The class implements the Deque interface, providing first-in-first-out queue operations for add, poll, along with other stack and deque operations.

2.TreeSet<E>

A NavigableSet implementation based on a TreeMap. The elements are ordered using their natural ordering, or by a Comparator provided at set creation time, depending on which constructor is used.

This implementation provides guaranteed log(n) time cost for the basic operations (add, remove and contains).

All of the operations perform as could be expected for a doubly-linked list. Operations that index into the list will traverse the list from the beginning or the end, whichever is closer to the specified index.
Most operations run in constant time (ignoring time spent blocking). Exceptions include remove, removeFirstOccurrence, removeLastOccurrence, contains, iterator.remove(), and the bulk operations, all of which run in linear time.

3.TreeMap<K,V>

A Red-Black tree based NavigableMap implementation. The map is sorted according to the natural ordering of its keys, or by a Comparator provided at map creation time, depending on which constructor is used.

Two new methods were added to the Collections utility class:

newSetFromMap(Map) - creates a general purpose Set implementation from a general purpose Map implementation.
There is no IdentityHashSet class, but instead, just use

Set<Object> identityHashSet=
    Collections.newSetFromMap(
        new IdentityHashMap<Object, Boolean>());

asLifoQueue(Deque) - returns a view of a Deque as a Last-in-first-out (Lifo) Queue.

Happy Learning !!!!! Keep watching for more basics .

Enabling SEO in Endeca

Hi All,

I wanted to discuss SEO in Endeca, as we all know the Search Engine Optimization plays an important role in any E-commerce Site. The Url we are navigating should be simpler and user-friendly so it will get more rank in the search engines. This is the main concept behind it, In Endeca as we all know it works only on the guided Navigation we have to apply the filter, these filters are nothing but the dimensions, it is evident that the Url is getting increased like anything with this long Ids. Endeca has SEO mechanism where we can hide/encrypt these dimensionIds for better viewing and simple Urls.

There are two ways you can achieve this .

1. Spring injection.
2. Defineing in the class and property file.

I am going to discuss about the first approach. That is implementing using injecting the Spring.

You can follow the below steps to achieve it. you can also refer the CRS for implementation, we are also going to take this as the base for our implementation.

1. Copy all the Jars from the folder \CommerceReferenceStore\Store\Storefront\j2ee-apps\Storefront\store.war\WEB-INF\lib

2. Next steps are to create the following files.

endeca-seo-url-config.xml

you can find this file from CommerceReferenceStore\Store\Storefront\j2ee-apps\Storefront\store.war\WEB-INF

spring-context.xml

you can find this file from CommerceReferenceStore\Store\Storefront\j2ee-apps\Storefront\store.war\WEB-INF

3.Create a reference for these files from the web.xml as like below.

 <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/spring-context.xml</param-value>
  </context-param>

  Once you define the context here then by default spring injection is happened through here.

4. Congratulations SEO is enabled. Now you have to define the navigation state to use this SEO URL with the property

urlFormatter=/atg/spring/FromSpring/seoUrlFormatter

5. Restart the servers Now you will start seeing the SEO URLs for all of the navigation state.

6.Whats there in endeca-seo-url-config. SeoUrlFormatter is the class where you can write a logic to parse input required, this will get called for each handler defined .parsePathInfo can be utilised for the parsing it, by the way, we write to read the request parameters.

7. Hence Extend the class SeoUrlFormatter and create your custom logic, and override the method

8. Adding descriptors.

you have define the following formatter for the dimension which you need to enable the SEO. you really have the control overSEO from here.

appendAncestors=will append the ancestors.
appendDescriptor=will append the descriptors.
appendRoot=will append the root.

you can also define the separator here.

<bean id="categoryFormatter"
        class="com.endeca.soleng.urlformatter.seo.SeoDimLocationFormatter">

    <property name="key">
      <value>product.category</value>
    </property>

    <property name="appendRoot">
      <value>false</value>
    </property>

    <property name="appendAncestors">
      <value>true</value>
    </property>

    <property name="appendDescriptor">
      <value>true</value>
    </property>

    <property name="separator">
      <value>-</value>
    </property>

    <property name="rootStringFormatter">

      <bean class="com.endeca.soleng.urlformatter.seo.StringFormatterChain">
        <property name="stringFormatters">
          <list>
            <!-- replace 'product.category' with 'Category' -->
            <bean class="com.endeca.soleng.urlformatter.seo.RegexStringFormatter">
              <property name="pattern">
                <value>product.category</value>
              </property>

              <property name="replacement">
                <value>Category</value>
              </property>

              <property name="replaceAll">
                <value>false</value>
              </property>
            </bean>

            <!-- Execute the default string formatter chain -->
            <ref bean="defaultStringFormatterChain"/>
          </list>
        </property>
      </bean>
    </property>

    <property name="dimValStringFormatter">
      <ref bean="defaultStringFormatterChain"/>
    </property>

  </bean>

9. These are the steps for the SEO Happy Learning !!!!

Friday, 6 July 2018

Performance Monitor in Oracle Commerce (ATG)

Hi All,

Performance is considered to be the most important factor in the success of the developmental projects. In my earlier posts, I have shared my thoughts to do efficient development. If you are seeing this posts for the first I am going to share what are the steps to be followed for identifying how our code performs in the environment.

Oracle web commerce as a matured enterprise applications gives you away, you can use and find it if you are not using it there are also different tools available you can use and identify it. I am going to concentrate more into the Oracle Web Commerce Tools that is Performance Monitor.

I recommend the following steps below.

1. Find the performace of your service using the chrome developer tools,Soap UI,jprofiler and many tools avalaible in the market.
2. Identify the services that takes more time to respond.
3.start putting the Performance Monitor to the places which you suspect causing the more loopings or time consuming if you know it by guess. or else put in these places.Usually start of the method and handlers,droplets etc.

Here's how you can put it . This is the starting of the Performance Monitor . 

if (PerformanceMonitor.isEnabled()) {
PerformanceMonitor.startOperation(String pOpName, String pParameter);
}
The End of the Performance Monitor should be the same as like passing the start parameter.

if (PerformanceMonitor.isEnabled()) {
PerformanceMonitor.endOperation(String pOpName, String pParameter);
}

If you want to cancel the Operation then you can do by.

if (PerformanceMonitor.isEnabled()) {
PerformanceMonitor.cancelOperation(String pOpName, String pParameter);
}

Here pOpName is the operation with this name get listed down in the console, will see the viewing in the end part. I recomment to use the class name by the follwing way . So it will be easily identifiable.

this.getClass().getName()

Where the parameter is the any name you pass should be descriptive and menaningful. 

When you are starting the operation, it shoule be ended otherwise it will not be causing any significance in adding it . Also, you can start the operation with the multiple operations with the same arguments, you should pass unique for avoidng the collision between the operations.

After adding this promote the code to any environements and do the following .

1. enable the performance monitor

Navigate to the folowing component .

http://hostname:port/dyn/admin/atg/dynamo/admin/en/performance-monitor-config.jhtml

Here you can set the modes .

There are different modes avaliable .

1.NORMAL - track the stack of operations each thread is currently executing
2.TIME - keep statistics for how much time each operation takes
3.MEMORY - keep statistics for how much time and memory each operation takes
4.DISABLED

It will be disable by defult enable it by selecting any of the modes . Based on the type of performace you want to measure.

after enabling it to execute or invoke your service again .

Then Navigate to the dashboard or the console for the results .

You can view the results at . http://hostname:port/dyn/admin/atg/dynamo/admin/en/performance-monitor.jhtml

Here you can see with the operations name, when you click more you will get the indivituval parameters level results towards the following parameters .

Operation||Number of Executions || Average Execution Time (msec)|| Minimum Execution Time (msec) || Maximum Execution Time (msec) || Total Execution Time (msec)


With this, you can analyse which part you have to concentrate and simplify the logic and remove the lopping etc.

Happy Learning . I will try to cover the indivutuval modes in detail in the upcoming posts .

x

Wednesday, 13 June 2018

Configuring GroupingApplicationRoutingStrategy

The GroupingApplicationRoutingStrategy allows more flexible groupings of sites than
SiteApplicationRoutingStrategy does. For example, with GroupingApplicationRoutingStrategy,
you can have three sites handled by one EAC application and two other sites handled by a second EAC application. If a site has multiple languages, all records for the site are directed to the site’s EAC application, regardless of the language.

Mapping of applications to sites is done through the applicationGroupingMap property of the
GroupingApplicationRoutingStrategy component. This property is a Map where each key is the name
of an EAC application and the corresponding value is a list of the site IDs of the sites to be routed to that
application. 

Naviate to /atg/endeca/ApplicationConfiguration

set 

applicationRoutingStrategy=\
  /atg/endeca/configuration/GroupingApplicationRoutingStrategy

 To ensure that separate records are created for each EAC application, you need to add
the MultipleSiteVariantProducer to the variantProducers property of each
EndecaIndexingOutputConfig component. For example:

variantProducers+=/atg/search/repository/MultipleSiteVariantProducer

 Also, mention the siteIDsToIndex property with all the sites required to index in output config. please consider this as an important step, if you are not doing this your indexing will always be a failure.

 Set the routingObjectAdapter property of the /atg/endeca/index/IndexingApplicationConfiguration component to specify the ContextRoutingObjectAdapter component to use:

routingObjectAdapter=\
 /atg/endeca/index/configuration/GroupingContextRoutingObjectAdapter

Set the routingObjectAdapter property of the /atg/endeca/assembler/AssemblerApplicationConfiguration component to specify the RequestRoutingObjectAdapter component to use:

routingObjectAdapter=\
 /atg/endeca/index/configuration/GroupingRequestRoutingObjectAdapter

eg: ApplicationConfiguration

workbenchHostName=localhost

# Our Workbench Port
workbenchPort=8006

applicationRoutingStrategy=\
  /atg/endeca/configuration/GroupingApplicationRoutingStrategy

defaultLanguageForApplications=

applicationKeyToMdexHostAndPort=\
ClothSiteAPP=localhost:15000,\
ApprealSiteApp=localhost:16000

keyToApplicationName^=/Constants.null

where ClothSiteAPP & ApprealSiteApp are EAC apps of the site. 


eg: GroupingApplicationRoutingStrategy

applicationGroupingMap=\
 ClothSiteAPP=ClothSite|shoeSiteCanada,\
 ApprealSiteApp=ApprealSite|clothesSiteUK|clothesSiteCanada

 It is necessary to mention two groups here otherwise you won't the response back from the assembler.

 For these group of sites, these apps will be used.

eg:IndexingApplicationConfiguration

CASHostName=localhost
CASPort=8500
EACHostName=localhost
EACPort=8888
routingObjectAdapter=\
  /atg/endeca/index/configuration/GroupingContextRoutingObjectAdapter
cxfLogLevelOverride^=/Constants.null


eg: AssemblerApplicationConfiguration

routingObjectAdapter=\
  /atg/endeca/assembler/configuration/GroupingRequestRoutingObjectAdapter

useFileStoreFactory=true


applicationKeyToStoreFactory=\
ClothSiteAPP=/atg/endeca/assembler/cartridge/manager/ClothSiteFileStoreFactory,\
ApprealSiteApp=/atg/endeca/assembler/cartridge/manager/ApprealSiteFileStoreFactory


Here you cannot use the default file store Factory, you have to use the filestore factory for separate instances.

Create a component 

eg :ClothSiteFileStoreFactory with the below data

$class=atg.endeca.assembler.content.ExtendedFileStoreFactory
configurationPath=\
C:\\Endeca\\Apps\\ClothSite
appName=ClothSiteApp

Last you mention about the 

eg:EndecaAdministrationService

/atg/endeca/assembler/admin/EndecaAdministrationService

$class=atg.endeca.assembler.MultiAppAdministrationService
storeFactory^=/Constants.NULL

Set this property to handle the multiple Applications.

Happy Learning !!!! 

Configuring SiteApplicationRoutingStrategy

Use the SiteApplicationRoutingStrategy if you have a separate EAC application for each site (with all languages in a given site being handled by that site’s EAC application), or if you have a separate EAC application for each combination of site and language. Make sure you are creating a separate app for the site.

Naviate to /atg/endeca/ApplicationConfiguration

set 
applicationRoutingStrategy=\
 /atg/endeca/configuration/SiteApplicationRoutingStrategy

 In addition, to ensure that separate records are created for each site, you need to add the UniqueSiteVariantProducer to the variantProducers property of each EndecaIndexingOutputConfig component. For example ProductCatalogOutputConfig,MediaOutputConfig,ArticleOutputConfig.

 variantProducers+=/atg/search/repository/UniqueSiteVariantProducer

 Also, mention the siteIDsToIndex property with all the sites required to index in output config. please consider this as an important step, if you are not doing this your indexing will always be a failure.

 Set the routingObjectAdapter property of the/atg/endeca/index/IndexingApplicationConfiguration component to specify the ContextRoutingObjectAdapter component to use:

routingObjectAdapter=\
 /atg/endeca/index/configuration/SiteContextRoutingObjectAdapter

Set the routingObjectAdapter property of the /atg/endeca/assembler/AssemblerApplicationConfiguration component to specify the RequestRoutingObjectAdapter component to use:

routingObjectAdapter=\
 /atg/endeca/index/configuration/SiteRequestRoutingObjectAdapter

eg: ApplicationConfiguration

workbenchHostName=localhost

# Our Workbench Port
workbenchPort=8006

applicationRoutingStrategy=\
 /atg/endeca/configuration/SiteApplicationRoutingStrategy

defaultLanguageForApplications=

keyToApplicationName=\
 ClothSite=ClothSiteAPP,\
 ApprealSite=ApprealSiteApp

applicationKeyToMdexHostAndPort=\
ClothSite=localhost:15000,\
ApprealSite=localhost:16000

where ClothSite & ApprealSite are sitesIds of the application

eg: SiteApplicationRoutingStrategy

eg:filterByLocale=true
applicationNameFormatString={0}{1}

eg:IndexingApplicationConfiguration

CASHostName=localhost
CASPort=8500
EACHostName=localhost
EACPort=8888
routingObjectAdapter=\
 /atg/endeca/index/configuration/SiteContextRoutingObjectAdapter
cxfLogLevelOverride^=/Constants.null


eg: AssemblerApplicationConfiguration

routingObjectAdapter=\
 /atg/endeca/index/configuration/SiteRequestRoutingObjectAdapter

useFileStoreFactory=true

applicationKeyToStoreFactory=\
ClothSite=/atg/endeca/assembler/cartridge/manager/ClothSiteFileStoreFactory,\
ApprealSite=/atg/endeca/assembler/cartridge/manager/ApprealSiteFileStoreFactory


Here you cannot use the defaultFileStore Factory, you have to use the filestore factory for separate instances.

Create a component 

eg: ClothSiteFileStoreFactory with the below data

$class=atg.endeca.assembler.content.ExtendedFileStoreFactory
configurationPath=\
C:\\Endeca\\Apps\\ClothSite
appName=ClothSiteApp


Last you mention about the 

eg:EndecaAdministrationService

/atg/endeca/assembler/admin/EndecaAdministrationService

$class=atg.endeca.assembler.MultiAppAdministrationService
storeFactory^=/Constants.NULL

Set this property to handle the multiple Applications.

Happy Learning !!!! 

Configuring Single ApplicationRoutingStrategy

This ApplicationRoutingStrategy by default available and you need to follow below steps for configuration

Naviate to /atg/endeca/ApplicationConfiguration

Set applicationRoutingStrategy property to null. This property is null by default, so you can leave it unset or set it to null explicitly. If applicationRoutingStrategy is null, an instance of the SingleApplicationRoutingStrategy class is created automatically.

Similarly, set the /atg/endeca/index/IndexingApplicationConfiguration .routingObjectAdapter and /atg/endeca/assembler/AssemblerApplicationConfiguration.routingObjectAdapter properties to null to automatically create instances of the SingleContextRoutingObjectAdapter and SingleRequestRoutingObjectAdapter
classes.

Additional configuration differs depending on whether you have a single EAC application for all languages or a separate EAC application for each language.

eg: ApplicationConfiguration
baseApplicationName=ATG
defaultApplicationName=ATG
# Our Workbench Host
workbenchHostName=localhost

# Our Workbench Port
workbenchPort=8006

If your application Name is ATG configure like above in ApplicationConfiguration. 

If you have different locales configure like these, Set this property if you have different locales otherwise set this property to Null.

defaultLanguageForApplications=fr

if this is set along with locale then during indexing the Application looks for the EAC application as ATGfr,ATGen etc.

eg:IndexingApplicationConfiguration 

CASHostName=localhost
CASPort=8500
EACHostName=localhost
EACPort=8888

eg:AssemblerApplicationConfiguration

defaultMdexHostName=localhost
defaultMdexPort=15000


Happy Learning !!!!

RoutingStrategy in Endeca

Hi guys, Sorry for taking more time to get back on 2018. I was busy with my regular works and did not find time in sharing the experience with you all. I was preparing this good contents for you these days, I am sure you are going to like all my upcoming topics, which is very interesting and concept wise more weight for you as an Endeca developer.

Why do want to go for routing?

The answer is simple !!!! my requirement of the application will not be the same at all the time. Sometimes my application works as a multisite, single site, group of sites. When we go with the default way Endeca provides for the application, it will be very hard to achieve it hence Endeca provides the way by which you can simplify the tasks. 

I used to term it as simplification, but the actual definition as per the document goes by this way "Routing is the process of directing records for indexing to specific EAC applications and their corresponding MDEX instances, and ensuring that queries (for example, search terms or dimension selections) are directed to the correct EAC applications as well." Remeber this you have to define the only by this way.

So we understand the routing and let's see what are the different types of routing supported by The platform Guided Search 11.3(Endeca)

There are three types RoutingStrategy

1. Single ApplicationRoutingStrategy

This is the default routing statergy the endeca comes with, It was recommended to use this statergy when we have no site based application, single mdex data and only one EAC application. Locale and language does not make difference. Configuring the  ApplicationRoutingStrategy check here .

2. SiteApplicationRoutingStrategy

This startergy can be used when we have the site based applications, for example, I have multisite application, different EAC applications for the sites, differnt mdex's and different data then we can go for this approach (with all languages in a given site being handled by that site’s EAC application), or if you have a separate EAC application for each combination of site and language. Configuring the SiteApplicationRoutingStrategy check here .

3. GroupingApplicationRoutingStrategy

This statergy can be used when we have the Single EAC applications for the group of sites, it is more flexible than the SiteApplicationRoutingStrategy regardless of the language. Configuring the GroupingApplicationRoutingStrategy check here .

Happy Learning Stay Tuned for featured posts !!!

Friday, 20 October 2017

About Editors in Endeca

Hi All,
   
   Happy Diwali !!!

Most of us when working on the XM Part of Endeca, dont explore much on the editors part since we are going with the OOTB editors , there was no necessary as well to learn about this OOTB editors .

So today in this post am going to explain some basics about this editors. What are  editors ? Editors are nothing but medium with the help of which we configure the data that flows from the xm. 

So What are the Default Editors are available ? There were many editors are available out of which some are very important for the basic operations are Boost and Burry, Choice,Link,Media,String etc.

So If you want to overwrite the existing Editors , you have follow some default steps that is being overridden .We can see this topic as future posts from developing via SDK.

Now how to change their configurations ? What are configurations , its nothing but the Values supporting the Functioning of this editors. What are the Inputs , what are its Configuration Files , this can be helpful in the many context of customization .How to Achieve this , follow the below steps .

1) Export the Existing Editors using   

runcommand.bat IFCR exportContent editors D:\backup\editors 

After the Editors whatever value you provide will be the Place where it gets exported .

2)After the Export Edit the Configs with the Custom Values which you need it .

3)Import the editors using 

runcommand.bat IFCR importContent editors D:\backup\editors 

Once the Importing is done those editors with the new Configs are avaliable .

So Extending and Creating the new Cartridges will be seen in the Future Posts !!!


Happy UnderStanding !!!!!


Saturday, 14 October 2017

Endeca Interview Questions part 1

Hi All,
      Many of us before going to attend any interviews , they want to know how much they have prepared for the Interview  so they will be testing their knowledge with the questions , I am sure this post going to be useful in that aspects for the ATG-Endeca Integration Developers . I will be covering from the basic to the compex Questions here .

1)What is Endeca ?
2)What is the Expansion of ITL?
3)Explain Forge Process in Endeca ?
4)What is MDEX?
5)What are the Components of MDEX?
6)What is Tools and Frameworks and Explain their Functionality?
7)What is Platform Services and Explain their Functionality?
8)What is CAS and Explain their Fuctionality?
9)Explain the Order of Installation if Endeca Components?
10)Explain Digix?
11)Explain Dgraph? 
12)Explain the Full Form of EAC and their Architecture?
13)Explain the Steps to be Followed while creating the Endeca Application?
14)What is Deployment Template and how it ca be used ?
15)What is the Full Form of XM?
16)Explain the uses of WorkBench?
17)Explain the uses of XM?
18)Explain about the ECR Repositroy and Mention about their uses?
19)What are record Stores in endeca?
20)What is last-mile crawl?
21)Explain about Indexing Process from Baseline Script perspective .?
22) How to make Dimension id same across all the environments?
23)What is Crawling and how it can be achieved .?
24)What are the cartridges ?
25)What are the templates ?
26)How to create cartridges and promoting it ?
27)What is Index Config ?
28)How ATG Interacts with Endeca ?
29)Component responsible for triggering Indexing ?
30)How to Schedule Indexing ATG?
31)How to set RecordFilterable as property?
32)Wat is Rollup key and how to define it ?.
33)What is property and Dimensions ?
34)Script Called from Endeca During BaselineIndex
35)What is Partial Indexing?
36)What is Baseline Indexing?
37) What is the Script Called During Baseline Indexing ?
38) What is the Script Called During the Partial Indexing?
39)Definition file for Defining te Indexables Components in ATG
40)What is Endeca Pipeline
41)What are Search Interfaces in endeca ?
42)What are Record Search in endeca ?
43)What are Dimension Search in endeca ?
44)What is Endeca_jspref?
45)Attribute used to define for the level  of Indexing in definition file?
46)How many records are computed by guided search if the same record is linked in the two or more category.?
47)Which Component outputs dimension Value records for all of the repository items types.?
48)What is Multi Select in Endeca Dimensions ?
49) How do you define a property as multiselect or and Explain it ?
50)How do you define a property as multiselect and Explain it ?
51)How do you enable the assembler for your application.?
52)what is the entry point of the request for assembler based applications?
53)What is Assembler Pipeline servlet?
54)What are the twotypes of input paramteres in InvokeAssembler?
55)Types if Content invoke in AssemblerPiplelineservlet?
56)Which Component is responsible for connection to MDEX from Assembler.?
 57)How is  the cartride configurations will be avalible as part of your handler?
58)What is Catridge Config?
58)What are Cartridge Handlers ?
60)How Cartridges can be linked to Handler Mapping done through ?
61)What are default Methods in Cartridge handlers ?
62)How the Endeca Content is Accessible in ATG?



Happy Learning and new Beginning !!!!


........................To Be Continued 


Saturday, 23 September 2017

Working with Statelessness in JAX-RS

Before Pitching in to the "How the Stateless works with the JAX-RS" , I want to discuss here about the basics of the stateless and how it can be created and what are the configurations required .


So What is Statelessness ? It is said that , while processing the request , the server does not maintain any state or the Information that is required , If it is not maintaining it, how can be proceed yes the client sends the information that is required to process the request this behavior is called as the statelessness .

JAX-RS implementation With ATG Commerce has support for this statelessness and we can see how we are going to enable it .

We all know that, we are generating the Ear for the ATG Application from the RunAssembler , and we are passing all the arguments while executing the RunAssembler.So to enable the Statelessness we have to pass the stateless argument for the RunAssembler . Once it if passed then the Required Modules are built along with it . I am just pasting the Snippet you can use the same for the ant build .For other Maven you see their manuals before using it .

               <arg line="stateless"/>

Now you have enabled the stateless mode .So the Beauty of the Statelessnessis that, all the session scope components in ATG will be converted in to the Request Scope Components .

So now its our time to See more about the functional aspects .

So what is x-ocstatedata ? I was mentioning about the required data must be passed as part of the Request from the client , this will be carried by this x-ocstatedata .

Did I need to create this x-ocstatedata every time? . No you need to create it OOTB takes care of creating it , but it is your responsiblity to put the data in the way OOTB expects then the x-ocstatedata is created automatically, So How to put it ? let see in the below .

Create a class extends GenericService implements MapLoadableService . When you create like this
there should be two methods that needs to implemented .

1))@Override
public void loadService(Map<String, Object> paramMap) {
}

//This method is the place where we have to read the previous state from the x-ocstatedata and used for the current request .

2)@Override
public Map<String,Object>getProperties() {
}
// This is the method where we need to write a logic so that it returns the request data that has to be put as part of the X-ocstatedata . Which is of type Map<String,Object>. This method will be called after each endpoint finishes . 


For More Information on the Implementation details you can refer the ProfileLoadableService OOTB class  . Where they have used the Profile component from the x-ocstatedata .

You can inject the created component in the RequestStateManager as below 

loadableServicePaths=\
                                       /atg/userprofiling/ProfileLoadableService


Once it is declared in the component path it will be called before it hits any service and end of the service calls .

By Following the above way you can Handle the stateless data in the JAX-RS.


Exception Handling in JAX-RS

In JAX-RS Implementation of REST, Each and every Exception should be handled as the Rest Exception as the OOTB Handles it , We can utilize the OOTB features to the Fullest by consuming this Classes and throwing the way it does , we can Briefly see how to handle it .

ATG 11.3 JAX-RS Implementation has inbuilt class RestException for handling this .  RestException  is the class that has different constructors for Providing the required inputs to be passed while Throwing it .

RestException error = RestUtils.getRestUtils().createException(400, "500", "Internal Server Error", null, null);

throw error;

Same like this above will have many constructors 

From the above example A RestException class can be instantiated
through utility methods in RestUtils , hence we are injecting in this way and supplying the parameters.

If you add error conditions to your endpoint, you should build a RestException, setting HTTP response codes,error messages, debug information and, optionally, error codes that are returned from your endpoint method.

400 is the status codes .

500 is the "internalserver" ie error codes

"Internal Server Error" is the message 

The RestExceptionMapper instance of the Jersey ExceptionMapper builds a response from the RestException that is returned to the client.If you want to handle any custom unhandled exceptions you can write the code here for handling it .


Additinally Every REST method should be constructed with an error message,which should be stored as resource strings in a property file residing in your custom module. Once you have constructed an error message, you can create string constants that refer to the error string keys within your endpoint class.


I am gives some of the status codes which you can use it while developing it .


ACCEPTED 202 Accepted
BAD_REQUEST 400 Bad Request
CONFLICT 409 Conflict
CREATED 201 Created
FORBIDDEN 403 Forbidden
GONE 410 Gone
INTERNAL_SERVER_ERROR 500 Internal Server Error
MOVED_PERMANENTLY 301 Moved Permanently
NO_CONTENT 204 No Content
NOT_ACCEPTABLE 406 Not Acceptable
NOT_FOUND 404 Not Found
NOT_MODIFIED 304 Not Modified
OK 200 OK
PRECONDITION_FAILED 412 Precondition Failed
SEE_OTHER 303 See Other
SERVICE_UNAVAILABLE 503 Service Unavailable
TEMPORARY_REDIRECT 307 Temporary Redirect
UNAUTHORIZED 401 Unauthorized
UNSUPPORTED_MEDIA_TYPE 415 Unsupported Media Type

It is our duty to set the correct status codes and error codes while throwing it .

Happy Handling !!!!


Friday, 22 September 2017

JAX-RS Basics - Getting Started : Sample Program

Hi All,
     
        Hope all are doing well, Today we are going to see some Interesting Basics of the JAX-RS .

JAX-RS Implementation was Introduced in the Oracle Commerce Platform 11.3 , with this Standard Oracle was able to competate the Industrial Standards,   in the REST Services . So Lets Deep in to .

1) The First Step to start with the JAX-RS Application is add the Following entry in the web.xml

<servlet>
    <servlet-name>Jersey</servlet-name>
    <servlet-class>atg.service.jaxrs.JerseyServletWrapper</servlet-class>
    <init-param>
        <param-name>atg.service.jaxrs.JerseyServletWrapper.servletClasses
</param-name>
        <param-value>org.glassfish.jersey.servlet.ServletContainer,
atg.service.swagger.SwaggerBootstrap</param-value>
    </init-param>
    <!-- Params for JerseyServletWrapper servlet -->
    <init-param>
        <param-name>javax.ws.rs.Application</param-name>
        <param-value>atg.service.jaxrs.JAXRSApplication</param-value>
    </init-param>
    <init-param>
        <param-name>jersey.config.server.provider.classnames</param-name>
        <param-value>atg.service.swagger.SwaggerApiListingResource,
io.swagger.jaxrs.listing.SwaggerSerializers</param-value>
    </init-param>
    <init-param>
        <!-- Params for JAXRSApplication -->
        <param-name>atg.service.jaxrs.JAXRSApplication.resourceRegistryPath
</param-name>
        <param-value>/atg/dynamo/service/jaxrs/RestResourceRegistry</param-value>
    </init-param>
    <init-param>
        <param-name>atg.service.jaxrs.JAXRSApplication.validatorRegistryPath
</param-name>
        <param-value>/atg/dynamo/service/validator/ValidatorRegistry</param-value>
    </init-param>
    <init-param>
        <!-- Params for SwaggerBootstrap servlet -->
        <param-name>atg.service.swagger.SwaggerBootstrap.bootstrapService
</param-name>
        <param-value>/atg/dynamo/service/swagger/SwaggerBootstrapService
</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
    <async-supported>true</async-supported>
</servlet>
<servlet-mapping>
    <servlet-name>Jersey</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

Once if you add the Following entry then the JAX-RS is enabled in the application, we can go ahead and creating our Resource classes . 

From the above XML there is a path for defining the RestResourceRegistry,Validatory Registry and SwaggerBootStratService , if you are defining your Custom you can update to point yours. For SwaggerBootStratService and ValidatoryRegistry give the OOTB Component path this is required till you start diving in to more . 

2)You can add the mentioned classes  are avaliable in the DAS, Rest Modules you can add the Reference in the Build Path once it is done ,these will be available for your project  .Make Sure you Resolve the Dependency issue  of the Jars. 

3)Start Creating the Component in the path /atg/dynamo/service/jaxrs/RestResourceRegistry
this is the Component where we have register the Components created on behalf of the JAX-RS implementaiton.

nucleusRestResources : this property hold those components .

Those components can be created by the Following way 

4)Create a class extends GenericService

@RestResource(id=OrderRestConstants.CURRENT_ORDER_ID)
@Path("/cart")
@Api(value="/cart")
public class CurrentOrderRestResource extends GenericService {
}

Here@RestResource – must be present for all resource classes, as it specifies the ID of the
resource. The ID is a string that uniquely identifies the resource and does not change when the context and/or version change.Try to give the package name as well.

@Path . The annotation contains the URI path for the resource. For example, @path ("/cart"). Note: If you are creating a sub-resource,ensure that there is no @Path annotation.

Create like above example . Next Will Start Writing the methods 

@GET
@Endpoint(id="/cart#GET" filterId="cart-Default")
@ApiOperation(value="Gets the current order.")
public Object getOrder(JSONObject pJson) throws RestException, CommerceException {
}

@GET, @POST, @PUT, @PATCH, and, @DELETE – These annotations are used as necessary when working with the endpoint.

@Endpoint – This annotation identifies the endpoint with a unique string ID. The ID does not change if the context or version changes. If the endpoint is for a singular resource, the isSingular attribute must be true.

5)A resource’s schema is controlled using the ValidatorManager component and payloadSchema.xml files.These XML files configure multiple validators that contain the definitions for expected input fields, as well as required output fields. Endpoints can specify which validator definition to use for input, using the validatorId attribute, and for output, using the filterId attribute.Will Discuss Brief more about this in the upcoming Sessions .

6)Write the Logic here and return type should be the Object , this is required because we are returning the RepresentationModel . 


The RepresentationModel is a holder class that allows you to build a representation of a resource for aresponse. It contains properties that specify the resource state, embedded resources, collection members, links,headers, and other properties. If an endpoint needs to respond with a representation of the resource, create an instance of this class.

7)Register the Class which we have created in to the Component and declare that component to the RestResourceRegistry component  nucleusRestResources property. 

8)How End Point Works .

Resources are registered with a REST resource registry that has a context root defined in the web.xml file. This context root takes the following format:


 <context-param>
    <param-name>context-root</param-name>
    <param-value>/public/v1</param-value>
  </context-param>


For example, a URI may be /public/v1. The full URI would be http://localhost:8080/public/v1.

Then the corresponding end point we have to invoke . In our Scenario of above example it is like 
http://localhost:8080/public/v1/cart/ this will change as per our Requirement. 


Try to access your First Ever JAX-RS application .

We will  start looking in to the advance concepts in the upcoming Tutorials . You can also take a look at the OOTB Classes on the JAX-RS implementation for more technical Stuffs.

Happy Learning !!!!!

Tuesday, 5 September 2017

Logging in Endeca Assembler

Hi All,
        Most of Us will be very keen about Debugging the Code via Logging , this is Because this Prints the line it need .

So here is a solution for you and how to implement in Endeca. By Default Endeca OOTB code has very limited set of Logging . If you want to enable logging , most of the Class does not extend the Generic Service so no logging !! Dont Worry, Blindly Follow the Below Steps , you can enable logging for your Application .

I would Recommend of using the Same logging all the Places , because when you enable in one Component all the Corresponding components will print it from Starting of the Request and When Request is Becoming Death.

you can use the below snippet wherever it is required .

VariableArgumentApplicationLogging mLogger = AssemblerTools.getApplicationLogging();

usauge will be as follows mLogger.isLoggingDebug()

apart from this you will get all the loggings .


Happy Logging !!!!

Tuesday, 8 August 2017

Machine Learning

There was hot talks around my team, when I received a mail stating that the Machine Learing Experience has been Implemented in the Elastic Search.

So What Actually is the Machine Learning Definition (Copied)


"Machine learning is a method of data analysis that automates analytical model building. It is a branch of artificial intelligence based on the idea that machines should be able to learn and adapt through experience."
So What is Machine Learning in the Plain Terms, System Learns by itself by the Previous Behavior or the Use Cases . What System is Learning by Itself !!! what will be the Future of the Developers who codes pages by Pages , don't worry we have not knocked out , still we have to write the recepies for it (Can See Brief When we are Exploring More).
Now as a Start , I will Share Some Information about the Elastic Search "X Pack" Tool they termed "Anomaly" which can be used to Identify the Troubles . It has the Following Features 
IT Operations: Spot an unusual drop in application requests, then drill in on the troublesome server contributing to the problem.
Security Analytics: Identify unusual network activity or user behavior to pinpoint attackers before they do damage.
Business Analytics: Get notified if there is an unusual increase in abandoned shopping carts in your ecommerce site. 
They also given the Recepies for Implementing it . I am Sure Gonna Try How Does it Works in the Real time . Oracle also identifying this type of Behavior not sure how they are handling want to explore .